[Android] Browsers: Download icon on http servers
Geoffrey Métais
git at videolan.org
Wed Feb 17 18:05:31 CET 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 17 18:03:31 2016 +0100| [f8a17fac7fa5c86acac10542ca04b738c1be61a3] | committer: Geoffrey Métais
Browsers: Download icon on http servers
> https://code.videolan.org/videolan/vlc-android/commit/f8a17fac7fa5c86acac10542ca04b738c1be61a3
---
vlc-android/res/layout/directory_view_item.xml | 6 +++++-
.../src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java | 4 ++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/vlc-android/res/layout/directory_view_item.xml b/vlc-android/res/layout/directory_view_item.xml
index eff9214..76229e8 100644
--- a/vlc-android/res/layout/directory_view_item.xml
+++ b/vlc-android/res/layout/directory_view_item.xml
@@ -26,6 +26,9 @@
<variable
name="protocole"
type="String"/>
+ <variable
+ name="image"
+ type="android.graphics.drawable.BitmapDrawable"/>
</data>
<LinearLayout
android:id="@+id/layout_item"
@@ -60,7 +63,8 @@
android:visibility="@{type != 2 ? View.VISIBLE : View.GONE}"
android:text="@{protocole}"
android:textSize="11sp"
- android:textColor="@color/whitetransparent"/>
+ android:textColor="@color/whitetransparent"
+ android:background="@{image}"/>
<RelativeLayout
android:layout_width="0dp"
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
index 5437ec0..8bbec7e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
@@ -35,11 +35,13 @@ import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.databinding.BrowserItemSeparatorBinding;
import org.videolan.vlc.databinding.DirectoryViewItemBinding;
+import org.videolan.vlc.gui.helpers.AsyncImageLoader;
import org.videolan.vlc.gui.helpers.MediaComparators;
import org.videolan.vlc.media.MediaDatabase;
import org.videolan.vlc.media.MediaUtils;
import org.videolan.vlc.media.MediaWrapper;
import org.videolan.vlc.util.CustomDirectories;
+import org.videolan.vlc.util.HttpImageFetcher;
import java.io.File;
import java.util.ArrayList;
@@ -108,6 +110,8 @@ public class BaseBrowserAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
vh.binding.executePendingBindings();
vh.binding.dviIcon.setBackgroundResource(getIconResId(media));
+ if (!TextUtils.isEmpty(media.getArtworkURL()) && media.getArtworkURL().startsWith("http"))
+ AsyncImageLoader.LoadImage(new HttpImageFetcher(vh.binding, media.getArtworkURL()), null);
vh.setContextMenuListener();
}
More information about the Android
mailing list