mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-12 14:16:58 -04:00
Use DocumentProvider instead of FileProvider
This commit is contained in:
parent
6896e7f737
commit
eb0f834fcc
@ -94,7 +94,6 @@ android {
|
||||
// multiDexEnabled = true
|
||||
// debuggable = true
|
||||
resValue 'string', 'storageProviderAuthorities', 'net.kdt.pojavlaunch.scoped.gamefolder'
|
||||
resValue 'string', 'shareProviderAuthority', 'net.kdt.pojavlaunch.scoped.controlfolder'
|
||||
}
|
||||
gplay {
|
||||
initWith release
|
||||
|
@ -96,22 +96,6 @@
|
||||
</intent-filter>
|
||||
</provider>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="@string/shareProviderAuthority"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true"
|
||||
android:permission="android.permission.MANAGE_DOCUMENTS">
|
||||
<intent-filter>
|
||||
<action android:name="android.content.action.DOCUMENTS_PROVIDER" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider"
|
||||
/>
|
||||
|
||||
</provider>
|
||||
|
||||
<service android:name=".services.ProgressService"/>
|
||||
<service android:name=".services.GameService" android:process=":game"/>
|
||||
|
||||
|
@ -9,6 +9,7 @@ import android.os.*;
|
||||
|
||||
import androidx.appcompat.app.*;
|
||||
|
||||
import android.provider.DocumentsContract;
|
||||
import android.view.View;
|
||||
import android.widget.*;
|
||||
|
||||
@ -54,19 +55,21 @@ public class CustomControlsActivity extends BaseActivity {
|
||||
case 3: save(false, mControlLayout); break;
|
||||
case 4: dialogSelectDefaultCtrl(mControlLayout); break;
|
||||
case 5: // Saving the currently shown control
|
||||
mControlLayout.save(Tools.DIR_DATA + "/files/" + sSelectedName + ".json");
|
||||
try {
|
||||
Uri contentUri = DocumentsContract.buildDocumentUri(getString(R.string.storageProviderAuthorities), doSaveCtrl(sSelectedName, mControlLayout));
|
||||
|
||||
Uri contentUri = getUriForFile(getBaseContext(), getString(R.string.shareProviderAuthority), new File(Tools.DIR_DATA, "/files/" + sSelectedName + ".json"));
|
||||
Intent shareIntent = new Intent();
|
||||
shareIntent.setAction(Intent.ACTION_SEND);
|
||||
shareIntent.putExtra(Intent.EXTRA_STREAM, contentUri);
|
||||
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
shareIntent.setType("application/json");
|
||||
startActivity(shareIntent);
|
||||
|
||||
Intent shareIntent = new Intent();
|
||||
shareIntent.setAction(Intent.ACTION_SEND);
|
||||
shareIntent.putExtra(Intent.EXTRA_STREAM, contentUri);
|
||||
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
shareIntent.setType("application/json");
|
||||
startActivity(shareIntent);
|
||||
|
||||
Intent sendIntent = Intent.createChooser(shareIntent, sSelectedName);
|
||||
startActivity(sendIntent);
|
||||
Intent sendIntent = Intent.createChooser(shareIntent, sSelectedName);
|
||||
startActivity(sendIntent);
|
||||
}catch (Exception e) {
|
||||
Tools.showError(this, e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
mDrawerLayout.closeDrawers();
|
||||
|
Loading…
x
Reference in New Issue
Block a user