Skip to content

Commit

Permalink
Remove import warning
Browse files Browse the repository at this point in the history
  • Loading branch information
zHd4 committed Dec 9, 2024
1 parent 8bb6ac2 commit 97071b3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 46 deletions.
41 changes: 16 additions & 25 deletions app/src/main/java/app/notesr/activity/data/ImportActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import app.notesr.App;
import app.notesr.R;
Expand Down Expand Up @@ -148,37 +147,29 @@ private ActivityResultCallback<ActivityResult> selectFileCallback() {

private View.OnClickListener startButtonOnClick() {
return view -> {
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AlertDialogTheme)
.setView(R.layout.dialog_import_warning)
.setTitle(R.string.warning)
.setNegativeButton(R.string.cancel, (dialog, result) -> {})
.setPositiveButton(R.string.continue_text, (dialog, result) -> {
if (selectedFileUri == null) {
RuntimeException e = new NullPointerException("File Uri is null");
if (selectedFileUri == null) {
RuntimeException e = new NullPointerException("File Uri is null");

Log.e(TAG, "NullPointerException", e);
throw e;
}

view.setEnabled(false);
view.setVisibility(View.INVISIBLE);
Log.e(TAG, "NullPointerException", e);
throw e;
}

actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setTitle(getString(R.string.importing));
view.setEnabled(false);
view.setVisibility(View.INVISIBLE);

selectFileButton.setEnabled(false);
selectFileButton.setVisibility(View.INVISIBLE);
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setTitle(getString(R.string.importing));

selectedFileTextView.setVisibility(View.INVISIBLE);
selectFileButton.setEnabled(false);
selectFileButton.setVisibility(View.INVISIBLE);

disableBackButton();
startImport();
selectedFileTextView.setVisibility(View.INVISIBLE);

progressBar.setVisibility(View.VISIBLE);
statusTextView.setVisibility(View.VISIBLE);
});
disableBackButton();
startImport();

builder.create().show();
progressBar.setVisibility(View.VISIBLE);
statusTextView.setVisibility(View.VISIBLE);
};
}

Expand Down
20 changes: 0 additions & 20 deletions app/src/main/res/layout/dialog_import_warning.xml

This file was deleted.

1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,5 @@
<string name="select_file">Select file</string>
<string name="start">Start</string>
<string name="cannot_import_data">Cannot import data, possible corrupted</string>
<string name="import_warning">All your data will be OVERWRITTEN, you can LOSE your critical data if you don`t have backup.\nAre you sure?</string>
<string name="continue_text">Continue</string>
</resources>

0 comments on commit 97071b3

Please sign in to comment.