Skip to content

Commit

Permalink
Merge branch 'master' into test_rxjava-2.2.21
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeAndGreen authored Oct 17, 2024
2 parents 6196020 + 68d2504 commit ce36e03
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ CommCare is an easily customizable, open source mobile platform that supports fr

This repository represents the Android version of CommCare. It depends on the [CommCare Core](https://github.com/dimagi/commcare-core) repository, which contains the XForm engine and case/lookup table implementations.

## End-to-End Development

CommCare Android is a mobile CommCare Platform client runtime, and requires a backend environment for full end-to-end usage and to test platform development.

If you don't have an access to another backend, or if you will be doing full platform development, after completing this setup you can follow [the end-to-end development guide](https://github.com/dimagi/commcare-hq/blob/master/local_dev_guide.rst) which explains how to establish a local environment for CommCare's full client/server software.

## Setup

To set up an Android dev environment for commcare-android, do the following:
Expand Down
4 changes: 2 additions & 2 deletions app/assets/locales/android_translatable_strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -896,8 +896,8 @@ repeat.dialog.go.back=Go Back
repeat.dialog.leave=Do Not Add
repeat.dialog.exit=Do Not Add. I'm Finished.
repeat.dialog.add=Add Group
repeat.dialog.add.another=Add another "${0}" group?
repeat.dialog.add.new=Add a new "${0}" group?
repeat.dialog.add.another=Add another ${0}?
repeat.dialog.add.new=Add a new ${0}?
lookup.table.missing.error=Unable to find lookup table "${0}". Make sure it exists and this user has access to it.

ethiopian_months=Mäskäräm,T’ïk’ïmt,Hïdar,Tahsas,T’ïr,Yäkatit,Mägabit,Miyaziya,Gïnbot,Säne,Hämle,Nähäse,P’agume
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ dependencies {
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'org.bouncycastle:bcprov-jdk15to18:1.72'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-maps:19.0.0'
implementation 'joda-time:joda-time:2.9.4'
implementation 'net.zetetic:android-database-sqlcipher:4.5.3@aar'
implementation 'androidx.sqlite:sqlite:2.2.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.commcare.androidTests

import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.runners.AndroidJUnit4
Expand Down Expand Up @@ -44,15 +45,16 @@ class DialogTests: BaseTest() {
onView(withId(R.id.nav_btn_next))
.perform(click())

withText("Add a new \"Error on add\" group?").isDisplayed()
onView(withId(R.id.choice_dialog_panel_2)).check(matches(withText("Add a new Error on add?")))

InstrumentationUtility.rotateLeft()
//TODO Expect dialog to not persist due to a activity lifecycle bug in our dialog framework.
withText("Add a new \"Error on add\" group?").doesNotExist()
withText(R.id.choice_dialog_panel_2).doesNotExist()

InstrumentationUtility.rotatePortrait()
onView(withId(R.id.nav_btn_next))
.perform(click())
onView(withText("ADD GROUP"))
onView(withId(R.id.choice_dialog_panel_2))
.perform(click())

checkDialogExistence_withRotation("Error Occurred")
Expand Down
18 changes: 10 additions & 8 deletions app/src/org/commcare/activities/FormEntryActivityUIController.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.javarosa.core.model.data.InvalidData;
import org.javarosa.core.services.Logger;
import org.javarosa.core.services.locale.Localization;
import org.javarosa.form.api.FormEntryCaption;
import org.javarosa.form.api.FormEntryController;
import org.javarosa.form.api.FormEntryPrompt;
import org.javarosa.xpath.XPathException;
Expand Down Expand Up @@ -493,24 +494,25 @@ private void createRepeatDialog() {
final boolean backExitsForm = !details.relevantBeforeCurrentScreen;
final boolean nextExitsForm = details.relevantAfterCurrentScreen == 0;

final FormEntryCaption repeatCaptionPrompt = FormEntryActivity.mFormController.getCaptionPrompt();

// Assign title and text strings based on the current state
String backText = Localization.get("repeat.dialog.go.back");
String addAnotherText = Localization.get("repeat.dialog.add");
String title, skipText;

boolean hasRepetitions = FormEntryActivity.mFormController.getLastRepeatCount() > 0;
final String addAnotherText = repeatCaptionPrompt.getRepeatText(hasRepetitions ? "add" : "add-empty");

String skipText;

if (!nextExitsForm) {
skipText = Localization.get("repeat.dialog.leave");
} else {
skipText = Localization.get("repeat.dialog.exit");
}
if (FormEntryActivity.mFormController.getLastRepeatCount() > 0) {
title = Localization.get("repeat.dialog.add.another", FormEntryActivity.mFormController.getLastGroupText());
} else {
title = Localization.get("repeat.dialog.add.new", FormEntryActivity.mFormController.getLastGroupText());
}

// Create the choice dialog
ContextThemeWrapper wrapper = new ContextThemeWrapper(activity, R.style.DialogBaseTheme);
final PaneledChoiceDialog dialog = new HorizontalPaneledChoiceDialog(wrapper, title);
final PaneledChoiceDialog dialog = new HorizontalPaneledChoiceDialog(wrapper, addAnotherText);

// Panel 1: Back option
View.OnClickListener backListener = v -> {
Expand Down

0 comments on commit ce36e03

Please sign in to comment.