Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adding support to customize the authority value on FileProvider #17

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions filebrowser/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@
<activity android:name=".utils.Permissions" android:theme="@style/Theme.AppCompat.Translucent" />
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.aditya.filebrowser.provider"
android:authorities="@string/aditya_filebrowser_provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
@@ -41,4 +41,4 @@
</provider>
</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -216,7 +216,7 @@ public void onItemClick(View view, int position) {
MimeTypeMap mimeMap = MimeTypeMap.getSingleton();
Intent openFileIntent = new Intent(Intent.ACTION_VIEW);
String mimeType = mimeMap.getMimeTypeFromExtension(FilenameUtils.getExtension(f.getName()));
Uri uri = FileProvider.getUriForFile(mContext,"com.aditya.filebrowser.provider", f);
Uri uri = FileProvider.getUriForFile(mContext, mContext.getString(R.string.aditya_filebrowser_provider), f);
openFileIntent.setDataAndType(uri,mimeType);
openFileIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
openFileIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
1 change: 1 addition & 0 deletions filebrowser/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<resources>
<string name="app_name">File Browser</string>
<string name="aditya_filebrowser_provider">com.aditya.filebrowser.provider</string>
<string name="cut">Cut</string>
<string name="refresh">Refresh</string>
<string name="paste">Paste</string>