mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-31 06:15:48 +00:00
PasswordStore: Clear some lint warnings and deprecated API
Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
@@ -175,7 +175,7 @@ public class PasswordStore extends AppCompatActivity {
|
|||||||
// Inflate the menu; this adds items to the action bar if it is present.
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
getMenuInflater().inflate(R.menu.main_menu, menu);
|
getMenuInflater().inflate(R.menu.main_menu, menu);
|
||||||
searchItem = menu.findItem(R.id.action_search);
|
searchItem = menu.findItem(R.id.action_search);
|
||||||
searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
|
searchView = (SearchView) searchItem.getActionView();
|
||||||
|
|
||||||
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -304,16 +304,21 @@ public class PasswordStore extends AppCompatActivity {
|
|||||||
PasswordRepository.initialize(this);
|
PasswordRepository.initialize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
File localDir = PasswordRepository.getRepositoryDirectory(getApplicationContext());
|
final File localDir = PasswordRepository.getRepositoryDirectory(getApplicationContext());
|
||||||
|
|
||||||
localDir.mkdir();
|
|
||||||
try {
|
try {
|
||||||
|
if (!localDir.mkdir())
|
||||||
|
throw new IllegalStateException("Failed to create directory!");
|
||||||
PasswordRepository.createRepository(localDir);
|
PasswordRepository.createRepository(localDir);
|
||||||
new File(localDir.getAbsolutePath() + "/.gpg-id").createNewFile();
|
if (new File(localDir.getAbsolutePath() + "/.gpg-id").createNewFile()) {
|
||||||
settings.edit().putBoolean("repository_initialized", true).apply();
|
settings.edit().putBoolean("repository_initialized", true).apply();
|
||||||
|
} else {
|
||||||
|
throw new IllegalStateException("Failed to initialize repository state.");
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
localDir.delete();
|
if (!localDir.delete()) {
|
||||||
|
Log.d(TAG, "Failed to delete local repository");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
checkLocalRepository();
|
checkLocalRepository();
|
||||||
|
Reference in New Issue
Block a user