use the new FilePicker for selecting the folder
This commit is contained in:
parent
7eeda1a2af
commit
d3666b13e7
|
@ -39,7 +39,7 @@ dependencies {
|
||||||
compile 'com.android.support:design:23.4.0'
|
compile 'com.android.support:design:23.4.0'
|
||||||
compile 'com.jakewharton:butterknife:8.0.1'
|
compile 'com.jakewharton:butterknife:8.0.1'
|
||||||
compile 'com.github.bumptech.glide:glide:3.7.0'
|
compile 'com.github.bumptech.glide:glide:3.7.0'
|
||||||
compile 'com.simplemobiletools:filepicker:1.0.0'
|
compile 'com.simplemobiletools:filepicker:1.0.0@aar'
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
|
|
||||||
apt 'com.jakewharton:butterknife-compiler:8.0.1'
|
apt 'com.jakewharton:butterknife-compiler:8.0.1'
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.simplemobiletools.filemanager.fragments;
|
package com.simplemobiletools.filemanager.fragments;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -39,6 +38,8 @@ import com.simplemobiletools.filemanager.Utils;
|
||||||
import com.simplemobiletools.filemanager.adapters.ItemsAdapter;
|
import com.simplemobiletools.filemanager.adapters.ItemsAdapter;
|
||||||
import com.simplemobiletools.filemanager.asynctasks.CopyTask;
|
import com.simplemobiletools.filemanager.asynctasks.CopyTask;
|
||||||
import com.simplemobiletools.filemanager.dialogs.PropertiesDialog;
|
import com.simplemobiletools.filemanager.dialogs.PropertiesDialog;
|
||||||
|
import com.simplemobiletools.filepicker.dialogs.PickFolderDialog;
|
||||||
|
import com.simplemobiletools.filepicker.models.FileDirItem;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileFilter;
|
import java.io.FileFilter;
|
||||||
|
@ -60,7 +61,6 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
||||||
@BindView(R.id.items_swipe_refresh) SwipeRefreshLayout mSwipeRefreshLayout;
|
@BindView(R.id.items_swipe_refresh) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
@BindView(R.id.items_holder) CoordinatorLayout mCoordinatorLayout;
|
@BindView(R.id.items_holder) CoordinatorLayout mCoordinatorLayout;
|
||||||
|
|
||||||
public static final int SELECT_FOLDER_REQUEST = 1;
|
|
||||||
private static Map<String, Parcelable> mStates;
|
private static Map<String, Parcelable> mStates;
|
||||||
|
|
||||||
private List<FileDirItem> mItems;
|
private List<FileDirItem> mItems;
|
||||||
|
@ -579,21 +579,21 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
||||||
public void onClick(final View view) {
|
public void onClick(final View view) {
|
||||||
final boolean showHiddenItems = mConfig.getShowHidden();
|
final boolean showHiddenItems = mConfig.getShowHidden();
|
||||||
final boolean showFullPath = mConfig.getShowFullPath();
|
final boolean showFullPath = mConfig.getShowFullPath();
|
||||||
/*PickFolderDialog dialog = PickFolderDialog.Companion.newInstance(mCopyDestinationPath, showHiddenItems, showFullPath);
|
new PickFolderDialog(getContext(), mCopyDestinationPath, showHiddenItems, showFullPath, new PickFolderDialog.OnPickFolderListener() {
|
||||||
dialog.setTargetFragment(ItemsFragment.this, SELECT_FOLDER_REQUEST);
|
@Override
|
||||||
dialog.show(getFragmentManager(), "selectFolder");*/
|
public void onFail(PickFolderDialog.PickFolderResult pickFolderResult) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String path) {
|
||||||
|
mCopyDestinationPath = path;
|
||||||
|
mDestinationView.setText(path);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
if (requestCode == SELECT_FOLDER_REQUEST && resultCode == Activity.RESULT_OK && data != null) {
|
|
||||||
mCopyDestinationPath = data.getDataString();
|
|
||||||
mDestinationView.setText(mCopyDestinationPath);
|
|
||||||
}
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
if (mSnackbar != null && mSnackbar.isShown()) {
|
if (mSnackbar != null && mSnackbar.isShown()) {
|
||||||
|
|
Loading…
Reference in New Issue