Minor code style changes

This commit is contained in:
Dominik Schürmann
2016-12-06 10:30:30 +01:00
parent 891ce29785
commit a1c0ef48d2

View File

@@ -197,7 +197,7 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
/** /**
* Load custom layout with StickyListView from library * Load custom layout
*/ */
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -319,11 +319,7 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
} }
// The list should now be shown. // The list should now be shown.
if (isResumed()) { showList(isResumed());
showList(true);
} else {
showList(false);
}
} }
@Override @Override
@@ -380,16 +376,15 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.menu_key_list_create: {
case R.id.menu_key_list_create:
createKey(); createKey();
return true; return true;
}
case R.id.menu_key_list_update_all_keys: case R.id.menu_key_list_update_all_keys: {
updateAllKeys(); updateAllKeys();
return true; return true;
}
case R.id.menu_key_list_debug_read: case R.id.menu_key_list_debug_read: {
try { try {
KeychainDatabase.debugBackup(getActivity(), true); KeychainDatabase.debugBackup(getActivity(), true);
Notify.create(getActivity(), "Restored debug_backup.db", Notify.Style.OK).show(); Notify.create(getActivity(), "Restored debug_backup.db", Notify.Style.OK).show();
@@ -399,8 +394,8 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
Notify.create(getActivity(), "IO Error " + e.getMessage(), Notify.Style.ERROR).show(); Notify.create(getActivity(), "IO Error " + e.getMessage(), Notify.Style.ERROR).show();
} }
return true; return true;
}
case R.id.menu_key_list_debug_write: case R.id.menu_key_list_debug_write: {
try { try {
KeychainDatabase.debugBackup(getActivity(), false); KeychainDatabase.debugBackup(getActivity(), false);
Notify.create(getActivity(), "Backup to debug_backup.db completed", Notify.Style.OK).show(); Notify.create(getActivity(), "Backup to debug_backup.db completed", Notify.Style.OK).show();
@@ -409,8 +404,8 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
Notify.create(getActivity(), "IO Error: " + e.getMessage(), Notify.Style.ERROR).show(); Notify.create(getActivity(), "IO Error: " + e.getMessage(), Notify.Style.ERROR).show();
} }
return true; return true;
}
case R.id.menu_key_list_debug_first_time: case R.id.menu_key_list_debug_first_time: {
Preferences prefs = Preferences.getPreferences(getActivity()); Preferences prefs = Preferences.getPreferences(getActivity());
prefs.setFirstTime(true); prefs.setFirstTime(true);
Intent intent = new Intent(getActivity(), CreateKeyActivity.class); Intent intent = new Intent(getActivity(), CreateKeyActivity.class);
@@ -418,17 +413,18 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
startActivity(intent); startActivity(intent);
getActivity().finish(); getActivity().finish();
return true; return true;
}
case R.id.menu_key_list_debug_cons: case R.id.menu_key_list_debug_cons: {
consolidate(); consolidate();
return true; return true;
}
case R.id.menu_key_list_debug_bench: case R.id.menu_key_list_debug_bench: {
benchmark(); benchmark();
return true; return true;
}
default: default: {
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
}
} }
} }