[Android] more variables clearing for video grid data binding
Sébastien Toque
git at videolan.org
Tue Sep 29 22:37:07 CEST 2015
vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Tue Sep 29 22:36:49 2015 +0200| [214c0cf1d368472b7a4a258a7f4fedb28a942095] | committer: Sébastien Toque
more variables clearing for video grid data binding
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=214c0cf1d368472b7a4a258a7f4fedb28a942095
---
vlc-android/res/layout/video_list_card.xml | 2 +-
.../videolan/vlc/gui/video/VideoListAdapter.java | 21 ++++++++++++--------
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/vlc-android/res/layout/video_list_card.xml b/vlc-android/res/layout/video_list_card.xml
index e1f0090..7bed298 100644
--- a/vlc-android/res/layout/video_list_card.xml
+++ b/vlc-android/res/layout/video_list_card.xml
@@ -122,13 +122,13 @@
android:layout_marginRight="10dip"
android:layout_marginLeft="10dip"
android:paddingBottom="3dip"
- android:visibility="@{time != null ? View.VISIBLE : View.INVISIBLE}"
android:focusable="false"
android:indeterminate="false"
android:maxHeight="2dip"
android:minHeight="2dip"
android:max="@{max}"
android:progress="@{progress}"
+ android:visibility="@{max == 0 ? View.INVISIBLE : View.VISIBLE}"
android:progressDrawable="?attr/gridview_progressbar" />
</RelativeLayout>
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index 0bf7234..385cff8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -219,27 +219,32 @@ public class VideoListAdapter extends ArrayAdapter<MediaWrapper>
}
private void fillVideoView(ViewHolder holder, MediaWrapper media) {
+ String text = "";
+ String resolution = "";
+ int max = 0;
+ int progress = 0;
+
/* Time / Duration */
if (media.getLength() > 0) {
long lastTime = media.getTime();
- String text;
if (lastTime > 0) {
text = String.format("%s / %s",
Strings.millisToText(lastTime),
Strings.millisToText(media.getLength()));
- holder.binding.setVariable(BR.max, (int) (media.getLength() / 1000));
- holder.binding.setVariable(BR.progress, (int) (lastTime / 1000));
+ max = (int) (media.getLength() / 1000);
+ progress = (int) (lastTime / 1000);
} else {
text = Strings.millisToText(media.getLength());
}
-
- holder.binding.setVariable(BR.time, text);
}
if (media.getWidth() > 0 && media.getHeight() > 0)
- holder.binding.setVariable(BR.resolution, String.format("%dx%d", media.getWidth(), media.getHeight()));
- else
- holder.binding.setVariable(BR.resolution, "");
+ resolution = String.format("%dx%d", media.getWidth(), media.getHeight());
+
holder.binding.setVariable(BR.group, false);
+ holder.binding.setVariable(BR.resolution, resolution);
+ holder.binding.setVariable(BR.time, text);
+ holder.binding.setVariable(BR.max, max);
+ holder.binding.setVariable(BR.progress, progress);
}
static class ViewHolder {
More information about the Android
mailing list