diff options
-rw-r--r-- | res/layout/abstract_list_fragment.xml | 8 | ||||
-rw-r--r-- | res/layout/select_album.xml | 8 | ||||
-rw-r--r-- | res/layout/tab_progress.xml | 4 | ||||
-rw-r--r-- | res/values-de/strings.xml | 1 | ||||
-rw-r--r-- | res/values-es/strings.xml | 1 | ||||
-rw-r--r-- | res/values-hu/strings.xml | 1 | ||||
-rw-r--r-- | res/values-ru/strings.xml | 1 | ||||
-rw-r--r-- | res/values/strings.xml | 3 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java | 13 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SelectListFragment.java | 12 | ||||
-rw-r--r-- | src/github/daneren2005/dsub/fragments/SubsonicFragment.java | 20 |
11 files changed, 36 insertions, 36 deletions
diff --git a/res/layout/abstract_list_fragment.xml b/res/layout/abstract_list_fragment.xml index be3889ee..4440c526 100644 --- a/res/layout/abstract_list_fragment.xml +++ b/res/layout/abstract_list_fragment.xml @@ -17,14 +17,6 @@ <include layout="@layout/tab_progress" />
- <TextView
- android:id="@+id/fragment_list_empty"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:padding="10dip"
- android:text="@string/common.empty"
- android:visibility="gone" />
-
<ListView
android:id="@+id/fragment_list"
android:layout_width="fill_parent"
diff --git a/res/layout/select_album.xml b/res/layout/select_album.xml index 2189fdcc..54d47047 100644 --- a/res/layout/select_album.xml +++ b/res/layout/select_album.xml @@ -17,14 +17,6 @@ <include layout="@layout/tab_progress"/>
- <TextView
- android:id="@+id/select_album_empty"
- android:text="@string/select_album.empty"
- android:visibility="gone"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:padding="10dip"/>
-
<ListView
android:id="@+id/select_album_entries"
android:textFilterEnabled="true"
diff --git a/res/layout/tab_progress.xml b/res/layout/tab_progress.xml index 53df7d18..a46dc34b 100644 --- a/res/layout/tab_progress.xml +++ b/res/layout/tab_progress.xml @@ -2,7 +2,8 @@ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tab_progress"
android:layout_width="fill_parent"
- android:layout_height="fill_parent">
+ android:layout_height="fill_parent"
+ android:clickable="true">
<LinearLayout
android:layout_width="wrap_content"
@@ -11,6 +12,7 @@ android:layout_gravity="center">
<ProgressBar
+ android:id="@+id/tab_progress_spinner"
style="?android:attr/progressBarStyleLarge"
android:layout_gravity="center_horizontal"
android:layout_marginRight="6dp"
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 61e8f7c6..ab40df85 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -125,7 +125,6 @@ <string name="music_library.label">Medienbibliothek</string>
<string name="music_library.label_offline">Offline Medien</string>
- <string name="select_album.empty">Keine Medien gefunden</string>
<string name="select_album.select">Alle auswählen</string>
<string name="select_album.n_selected">%d Lieder ausgewählt.</string>
<string name="select_album.n_unselected">%d Lieder deselektiert.</string>
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index dd46f6ca..ef025a6d 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -121,7 +121,6 @@ <string name="music_library.label">Biblioteca de medios</string> <string name="music_library.label_offline">Archivos Offline</string> - <string name="select_album.empty">Vacío</string> <string name="select_album.select">Seleccionar todo</string> <string name="select_album.n_selected">Seleccionadas %d canciones</string> <string name="select_album.n_unselected">%d canciones deseleccionadas</string> diff --git a/res/values-hu/strings.xml b/res/values-hu/strings.xml index 9f6c6318..330ab8b7 100644 --- a/res/values-hu/strings.xml +++ b/res/values-hu/strings.xml @@ -125,7 +125,6 @@ <string name="music_library.label">Médiakönyvtár</string>
<string name="music_library.label_offline">Kapcsolat nélküli médiák</string>
- <string name="select_album.empty">Nem található média!</string>
<string name="select_album.select">Összes jelölése be/ki</string>
<string name="select_album.n_selected">%d dal kijelölve.</string>
<string name="select_album.n_unselected">%d dal visszavonva.</string>
diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 0f6cce5d..8e636328 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -88,7 +88,6 @@ <string name="music_library.label">Медиатека</string>
<string name="music_library.label_offline">Оффлайн медиа</string>
- <string name="select_album.empty">Медиафайлы не найдены</string>
<string name="select_album.select">Выбрать все</string>
<string name="select_album.n_selected">%d композиций выбрано.</string>
<string name="select_album.n_unselected">Выбор снят с %d композиций.</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml index 234f7d21..3be73dd7 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -23,7 +23,7 @@ <string name="common.confirm">Confirm</string>
<string name="common.confirm_message">Do you want to %1$s %2$s?</string>
<string name="common.confirm_message_cache">cache</string>
- <string name="common.empty">None found</string>
+ <string name="common.empty">No data</string>
<string name="common.warning">Warning</string>
<string name="button_bar.home">Home</string>
@@ -125,7 +125,6 @@ <string name="music_library.label">Media library</string>
<string name="music_library.label_offline">Offline media</string>
- <string name="select_album.empty">No media found</string>
<string name="select_album.select">Select all</string>
<string name="select_album.n_selected">%d tracks selected.</string>
<string name="select_album.n_unselected">%d tracks unselected.</string>
diff --git a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java index 7703d5b2..bd1d98dc 100644 --- a/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java @@ -54,7 +54,6 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter private GridView albumList;
private ListView entryList;
- private View emptyView;
private boolean hideButtons = false;
private Boolean licenseValid;
private boolean showHeader = true;
@@ -182,8 +181,6 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter }
});
- emptyView = rootView.findViewById(R.id.select_album_empty);
-
registerForContextMenu(entryList);
registerForContextMenu(albumList);
@@ -445,7 +442,6 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter }
entryList.setVisibility(View.INVISIBLE);
- emptyView.setVisibility(View.INVISIBLE);
if (playlistId != null) {
getPlaylist(playlistId, playlistName, refresh);
} else if(podcastId != null) {
@@ -658,7 +654,10 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter addAlbumHeader = false;
}
- emptyView.setVisibility((entries.isEmpty() && albums.isEmpty()) ? View.VISIBLE : View.GONE);
+ boolean validData = !entries.isEmpty() || !albums.isEmpty();
+ if(!validData) {
+ setEmpty(true);
+ }
// Always going to have entries in entryAdapter
entryAdapter = new EntryAdapter(context, getImageLoader(), entries, (podcastId == null));
ListAdapter listAdapter = entryAdapter;
@@ -683,7 +682,9 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter }
}
entryList.setAdapter(listAdapter);
- entryList.setVisibility(View.VISIBLE);
+ if(validData) {
+ entryList.setVisibility(View.VISIBLE);
+ }
context.supportInvalidateOptionsMenu();
Bundle args = getArguments();
diff --git a/src/github/daneren2005/dsub/fragments/SelectListFragment.java b/src/github/daneren2005/dsub/fragments/SelectListFragment.java index 1c77ad68..751b840f 100644 --- a/src/github/daneren2005/dsub/fragments/SelectListFragment.java +++ b/src/github/daneren2005/dsub/fragments/SelectListFragment.java @@ -52,7 +52,6 @@ public abstract class SelectListFragment<T> extends SubsonicFragment implements private static final String TAG = SelectListFragment.class.getSimpleName();
protected ListView listView;
protected ArrayAdapter adapter;
- protected View emptyView;
protected List<T> objects;
protected boolean serialize = true;
@@ -84,7 +83,6 @@ public abstract class SelectListFragment<T> extends SubsonicFragment implements listView.setOnItemClickListener(this);
setupScrollList(listView);
registerForContextMenu(listView);
- emptyView = rootView.findViewById(R.id.fragment_list_empty);
if(objects == null) {
refresh(false);
@@ -115,8 +113,7 @@ public abstract class SelectListFragment<T> extends SubsonicFragment implements if(titleRes != 0) {
setTitle(getTitleResource());
}
- listView.setVisibility(View.INVISIBLE);
- emptyView.setVisibility(View.GONE);
+ listView.setVisibility(View.GONE);
BackgroundTask<List<T>> task = new TabBackgroundTask<List<T>>(this) {
@Override
@@ -136,11 +133,12 @@ public abstract class SelectListFragment<T> extends SubsonicFragment implements @Override
protected void done(List<T> result) {
- emptyView.setVisibility(result == null || result.isEmpty() ? View.VISIBLE : View.GONE);
-
- if (result != null) {
+ if (result != null && !result.isEmpty()) {
listView.setAdapter(adapter = getAdapter(result));
listView.setVisibility(View.VISIBLE);
+ } else {
+ setEmpty(true);
+ refreshLayout.setEnabled(true);
}
}
};
diff --git a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java index d799877b..a9d6d06d 100644 --- a/src/github/daneren2005/dsub/fragments/SubsonicFragment.java +++ b/src/github/daneren2005/dsub/fragments/SubsonicFragment.java @@ -434,6 +434,11 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR View view = rootView.findViewById(R.id.tab_progress);
if (view != null) {
view.setVisibility(visible ? View.VISIBLE : View.GONE);
+
+ if(visible) {
+ View progress = rootView.findViewById(R.id.tab_progress_spinner);
+ progress.setVisibility(View.VISIBLE);
+ }
}
}
@@ -444,6 +449,21 @@ public class SubsonicFragment extends Fragment implements SwipeRefreshLayout.OnR }
}
+ public void setEmpty(boolean empty) {
+ View view = rootView.findViewById(R.id.tab_progress);
+ if(empty) {
+ view.setVisibility(View.VISIBLE);
+
+ View progress = view.findViewById(R.id.tab_progress_spinner);
+ progress.setVisibility(View.GONE);
+
+ TextView text = (TextView) view.findViewById(R.id.tab_progress_message);
+ text.setText(R.string.common_empty);
+ } else {
+ view.setVisibility(View.GONE);
+ }
+ }
+
protected synchronized ImageLoader getImageLoader() {
return context.getImageLoader();
}
|