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

View File

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