Edit identities design
This commit is contained in:
@@ -56,7 +56,6 @@ import org.sufficientlysecure.keychain.ui.base.QueueingCryptoOperationFragment;
|
|||||||
import org.sufficientlysecure.keychain.ui.dialog.AddUserIdDialogFragment;
|
import org.sufficientlysecure.keychain.ui.dialog.AddUserIdDialogFragment;
|
||||||
import org.sufficientlysecure.keychain.ui.dialog.EditUserIdDialogFragment;
|
import org.sufficientlysecure.keychain.ui.dialog.EditUserIdDialogFragment;
|
||||||
import org.sufficientlysecure.keychain.ui.dialog.SetPassphraseDialogFragment;
|
import org.sufficientlysecure.keychain.ui.dialog.SetPassphraseDialogFragment;
|
||||||
import org.sufficientlysecure.keychain.ui.util.Notify;
|
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -99,9 +98,9 @@ public class EditIdentitiesFragment extends QueueingCryptoOperationFragment<Save
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup superContainer, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup superContainer, Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.edit_identities_fragment, null);
|
View view = inflater.inflate(R.layout.edit_identities_fragment, null);
|
||||||
|
|
||||||
mUserIdsList = (ListView) view.findViewById(R.id.edit_key_user_ids);
|
mUserIdsList = (ListView) view.findViewById(R.id.edit_identities_user_ids);
|
||||||
mUserIdsAddedList = (ListView) view.findViewById(R.id.edit_key_user_ids_added);
|
mUserIdsAddedList = (ListView) view.findViewById(R.id.edit_identities_user_ids_added);
|
||||||
mAddUserId = view.findViewById(R.id.edit_key_action_add_user_id);
|
mAddUserId = view.findViewById(R.id.edit_identities_add_user_id);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
@@ -114,12 +113,7 @@ public class EditIdentitiesFragment extends QueueingCryptoOperationFragment<Save
|
|||||||
new OnClickListener() {
|
new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
// if we are working on an Uri, save directly
|
cryptoOperation(new CryptoInputParcel(new Date()));
|
||||||
if (mDataUri == null) {
|
|
||||||
returnKeyringParcel();
|
|
||||||
} else {
|
|
||||||
cryptoOperation(new CryptoInputParcel(new Date()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, new OnClickListener() {
|
}, new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -302,27 +296,11 @@ public class EditIdentitiesFragment extends QueueingCryptoOperationFragment<Save
|
|||||||
// pre-fill out primary name
|
// pre-fill out primary name
|
||||||
String predefinedName = KeyRing.splitUserId(mPrimaryUserId).name;
|
String predefinedName = KeyRing.splitUserId(mPrimaryUserId).name;
|
||||||
AddUserIdDialogFragment addUserIdDialog = AddUserIdDialogFragment.newInstance(messenger,
|
AddUserIdDialogFragment addUserIdDialog = AddUserIdDialogFragment.newInstance(messenger,
|
||||||
predefinedName);
|
predefinedName, false);
|
||||||
|
|
||||||
addUserIdDialog.show(getActivity().getSupportFragmentManager(), "addUserIdDialog");
|
addUserIdDialog.show(getActivity().getSupportFragmentManager(), "addUserIdDialog");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void returnKeyringParcel() {
|
|
||||||
if (mSaveKeyringParcel.mAddUserIds.size() == 0) {
|
|
||||||
Notify.create(getActivity(), R.string.edit_key_error_add_identity, Notify.Style.ERROR).show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// use first user id as primary
|
|
||||||
mSaveKeyringParcel.mChangePrimaryUserId = mSaveKeyringParcel.mAddUserIds.get(0);
|
|
||||||
|
|
||||||
Intent returnIntent = new Intent();
|
|
||||||
returnIntent.putExtra(EditKeyActivity.EXTRA_SAVE_KEYRING_PARCEL, mSaveKeyringParcel);
|
|
||||||
getActivity().setResult(Activity.RESULT_OK, returnIntent);
|
|
||||||
getActivity().finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes this activity, returning a result parcel with a single error log entry.
|
* Closes this activity, returning a result parcel with a single error log entry.
|
||||||
*/
|
*/
|
||||||
@@ -333,7 +311,7 @@ public class EditIdentitiesFragment extends QueueingCryptoOperationFragment<Save
|
|||||||
new SingletonResult(SingletonResult.RESULT_ERROR, reason));
|
new SingletonResult(SingletonResult.RESULT_ERROR, reason));
|
||||||
|
|
||||||
// Finish with result
|
// Finish with result
|
||||||
getActivity().setResult(EditKeyActivity.RESULT_OK, intent);
|
getActivity().setResult(Activity.RESULT_OK, intent);
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,7 +329,7 @@ public class EditIdentitiesFragment extends QueueingCryptoOperationFragment<Save
|
|||||||
// if good -> finish, return result to showkey and display there!
|
// if good -> finish, return result to showkey and display there!
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(OperationResult.EXTRA_RESULT, result);
|
intent.putExtra(OperationResult.EXTRA_RESULT, result);
|
||||||
activity.setResult(EditKeyActivity.RESULT_OK, intent);
|
activity.setResult(Activity.RESULT_OK, intent);
|
||||||
activity.finish();
|
activity.finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -556,7 +556,7 @@ public class EditKeyFragment extends QueueingCryptoOperationFragment<SaveKeyring
|
|||||||
// pre-fill out primary name
|
// pre-fill out primary name
|
||||||
String predefinedName = KeyRing.splitUserId(mPrimaryUserId).name;
|
String predefinedName = KeyRing.splitUserId(mPrimaryUserId).name;
|
||||||
AddUserIdDialogFragment addUserIdDialog = AddUserIdDialogFragment.newInstance(messenger,
|
AddUserIdDialogFragment addUserIdDialog = AddUserIdDialogFragment.newInstance(messenger,
|
||||||
predefinedName);
|
predefinedName, true);
|
||||||
|
|
||||||
addUserIdDialog.show(getActivity().getSupportFragmentManager(), "addUserIdDialog");
|
addUserIdDialog.show(getActivity().getSupportFragmentManager(), "addUserIdDialog");
|
||||||
}
|
}
|
||||||
@@ -612,7 +612,7 @@ public class EditKeyFragment extends QueueingCryptoOperationFragment<SaveKeyring
|
|||||||
new SingletonResult(SingletonResult.RESULT_ERROR, reason));
|
new SingletonResult(SingletonResult.RESULT_ERROR, reason));
|
||||||
|
|
||||||
// Finish with result
|
// Finish with result
|
||||||
getActivity().setResult(EditKeyActivity.RESULT_OK, intent);
|
getActivity().setResult(Activity.RESULT_OK, intent);
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -630,7 +630,7 @@ public class EditKeyFragment extends QueueingCryptoOperationFragment<SaveKeyring
|
|||||||
// if good -> finish, return result to showkey and display there!
|
// if good -> finish, return result to showkey and display there!
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(OperationResult.EXTRA_RESULT, result);
|
intent.putExtra(OperationResult.EXTRA_RESULT, result);
|
||||||
activity.setResult(EditKeyActivity.RESULT_OK, intent);
|
activity.setResult(Activity.RESULT_OK, intent);
|
||||||
activity.finish();
|
activity.finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,7 +210,8 @@ public class ViewKeyAdvUserIdsFragment extends LoaderFragment implements
|
|||||||
Messenger messenger = new Messenger(returnHandler);
|
Messenger messenger = new Messenger(returnHandler);
|
||||||
|
|
||||||
// pre-fill out primary name
|
// pre-fill out primary name
|
||||||
AddUserIdDialogFragment addUserIdDialog = AddUserIdDialogFragment.newInstance(messenger, "");
|
AddUserIdDialogFragment addUserIdDialog =
|
||||||
|
AddUserIdDialogFragment.newInstance(messenger, "", true);
|
||||||
|
|
||||||
addUserIdDialog.show(getActivity().getSupportFragmentManager(), "addUserIdDialog");
|
addUserIdDialog.show(getActivity().getSupportFragmentManager(), "addUserIdDialog");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ import android.widget.TextView;
|
|||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround;
|
import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround;
|
||||||
|
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||||
import org.sufficientlysecure.keychain.ui.adapter.LinkedIdsAdapter;
|
import org.sufficientlysecure.keychain.ui.adapter.LinkedIdsAdapter;
|
||||||
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
|
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
|
||||||
@@ -311,6 +312,17 @@ public class ViewKeyFragment extends LoaderFragment implements
|
|||||||
loadData(dataUri);
|
loadData(dataUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
// if a result has been returned, display a notify
|
||||||
|
if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) {
|
||||||
|
OperationResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT);
|
||||||
|
result.createNotify(getActivity()).show();
|
||||||
|
} else {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// These are the rows that we will retrieve.
|
// These are the rows that we will retrieve.
|
||||||
static final String[] UNIFIED_PROJECTION = new String[]{
|
static final String[] UNIFIED_PROJECTION = new String[]{
|
||||||
KeychainContract.KeyRings._ID,
|
KeychainContract.KeyRings._ID,
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import org.sufficientlysecure.keychain.util.Log;
|
|||||||
public class AddUserIdDialogFragment extends DialogFragment implements OnEditorActionListener {
|
public class AddUserIdDialogFragment extends DialogFragment implements OnEditorActionListener {
|
||||||
private static final String ARG_MESSENGER = "messenger";
|
private static final String ARG_MESSENGER = "messenger";
|
||||||
private static final String ARG_NAME = "name";
|
private static final String ARG_NAME = "name";
|
||||||
|
private static final String ARG_ALLOW_COMMENT = "allow_comment";
|
||||||
|
|
||||||
public static final int MESSAGE_OKAY = 1;
|
public static final int MESSAGE_OKAY = 1;
|
||||||
public static final int MESSAGE_CANCEL = 2;
|
public static final int MESSAGE_CANCEL = 2;
|
||||||
@@ -59,12 +60,14 @@ public class AddUserIdDialogFragment extends DialogFragment implements OnEditorA
|
|||||||
private EmailEditText mEmail;
|
private EmailEditText mEmail;
|
||||||
private EditText mComment;
|
private EditText mComment;
|
||||||
|
|
||||||
public static AddUserIdDialogFragment newInstance(Messenger messenger, String predefinedName) {
|
public static AddUserIdDialogFragment newInstance(Messenger messenger, String predefinedName,
|
||||||
|
boolean allowComment) {
|
||||||
|
|
||||||
AddUserIdDialogFragment frag = new AddUserIdDialogFragment();
|
AddUserIdDialogFragment frag = new AddUserIdDialogFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putParcelable(ARG_MESSENGER, messenger);
|
args.putParcelable(ARG_MESSENGER, messenger);
|
||||||
args.putString(ARG_NAME, predefinedName);
|
args.putString(ARG_NAME, predefinedName);
|
||||||
|
args.putBoolean(ARG_ALLOW_COMMENT, allowComment);
|
||||||
frag.setArguments(args);
|
frag.setArguments(args);
|
||||||
|
|
||||||
return frag;
|
return frag;
|
||||||
@@ -78,6 +81,7 @@ public class AddUserIdDialogFragment extends DialogFragment implements OnEditorA
|
|||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
mMessenger = getArguments().getParcelable(ARG_MESSENGER);
|
mMessenger = getArguments().getParcelable(ARG_MESSENGER);
|
||||||
String predefinedName = getArguments().getString(ARG_NAME);
|
String predefinedName = getArguments().getString(ARG_NAME);
|
||||||
|
boolean allowComment = getArguments().getBoolean(ARG_ALLOW_COMMENT);
|
||||||
|
|
||||||
CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(activity);
|
CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(activity);
|
||||||
|
|
||||||
@@ -91,6 +95,12 @@ public class AddUserIdDialogFragment extends DialogFragment implements OnEditorA
|
|||||||
mEmail = (EmailEditText) view.findViewById(R.id.add_user_id_address);
|
mEmail = (EmailEditText) view.findViewById(R.id.add_user_id_address);
|
||||||
mComment = (EditText) view.findViewById(R.id.add_user_id_comment);
|
mComment = (EditText) view.findViewById(R.id.add_user_id_comment);
|
||||||
|
|
||||||
|
if (allowComment) {
|
||||||
|
mComment.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
mComment.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
mName.setText(predefinedName);
|
mName.setText(predefinedName);
|
||||||
|
|
||||||
alert.setPositiveButton(android.R.string.ok, new OnClickListener() {
|
alert.setPositiveButton(android.R.string.ok, new OnClickListener() {
|
||||||
|
|||||||
@@ -1,77 +1,78 @@
|
|||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ui.EditIdentitiesActivity">
|
||||||
|
|
||||||
<LinearLayout
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent">
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="16dp"
|
|
||||||
android:paddingLeft="16dp"
|
|
||||||
android:paddingRight="16dp"
|
|
||||||
android:paddingTop="16dp">
|
|
||||||
|
|
||||||
<android.support.v7.widget.CardView
|
<LinearLayout
|
||||||
android:id="@+id/view_key_card_user_ids"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:orientation="vertical"
|
||||||
card_view:cardBackgroundColor="?attr/colorCardViewBackground"
|
android:paddingBottom="96dp"
|
||||||
card_view:cardCornerRadius="4dp"
|
android:paddingLeft="16dp"
|
||||||
card_view:cardElevation="2dp"
|
android:paddingRight="16dp"
|
||||||
card_view:cardUseCompatPadding="true">
|
android:paddingTop="16dp">
|
||||||
|
|
||||||
<LinearLayout
|
<android.support.v7.widget.CardView
|
||||||
|
android:id="@+id/edit_identities_user_ids_card"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:layout_gravity="center"
|
||||||
|
card_view:cardBackgroundColor="?attr/colorCardViewBackground"
|
||||||
|
card_view:cardCornerRadius="4dp"
|
||||||
|
card_view:cardElevation="2dp"
|
||||||
|
card_view:cardUseCompatPadding="true">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
style="@style/CardViewHeader"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/section_linked_identities" />
|
android:orientation="vertical">
|
||||||
|
|
||||||
<org.sufficientlysecure.keychain.ui.widget.FixedListView
|
<TextView
|
||||||
android:id="@+id/edit_key_user_ids"
|
style="@style/CardViewHeader"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/section_user_ids" />
|
||||||
|
|
||||||
<View
|
<org.sufficientlysecure.keychain.ui.widget.FixedListView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/edit_identities_user_ids"
|
||||||
android:layout_height="1dip"
|
android:layout_width="match_parent"
|
||||||
android:background="?android:attr/listDivider" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<org.sufficientlysecure.keychain.ui.widget.FixedListView
|
<View
|
||||||
android:id="@+id/edit_key_user_ids_added"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="1dip"
|
||||||
android:layout_height="wrap_content" />
|
android:background="?android:attr/listDivider" />
|
||||||
|
|
||||||
<View
|
<org.sufficientlysecure.keychain.ui.widget.FixedListView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/edit_identities_user_ids_added"
|
||||||
android:layout_height="1dip"
|
android:layout_width="match_parent"
|
||||||
android:background="?android:attr/listDivider" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<TextView
|
</LinearLayout>
|
||||||
android:id="@+id/edit_key_action_add_user_id"
|
|
||||||
style="?android:attr/borderlessButtonStyle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:clickable="true"
|
|
||||||
android:drawablePadding="8dp"
|
|
||||||
android:drawableRight="@drawable/ic_person_add_grey_24dp"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
|
||||||
android:paddingLeft="8dp"
|
|
||||||
android:paddingRight="8dp"
|
|
||||||
android:text="@string/edit_key_action_add_identity"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</android.support.v7.widget.CardView>
|
||||||
|
|
||||||
</android.support.v7.widget.CardView>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<android.support.design.widget.FloatingActionButton
|
||||||
|
android:id="@+id/edit_identities_add_user_id"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_marginBottom="24dp"
|
||||||
|
android:layout_marginRight="24dp"
|
||||||
|
android:src="@drawable/ic_add_white_24dp" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user