diff --git a/app_pojavlauncher/build.gradle b/app_pojavlauncher/build.gradle index 2a57c86c9..e630c37cd 100644 --- a/app_pojavlauncher/build.gradle +++ b/app_pojavlauncher/build.gradle @@ -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 diff --git a/app_pojavlauncher/src/main/AndroidManifest.xml b/app_pojavlauncher/src/main/AndroidManifest.xml index fd45ac3c1..6f2af0f20 100644 --- a/app_pojavlauncher/src/main/AndroidManifest.xml +++ b/app_pojavlauncher/src/main/AndroidManifest.xml @@ -96,22 +96,6 @@ - - - - - - - - diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/CustomControlsActivity.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/CustomControlsActivity.java index 43c29ab7f..c3db618ef 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/CustomControlsActivity.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/CustomControlsActivity.java @@ -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();