Minor improvements

This commit is contained in:
Martin Fietz 2015-07-19 02:07:50 +02:00
parent c779e78ee8
commit 35dcabd103
2 changed files with 13 additions and 15 deletions

View File

@ -66,7 +66,7 @@ public class QueueFragment extends Fragment {
EventDistributor.DOWNLOAD_QUEUED | EventDistributor.DOWNLOAD_QUEUED |
EventDistributor.PLAYER_STATUS_UPDATE; EventDistributor.PLAYER_STATUS_UPDATE;
private TextView statusBar; private TextView infoBar;
private DragSortListView listView; private DragSortListView listView;
private QueueListAdapter listAdapter; private QueueListAdapter listAdapter;
private TextView txtvEmpty; private TextView txtvEmpty;
@ -364,7 +364,7 @@ public class QueueFragment extends Fragment {
((MainActivity) getActivity()).getSupportActionBar().setTitle(R.string.queue_label); ((MainActivity) getActivity()).getSupportActionBar().setTitle(R.string.queue_label);
View root = inflater.inflate(R.layout.queue_fragment, container, false); View root = inflater.inflate(R.layout.queue_fragment, container, false);
statusBar = (TextView) root.findViewById(R.id.status_bar); infoBar = (TextView) root.findViewById(R.id.info_bar);
listView = (DragSortListView) root.findViewById(android.R.id.list); listView = (DragSortListView) root.findViewById(android.R.id.list);
txtvEmpty = (TextView) root.findViewById(android.R.id.empty); txtvEmpty = (TextView) root.findViewById(android.R.id.empty);
progLoading = (ProgressBar) root.findViewById(R.id.progLoading); progLoading = (ProgressBar) root.findViewById(R.id.progLoading);
@ -472,7 +472,8 @@ public class QueueFragment extends Fragment {
// needs data that may have just been loaded. // needs data that may have just been loaded.
getActivity().supportInvalidateOptionsMenu(); getActivity().supportInvalidateOptionsMenu();
// refresh status bar // refresh information bar
String info = queue.size() + getString(R.string.episodes_suffix);
if(queue.size() > 0) { if(queue.size() > 0) {
int durationSec = 0; int durationSec = 0;
for(FeedItem item : queue) { for(FeedItem item : queue) {
@ -480,18 +481,15 @@ public class QueueFragment extends Fragment {
durationSec += item.getMedia().getDuration() / 1000; durationSec += item.getMedia().getDuration() / 1000;
} }
} }
String duration = ""; int hours = durationSec / 3600;
if(durationSec > 3600) { int minutes = (durationSec % 3600) / 60;
duration += durationSec / 3600 + " " + getString(R.string.time_unit_hours) + " " info += " \u2022 ";
+ (durationSec % 3600) / 60 + " " + getString(R.string.time_unit_minutes); if (hours > 0) {
} else { info += hours + " " + getString(R.string.time_unit_hours) + " ";
duration = durationSec / 60 + " " + getString(R.string.time_unit_minutes);
} }
statusBar.setText(queue.size() + getString(R.string.episodes_suffix) + " \u2022 " + duration); info += minutes + " " + getString(R.string.time_unit_minutes);
} else {
statusBar.setText("0" + getString(R.string.episodes_suffix));
} }
infoBar.setText(info);
} }
private DownloadObserver.Callback downloadObserverCallback = new DownloadObserver.Callback() { private DownloadObserver.Callback downloadObserverCallback = new DownloadObserver.Callback() {

View File

@ -6,7 +6,7 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<TextView <TextView
android:id="@+id/status_bar" android:id="@+id/info_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
@ -17,7 +17,7 @@
android:id="@+id/divider" android:id="@+id/divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_below="@id/status_bar" android:layout_below="@id/info_bar"
android:background="?android:attr/listDivider"/> android:background="?android:attr/listDivider"/>
<com.mobeta.android.dslv.DragSortListView <com.mobeta.android.dslv.DragSortListView