mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-06-05 22:09:15 +02:00
return the result of SelectFolderDialog as uri data
This commit is contained in:
@ -60,7 +60,6 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
|||||||
@BindView(R.id.items_holder) CoordinatorLayout mCoordinatorLayout;
|
@BindView(R.id.items_holder) CoordinatorLayout mCoordinatorLayout;
|
||||||
|
|
||||||
public static final int SELECT_FOLDER_REQUEST = 1;
|
public static final int SELECT_FOLDER_REQUEST = 1;
|
||||||
public static final String SELECT_FOLDER_PATH = "path";
|
|
||||||
|
|
||||||
private List<FileDirItem> mItems;
|
private List<FileDirItem> mItems;
|
||||||
private ItemInteractionListener mListener;
|
private ItemInteractionListener mListener;
|
||||||
@ -562,7 +561,7 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
|||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if (requestCode == SELECT_FOLDER_REQUEST && resultCode == Activity.RESULT_OK && data != null) {
|
if (requestCode == SELECT_FOLDER_REQUEST && resultCode == Activity.RESULT_OK && data != null) {
|
||||||
mCopyDestinationPath = data.getStringExtra(SELECT_FOLDER_PATH);
|
mCopyDestinationPath = data.getDataString();
|
||||||
mDestinationView.setText(mCopyDestinationPath);
|
mDestinationView.setText(mCopyDestinationPath);
|
||||||
}
|
}
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
@ -3,6 +3,7 @@ package com.simplemobiletools.filepicker.dialogs
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.support.v4.app.DialogFragment
|
import android.support.v4.app.DialogFragment
|
||||||
import android.support.v7.app.AlertDialog
|
import android.support.v7.app.AlertDialog
|
||||||
@ -24,7 +25,6 @@ class SelectFolderDialog : DialogFragment(), Breadcrumbs.BreadcrumbsListener {
|
|||||||
var mFirstUpdate: Boolean = true
|
var mFirstUpdate: Boolean = true
|
||||||
var mShowHidden: Boolean = false
|
var mShowHidden: Boolean = false
|
||||||
var mShowFullPath: Boolean = false
|
var mShowFullPath: Boolean = false
|
||||||
val SELECT_FOLDER_PATH = "path"
|
|
||||||
|
|
||||||
fun newInstance(path: String, showHidden: Boolean, showFullPath: Boolean): SelectFolderDialog {
|
fun newInstance(path: String, showHidden: Boolean, showFullPath: Boolean): SelectFolderDialog {
|
||||||
mPath = path
|
mPath = path
|
||||||
@ -78,7 +78,7 @@ class SelectFolderDialog : DialogFragment(), Breadcrumbs.BreadcrumbsListener {
|
|||||||
|
|
||||||
private fun sendResult() {
|
private fun sendResult() {
|
||||||
val intent = Intent()
|
val intent = Intent()
|
||||||
intent.putExtra(SELECT_FOLDER_PATH, mPath)
|
intent.data = Uri.parse(mPath)
|
||||||
targetFragment.onActivityResult(requestCode, Activity.RESULT_OK, intent)
|
targetFragment.onActivityResult(requestCode, Activity.RESULT_OK, intent)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user