diff --git a/opensrp-eusm/build.gradle b/opensrp-eusm/build.gradle index 77c9260..a57d31f 100644 --- a/opensrp-eusm/build.gradle +++ b/opensrp-eusm/build.gradle @@ -51,7 +51,7 @@ android { minSdkVersion androidMinSdkVersion targetSdkVersion androidTargetSdkVersion versionCode 1 - versionName "0.1.1" + versionName "0.1.2" multiDexEnabled true buildConfigField "long", "MAX_SERVER_TIME_DIFFERENCE", "1800000l" buildConfigField "boolean", "TIME_CHECK", "false" @@ -218,7 +218,7 @@ dependencies { exclude group: 'com.android.support', module: 'appcompat-v7' } - implementation('org.smartregister:opensrp-client-native-form:2.1.3-r12-SNAPSHOT@aar') { + implementation('org.smartregister:opensrp-client-native-form:2.1.8-SNAPSHOT@aar') { transitive = true exclude group: 'com.android.support', module: 'appcompat-v7' exclude group: 'com.android.support', module: 'cardview-v7' diff --git a/opensrp-eusm/src/main/AndroidManifest.xml b/opensrp-eusm/src/main/AndroidManifest.xml index 16adf60..eb54988 100644 --- a/opensrp-eusm/src/main/AndroidManifest.xml +++ b/opensrp-eusm/src/main/AndroidManifest.xml @@ -76,7 +76,12 @@ android:screenOrientation="portrait" android:theme="@style/AppTheme.NoActionBar" android:windowSoftInputMode="stateAlwaysHidden|adjustResize" /> - + getMinMaxZoomMapDownloadPair() { public List getBaseLayers() { return Arrays.asList( BaseLayerSwitchModel.builder().baseLayer(new DigitalGlobeLayer()).build(), - BaseLayerSwitchModel.builder().baseLayer(new MapBoxLayer()).isDefault(true).build(), + BaseLayerSwitchModel.builder().baseLayer(new MapBoxLayer()).build(), BaseLayerSwitchModel.builder().baseLayer(new StreetsBaseLayer(EusmApplication.getInstance().getBaseContext())).build(), - BaseLayerSwitchModel.builder().baseLayer(new SatelliteStreetsLayer(EusmApplication.getInstance().getBaseContext())).build() + BaseLayerSwitchModel.builder().baseLayer(new SatelliteStreetsLayer(EusmApplication.getInstance().getBaseContext())).isDefault(true).build() ); } diff --git a/opensrp-eusm/src/main/java/org/smartregister/eusm/layer/SatelliteStreetsLayer.java b/opensrp-eusm/src/main/java/org/smartregister/eusm/layer/SatelliteStreetsLayer.java index 0cfedcf..59e526e 100644 --- a/opensrp-eusm/src/main/java/org/smartregister/eusm/layer/SatelliteStreetsLayer.java +++ b/opensrp-eusm/src/main/java/org/smartregister/eusm/layer/SatelliteStreetsLayer.java @@ -8,6 +8,7 @@ import com.mapbox.mapboxsdk.style.layers.FillLayer; import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.layers.PropertyFactory; +import com.mapbox.mapboxsdk.style.sources.RasterSource; import com.mapbox.mapboxsdk.style.sources.Source; import com.mapbox.mapboxsdk.style.sources.VectorSource; @@ -31,14 +32,17 @@ public class SatelliteStreetsLayer extends BaseLayer { private String streetSourceId = "composite"; private ArrayList sourcesList = new ArrayList<>(); private LinkedHashSet layers = new LinkedHashSet<>(); + private String satelliteSourceId = "mapbox://mapbox.satellite"; public SatelliteStreetsLayer(@NonNull Context context) { createLayersAndSources(context); } protected void createLayersAndSources(@NonNull Context context) { + RasterSource rasterSource = new RasterSource(satelliteSourceId, satelliteSourceId, 256); VectorSource streetSource = new VectorSource(streetSourceId, "mapbox://mapbox.mapbox-streets-v8,mapbox.mapbox-terrain-v2"); sourcesList.add(streetSource); + sourcesList.add(rasterSource); LayerUtil layerUtil = new LayerUtil(); diff --git a/opensrp-eusm/src/main/java/org/smartregister/eusm/service/AppSyncIntentService.java b/opensrp-eusm/src/main/java/org/smartregister/eusm/service/AppSyncIntentService.java index a3fdf64..0dd7c41 100644 --- a/opensrp-eusm/src/main/java/org/smartregister/eusm/service/AppSyncIntentService.java +++ b/opensrp-eusm/src/main/java/org/smartregister/eusm/service/AppSyncIntentService.java @@ -5,14 +5,14 @@ import androidx.annotation.NonNull; import org.smartregister.eusm.helper.AppValidateAssignmentHelper; +import org.smartregister.eusm.util.EusmSyncUtils; import org.smartregister.sync.intent.SyncIntentService; -import org.smartregister.util.SyncUtils; public class AppSyncIntentService extends SyncIntentService { @Override protected void init(@NonNull Context context) { super.init(context); - validateAssignmentHelper = new AppValidateAssignmentHelper(new SyncUtils(getBaseContext())); + validateAssignmentHelper = new AppValidateAssignmentHelper(new EusmSyncUtils(getBaseContext())); } } diff --git a/opensrp-eusm/src/main/java/org/smartregister/eusm/util/EusmSyncUtils.java b/opensrp-eusm/src/main/java/org/smartregister/eusm/util/EusmSyncUtils.java new file mode 100644 index 0000000..16805fb --- /dev/null +++ b/opensrp-eusm/src/main/java/org/smartregister/eusm/util/EusmSyncUtils.java @@ -0,0 +1,32 @@ +package org.smartregister.eusm.util; + +import android.content.Context; +import android.content.Intent; + +import androidx.annotation.NonNull; + +import org.smartregister.AllConstants; +import org.smartregister.eusm.R; +import org.smartregister.util.SyncUtils; + +import static org.smartregister.AllConstants.ACCOUNT_DISABLED; + +public class EusmSyncUtils extends SyncUtils { + + private Context context; + + public EusmSyncUtils(Context context) { + super(context); + this.context = context; + } + + @NonNull + @Override + protected Intent getLogoutUserIntent(int logoutMessage) { + Intent intent = super.getLogoutUserIntent(logoutMessage); + intent.removeExtra(ACCOUNT_DISABLED); + intent.putExtra(AllConstants.INTENT_KEY.DIALOG_MESSAGE, context.getString(logoutMessage)); + intent.putExtra(AllConstants.INTENT_KEY.DIALOG_TITLE, context.getString(R.string.new_assignment_dialog_title)); + return intent; + } +} diff --git a/opensrp-eusm/src/main/java/org/smartregister/eusm/view/EusmTreeViewDialog.java b/opensrp-eusm/src/main/java/org/smartregister/eusm/view/EusmTreeViewDialog.java index ccddcda..6f11438 100644 --- a/opensrp-eusm/src/main/java/org/smartregister/eusm/view/EusmTreeViewDialog.java +++ b/opensrp-eusm/src/main/java/org/smartregister/eusm/view/EusmTreeViewDialog.java @@ -38,7 +38,7 @@ public TreeNode.BaseNodeViewHolder getNodeViewHolder(Context context, JS @Override public void updateTreeNode(int level, TreeNode curNode, TreeNode parentNode) { - curNode.setSelectable(level > 2); + curNode.setSelectable(level == 3); boolean isSelected = operationalAreas.contains(curNode.getValue().toString()); curNode.setSelected(isSelected); } diff --git a/opensrp-eusm/src/main/java/org/smartregister/eusm/view/NavigationDrawerView.java b/opensrp-eusm/src/main/java/org/smartregister/eusm/view/NavigationDrawerView.java index bc59312..1966227 100644 --- a/opensrp-eusm/src/main/java/org/smartregister/eusm/view/NavigationDrawerView.java +++ b/opensrp-eusm/src/main/java/org/smartregister/eusm/view/NavigationDrawerView.java @@ -5,8 +5,10 @@ import android.util.TypedValue; import android.view.Gravity; import android.view.View; +import android.view.ViewGroup; import android.widget.Button; import android.widget.LinearLayout; +import android.widget.ScrollView; import android.widget.TextView; import androidx.annotation.NonNull; @@ -25,6 +27,7 @@ import org.smartregister.tasking.util.PreferencesUtil; import org.smartregister.tasking.view.DrawerMenuView; import org.smartregister.util.LangUtils; +import org.smartregister.util.NetworkUtils; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -162,7 +165,16 @@ public void showOperationalAreaSelector(Pair> location LinearLayout buttonLayout = new LinearLayout(getContext()); buttonLayout.setGravity(Gravity.CENTER); + LinearLayout.LayoutParams treeViewLayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); + LinearLayout treeViewLayout = new LinearLayout(getContext()); + treeViewLayout.setOrientation(LinearLayout.VERTICAL); + treeViewLayout.setGravity(Gravity.CENTER); + treeViewLayout.setLayoutParams(treeViewLayoutParams); + + + LinearLayout.LayoutParams buttonLayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); Button okButton = new Button(getContext()); + okButton.setLayoutParams(buttonLayoutParams); okButton.setText(R.string.ok_text); okButton.setTypeface(Typeface.DEFAULT_BOLD); okButton.setTextColor(getContext().getResources().getColor(R.color.white)); @@ -170,9 +182,18 @@ public void showOperationalAreaSelector(Pair> location okButton.setTextSize(TypedValue.COMPLEX_UNIT_PX, getContext().getResources() .getDimension(com.vijay.jsonwizard.R.dimen.button_text_size)); okButton.setHeight(getContext().getResources().getDimensionPixelSize(com.vijay.jsonwizard.R.dimen.button_height)); - buttonLayout.addView(okButton); - linearLayout.addView(buttonLayout); + + ScrollView scrollView = (ScrollView) linearLayout.getChildAt(0); + View androidTreeView = scrollView.getChildAt(0); + scrollView.removeView(androidTreeView); + treeViewLayout.addView(androidTreeView); + treeViewLayout.addView(buttonLayout); + scrollView.addView(treeViewLayout); + linearLayout.removeView(scrollView); + linearLayout.setOrientation(LinearLayout.VERTICAL); + linearLayout.addView(scrollView); + okButton.setOnClickListener(v -> { List selectedValues = treeViewDialog.getTreeView().getSelectedValues(String.class); getPresenter().onOperationalAreaSelectorClicked(new ArrayList<>(selectedValues)); @@ -195,4 +216,11 @@ public void onDrawerOpened(@NonNull View drawerView) { } } } + + @Override + public void toggleProgressBarView(boolean syncing) { + super.toggleProgressBarView(syncing); + View flexBox = this.activity.getActivity().findViewById(R.id.flex_box); + flexBox.setVisibility((syncing && NetworkUtils.isNetworkAvailable()) ? View.GONE : View.VISIBLE); + } } diff --git a/opensrp-eusm/src/main/res/layout/activity_product_info.xml b/opensrp-eusm/src/main/res/layout/activity_product_info.xml index 3971db1..f3d9f6d 100644 --- a/opensrp-eusm/src/main/res/layout/activity_product_info.xml +++ b/opensrp-eusm/src/main/res/layout/activity_product_info.xml @@ -141,30 +141,33 @@ android:id="@+id/layout" android:layout_width="match_parent" android:layout_height="wrap_content" + android:minHeight="70dp" + android:layout_gravity="center" android:layout_marginStart="10dp" android:layout_marginEnd="10dp" - android:orientation="horizontal" - android:layout_gravity="center" android:gravity="center" + android:orientation="horizontal" android:paddingTop="10dp" android:paddingBottom="5dp" android:weightSum="1"> - + - + + + + diff --git a/opensrp-eusm/src/main/res/layout/nav_header.xml b/opensrp-eusm/src/main/res/layout/nav_header.xml index d785a4f..a53188c 100644 --- a/opensrp-eusm/src/main/res/layout/nav_header.xml +++ b/opensrp-eusm/src/main/res/layout/nav_header.xml @@ -37,71 +37,86 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/application_version" /> - - - - - - - - + android:layout_marginTop="20dp" + app:layout_constraintTop_toBottomOf="@id/application_updated"> + + + + + + + + + + + + + + + + + + + + app:layout_constraintTop_toBottomOf="@id/progressbar_layout" /> + android:focusable="false"> - + android:layout_marginTop="10dp" + app:alignContent="stretch" + app:alignItems="stretch" + app:flexWrap="wrap"> - + + + + Le fuseau horaire de l\'appareil a changé. Veuillez vous connecter à nouveau. L\'heure de l\'appareil a changé. Veuillez vous connecter à nouveau. - Saisir le mot de passe - Saisir l\'identifiant - Synchro + Saisir mot de passe + Saisir identifiant + Sync Mission District Mission @@ -86,24 +86,21 @@ >]]> - %s · %s %s - Serial # - Qty: Serial # %s Serial # %s PRODUITS VERIFIÉ - Aucun article à vérifier - Aucun article n\'a encore été vérifié + Aucun produit à vérifier + Aucun produit n\'a encore été vérifié Retour - Marquer comme \" semble en bon état \" ? - Le matériel existe, il est en bon état et il est utilisé de manière appropriée. + Confirmer C\'est OK \" ? + Le produit existe, il est en bon état et il est utilisé de manière appropriée. Annuler évaluation pour %s Annuler \"C\'est OK !\" pour %s Annuler \"Signaler Problème\" pour %s - Ceci annulera votre évaluation sur cet article - Annuler + Ceci annulera votre évaluation sur ce produit + Non Annuler %s produits Existe-t-il ? @@ -111,7 +108,7 @@ Est-il utilisé de manière appropriée? Enregistrement Résoudre problème : %s - Voir l\'inventaire + Voir les produits En cours Terminé Signaler un problème @@ -122,6 +119,10 @@ Localisation GPS inconnue Mission et District non définis + Mission et district non fixé. Sélectionner dans le menu + Mission et district ulterieurement selectionnés sont annulé(s). Sélectionner de nouveau dans le menu + Permission de stockage en lecture et écriture non accordée + Check point de service Enregistrer GPS - + diff --git a/opensrp-eusm/src/main/res/values/strings.xml b/opensrp-eusm/src/main/res/values/strings.xml index e4023ce..4023d68 100644 --- a/opensrp-eusm/src/main/res/values/strings.xml +++ b/opensrp-eusm/src/main/res/values/strings.xml @@ -143,7 +143,13 @@ date checked You\'ve selected a cluster point! - identifier + identifier OK - + New Mission Assigned + There are no structures mapped to this operational area. Please add a point to begin + This operational area has not been defined in the system. Please try to sync your device. Please contact the system administrator if that doesn\'t solve the issue noting the operational area number %1$s. + Account Disabled + Fetching Structure Details + Fetching Structure Details. Please wait + Downloading: %,.2f %%