progress dialog design fix

This commit is contained in:
Dominik Schürmann 2014-08-20 20:13:25 +02:00
parent e13c3bd1ac
commit 50c33ef322
2 changed files with 7 additions and 9 deletions

View File

@ -17,24 +17,16 @@
package org.sufficientlysecure.keychain.ui; package org.sufficientlysecure.keychain.ui;
import android.app.Dialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Message; import android.os.Message;
import android.os.Messenger; import android.os.Messenger;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentService;
import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler;
import org.sufficientlysecure.keychain.service.OperationResults.ConsolidateResult;
/** /**
* We can not directly create a dialog on the application context. * We can not directly create a dialog on the application context.

View File

@ -25,6 +25,7 @@ import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnKeyListener; import android.content.DialogInterface.OnKeyListener;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.view.ContextThemeWrapper;
import android.view.KeyEvent; import android.view.KeyEvent;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
@ -113,7 +114,12 @@ public class ProgressDialogFragment extends DialogFragment {
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
final Activity activity = getActivity(); final Activity activity = getActivity();
ProgressDialog dialog = new ProgressDialog(activity); // if the progress dialog is displayed from the application class, design is missing
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
ContextThemeWrapper context = new ContextThemeWrapper(activity,
R.style.Theme_AppCompat_Light);
ProgressDialog dialog = new ProgressDialog(context);
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dialog.setCancelable(false); dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false); dialog.setCanceledOnTouchOutside(false);