mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Show explanatory text when no categories are found for search text
This commit is contained in:
parent
ff1a5aed1c
commit
0176995612
3 changed files with 17 additions and 0 deletions
|
|
@ -29,6 +29,14 @@
|
||||||
/>
|
/>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/categoriesNotFound"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:gravity="center"
|
||||||
|
/>
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/categoriesListBox"
|
android:id="@+id/categoriesListBox"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
||||||
|
|
@ -68,4 +68,6 @@
|
||||||
<item quantity="one">1 upload</item>
|
<item quantity="one">1 upload</item>
|
||||||
<item quantity="other">%d uploads</item>
|
<item quantity="other">%d uploads</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
|
||||||
|
<string name="categories_not_found">No categories matching %1$s found</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ public class CategorizationFragment extends SherlockFragment{
|
||||||
ListView categoriesList;
|
ListView categoriesList;
|
||||||
EditText categoriesFilter;
|
EditText categoriesFilter;
|
||||||
ProgressBar categoriesSearchInProgress;
|
ProgressBar categoriesSearchInProgress;
|
||||||
|
TextView categoriesNotFoundView;
|
||||||
|
|
||||||
CategoriesAdapter categoriesAdapter;
|
CategoriesAdapter categoriesAdapter;
|
||||||
CategoriesUpdater lastUpdater = null;
|
CategoriesUpdater lastUpdater = null;
|
||||||
|
|
@ -85,6 +86,7 @@ public class CategorizationFragment extends SherlockFragment{
|
||||||
super.onPreExecute();
|
super.onPreExecute();
|
||||||
filter = categoriesFilter.getText().toString();
|
filter = categoriesFilter.getText().toString();
|
||||||
categoriesSearchInProgress.setVisibility(View.VISIBLE);
|
categoriesSearchInProgress.setVisibility(View.VISIBLE);
|
||||||
|
categoriesNotFoundView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -106,6 +108,10 @@ public class CategorizationFragment extends SherlockFragment{
|
||||||
categoriesAdapter.setItems(items);
|
categoriesAdapter.setItems(items);
|
||||||
categoriesAdapter.notifyDataSetInvalidated();
|
categoriesAdapter.notifyDataSetInvalidated();
|
||||||
categoriesSearchInProgress.setVisibility(View.GONE);
|
categoriesSearchInProgress.setVisibility(View.GONE);
|
||||||
|
if(!TextUtils.isEmpty(filter) && categories.size() == 0) {
|
||||||
|
categoriesNotFoundView.setText(getString(R.string.categories_not_found, filter));
|
||||||
|
categoriesNotFoundView.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -195,6 +201,7 @@ public class CategorizationFragment extends SherlockFragment{
|
||||||
categoriesList = (ListView) rootView.findViewById(R.id.categoriesListBox);
|
categoriesList = (ListView) rootView.findViewById(R.id.categoriesListBox);
|
||||||
categoriesFilter = (EditText) rootView.findViewById(R.id.categoriesSearchBox);
|
categoriesFilter = (EditText) rootView.findViewById(R.id.categoriesSearchBox);
|
||||||
categoriesSearchInProgress = (ProgressBar) rootView.findViewById(R.id.categoriesSearchInProgress);
|
categoriesSearchInProgress = (ProgressBar) rootView.findViewById(R.id.categoriesSearchInProgress);
|
||||||
|
categoriesNotFoundView = (TextView) rootView.findViewById(R.id.categoriesNotFound);
|
||||||
|
|
||||||
ArrayList<CategoryItem> items;
|
ArrayList<CategoryItem> items;
|
||||||
if(savedInstanceState == null) {
|
if(savedInstanceState == null) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue