PasswordStore: Resolve some IDE warnings

Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
Harsh Shandilya 2019-04-25 09:18:31 +05:30
parent 655b3a11f4
commit 00e2cf352f
No known key found for this signature in database
GPG key ID: C2E74282C2133D62

View file

@ -160,23 +160,16 @@ public class PasswordStore extends AppCompatActivity {
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) { // If request is cancelled, the result arrays are empty.
case REQUEST_EXTERNAL_STORAGE: { if (requestCode == REQUEST_EXTERNAL_STORAGE) {
// If request is cancelled, the result arrays are empty. if (grantResults.length > 0
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) { checkLocalRepository();
checkLocalRepository();
}
} }
} }
} }
@Override
public void onPause() {
super.onPause();
}
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
// 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.
@ -199,7 +192,7 @@ public class PasswordStore extends AppCompatActivity {
// When using the support library, the setOnActionExpandListener() method is // When using the support library, the setOnActionExpandListener() method is
// static and accepts the MenuItem object as an argument // static and accepts the MenuItem object as an argument
MenuItemCompat.setOnActionExpandListener(searchItem, new MenuItemCompat.OnActionExpandListener() { searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
@Override @Override
public boolean onMenuItemActionCollapse(MenuItem item) { public boolean onMenuItemActionCollapse(MenuItem item) {
refreshListAdapter(); refreshListAdapter();
@ -341,7 +334,7 @@ public class PasswordStore extends AppCompatActivity {
} }
} }
final Set<String> keyIds = settings.getStringSet("openpgp_key_ids_set", new HashSet<String>()); final Set<String> keyIds = settings.getStringSet("openpgp_key_ids_set", new HashSet<>());
if (keyIds.isEmpty()) if (keyIds.isEmpty())
new AlertDialog.Builder(this) new AlertDialog.Builder(this)
@ -602,7 +595,7 @@ public class PasswordStore extends AppCompatActivity {
@Override @Override
public void execute() { public void execute() {
Log.d(TAG, "Committing with message " + message); Log.d(TAG, "Committing with message " + message);
Git git = new Git(this.repository); Git git = new Git(repository);
GitAsyncTask tasks = new GitAsyncTask(activity, false, true, this); GitAsyncTask tasks = new GitAsyncTask(activity, false, true, this);
tasks.execute( tasks.execute(
git.add().addFilepattern("."), git.add().addFilepattern("."),