Toast when trying to open another database

This commit is contained in:
J-Jamet
2022-03-23 18:31:20 +01:00
parent 6e42db41be
commit 8324acadc8
2 changed files with 11 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ import android.view.ViewGroup
import android.widget.Button
import android.widget.CompoundButton
import android.widget.TextView
import android.widget.Toast
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.viewModels
import androidx.annotation.RequiresApi
@@ -235,6 +236,15 @@ class MainCredentialActivity : DatabaseModeActivity(), AdvancedUnlockFragment.Bu
override fun onDatabaseRetrieved(database: Database?) {
super.onDatabaseRetrieved(database)
if (database != null) {
// Trying to load another database
if (mDatabaseFileUri != null
&& database.fileUri != null
&& mDatabaseFileUri != database.fileUri) {
Toast.makeText(this,
R.string.warning_database_already_opened,
Toast.LENGTH_LONG
).show()
}
launchGroupActivityIfLoaded(database)
}
}

View File

@@ -331,6 +331,7 @@
<string name="warning_password_encoding">Avoid password characters outside of text encoding format in database file (unrecognized chars are converted to the same letter).</string>
<string name="warning_database_read_only">Grant file write access to save database changes</string>
<string name="warning_database_link_revoked">Access to the file revoked by the file manager</string>
<string name="warning_database_already_opened">A database is already open, close it first to open the new one</string>
<string name="warning_empty_password">Continue without password unlocking protection?</string>
<string name="warning_no_encryption_key">Continue without encryption key?</string>
<string name="warning_permanently_delete_nodes">Permanently delete selected nodes?</string>