Commit dbad9dc7 authored by Geoffrey Métais's avatar Geoffrey Métais

No media view is now a button to setup directories

parent 03055d62
<?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"
......
<?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" />
......
......@@ -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>
......
......@@ -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:
......
......@@ -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);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment