From de7bb1ecc3d23a1c30092024824ebda1fd81d35f Mon Sep 17 00:00:00 2001
From: Apoorv Srivastava <2000apoorv@gmail.com>
Date: Sun, 17 Jan 2021 11:50:18 +0530
Subject: [PATCH 1/8] replace icon
---
.../main/res/drawable/ic_audio_lang_24px.xml | 12 ++++++++++++
app/src/main/res/layout/audio_fragment.xml | 19 ++++++++++---------
.../app/player/audio/AudioFragmentTest.kt | 14 ++++++--------
.../exploration/ExplorationActivityTest.kt | 6 +++---
4 files changed, 31 insertions(+), 20 deletions(-)
create mode 100644 app/src/main/res/drawable/ic_audio_lang_24px.xml
diff --git a/app/src/main/res/drawable/ic_audio_lang_24px.xml b/app/src/main/res/drawable/ic_audio_lang_24px.xml
new file mode 100644
index 00000000000..524c0656629
--- /dev/null
+++ b/app/src/main/res/drawable/ic_audio_lang_24px.xml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/app/src/main/res/layout/audio_fragment.xml b/app/src/main/res/layout/audio_fragment.xml
index f43300e6a02..fb3472d371c 100755
--- a/app/src/main/res/layout/audio_fragment.xml
+++ b/app/src/main/res/layout/audio_fragment.xml
@@ -3,11 +3,15 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
+
+
+
+
@@ -43,6 +47,7 @@
style="@style/AudioSeekBar"
android:layout_width="0dp"
android:layout_height="26dp"
+ android:layout_marginStart="16dp"
android:max="@{viewModel.durationLiveData}"
android:maxHeight="4dp"
android:minWidth="180dp"
@@ -51,18 +56,17 @@
android:progressDrawable="@drawable/audio_seekbar_background"
android:splitTrack="false"
android:thumb="@drawable/seekbar_thumb"
- android:layout_marginStart="16dp"
android:thumbOffset="16dp"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toStartOf="@+id/tvAudioLanguage"
+ app:layout_constraintEnd_toStartOf="@+id/ivAudioLanguage"
app:layout_constraintStart_toEndOf="@+id/ivPlayPauseAudio"
app:layout_constraintTop_toTopOf="parent" />
-
diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt
index 0653dfb5b4c..5be7a1a9850 100644
--- a/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt
+++ b/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt
@@ -86,7 +86,7 @@ import org.oppia.android.util.parser.HtmlParserEntityTypeModule
import org.oppia.android.util.parser.ImageParsingModule
import org.robolectric.annotation.Config
import org.robolectric.annotation.LooperMode
-import java.util.Locale
+import java.util.*
import javax.inject.Inject
import javax.inject.Singleton
@@ -151,7 +151,6 @@ class AudioFragmentTest {
)
}
- // TODO(#1845): As updating tvAudioLanguage to image, we need to remove this test
@Test
fun testAudioFragment_withDefaultProfile_showsAudioLanguageAsEnglish() {
addMediaInfo()
@@ -160,11 +159,11 @@ class AudioFragmentTest {
internalProfileId
)
).use {
- onView(withId(R.id.tvAudioLanguage)).check(matches(withText("EN")))
+ onView(withId(R.id.ivAudioLanguage)).check(matches(withContentDescription("en")))
}
}
- // TODO(#1845): As updating tvAudioLanguage to image, we need to remove this test
+ @RunOn(TestPlatform.ESPRESSO)
@Test
fun testAudioFragment_withHindiAudioLanguageProfile_showsHindiAudioLanguage() {
addMediaInfo()
@@ -181,7 +180,7 @@ class AudioFragmentTest {
it.onActivity {
profileTestHelper.waitForOperationToComplete(data)
}
- onView(withId(R.id.tvAudioLanguage)).check(matches(withText("EN")))
+ onView(withId(R.id.ivAudioLanguage)).check(matches(withContentDescription("hi")))
}
}
@@ -269,7 +268,7 @@ class AudioFragmentTest {
internalProfileId
)
).use {
- invokePreparedListener(shadowMediaPlayer)
+ //invokePreparedListener(shadowMediaPlayer)
onView(withId(R.id.ivPlayPauseAudio)).perform(click())
onView(withId(R.id.sbAudioProgress)).perform(setProgress(100))
onView(isRoot()).perform(orientationLandscape())
@@ -278,7 +277,6 @@ class AudioFragmentTest {
}
}
- // TODO(#1845): As updating tvAudioLanguage to image, we need to update this test
@Test
fun testAudioFragment_invokePrepared_changeDifferentLanguage_checkResetSeekBarAndPaused() {
addMediaInfo()
@@ -294,7 +292,7 @@ class AudioFragmentTest {
onView(withId(R.id.sbAudioProgress)).perform(setProgress(100))
testCoroutineDispatchers.runCurrent()
- onView(withId(R.id.tvAudioLanguage)).perform(click())
+ onView(withId(R.id.ivAudioLanguage)).perform(click())
val locale = Locale("es")
diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt
index 13bfe8b8eb3..42d1886b442 100644
--- a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt
+++ b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt
@@ -544,7 +544,7 @@ class ExplorationActivityTest {
withEffectiveVisibility(Visibility.VISIBLE)
)
)
- onView(allOf(withText("EN"), withEffectiveVisibility(Visibility.VISIBLE)))
+ onView(allOf(withId(R.id.ivAudioLanguage), withEffectiveVisibility(Visibility.VISIBLE)))
waitForTheView(withDrawable(R.drawable.ic_pause_circle_filled_white_24dp))
onView(withId(R.id.ivPlayPauseAudio)).check(
matches(
@@ -581,7 +581,7 @@ class ExplorationActivityTest {
onView(withId(R.id.action_audio_player)).perform(click())
onView(
allOf(
- withText("EN"),
+ withId(R.id.ivAudioLanguage),
withEffectiveVisibility(Visibility.VISIBLE)
)
).perform(click())
@@ -599,7 +599,7 @@ class ExplorationActivityTest {
)
)
onView(withId(R.id.continue_button)).perform(click())
- onView(withText("HI-EN")).check(matches(isDisplayed()))
+ onView(withId(R.id.ivAudioLanguage)).check(matches(withContentDescription("hi-en")))
}
explorationDataController.stopPlayingExploration()
}
From 1a91a369cdd6c00c2a04cc6f7c26b40bb51bc76e Mon Sep 17 00:00:00 2001
From: Apoorv Srivastava <2000apoorv@gmail.com>
Date: Sun, 17 Jan 2021 11:54:01 +0530
Subject: [PATCH 2/8] removed comment
---
.../org/oppia/android/app/player/audio/AudioFragmentTest.kt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt
index 5be7a1a9850..071075b5fbc 100644
--- a/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt
+++ b/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt
@@ -268,7 +268,7 @@ class AudioFragmentTest {
internalProfileId
)
).use {
- //invokePreparedListener(shadowMediaPlayer)
+ invokePreparedListener(shadowMediaPlayer)
onView(withId(R.id.ivPlayPauseAudio)).perform(click())
onView(withId(R.id.sbAudioProgress)).perform(setProgress(100))
onView(isRoot()).perform(orientationLandscape())
From 9db0a2bd323ce7abd4a73f998f847403aae0fd15 Mon Sep 17 00:00:00 2001
From: Apoorv Srivastava <2000apoorv@gmail.com>
Date: Sun, 17 Jan 2021 12:00:05 +0530
Subject: [PATCH 3/8] removed wild card import
---
.../org/oppia/android/app/player/audio/AudioFragmentTest.kt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt
index 071075b5fbc..8f92d7ba5f0 100644
--- a/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt
+++ b/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt
@@ -86,7 +86,7 @@ import org.oppia.android.util.parser.HtmlParserEntityTypeModule
import org.oppia.android.util.parser.ImageParsingModule
import org.robolectric.annotation.Config
import org.robolectric.annotation.LooperMode
-import java.util.*
+import java.util.Locale
import javax.inject.Inject
import javax.inject.Singleton
From 6513ca4d4b6da98d789ddeb499e38eac8e9a0d1a Mon Sep 17 00:00:00 2001
From: Apoorv Srivastava <2000apoorv@gmail.com>
Date: Tue, 26 Jan 2021 19:10:31 +0530
Subject: [PATCH 4/8] fixed ids of audio_fragment
---
app/src/main/res/layout/audio_fragment.xml | 10 ++---
.../app/player/audio/AudioFragmentTest.kt | 38 +++++++++----------
.../exploration/ExplorationActivityTest.kt | 20 +++++-----
3 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/app/src/main/res/layout/audio_fragment.xml b/app/src/main/res/layout/audio_fragment.xml
index fb3472d371c..9c983b60586 100755
--- a/app/src/main/res/layout/audio_fragment.xml
+++ b/app/src/main/res/layout/audio_fragment.xml
@@ -29,7 +29,7 @@
android:padding="4dp">
Date: Tue, 26 Jan 2021 19:24:43 +0530
Subject: [PATCH 5/8] fixed failing tests
---
.../oppia/android/app/player/audio/AudioFragmentPresenter.kt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt
index 6332081db89..fe83b943f68 100755
--- a/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt
+++ b/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt
@@ -78,7 +78,7 @@ class AudioFragmentPresenter @Inject constructor(
)
val binding = AudioFragmentBinding.inflate(inflater, container, /* attachToRoot= */ false)
- binding.sbAudioProgress.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
+ binding.audioProgressSeekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
if (fromUser) {
userProgress = progress
@@ -98,7 +98,7 @@ class AudioFragmentPresenter @Inject constructor(
fragment,
Observer {
prepared = it != UiAudioPlayStatus.LOADING && it != UiAudioPlayStatus.FAILED
- binding.sbAudioProgress.isEnabled = prepared
+ binding.audioProgressSeekBar.isEnabled = prepared
}
)
From f9e7ae047876fa4e8c093d97879f8779b9fb5447 Mon Sep 17 00:00:00 2001
From: Apoorv Srivastava <2000apoorv@gmail.com>
Date: Tue, 26 Jan 2021 19:31:08 +0530
Subject: [PATCH 6/8] lint fix
---
.../player/audio/AudioFragmentPresenter.kt | 27 ++++++++++---------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt
index fe83b943f68..b6138f383ba 100755
--- a/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt
+++ b/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt
@@ -78,22 +78,23 @@ class AudioFragmentPresenter @Inject constructor(
)
val binding = AudioFragmentBinding.inflate(inflater, container, /* attachToRoot= */ false)
- binding.audioProgressSeekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
- override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
- if (fromUser) {
- userProgress = progress
+ binding.audioProgressSeekBar
+ .setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
+ override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
+ if (fromUser) {
+ userProgress = progress
+ }
}
- }
- override fun onStartTrackingTouch(seekBar: SeekBar?) {
- userIsSeeking = true
- }
+ override fun onStartTrackingTouch(seekBar: SeekBar?) {
+ userIsSeeking = true
+ }
- override fun onStopTrackingTouch(seekBar: SeekBar?) {
- viewModel.handleSeekTo(userProgress)
- userIsSeeking = false
- }
- })
+ override fun onStopTrackingTouch(seekBar: SeekBar?) {
+ viewModel.handleSeekTo(userProgress)
+ userIsSeeking = false
+ }
+ })
viewModel.playStatusLiveData.observe(
fragment,
Observer {
From 572d0b4a634100180b8b5b062eba3d6bfeeb3a10 Mon Sep 17 00:00:00 2001
From: Apoorv Srivastava <2000apoorv@gmail.com>
Date: Wed, 27 Jan 2021 10:15:53 +0530
Subject: [PATCH 7/8] fixed failing build
---
.../oppia/android/app/player/audio/AudioFragmentPresenter.kt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt
index b6138f383ba..fdfe6a99afa 100755
--- a/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt
+++ b/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt
@@ -78,8 +78,8 @@ class AudioFragmentPresenter @Inject constructor(
)
val binding = AudioFragmentBinding.inflate(inflater, container, /* attachToRoot= */ false)
- binding.audioProgressSeekBar
- .setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
+ binding.audioProgressSeekBar.setOnSeekBarChangeListener(
+ object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
if (fromUser) {
userProgress = progress
From 09ca1381605e9edbee7671f16cf15e7faecfd6e1 Mon Sep 17 00:00:00 2001
From: Apoorv Srivastava <2000apoorv@gmail.com>
Date: Wed, 27 Jan 2021 18:02:14 +0530
Subject: [PATCH 8/8] added TODO for ignored robolectric test
---
.../java/org/oppia/android/app/player/audio/AudioFragmentTest.kt | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt
index 9242ee629a2..ced22ca84bf 100644
--- a/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt
+++ b/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt
@@ -163,6 +163,7 @@ class AudioFragmentTest {
}
}
+ // TODO(#2417): Re-enable once this test passes on robolectric
@RunOn(TestPlatform.ESPRESSO)
@Test
fun testAudioFragment_withHindiAudioLanguageProfile_showsHindiAudioLanguage() {