mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-24 01:32:16 -05:00
Fix progress_generating and reformat
This commit is contained in:
parent
da83c8ff60
commit
be41a0a3e1
@ -598,8 +598,10 @@ public class KeychainIntentService extends IntentService implements ProgressDial
|
|||||||
/* Operation */
|
/* Operation */
|
||||||
int keysTotal = 2;
|
int keysTotal = 2;
|
||||||
int keysCreated = 0;
|
int keysCreated = 0;
|
||||||
setProgress(getApplicationContext().getResources().getQuantityString(R.plurals.progress_generating,keysTotal),
|
setProgress(
|
||||||
keysCreated, keysTotal);
|
getResources().getQuantityString(R.plurals.progress_generating, keysTotal),
|
||||||
|
keysCreated,
|
||||||
|
keysTotal);
|
||||||
PgpKeyOperation keyOperations = new PgpKeyOperation(this, this);
|
PgpKeyOperation keyOperations = new PgpKeyOperation(this, this);
|
||||||
|
|
||||||
PGPSecretKey masterKey = keyOperations.createKey(Id.choice.algorithm.rsa,
|
PGPSecretKey masterKey = keyOperations.createKey(Id.choice.algorithm.rsa,
|
||||||
|
@ -55,6 +55,10 @@ public class KeychainIntentServiceHandler extends Handler {
|
|||||||
this.mProgressDialogFragment = progressDialogFragment;
|
this.mProgressDialogFragment = progressDialogFragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public KeychainIntentServiceHandler(Activity activity, String progressDialogMessage, int progressDialogStyle) {
|
||||||
|
this(activity, progressDialogMessage, progressDialogStyle, false, null);
|
||||||
|
}
|
||||||
|
|
||||||
public KeychainIntentServiceHandler(Activity activity, int progressDialogMessageId, int progressDialogStyle) {
|
public KeychainIntentServiceHandler(Activity activity, int progressDialogMessageId, int progressDialogStyle) {
|
||||||
this(activity, progressDialogMessageId, progressDialogStyle, false, null);
|
this(activity, progressDialogMessageId, progressDialogStyle, false, null);
|
||||||
}
|
}
|
||||||
@ -62,9 +66,22 @@ public class KeychainIntentServiceHandler extends Handler {
|
|||||||
public KeychainIntentServiceHandler(Activity activity, int progressDialogMessageId,
|
public KeychainIntentServiceHandler(Activity activity, int progressDialogMessageId,
|
||||||
int progressDialogStyle, boolean cancelable,
|
int progressDialogStyle, boolean cancelable,
|
||||||
OnCancelListener onCancelListener) {
|
OnCancelListener onCancelListener) {
|
||||||
|
this(activity,
|
||||||
|
activity.getString(progressDialogMessageId),
|
||||||
|
progressDialogStyle,
|
||||||
|
cancelable,
|
||||||
|
onCancelListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public KeychainIntentServiceHandler(Activity activity, String progressDialogMessage,
|
||||||
|
int progressDialogStyle, boolean cancelable,
|
||||||
|
OnCancelListener onCancelListener) {
|
||||||
this.mActivity = activity;
|
this.mActivity = activity;
|
||||||
this.mProgressDialogFragment = ProgressDialogFragment.newInstance(progressDialogMessageId,
|
this.mProgressDialogFragment = ProgressDialogFragment.newInstance(
|
||||||
progressDialogStyle, cancelable, onCancelListener);
|
progressDialogMessage,
|
||||||
|
progressDialogStyle,
|
||||||
|
cancelable,
|
||||||
|
onCancelListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showProgressDialog(FragmentActivity activity) {
|
public void showProgressDialog(FragmentActivity activity) {
|
||||||
|
@ -187,7 +187,8 @@ public class EditKeyActivity extends ActionBarActivity {
|
|||||||
|
|
||||||
// Message is received after generating is done in ApgService
|
// Message is received after generating is done in ApgService
|
||||||
KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(
|
KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(
|
||||||
this, R.string.progress_generating, ProgressDialog.STYLE_HORIZONTAL, true,
|
this, getResources().getQuantityString(R.plurals.progress_generating, 1),
|
||||||
|
ProgressDialog.STYLE_HORIZONTAL, true,
|
||||||
|
|
||||||
new DialogInterface.OnCancelListener() {
|
new DialogInterface.OnCancelListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -83,7 +83,10 @@ public class DeleteFileDialogFragment extends DialogFragment {
|
|||||||
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
||||||
|
|
||||||
ProgressDialogFragment deletingDialog = ProgressDialogFragment.newInstance(
|
ProgressDialogFragment deletingDialog = ProgressDialogFragment.newInstance(
|
||||||
R.string.progress_deleting_securely, ProgressDialog.STYLE_HORIZONTAL, false, null);
|
getString(R.string.progress_deleting_securely),
|
||||||
|
ProgressDialog.STYLE_HORIZONTAL,
|
||||||
|
false,
|
||||||
|
null);
|
||||||
|
|
||||||
// Message is received after deleting is done in ApgService
|
// Message is received after deleting is done in ApgService
|
||||||
KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(activity, deletingDialog) {
|
KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(activity, deletingDialog) {
|
||||||
|
@ -30,7 +30,7 @@ import android.view.KeyEvent;
|
|||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
|
|
||||||
public class ProgressDialogFragment extends DialogFragment {
|
public class ProgressDialogFragment extends DialogFragment {
|
||||||
private static final String ARG_MESSAGE_ID = "message_id";
|
private static final String ARG_MESSAGE = "message_id";
|
||||||
private static final String ARG_STYLE = "style";
|
private static final String ARG_STYLE = "style";
|
||||||
private static final String ARG_CANCELABLE = "cancelable";
|
private static final String ARG_CANCELABLE = "cancelable";
|
||||||
|
|
||||||
@ -39,16 +39,16 @@ public class ProgressDialogFragment extends DialogFragment {
|
|||||||
/**
|
/**
|
||||||
* Creates new instance of this fragment
|
* Creates new instance of this fragment
|
||||||
*
|
*
|
||||||
* @param messageId
|
* @param message
|
||||||
* @param style
|
* @param style
|
||||||
* @param cancelable
|
* @param cancelable
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static ProgressDialogFragment newInstance(int messageId, int style, boolean cancelable,
|
public static ProgressDialogFragment newInstance(String message, int style, boolean cancelable,
|
||||||
OnCancelListener onCancelListener) {
|
OnCancelListener onCancelListener) {
|
||||||
ProgressDialogFragment frag = new ProgressDialogFragment();
|
ProgressDialogFragment frag = new ProgressDialogFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putInt(ARG_MESSAGE_ID, messageId);
|
args.putString(ARG_MESSAGE, message);
|
||||||
args.putInt(ARG_STYLE, style);
|
args.putInt(ARG_STYLE, style);
|
||||||
args.putBoolean(ARG_CANCELABLE, cancelable);
|
args.putBoolean(ARG_CANCELABLE, cancelable);
|
||||||
|
|
||||||
@ -117,11 +117,11 @@ public class ProgressDialogFragment extends DialogFragment {
|
|||||||
dialog.setCancelable(false);
|
dialog.setCancelable(false);
|
||||||
dialog.setCanceledOnTouchOutside(false);
|
dialog.setCanceledOnTouchOutside(false);
|
||||||
|
|
||||||
int messageId = getArguments().getInt(ARG_MESSAGE_ID);
|
String message = getArguments().getString(ARG_MESSAGE);
|
||||||
int style = getArguments().getInt(ARG_STYLE);
|
int style = getArguments().getInt(ARG_STYLE);
|
||||||
boolean cancelable = getArguments().getBoolean(ARG_CANCELABLE);
|
boolean cancelable = getArguments().getBoolean(ARG_CANCELABLE);
|
||||||
|
|
||||||
dialog.setMessage(getString(messageId));
|
dialog.setMessage(message);
|
||||||
dialog.setProgressStyle(style);
|
dialog.setProgressStyle(style);
|
||||||
|
|
||||||
if (cancelable) {
|
if (cancelable) {
|
||||||
|
@ -103,7 +103,9 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
mInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
mInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
@ -121,7 +123,9 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
public void onDeleted(Editor editor) {
|
public void onDeleted(Editor editor) {
|
||||||
this.updateEditorsVisible();
|
this.updateEditorsVisible();
|
||||||
}
|
}
|
||||||
@ -131,7 +135,9 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
mEditors.setVisibility(hasChildren ? View.VISIBLE : View.GONE);
|
mEditors.setVisibility(hasChildren ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (canEdit) {
|
if (canEdit) {
|
||||||
switch (mType) {
|
switch (mType) {
|
||||||
@ -238,8 +244,11 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
||||||
|
|
||||||
// show progress dialog
|
// show progress dialog
|
||||||
mGeneratingDialog = ProgressDialogFragment.newInstance(R.string.progress_generating,
|
mGeneratingDialog = ProgressDialogFragment.newInstance(
|
||||||
ProgressDialog.STYLE_SPINNER, true, new DialogInterface.OnCancelListener() {
|
getResources().getQuantityString(R.plurals.progress_generating, 1),
|
||||||
|
ProgressDialog.STYLE_SPINNER,
|
||||||
|
true,
|
||||||
|
new DialogInterface.OnCancelListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCancel(DialogInterface dialog) {
|
public void onCancel(DialogInterface dialog) {
|
||||||
mActivity.stopService(intent);
|
mActivity.stopService(intent);
|
||||||
|
Loading…
Reference in New Issue
Block a user