mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-29 13:26:50 +01:00
Set default name for database export file
This commit is contained in:
parent
f9ef3f47ab
commit
47a757bd91
@ -92,7 +92,7 @@ public class SettingsActivity extends AbstractSettingsActivityV2 {
|
|||||||
|
|
||||||
static final String FRAGMENT_TAG = "SETTINGS_FRAGMENT";
|
static final String FRAGMENT_TAG = "SETTINGS_FRAGMENT";
|
||||||
|
|
||||||
private static final int FILE_REQUEST_CODE = 4711;
|
private static final int EXPORT_LOCATION_FILE_REQUEST_CODE = 4711;
|
||||||
private EditText fitnessAppEditText = null;
|
private EditText fitnessAppEditText = null;
|
||||||
private int fitnessAppSelectionListSpinnerFirstRun = 0;
|
private int fitnessAppSelectionListSpinnerFirstRun = 0;
|
||||||
|
|
||||||
@ -296,9 +296,10 @@ public class SettingsActivity extends AbstractSettingsActivityV2 {
|
|||||||
Intent i = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
Intent i = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
||||||
i.setType("application/x-sqlite3");
|
i.setType("application/x-sqlite3");
|
||||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
|
i.putExtra(Intent.EXTRA_TITLE, "Gadgetbridge.db");
|
||||||
i.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
i.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||||
String title = requireContext().getApplicationContext().getString(R.string.choose_auto_export_location);
|
String title = requireContext().getApplicationContext().getString(R.string.choose_auto_export_location);
|
||||||
startActivityForResult(Intent.createChooser(i, title), FILE_REQUEST_CODE);
|
startActivityForResult(Intent.createChooser(i, title), EXPORT_LOCATION_FILE_REQUEST_CODE);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
pref.setSummary(getAutoExportLocationSummary());
|
pref.setSummary(getAutoExportLocationSummary());
|
||||||
@ -483,7 +484,7 @@ public class SettingsActivity extends AbstractSettingsActivityV2 {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||||
if (requestCode == FILE_REQUEST_CODE && intent != null) {
|
if (requestCode == EXPORT_LOCATION_FILE_REQUEST_CODE && intent != null) {
|
||||||
Uri uri = intent.getData();
|
Uri uri = intent.getData();
|
||||||
requireContext().getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
requireContext().getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||||
GBApplication.getPrefs().getPreferences()
|
GBApplication.getPrefs().getPreferences()
|
||||||
|
Loading…
Reference in New Issue
Block a user