From 4ea60018bc9dd90590d7b4aa5334e25cb73b8146 Mon Sep 17 00:00:00 2001 From: Nishon Tandukar Date: Tue, 5 Mar 2019 13:44:51 +0545 Subject: [PATCH] redirects screen on siteupload --- collect_app/build.gradle | 4 +-- collect_app/release/output.json | 6 +--- .../naxa/site/SiteDashboardFragment.java | 34 ++++++++++++++----- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/collect_app/build.gradle b/collect_app/build.gradle index fb45e5ef5..cf87d48a4 100644 --- a/collect_app/build.gradle +++ b/collect_app/build.gradle @@ -69,7 +69,7 @@ if (secretsFile.exists()) { def versionMajor = 2 def versionMinor = 6 -def versionPatch = 0 +def versionPatch = 1 android { @@ -81,7 +81,7 @@ android { targetSdkVersion(26) //versionCode LEGACY_BUILD_NUMBER_OFFSET + getMasterCommitCount() //versionName getVersionName() - versionCode 49 + versionCode 54 versionName "${versionMajor}.${versionMinor}.${versionPatch}" System.out.println(versionName + " " + versionCode) testInstrumentationRunner('android.support.test.runner.AndroidJUnitRunner') diff --git a/collect_app/release/output.json b/collect_app/release/output.json index 37f589973..e1e3b0700 100644 --- a/collect_app/release/output.json +++ b/collect_app/release/output.json @@ -1,5 +1 @@ -<<<<<<< HEAD -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":51,"versionName":"2.5.3","enabled":true,"outputFile":"collect-release-2.5.3.apk","fullName":"release","baseName":"release"},"path":"collect-release-2.5.3.apk","properties":{}}] -======= -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":49,"versionName":"2.5.5","enabled":true,"outputFile":"collect-release-2.5.5.apk","fullName":"release","baseName":"release"},"path":"collect-release-2.5.5.apk","properties":{}}] ->>>>>>> 980a41b8383f2c9266e4ff892ddddc55be64e84f +[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":54,"versionName":"2.6.1","enabled":true,"outputFile":"collect-release-2.6.1.apk","fullName":"release","baseName":"release"},"path":"collect-release-2.6.1.apk","properties":{}}] \ No newline at end of file diff --git a/collect_app/src/main/java/org/bcss/collect/naxa/site/SiteDashboardFragment.java b/collect_app/src/main/java/org/bcss/collect/naxa/site/SiteDashboardFragment.java index 3de5e4775..23912201f 100644 --- a/collect_app/src/main/java/org/bcss/collect/naxa/site/SiteDashboardFragment.java +++ b/collect_app/src/main/java/org/bcss/collect/naxa/site/SiteDashboardFragment.java @@ -70,6 +70,8 @@ import retrofit2.HttpException; import timber.log.Timber; +import static android.app.Activity.RESULT_CANCELED; +import static android.app.Activity.RESULT_OK; import static org.bcss.collect.naxa.common.Constant.ANIM.fragmentEnterAnimation; import static org.bcss.collect.naxa.common.Constant.ANIM.fragmentExitAnimation; import static org.bcss.collect.naxa.common.Constant.ANIM.fragmentPopEnterAnimation; @@ -390,14 +392,17 @@ public void accept(Disposable disposable) throws Exception { public void onSuccess(List instanceIDs) { FieldSightNotificationUtils.getINSTANCE().cancelNotification(progressNotifyId); - if (uploadForms && instanceIDs.size() > 0) { - Intent i = new Intent(getActivity(), InstanceUploaderActivity.class); - i.putExtra(FormEntryActivity.KEY_INSTANCES, Longs.toArray(instanceIDs)); - startActivityForResult(i, INSTANCE_UPLOADER); - } - - if (uploadForms && instanceIDs.size() == 0) { - FlashBarUtils.showFlashbar(requireActivity(), "There are no forms to upload"); + if (uploadForms) { + if (instanceIDs.size() > 0) { + Intent i = new Intent(getActivity(), InstanceUploaderActivity.class); + i.putExtra(FormEntryActivity.KEY_INSTANCES, Longs.toArray(instanceIDs)); + startActivityForResult(i, INSTANCE_UPLOADER); + } else { + FlashBarUtils.showFlashbar(requireActivity(), "There are no forms to upload"); + requireActivity().onBackPressed(); + } + } else { + requireActivity().onBackPressed(); } } @@ -417,6 +422,19 @@ public void onError(Throwable e) { } + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if (requestCode == INSTANCE_UPLOADER) { + switch (resultCode) { + case RESULT_OK: + case RESULT_CANCELED: + requireActivity().onBackPressed(); + break; + } + } + } + private ArrayList getNotUploadedFormForSite(String siteId) { String selection; String[] selectionArgs;