Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide subforms #155

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}
}
}

Expand Down
1 change: 1 addition & 0 deletions survey_app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,6 @@
<string name="name">Name</string>
<string name="tableId">Table ID</string>
<string name="sort_by">Sort by</string>
<string name="show_sub_forms">Show Subforms</string>

</resources>