Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2581: Marquee auto restart issue #4392

Merged
merged 56 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
0cff83a
Fix #4186 Uncheck all selection on developer options not working
KevinGitonga Jun 7, 2022
5295364
Fix #4186 Add changes to code as suggested on code review.
KevinGitonga Jun 8, 2022
ca5bca5
Fix #4186 Undo changes on line wrap as advised by code reviewer.
KevinGitonga Jun 9, 2022
20e93e4
Fix #2581 Marquee restarts automatically in certain scenarios.
KevinGitonga Jun 10, 2022
841a35e
Fix #2581 Marquee restarts automatically in certain scenarios.
KevinGitonga Jun 13, 2022
f82b874
Fix #2581 Marquee restarts automatically in certain scenarios.
KevinGitonga Jun 10, 2022
008333c
Fix #2581 Marquee restarts automatically in certain scenarios.
KevinGitonga Jun 13, 2022
d4f6dd5
Merge remote-tracking branch 'origin/fix-marquee-auto-restart-issue' …
KevinGitonga Jun 14, 2022
3e99863
Revert "Fix #4186 Undo changes on line wrap as advised by code review…
KevinGitonga Jun 14, 2022
4a60eac
Revert "Fix #4186 Add changes to code as suggested on code review."
KevinGitonga Jun 14, 2022
94222cf
Revert "Fix #4186 Uncheck all selection on developer options not work…
KevinGitonga Jun 14, 2022
c8b74e8
Insert timer in OnClick listener to enable unselect during subsequent…
KevinGitonga Jun 15, 2022
ab46619
Introduce custom translation animation logic to fix issue with the co…
KevinGitonga Aug 18, 2022
962fb0f
Introduce custom translation animation logic to fix issue with the co…
KevinGitonga Aug 18, 2022
aad00e1
Fix some of the failing tests.
KevinGitonga Aug 19, 2022
0e4c837
Fix some of the failing tests.
KevinGitonga Aug 19, 2022
70892d7
Fix some of the failing tests, exclude MarqueeView from tests.
KevinGitonga Aug 19, 2022
40cb71f
Revert some of the changes.
KevinGitonga Aug 19, 2022
8c3143f
Merge branch 'oppia:develop' into fix-marquee-auto-restart-issue
KevinGitonga Aug 19, 2022
fae0685
Add MarqueeView to bazel list of custom views that import resources.
KevinGitonga Aug 22, 2022
4a463e5
Merge branch 'oppia:develop' into fix-marquee-auto-restart-issue
KevinGitonga Aug 22, 2022
091ff1a
Remove Marquee tests to fix some failures.
KevinGitonga Aug 22, 2022
c6a6871
Update exploration_activity.xml to fix failing tests.
KevinGitonga Aug 22, 2022
19847f2
Update exploration_activity.xml to fix failing tests.
KevinGitonga Aug 22, 2022
459f0e7
Fix failing tests.
KevinGitonga Aug 22, 2022
74413c2
Fix some of the failing tests.
KevinGitonga Aug 22, 2022
c0c0b28
Fix some of the failing tests.
KevinGitonga Aug 22, 2022
6f6c949
Fix some of the failing tests.
KevinGitonga Aug 22, 2022
f6feb0e
Fix some of failing test cases.
KevinGitonga Aug 24, 2022
d54b2d4
Update magic value textViewVirtualWidth to use the device width.
KevinGitonga Aug 24, 2022
0391003
Fix Buildifier issue with bazel.
KevinGitonga Aug 30, 2022
44a1eed
Update to use Library forked to oppia as advised.
KevinGitonga Sep 7, 2022
c79c66a
Fix custom res import issues.
KevinGitonga Sep 7, 2022
a307c20
Add binding adapters for "app:speed" and "app:pause".
KevinGitonga Sep 8, 2022
6106073
Revert to "app" from "marquee".
KevinGitonga Sep 8, 2022
4763e7c
Revert unnecessary file exemption.
KevinGitonga Sep 8, 2022
d246a06
Fix Nit.
KevinGitonga Sep 8, 2022
7444be8
Fix failing tests and revert from previous fix, which could not be us…
KevinGitonga Sep 12, 2022
6ce34d3
Merge branch 'oppia:develop' into fix-marquee-auto-restart-issue
KevinGitonga Sep 14, 2022
85d7dcd
Change to pass "app" and "speed" values in code.
KevinGitonga Sep 14, 2022
7fd4094
Fix import NIT.
KevinGitonga Sep 14, 2022
2c98b5e
Fix failing tests by updating Bazel config files to add Android-Marqu…
KevinGitonga Sep 15, 2022
e8b16c9
Fix buildifier issues after bazel file changes.
KevinGitonga Sep 15, 2022
59169e1
Revert tests for this feature and fix NITs.
KevinGitonga Sep 19, 2022
822606a
Migrate to Oppia's fork of AndroidMarquee-View remove ellipsize asser…
KevinGitonga Sep 20, 2022
727ad10
Change width to matchParent on exploration_activity.xml.
KevinGitonga Sep 20, 2022
a353e30
Merge branch 'develop' into fix-marquee-auto-restart-issue
KevinGitonga Sep 21, 2022
79e2e5b
Merge branch 'oppia:develop' into fix-marquee-auto-restart-issue
KevinGitonga Sep 22, 2022
7e4a505
Update speed and pause to animationSpeed and animationDelay respectiv…
KevinGitonga Sep 22, 2022
c89aadb
Change Bazel workspace config to point to Oppia's official fork.
KevinGitonga Sep 22, 2022
24782a3
Change to click on MarqueeView as it is parent to the ToolbarTitle on…
KevinGitonga Sep 23, 2022
d8fb232
Add indentations to layouts and shallow_since from CI logs.
KevinGitonga Sep 27, 2022
0aa662d
Revert shallow since.
KevinGitonga Sep 27, 2022
d3b5b6c
Update shallow since.
KevinGitonga Sep 27, 2022
58f10eb
Add class assertion tests.
KevinGitonga Sep 27, 2022
5f8afdd
Fix spacing NIT.
KevinGitonga Sep 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ git_repository(
shallow_since = "1647554845 -0700",
)

# A custom fork of Android-MarqueeView that is updated with latest dependencies compatible with Oppia and also
# min target SDK version set to be compatible with Oppia.
git_repository(
name = "marqueeview",
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
commit = "a935a78c88a01958716396e6f2cb4abf4559eccc",
remote = "https://github.com/oppia/Android-MarqueeView",
)

bind(
name = "databinding_annotation_processor",
actual = "//tools/android:compiler_annotation_processor",
Expand Down
1 change: 1 addition & 0 deletions app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ android_library(
"//third_party:androidx_recyclerview_recyclerview",
"//third_party:androidx_viewpager2_viewpager2",
"//third_party:androidx_viewpager_viewpager",
"//third_party:asia_ivity_android_marqueeview",
"//third_party:circularimageview_circular_image_view",
"//third_party:com_google_android_flexbox_flexbox",
"//third_party:com_google_android_material_material",
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ dependencies {
'com.google.firebase:firebase-crashlytics:17.0.0',
'com.google.guava:guava:28.1-android',
'com.google.protobuf:protobuf-javalite:3.17.3',
'com.github.oppia:Android-MarqueeView:a935a78c88',
'com.github.oppia:CircularImageview:35d08ba88a',
'de.hdodenhof:circleimageview:3.0.1',
'nl.dionsegijn:konfetti:1.2.5',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class LicenseTextViewerActivityPresenter @Inject constructor(
}

binding.licenseTextViewerActivityToolbarTitle.setOnClickListener {
binding.licenseTextViewerActivityToolbarTitle.isSelected = true
binding.licenseTextViewerActivityMarqueeView.startMarquee()
}

if (getLicenseTextViewerFragment() == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class ExplorationActivityPresenter @Inject constructor(
activity.setSupportActionBar(explorationToolbar)

binding.explorationToolbarTitle.setOnClickListener {
binding.explorationToolbarTitle.isSelected = true
binding.explorationMarqueeView.startMarquee()
}

binding.explorationToolbar.setNavigationOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class StoryFragmentPresenter @Inject constructor(
}

binding.storyToolbarTitle.setOnClickListener {
binding.storyToolbarTitle.isSelected = true
binding.storyMarqueeView?.startMarquee()
}

linearLayoutManager = LinearLayoutManager(activity.applicationContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class TopicFragmentPresenter @Inject constructor(
(activity as TopicActivity).finish()
}

binding.topicToolbar.setOnClickListener {
binding.topicToolbarTitle.isSelected = true
binding.topicToolbarTitle.setOnClickListener {
binding.topicMarqueeView.startMarquee()
}

viewModel.setInternalProfileId(internalProfileId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class RevisionCardActivityPresenter @Inject constructor(
(activity as RevisionCardActivity).finish()
}
binding.revisionCardToolbarTitle.setOnClickListener {
binding.revisionCardToolbarTitle.isSelected = true
binding.revisionCardMarqueeView.startMarquee()
}
subscribeToSubtopicTitle()

Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/layout-sw600dp/story_fragment.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:marquee="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<data>
Expand Down Expand Up @@ -36,13 +37,20 @@
app:navigationContentDescription="@string/navigate_up"
app:navigationIcon="?attr/homeAsUpIndicator">

<asia.ivity.android.marqueeview.MarqueeView
android:id="@+id/story_marquee_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:animationSpeed="10"
app:animationDelay="500">
<TextView
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
android:id="@+id/story_toolbar_title"
style="@style/MarqueeToolbarTitleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:text="@{viewModel.storyNameLiveData}" />
</asia.ivity.android.marqueeview.MarqueeView>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>

Expand Down
17 changes: 13 additions & 4 deletions app/src/main/res/layout/exploration_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,22 @@
android:layout_height="wrap_content"
android:orientation="horizontal">

<asia.ivity.android.marqueeview.MarqueeView
android:id="@+id/exploration_marquee_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="20dp"
app:animationSpeed="10"
app:animationDelay="500">

<TextView
android:id="@+id/exploration_toolbar_title"
style="@style/MarqueeToolbarTitleTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_weight="1" />
android:layout_width="match_parent"
android:layout_height="wrap_content" />

</asia.ivity.android.marqueeview.MarqueeView>

<ImageView
android:id="@+id/action_audio_player"
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/res/layout/license_text_viewer_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,21 @@
app:navigationContentDescription="@string/navigate_up"
app:navigationIcon="?attr/homeAsUpIndicator">

<asia.ivity.android.marqueeview.MarqueeView
android:id="@+id/license_text_viewer_activity_marquee_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:animationSpeed="10"
app:animationDelay="500">

<TextView
android:id="@+id/license_text_viewer_activity_toolbar_title"
style="@style/MarqueeToolbarTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:minHeight="48dp" />
android:layout_marginEnd="20dp" />

</asia.ivity.android.marqueeview.MarqueeView>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>

Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/layout/revision_card_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,21 @@
app:navigationContentDescription="@string/navigate_up"
app:navigationIcon="?attr/homeAsUpIndicator">

<asia.ivity.android.marqueeview.MarqueeView
android:id="@+id/revision_card_marquee_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:animationSpeed="10"
app:animationDelay="500">

<TextView
android:id="@+id/revision_card_toolbar_title"
style="@style/MarqueeToolbarTitleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"/>

</asia.ivity.android.marqueeview.MarqueeView>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>

Expand Down
11 changes: 10 additions & 1 deletion app/src/main/res/layout/story_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,22 @@
app:navigationContentDescription="@string/navigate_up"
app:navigationIcon="?attr/homeAsUpIndicator">

<asia.ivity.android.marqueeview.MarqueeView
android:id="@+id/story_marquee_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:animationSpeed="10"
app:animationDelay="500">

<TextView
android:id="@+id/story_toolbar_title"
style="@style/MarqueeToolbarTitleTextView"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:text="@{viewModel.storyNameLiveData}"/>

</asia.ivity.android.marqueeview.MarqueeView>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>

Expand Down
13 changes: 11 additions & 2 deletions app/src/main/res/layout/topic_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,22 @@
app:navigationContentDescription="@string/navigate_up"
app:navigationIcon="?attr/homeAsUpIndicator">

<asia.ivity.android.marqueeview.MarqueeView
android:id="@+id/topic_marquee_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:animationSpeed="10"
app:animationDelay="500">

<TextView
android:id="@+id/topic_toolbar_title"
style="@style/MarqueeToolbarTitleTextView"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/MarqueeToolbarTitleTextView"
android:layout_marginEnd="20dp"
android:text="@{viewModel.topicToolbarTitleLiveData}" />

</asia.ivity.android.marqueeview.MarqueeView>
</androidx.appcompat.widget.Toolbar>

<com.google.android.material.tabs.TabLayout
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -450,19 +450,13 @@
<style name="BorderlessMaterialButton" parent="Widget.AppCompat.Button.Borderless" />

<style name="MarqueeToolbarTitleTextView" parent="TextView.Common1">
<item name="android:ellipsize">marquee</item>
<item name="android:fadingEdge">horizontal</item>
<item name="android:fadingEdgeLength">20dp</item>
<item name="android:focusable">false</item>
<item name="android:focusableInTouchMode">true</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:marqueeRepeatLimit">1</item>
<item name="android:minHeight">48dp</item>
<item name="android:textAlignment">viewStart</item>
<item name="android:textColor">@color/color_def_white</item>
<item name="android:textSize">20sp</item>
<item name="android:requiresFadingEdge">horizontal</item>
<item name="android:scrollHorizontally">true</item>
<item name="android:singleLine">true</item>
<item name="fontFamily">sans-serif</item>
<item name="textAllCaps">false</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.oppia.android.app.player.exploration
import android.app.Application
import android.content.Context
import android.content.Intent
import android.text.TextUtils
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
Expand Down Expand Up @@ -323,8 +322,7 @@ class ExplorationActivityTest {
explorationActivityTestRule.activity.findViewById(R.id.exploration_toolbar_title)
ViewCompat.setLayoutDirection(explorationToolbarTitle, ViewCompat.LAYOUT_DIRECTION_RTL)

onView(withId(R.id.exploration_toolbar_title)).perform(click())
assertThat(explorationToolbarTitle.ellipsize).isEqualTo(TextUtils.TruncateAt.MARQUEE)
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
onView(withId(R.id.exploration_marquee_view)).perform(click())
assertThat(explorationToolbarTitle.textAlignment).isEqualTo(View.TEXT_ALIGNMENT_VIEW_START)
}

Expand All @@ -343,8 +341,7 @@ class ExplorationActivityTest {
explorationActivityTestRule.activity.findViewById(R.id.exploration_toolbar_title)
ViewCompat.setLayoutDirection(explorationToolbarTitle, ViewCompat.LAYOUT_DIRECTION_LTR)

onView(withId(R.id.exploration_toolbar_title)).perform(click())
assertThat(explorationToolbarTitle.ellipsize).isEqualTo(TextUtils.TruncateAt.MARQUEE)
onView(withId(R.id.exploration_marquee_view)).perform(click())
assertThat(explorationToolbarTitle.textAlignment).isEqualTo(View.TEXT_ALIGNMENT_VIEW_START)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.Context
import android.content.Intent
import android.content.res.Resources
import android.text.Spannable
import android.text.TextUtils
import android.text.style.ClickableSpan
import android.view.View
import android.view.View.TEXT_ALIGNMENT_VIEW_START
Expand Down Expand Up @@ -236,7 +235,6 @@ class StoryFragmentTest {
ViewCompat.setLayoutDirection(storyToolbarTitle, ViewCompat.LAYOUT_DIRECTION_RTL)

onView(withId(R.id.story_toolbar_title)).perform(click())
assertThat(storyToolbarTitle.ellipsize).isEqualTo(TextUtils.TruncateAt.MARQUEE)
assertThat(storyToolbarTitle.textAlignment).isEqualTo(TEXT_ALIGNMENT_VIEW_START)
}

Expand All @@ -251,7 +249,6 @@ class StoryFragmentTest {
ViewCompat.setLayoutDirection(storyToolbarTitle, ViewCompat.LAYOUT_DIRECTION_LTR)

onView(withId(R.id.story_toolbar_title)).perform(click())
assertThat(storyToolbarTitle.ellipsize).isEqualTo(TextUtils.TruncateAt.MARQUEE)
assertThat(storyToolbarTitle.textAlignment).isEqualTo(TEXT_ALIGNMENT_VIEW_START)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package org.oppia.android.app.topic

import android.app.Application
import android.content.Intent
import android.text.TextUtils
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
Expand Down Expand Up @@ -180,7 +179,6 @@ class TopicFragmentTest {
ViewCompat.setLayoutDirection(topicToolbarTitle, ViewCompat.LAYOUT_DIRECTION_RTL)

onView(withId(R.id.topic_toolbar_title)).perform(click())
assertThat(topicToolbarTitle.ellipsize).isEqualTo(TextUtils.TruncateAt.MARQUEE)
assertThat(topicToolbarTitle.textAlignment).isEqualTo(View.TEXT_ALIGNMENT_VIEW_START)
}

Expand All @@ -198,7 +196,6 @@ class TopicFragmentTest {
activityTestRule.activity.findViewById(R.id.topic_toolbar_title)
ViewCompat.setLayoutDirection(topicToolbarTitle, ViewCompat.LAYOUT_DIRECTION_LTR)
onView(withId(R.id.topic_toolbar_title)).perform(click())
assertThat(topicToolbarTitle.ellipsize).isEqualTo(TextUtils.TruncateAt.MARQUEE)
assertThat(topicToolbarTitle.textAlignment).isEqualTo(View.TEXT_ALIGNMENT_VIEW_START)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package org.oppia.android.app.topic.revisioncard

import android.app.Application
import android.content.Context
import android.text.TextUtils
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
Expand Down Expand Up @@ -184,7 +183,6 @@ class RevisionCardActivityTest {
ViewCompat.setLayoutDirection(revisionCardToolbarTitle, ViewCompat.LAYOUT_DIRECTION_RTL)

onView(withId(R.id.revision_card_toolbar_title)).perform(ViewActions.click())
assertThat(revisionCardToolbarTitle.ellipsize).isEqualTo(TextUtils.TruncateAt.MARQUEE)
assertThat(revisionCardToolbarTitle.textAlignment).isEqualTo(View.TEXT_ALIGNMENT_VIEW_START)
}
}
Expand All @@ -204,7 +202,6 @@ class RevisionCardActivityTest {
ViewCompat.setLayoutDirection(revisionCardToolbarTitle, ViewCompat.LAYOUT_DIRECTION_LTR)

onView(withId(R.id.revision_card_toolbar_title)).perform(click())
assertThat(revisionCardToolbarTitle.ellipsize).isEqualTo(TextUtils.TruncateAt.MARQUEE)
assertThat(revisionCardToolbarTitle.textAlignment).isEqualTo(View.TEXT_ALIGNMENT_VIEW_START)
}
}
Expand Down
8 changes: 8 additions & 0 deletions third_party/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ android_library(
],
)

android_library(
name = "asia_ivity_android_marqueeview",
visibility = ["//visibility:public"],
exports = [
"@marqueeview//library:Android-MarqueeView",
],
)

# Define a separate target for the Glide annotation processor compiler. Unfortunately, this library
# can't encapsulate all of Glide (i.e. by exporting the main Glide dependency) since that includes
# Android assets which java_library targets do not export.
Expand Down