Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/dimagi/commcare-android i…
Browse files Browse the repository at this point in the history
…nto dv/nav_fixes
  • Loading branch information
Dave Viggiano committed May 21, 2024
2 parents 1b70c3e + 5da77f9 commit 65b93bc
Show file tree
Hide file tree
Showing 52 changed files with 1,192 additions and 889 deletions.
6 changes: 5 additions & 1 deletion app/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="106"
android:versionName="2.54">
android:versionName="2.55">

<uses-permission android:name="android.permission.NFC"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
Expand Down Expand Up @@ -212,6 +212,10 @@
android:name="org.commcare.activities.SessionAwarePreferenceActivity"
android:theme="@style/PreferenceTheme">
</activity>
<activity
android:name="org.commcare.activities.FullscreenVideoViewActivity"
android:theme="@style/FullscreenTheme">
</activity>
<activity
android:exported="false"
android:name="org.commcare.activities.DotsEntryActivity">
Expand Down
6 changes: 5 additions & 1 deletion app/assets/locales/android_translatable_strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -447,20 +447,24 @@ custom.restore.file.not.set=Custom restore file path is not set in preferences
custom.restore.error=Error loading custom sync

start.recording=Start Recording
start.recording.failed=Unable to start recording while another application is recording!
stop.recording=Stop Recording
recording.header=Record a sound
before.recording=Tap to start recording
before.overwrite.recording=Tap to start a new recording
during.recording=Tap to stop recording
during.recording=Recording is in progress, avoid navigating away from CommCare. Tap to stop recording
after.recording=Recording complete.
delete.recording=Tap to delete recording
pause.recording=Recording paused, tap to continue recording
pause.recording.because.no.sound.captured=Recording paused because another app started recording, tap to continue recording
save=Save
recording.cancel=Cancel
recording.clear=Clear
recording.prompt.with.file.chooser=Record or choose sound below
recording.prompt.without.file.chooser=Record sound below
recording.custom=Recorded Sound
recording.paused.due.another.app.recording.title=CommCare Audio Recording
recording.paused.due.another.app.recording.message=Recording paused as another app started recording. Click here to resume the recording!

callout.failure.dialer=Device is not currently configured to make telephone calls
callout.failure.sms=SMS app not found
Expand Down
245 changes: 126 additions & 119 deletions app/build.gradle

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions app/instrumentation-tests/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="${applicationId}">
xmlns:tools="http://schemas.android.com/tools">

<uses-sdk tools:overrideLibrary="android_libs.ub_uiautomator"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.intent.Intents.intended
import androidx.test.espresso.intent.Intents.intending
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
import androidx.test.espresso.matcher.ViewMatchers.isChecked
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withClassName
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import org.commcare.annotations.BrowserstackTests
Expand All @@ -26,7 +31,7 @@ import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@LargeTest
@BrowserstackTests
class AppPreferenceSettingsTest: BaseTest() {
class AppPreferenceSettingsTest : BaseTest() {

companion object {
const val CCZ_NAME = "settings_sheet_tests.ccz"
Expand All @@ -44,13 +49,13 @@ class AppPreferenceSettingsTest: BaseTest() {
val settingName = "Fuzzy Search Matches"
InstrumentationUtility.openOptionsMenu()
onView(withText("Settings"))
.perform(click())
.perform(click())
selectSetting(settingName)

onView(withText("Enabled"))
.check(matches(isDisplayed()))
.check(matches(isDisplayed()))
onView(withText("Disabled"))
.check(matches(isDisplayed()))
.check(matches(isDisplayed()))

// Check enabled is selected by default
matchSelectedPreference("Enabled")
Expand All @@ -68,15 +73,15 @@ class AppPreferenceSettingsTest: BaseTest() {
val settingName = "Auto Update Frequency"
InstrumentationUtility.openOptionsMenu()
onView(withText("Settings"))
.perform(click())
.perform(click())
selectSetting(settingName)

onView(withText("Never"))
.check(matches(isDisplayed()))
.check(matches(isDisplayed()))
onView(withText("Daily"))
.check(matches(isDisplayed()))
.check(matches(isDisplayed()))
onView(withText("Weekly"))
.check(matches(isDisplayed()))
.check(matches(isDisplayed()))

// Change setting and check their persistence
changePreferenceAndCheckPersistence("Daily", settingName)
Expand All @@ -91,7 +96,7 @@ class AppPreferenceSettingsTest: BaseTest() {
InstrumentationUtility.login("settings.test.3", "123")
InstrumentationUtility.openOptionsMenu()
onView(withText("Settings"))
.perform(click())
.perform(click())
selectSetting("Set Print Template")

//Create a dummy file selection intent
Expand All @@ -102,34 +107,34 @@ class AppPreferenceSettingsTest: BaseTest() {

// Click on file fetch
onView(withId(R.id.filefetch))
.perform(click())
.perform(click())

// Confirm that the file selection intent was called.
intended(expectedIntent)
}

private fun selectSetting(text: String) {
onView(withText("CommCare > Settings"))
.check(matches(isDisplayed()))
onView(withId(R.id.recycler_view))
.perform(RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
hasDescendant(withText(text))
.check(matches(isDisplayed()))
onView(withId(androidx.preference.R.id.recycler_view))
.perform(RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
hasDescendant(withText(text))
))
onView(withText(text))
.perform(click())
.perform(click())
}

private fun cancelSettingChangeDialog() {
onView(withText("CANCEL"))
.perform(click())
.perform(click())
onView(withText("CommCare > Settings"))
.check(matches(isDisplayed()))
.check(matches(isDisplayed()))
}

private fun changePreferenceAndCheckPersistence(newPref: String, setting: String) {
// Change to new preference
onView(withText(newPref))
.perform(click())
.perform(click())

//Rotate and check the selection persists.
InstrumentationUtility.rotateLeft()
Expand All @@ -142,8 +147,8 @@ class AppPreferenceSettingsTest: BaseTest() {

private fun matchSelectedPreference(value: String) {
onView(allOf(
withClassName(endsWith("AppCompatCheckedTextView")),
withText(value)
withClassName(endsWith("AppCompatCheckedTextView")),
withText(value)
)).check(matches(isChecked()))
}

Expand Down

0 comments on commit 65b93bc

Please sign in to comment.