[Android] No media view is now a button to setup directories
Geoffrey Métais
git at videolan.org
Wed Mar 1 13:33:41 CET 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 1 13:32:52 2017 +0100| [dbad9dc70e24e732023840f268cac86f4e480836] | committer: Geoffrey Métais
No media view is now a button to setup directories
> https://code.videolan.org/videolan/vlc-android/commit/dbad9dc70e24e732023840f268cac86f4e480836
---
vlc-android/res/layout/audio_browser.xml | 34 ++++++++++++----------
vlc-android/res/layout/video_grid.xml | 4 +++
vlc-android/res/values/strings.xml | 2 +-
.../vlc/gui/audio/AudioBrowserFragment.java | 14 ++++++++-
.../videolan/vlc/gui/video/VideoGridFragment.java | 13 ++++++++-
5 files changed, 49 insertions(+), 18 deletions(-)
diff --git a/vlc-android/res/layout/audio_browser.xml b/vlc-android/res/layout/audio_browser.xml
index 18decfe..0885729 100644
--- a/vlc-android/res/layout/audio_browser.xml
+++ b/vlc-android/res/layout/audio_browser.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
@@ -16,21 +17,6 @@
android:layout_marginRight="@dimen/default_margin"
android:layout_marginEnd="@dimen/default_margin" />
- <TextView
- android:id="@+id/no_media"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@+id/header"
- android:layout_centerInParent="true"
- android:layout_margin="@dimen/default_margin"
- android:drawableBottom="@drawable/ic_no_media"
- android:drawablePadding="@dimen/default_margin"
- android:gravity="center"
- android:maxWidth="600dp"
- android:text="@string/nomedia"
- android:textSize="20sp"
- android:visibility="gone" />
-
<org.videolan.vlc.gui.view.SwipeRefreshLayout
android:id="@+id/swipeLayout"
android:layout_width="match_parent"
@@ -57,6 +43,24 @@
android:layout_alignTop="@+id/swipeLayout"
android:visibility="invisible"/>
+ <Button
+ android:id="@+id/no_media"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/header"
+ android:layout_centerInParent="true"
+ android:layout_margin="@dimen/default_margin"
+ android:drawableBottom="@drawable/ic_no_media"
+ android:drawablePadding="@dimen/default_margin"
+ android:gravity="center"
+ android:maxWidth="600dp"
+ tools:targetApi="11"
+ style="?android:attr/borderlessButtonStyle"
+ android:textAppearance="@style/Result.Title"
+ android:text="@string/nomedia"
+ android:textSize="20sp"
+ android:visibility="gone" />
+
<include layout="@layout/shadow_top"
android:layout_width="match_parent"
android:layout_below="@+id/sliding_tabs"
diff --git a/vlc-android/res/layout/video_grid.xml b/vlc-android/res/layout/video_grid.xml
index 2cf5612..3ed1b67 100644
--- a/vlc-android/res/layout/video_grid.xml
+++ b/vlc-android/res/layout/video_grid.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -42,6 +43,9 @@
android:drawablePadding="@dimen/default_margin"
android:gravity="center"
android:maxWidth="600dp"
+ tools:targetApi="11"
+ style="?android:attr/borderlessButtonStyle"
+ android:textAppearance="@style/Result.Title"
android:text="@string/nomedia"
android:textSize="20sp"
android:visibility="visible" />
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 32ebe4d..13093f8 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -88,7 +88,7 @@
<string name="directories">Directories</string>
<string name="loading">Loading</string>
<string name="please_wait">Please wait…</string>
- <string name="nomedia">No media files found, please transfer some files to your device or adjust your preferences.</string>
+ <string name="nomedia">No media files found, please select directories to add to your medialibrary</string>
<string name="noplaylist">No playlist found.</string>
<string name="mediafiles">Media files</string>
<string name="notavailable">not available</string>
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index cd1ef26..6a5d895 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -75,7 +75,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Random;
-public class AudioBrowserFragment extends BaseAudioBrowser implements DevicesDiscoveryCb, SwipeRefreshLayout.OnRefreshListener, MediaBrowser.EventListener, ViewPager.OnPageChangeListener, Medialibrary.ArtistsAddedCb, Medialibrary.ArtistsModifiedCb, Medialibrary.AlbumsAddedCb, Medialibrary.AlbumsModifiedCb, MediaAddedCb, MediaUpdatedCb, TabLayout.OnTabSelectedListener, Filterable {
+public class AudioBrowserFragment extends BaseAudioBrowser implements DevicesDiscoveryCb, SwipeRefreshLayout.OnRefreshListener, MediaBrowser.EventListener, ViewPager.OnPageChangeListener, Medialibrary.ArtistsAddedCb, Medialibrary.ArtistsModifiedCb, Medialibrary.AlbumsAddedCb, Medialibrary.AlbumsModifiedCb, MediaAddedCb, MediaUpdatedCb, TabLayout.OnTabSelectedListener, Filterable, View.OnClickListener {
public final static String TAG = "VLC/AudioBrowserFragment";
private MediaBrowser mMediaBrowser;
@@ -132,6 +132,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements DevicesDis
View v = inflater.inflate(R.layout.audio_browser, container, false);
mEmptyView = (TextView) v.findViewById(R.id.no_media);
+ mEmptyView.setOnClickListener(this);
mViewPager = (ViewPager) v.findViewById(R.id.pager);
mFastScroller = (FastScroller) v.findViewById(R.id.songs_fast_scroller);
@@ -670,6 +671,15 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements DevicesDis
return mLists[mViewPager.getCurrentItem()];
}
+ @Override
+ public void onClick(View v) {
+ if (v.getId() == R.id.no_media) {
+ Intent intent = new Intent(v.getContext(), SecondaryActivity.class);
+ intent.putExtra("fragment", SecondaryActivity.STORAGE_BROWSER);
+ startActivity(intent);
+ }
+ }
+
private static class AudioBrowserHandler extends WeakHandler<AudioBrowserFragment> {
AudioBrowserHandler(AudioBrowserFragment owner) {
super(owner);
@@ -696,6 +706,8 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements DevicesDis
fragment.mSwipeRefreshLayout.setRefreshing(true);
break;
case UNSET_REFRESHING:
+ removeMessages(SET_REFRESHING);
+ removeMessages(MSG_LOADING);
fragment.mSwipeRefreshLayout.setRefreshing(false);
break;
case UPDATE_EMPTY_VIEW:
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 828e82c..095bb83 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -82,7 +82,7 @@ import org.videolan.vlc.util.VLCInstance;
import java.util.ArrayList;
import java.util.List;
-public class VideoGridFragment extends MediaBrowserFragment implements MediaUpdatedCb, ISortable, SwipeRefreshLayout.OnRefreshListener, DevicesDiscoveryCb, MediaAddedCb, Filterable, IEventsHandler {
+public class VideoGridFragment extends MediaBrowserFragment implements MediaUpdatedCb, ISortable, SwipeRefreshLayout.OnRefreshListener, DevicesDiscoveryCb, MediaAddedCb, Filterable, IEventsHandler, View.OnClickListener {
public final static String TAG = "VLC/VideoListFragment";
@@ -124,6 +124,7 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
mSearchButtonView = v.findViewById(R.id.searchButton);
mSwipeRefreshLayout.setOnRefreshListener(this);
+ mTextViewNomedia.setOnClickListener(this);
mDividerItemDecoration = new DividerItemDecoration(v.getContext(), DividerItemDecoration.VERTICAL);
if (mVideoAdapter.isListMode())
@@ -647,7 +648,17 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
@Override
public void onUpdateFinished(RecyclerView.Adapter adapter) {
+ mHandler.sendEmptyMessage(UNSET_REFRESHING);
updateEmptyView();
setFabPlayVisibility(true);
}
+
+ @Override
+ public void onClick(View v) {
+ if (v.getId() == R.id.textview_nomedia) {
+ Intent intent = new Intent(v.getContext(), SecondaryActivity.class);
+ intent.putExtra("fragment", SecondaryActivity.STORAGE_BROWSER);
+ startActivity(intent);
+ }
+ }
}
More information about the Android
mailing list