mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
Work on add subkey dialog design
This commit is contained in:
parent
d377d1f23d
commit
04cdd45e1a
@ -32,6 +32,9 @@ import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
@ -54,11 +57,18 @@ public class AddSubkeyDialogFragment extends DialogFragment {
|
||||
private static final String ARG_WILL_BE_MASTER_KEY = "will_be_master_key";
|
||||
|
||||
private OnAlgorithmSelectedListener mAlgorithmSelectedListener;
|
||||
|
||||
private CheckBox mNoExpiryCheckBox;
|
||||
private DatePicker mExpiryDatePicker;
|
||||
private Spinner mAlgorithmSpinner;
|
||||
private Spinner mKeySizeSpinner;
|
||||
private TextView mCustomKeyTextView;
|
||||
private EditText mCustomKeyEditText;
|
||||
private TextView mCustomKeyInfoTextView;
|
||||
private CheckBox mFlagCertify;
|
||||
private CheckBox mFlagSign;
|
||||
private CheckBox mFlagEncrypt;
|
||||
private CheckBox mFlagAuthenticate;
|
||||
|
||||
public void setOnAlgorithmSelectedListener(OnAlgorithmSelectedListener listener) {
|
||||
mAlgorithmSelectedListener = listener;
|
||||
@ -85,11 +95,33 @@ public class AddSubkeyDialogFragment extends DialogFragment {
|
||||
|
||||
CustomAlertDialogBuilder dialog = new CustomAlertDialogBuilder(context);
|
||||
|
||||
View view = mInflater.inflate(R.layout.create_key_dialog, null);
|
||||
View view = mInflater.inflate(R.layout.add_subkey_dialog, null);
|
||||
dialog.setView(view);
|
||||
dialog.setTitle(R.string.title_create_key);
|
||||
|
||||
mAlgorithmSpinner = (Spinner) view.findViewById(R.id.create_key_algorithm);
|
||||
mNoExpiryCheckBox = (CheckBox) view.findViewById(R.id.add_subkey_no_expiry);
|
||||
mExpiryDatePicker = (DatePicker) view.findViewById(R.id.add_subkey_expiry_date_picker);
|
||||
mAlgorithmSpinner = (Spinner) view.findViewById(R.id.add_subkey_algorithm);
|
||||
mKeySizeSpinner = (Spinner) view.findViewById(R.id.add_subkey_size);
|
||||
mCustomKeyTextView = (TextView) view.findViewById(R.id.add_subkey_custom_key_size_label);
|
||||
mCustomKeyEditText = (EditText) view.findViewById(R.id.add_subkey_custom_key_size_input);
|
||||
mCustomKeyInfoTextView = (TextView) view.findViewById(R.id.add_subkey_custom_key_size_info);
|
||||
mFlagCertify = (CheckBox) view.findViewById(R.id.add_subkey_flag_certify);
|
||||
mFlagSign = (CheckBox) view.findViewById(R.id.add_subkey_flag_sign);
|
||||
mFlagEncrypt = (CheckBox) view.findViewById(R.id.add_subkey_flag_encrypt);
|
||||
mFlagAuthenticate = (CheckBox) view.findViewById(R.id.add_subkey_flag_authenticate);
|
||||
|
||||
mNoExpiryCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
mExpiryDatePicker.setVisibility(View.GONE);
|
||||
} else {
|
||||
mExpiryDatePicker.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ArrayList<Choice> choices = new ArrayList<Choice>();
|
||||
choices.add(new Choice(Constants.choice.algorithm.dsa, getResources().getString(
|
||||
R.string.dsa)));
|
||||
@ -97,10 +129,8 @@ public class AddSubkeyDialogFragment extends DialogFragment {
|
||||
choices.add(new Choice(Constants.choice.algorithm.elgamal, getResources().getString(
|
||||
R.string.elgamal)));
|
||||
}
|
||||
|
||||
choices.add(new Choice(Constants.choice.algorithm.rsa, getResources().getString(
|
||||
R.string.rsa)));
|
||||
|
||||
ArrayAdapter<Choice> adapter = new ArrayAdapter<Choice>(context,
|
||||
android.R.layout.simple_spinner_item, choices);
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
@ -113,7 +143,7 @@ public class AddSubkeyDialogFragment extends DialogFragment {
|
||||
}
|
||||
}
|
||||
|
||||
mKeySizeSpinner = (Spinner) view.findViewById(R.id.create_key_size);
|
||||
|
||||
// dynamic ArrayAdapter must be created (instead of ArrayAdapter.getFromResource), because it's content may change
|
||||
ArrayAdapter<CharSequence> keySizeAdapter = new ArrayAdapter<CharSequence>(context, android.R.layout.simple_spinner_item,
|
||||
new ArrayList<CharSequence>(Arrays.asList(getResources().getStringArray(R.array.rsa_key_size_spinner_values))));
|
||||
@ -121,9 +151,6 @@ public class AddSubkeyDialogFragment extends DialogFragment {
|
||||
mKeySizeSpinner.setAdapter(keySizeAdapter);
|
||||
mKeySizeSpinner.setSelection(1); // Default to 4096 for the key length
|
||||
|
||||
mCustomKeyTextView = (TextView) view.findViewById(R.id.custom_key_size_label);
|
||||
mCustomKeyEditText = (EditText) view.findViewById(R.id.custom_key_size_input);
|
||||
mCustomKeyInfoTextView = (TextView) view.findViewById(R.id.custom_key_size_info);
|
||||
|
||||
dialog.setPositiveButton(android.R.string.ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@ -148,7 +175,8 @@ public class AddSubkeyDialogFragment extends DialogFragment {
|
||||
public void onClick(DialogInterface di, int id) {
|
||||
di.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
final AlertDialog alertDialog = dialog.show();
|
||||
|
||||
|
@ -92,10 +92,10 @@ public class EditSubkeyExpiryDialogFragment extends DialogFragment {
|
||||
alert.setTitle(R.string.expiry_date_dialog_title);
|
||||
|
||||
LayoutInflater inflater = activity.getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.expiry_dialog, null);
|
||||
View view = inflater.inflate(R.layout.edit_subkey_expiry_dialog, null);
|
||||
alert.setView(view);
|
||||
|
||||
mDatePicker = (DatePicker) view.findViewById(R.id.datePicker);
|
||||
mDatePicker = (DatePicker) view.findViewById(R.id.edit_subkey_expiry_date_picker);
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
|
||||
// will crash with IllegalArgumentException if we set a min date
|
||||
|
@ -29,8 +29,6 @@ import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class EditUserIdDialogFragment extends DialogFragment {
|
||||
private static final String ARG_MESSENGER = "messenger";
|
||||
|
||||
|
@ -6,10 +6,70 @@
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:stretchColumns="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/key_creation_el_gamal_info" />
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/label_algorithm" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/add_subkey_algorithm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/label_key_size" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/add_subkey_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right"
|
||||
android:padding="4dp" />
|
||||
</TableRow>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/add_subkey_custom_key_size_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/key_size_custom_info"
|
||||
android:visibility="gone" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/add_subkey_custom_key_size_input"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:inputType="number"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/add_subkey_custom_key_size_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
@ -20,15 +80,35 @@
|
||||
android:paddingRight="10dip"
|
||||
android:text="@string/label_expiry" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/expiry"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:text="@string/none"
|
||||
android:background="@drawable/button_edgy" />
|
||||
<CheckBox
|
||||
android:id="@+id/add_subkey_no_expiry"
|
||||
android:checked="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/btn_no_date" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow android:id="@+id/row_certify">
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingRight="10dip" />
|
||||
|
||||
<DatePicker
|
||||
android:id="@+id/add_subkey_expiry_date_picker"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:spinnersShown="true"
|
||||
android:calendarViewShown="false" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_usage"
|
||||
@ -38,32 +118,31 @@
|
||||
android:paddingRight="10dip"
|
||||
android:text="@string/label_usage" />
|
||||
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/chkCertify"
|
||||
android:id="@+id/add_subkey_flag_certify"
|
||||
android:enabled="false"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/flag_certify" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow android:id="@+id/row_sign">
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_usage2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingRight="10dip"
|
||||
android:text="@string/label_usage" />
|
||||
android:paddingRight="10dip" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/chkSign"
|
||||
android:id="@+id/add_subkey_flag_sign"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/flag_sign" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow android:id="@+id/row_encrypt">
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@ -72,13 +151,13 @@
|
||||
android:paddingRight="10dip" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/chkEncrypt"
|
||||
android:id="@+id/add_subkey_flag_encrypt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/flag_encrypt" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow android:id="@+id/row_authenticate">
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@ -87,76 +166,12 @@
|
||||
android:paddingRight="10dip" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/chkAuthenticate"
|
||||
android:id="@+id/add_subkey_flag_authenticate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/flag_authenticate" />
|
||||
</TableRow>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="4dp"
|
||||
android:text="@string/key_creation_el_gamal_info" />
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="4dp"
|
||||
android:text="@string/label_algorithm" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/create_key_algorithm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="4dp" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="4dp"
|
||||
android:text="@string/label_key_size" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/create_key_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right"
|
||||
android:padding="4dp" />
|
||||
</TableRow>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/custom_key_size_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="4dp"
|
||||
android:text="@string/key_size_custom_info"
|
||||
android:visibility="gone" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/custom_key_size_input"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:inputType="number"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/custom_key_size_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="4dp" />
|
||||
|
||||
</TableLayout>
|
||||
|
||||
</ScrollView>
|
@ -4,8 +4,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<DatePicker xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/datePicker"
|
||||
<DatePicker
|
||||
android:id="@+id/edit_subkey_expiry_date_picker"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
Loading…
Reference in New Issue
Block a user