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>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/categoriesNotFound"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:visibility="gone"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/categoriesListBox"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
|||
|
|
@ -68,4 +68,6 @@
|
|||
<item quantity="one">1 upload</item>
|
||||
<item quantity="other">%d uploads</item>
|
||||
</plurals>
|
||||
|
||||
<string name="categories_not_found">No categories matching %1$s found</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ public class CategorizationFragment extends SherlockFragment{
|
|||
ListView categoriesList;
|
||||
EditText categoriesFilter;
|
||||
ProgressBar categoriesSearchInProgress;
|
||||
TextView categoriesNotFoundView;
|
||||
|
||||
CategoriesAdapter categoriesAdapter;
|
||||
CategoriesUpdater lastUpdater = null;
|
||||
|
|
@ -85,6 +86,7 @@ public class CategorizationFragment extends SherlockFragment{
|
|||
super.onPreExecute();
|
||||
filter = categoriesFilter.getText().toString();
|
||||
categoriesSearchInProgress.setVisibility(View.VISIBLE);
|
||||
categoriesNotFoundView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -106,6 +108,10 @@ public class CategorizationFragment extends SherlockFragment{
|
|||
categoriesAdapter.setItems(items);
|
||||
categoriesAdapter.notifyDataSetInvalidated();
|
||||
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
|
||||
|
|
@ -195,6 +201,7 @@ public class CategorizationFragment extends SherlockFragment{
|
|||
categoriesList = (ListView) rootView.findViewById(R.id.categoriesListBox);
|
||||
categoriesFilter = (EditText) rootView.findViewById(R.id.categoriesSearchBox);
|
||||
categoriesSearchInProgress = (ProgressBar) rootView.findViewById(R.id.categoriesSearchInProgress);
|
||||
categoriesNotFoundView = (TextView) rootView.findViewById(R.id.categoriesNotFound);
|
||||
|
||||
ArrayList<CategoryItem> items;
|
||||
if(savedInstanceState == null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue