Commit 41e6ece3 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

FAB button to add a custom directory

parent 794bc610
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.videolan.vlc.widget.SwipeRefreshLayout
......@@ -24,4 +24,14 @@
</org.videolan.vlc.widget.SwipeRefreshLayout>
<include layout="@layout/shadow_top"/>
</FrameLayout>
<ImageView
android:id="@+id/fab_add_custom_dir"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_fab_shuffle"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:visibility="gone"
android:layout_margin="16dp"/>
</RelativeLayout>
......@@ -27,19 +27,22 @@ import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import org.videolan.libvlc.Media;
import org.videolan.vlc.MediaWrapper;
import org.videolan.vlc.R;
import org.videolan.vlc.util.AndroidDevices;
import java.util.ArrayList;
public class StorageBrowserFragment extends FileBrowserFragment {
public class StorageBrowserFragment extends FileBrowserFragment implements View.OnClickListener {
public static final String KEY_IN_MEDIALIB = "key_in_medialib";
boolean mScannedDirectory = false;
ImageView mAddDirectoryFAB;
public StorageBrowserFragment(){
mHandler = new BrowserFragmentHandler(this);
......@@ -62,6 +65,17 @@ public class StorageBrowserFragment extends FileBrowserFragment {
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = super.onCreateView(inflater, container, savedInstanceState);
if (mRoot) {
mAddDirectoryFAB = (ImageView) v.findViewById(R.id.fab_add_custom_dir);
mAddDirectoryFAB.setVisibility(View.VISIBLE);
mAddDirectoryFAB.setOnClickListener(this);
}
return v;
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
......@@ -119,4 +133,16 @@ public class StorageBrowserFragment extends FileBrowserFragment {
ft.addToBackStack(mMrl);
ft.commit();
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.fab_add_custom_dir){
showAddDirectoryDialog();
}
}
@Override
protected String getCategoryTitle() {
return getString(R.string.directories_summary);
}
}
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