Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Keep SAF only #2011

Merged
merged 1 commit into from
Dec 27, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ public void showStorageFilePicker() {
host.startActivityForResult(intent, requestCode);
} catch (ActivityNotFoundException e) {
Timber.e(e, "No storage providers found.");

showSelectLocalFileDialog();
}
}

Expand Down Expand Up @@ -356,34 +354,6 @@ private void downloadDatabase(Uri uri, String localPath) throws Exception {
Files.move(tempDatabaseFile, localDatabaseFile);
}

/**
* Shows a file picker. The results from the picker will be sent to the host activity.
* This is a custom picker that works with local files only.
* Uses SELECT_FILE request code.
*/
private void showSelectLocalFileDialog() {
int requestCode = RequestCodes.SELECT_FILE;
AppCompatActivity host = (AppCompatActivity) _host;

//MmxDatabaseUtils dbUtils = new MmxDatabaseUtils(host);
DatabaseManager dbManager = new DatabaseManager(getContext());
String dbDirectory = dbManager.getDefaultDatabaseDirectory();
// Environment.getDefaultDatabaseDirectory().getPath()

// This works if you defined the intent filter
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");
// Set these depending on your use case. These are the defaults.

// Configure initial directory by specifying a String.
// You could specify a String like "/storage/emulated/0/", but that can
// dangerous. Always use Android's API calls to get paths to the SD-card or
// internal memory.
// Environment.getExternalStorageDirectory().getPath()

host.startActivityForResult(intent, requestCode);
}

/**
* Reads the date/time when the local database file was last changed.
* @return The date/time of the last change
Expand Down
Loading