aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java44
1 files changed, 30 insertions, 14 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
index 8c34efba2..5f1189deb 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
@@ -169,6 +169,22 @@ public class KeyListFragment extends LoaderFragment
mStickyList.setDrawingListUnderStickyHeader(false);
mStickyList.setFastScrollEnabled(true);
+ // Adds an empty footer view so that the Floating Action Button won't block content
+ // in last few rows.
+ View footer = new View(getActivity());
+
+ int spacing = (int) android.util.TypedValue.applyDimension(
+ android.util.TypedValue.COMPLEX_UNIT_DIP, 72, getResources().getDisplayMetrics()
+ );
+
+ android.widget.AbsListView.LayoutParams params = new android.widget.AbsListView.LayoutParams(
+ android.widget.AbsListView.LayoutParams.MATCH_PARENT,
+ spacing
+ );
+
+ footer.setLayoutParams(params);
+ mStickyList.addFooterView(footer, null, false);
+
/*
* Multi-selection
*/
@@ -369,13 +385,13 @@ public class KeyListFragment extends LoaderFragment
/**
* Show dialog to delete key
*
- * @param hasSecret must contain whether the list of masterKeyIds contains a secret key or not
+ * @param hasSecret must contain whether the list of masterKeyIds contains a secret key or not
*/
public void showDeleteKeyDialog(final ActionMode mode, long[] masterKeyIds, boolean hasSecret) {
// Can only work on singular secret keys
if (hasSecret && masterKeyIds.length > 1) {
- Notify.showNotify(getActivity(), R.string.secret_cannot_multiple,
- Notify.Style.ERROR);
+ Notify.create(getActivity(), R.string.secret_cannot_multiple,
+ Notify.Style.ERROR).show();
return;
}
@@ -468,28 +484,29 @@ public class KeyListFragment extends LoaderFragment
case R.id.menu_key_list_debug_read:
try {
KeychainDatabase.debugBackup(getActivity(), true);
- Notify.showNotify(getActivity(), "Restored debug_backup.db", Notify.Style.INFO);
+ Notify.create(getActivity(), "Restored debug_backup.db", Notify.Style.OK).show();
getActivity().getContentResolver().notifyChange(KeychainContract.KeyRings.CONTENT_URI, null);
} catch (IOException e) {
Log.e(Constants.TAG, "IO Error", e);
- Notify.showNotify(getActivity(), "IO Error " + e.getMessage(), Notify.Style.ERROR);
+ Notify.create(getActivity(), "IO Error " + e.getMessage(), Notify.Style.ERROR).show();
}
return true;
case R.id.menu_key_list_debug_write:
try {
KeychainDatabase.debugBackup(getActivity(), false);
- Notify.showNotify(getActivity(), "Backup to debug_backup.db completed", Notify.Style.INFO);
+ Notify.create(getActivity(), "Backup to debug_backup.db completed", Notify.Style.OK).show();
} catch (IOException e) {
Log.e(Constants.TAG, "IO Error", e);
- Notify.showNotify(getActivity(), "IO Error: " + e.getMessage(), Notify.Style.ERROR);
+ Notify.create(getActivity(), "IO Error: " + e.getMessage(), Notify.Style.ERROR).show();
}
return true;
case R.id.menu_key_list_debug_first_time:
Preferences prefs = Preferences.getPreferences(getActivity());
prefs.setFirstTime(true);
- Intent intent = new Intent(getActivity(), FirstTimeActivity.class);
+ Intent intent = new Intent(getActivity(), CreateKeyActivity.class);
+ intent.putExtra(CreateKeyActivity.EXTRA_FIRST_TIME, true);
startActivity(intent);
getActivity().finish();
return true;
@@ -688,14 +705,14 @@ public class KeyListFragment extends LoaderFragment
{ // set name and stuff, common to both key types
String userId = cursor.getString(INDEX_USER_ID);
- String[] userIdSplit = KeyRing.splitUserId(userId);
- if (userIdSplit[0] != null) {
- h.mMainUserId.setText(highlighter.highlight(userIdSplit[0]));
+ KeyRing.UserId userIdSplit = KeyRing.splitUserId(userId);
+ if (userIdSplit.name != null) {
+ h.mMainUserId.setText(highlighter.highlight(userIdSplit.name));
} else {
h.mMainUserId.setText(R.string.user_id_no_name);
}
- if (userIdSplit[1] != null) {
- h.mMainUserIdRest.setText(highlighter.highlight(userIdSplit[1]));
+ if (userIdSplit.email != null) {
+ h.mMainUserIdRest.setText(highlighter.highlight(userIdSplit.email));
h.mMainUserIdRest.setVisibility(View.VISIBLE);
} else {
h.mMainUserIdRest.setVisibility(View.GONE);
@@ -908,5 +925,4 @@ public class KeyListFragment extends LoaderFragment
}
-
}