-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for external intent to view directory
- Loading branch information
1 parent
2cce881
commit 2c14ba5
Showing
2 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,7 @@ | |
import com.amaze.filemanager.fragments.SearchWorkerFragment; | ||
import com.amaze.filemanager.fragments.TabFragment; | ||
import com.amaze.filemanager.fragments.ZipExplorerFragment; | ||
import com.amaze.filemanager.fragments.preference_fragments.PrefFrag; | ||
import com.amaze.filemanager.fragments.preference_fragments.QuickAccessPref; | ||
import com.amaze.filemanager.ui.dialogs.GeneralDialogCreation; | ||
import com.amaze.filemanager.ui.dialogs.RenameBookmark; | ||
|
@@ -276,6 +277,12 @@ public class MainActivity extends ThemedActivity implements | |
public static final String TAG_INTENT_FILTER_GENERAL = "general_communications"; | ||
public static final String ARGS_KEY_LOADER = "loader_cloud_args_service"; | ||
|
||
/** | ||
* Mime type in intent that apps need to pass when trying to open file manager from a specific directory | ||
* Should be clubbed with {@link Intent#ACTION_VIEW} and send in path to open in intent data field | ||
*/ | ||
public static final String ARGS_INTENT_ACTION_VIEW_MIME_FOLDER = "resource/folder"; | ||
|
||
private static final String CLOUD_AUTHENTICATOR_GDRIVE = "android.intent.category.BROWSABLE"; | ||
private static final String CLOUD_AUTHENTICATOR_REDIRECT_URI = "com.amaze.filemanager:/oauth2redirect"; | ||
|
||
|
@@ -373,8 +380,25 @@ public void onSearch(String queue) { | |
|
||
// zip viewer intent | ||
Uri uri = intent.getData(); | ||
openzip = true; | ||
zippath = uri.toString(); | ||
String type = intent.getType(); | ||
|
||
if (type != null && type.equals(ARGS_INTENT_ACTION_VIEW_MIME_FOLDER)) { | ||
// support for syncting or intents from external apps that | ||
// need to start file manager from a specific path | ||
|
||
if (uri != null) { | ||
|
||
path = uri.getPath(); | ||
This comment has been minimized.
Sorry, something went wrong.
friedger
|
||
} else { | ||
// no data field, open home for the tab in later processing | ||
path = null; | ||
} | ||
} else { | ||
// we don't have folder resource mime type set, supposed to be zip/rar | ||
openzip = true; | ||
zippath = uri.toString(); | ||
} | ||
|
||
} else if (actionIntent.equals(Intent.ACTION_SEND) && typeIntent != null) { | ||
// save a single file to filesystem | ||
|
||
|
1 comment
on commit 2c14ba5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this mime type come from?
Wouldn't it be better to use DocumentContracts.Document.MIME_TYPE_DIR?