From 12b17c5ad6e828c0af69834b8bc60a3fd4f96cc7 Mon Sep 17 00:00:00 2001
From: sanyud24 <57134307+sanyud24@users.noreply.github.com>
Date: Wed, 28 Apr 2021 21:30:25 +0530
Subject: [PATCH] Hide subforms
manually hide subforms w.r.t positions in a listview.
---
.../fragments/FormChooserListFragment.java | 20 ++++++++++++++++---
survey_app/src/main/res/values/strings.xml | 1 +
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/survey_app/src/main/java/org/opendatakit/survey/fragments/FormChooserListFragment.java b/survey_app/src/main/java/org/opendatakit/survey/fragments/FormChooserListFragment.java
index f6eee096..66fee5b2 100644
--- a/survey_app/src/main/java/org/opendatakit/survey/fragments/FormChooserListFragment.java
+++ b/survey_app/src/main/java/org/opendatakit/survey/fragments/FormChooserListFragment.java
@@ -57,7 +57,9 @@ public class FormChooserListFragment extends ListFragment
private PropertiesSingleton mPropSingleton;
private static String mAppName;
private static final String SORT_BY_TABLEID = "sortByTableID";
-
+ int[] tableIdHideform = {50 , 51};
+ int[] nameHideform = {14, 32};
+ int showForm = 0 ;
/*this is also used in CommonToolProperties.java to set default value for sorting order ,if updated
change there too..*/
private static final String SORT_BY_NAME = "sortByName";
@@ -178,7 +180,13 @@ public boolean onOptionsItemSelected(MenuItem item) {
String sortingOrder = mPropSingleton.getProperty(KEY_SURVEY_SORT_ORDER);
mItems = dataset;
sortFormList(dataset,sortingOrder);
-
+ if(showForm==0){
+ for (int i = (nameHideform.length - 1); i >= 0; i--) {
+ dataset.remove(nameHideform[i]);
+ mAdapter.notifyDataSetChanged();
+ }
+ mAdapter.notifyDataSetChanged();
+ }
// Swap the new cursor in. (The framework will take care of closing the
// old cursor once we return.)
mAdapter.swapData(dataset);
@@ -245,7 +253,13 @@ public int compare(FormInfo left, FormInfo right) {
}
});
mAdapter.swapData(mItems);
-
+ if(showForm==0){
+ for (int i = (tableIdHideform.length - 1); i >= 0; i--) {
+ mItems.remove(tableIdHideform[i]);
+ mAdapter.notifyDataSetChanged();
+ }
+ mAdapter.notifyDataSetChanged();
+ }
}
}
diff --git a/survey_app/src/main/res/values/strings.xml b/survey_app/src/main/res/values/strings.xml
index c5891022..5059230f 100644
--- a/survey_app/src/main/res/values/strings.xml
+++ b/survey_app/src/main/res/values/strings.xml
@@ -230,5 +230,6 @@
Name
Table ID
Sort by
+Show Subforms