Loading k9mail/src/main/java/com/fsck/k9/Account.java +8 −1 Original line number Diff line number Diff line Loading @@ -221,6 +221,7 @@ public class Account implements BaseAccount, StoreConfig { private boolean mStripSignature; private boolean mSyncRemoteDeletions; private String mCryptoApp; private boolean mCryptoAppIsDeprecatedApg; private long mCryptoKey; private boolean mCryptoSupportSignOnly; private boolean mMarkMessageAsReadOnView; Loading Loading @@ -1607,13 +1608,19 @@ public class Account implements BaseAccount, StoreConfig { } public void setCryptoApp(String cryptoApp) { if (cryptoApp == null || cryptoApp.equals("apg")) { boolean isApgCryptoProvider = "apg".equals(cryptoApp); if (cryptoApp == null || isApgCryptoProvider) { mCryptoAppIsDeprecatedApg = isApgCryptoProvider; mCryptoApp = NO_OPENPGP_PROVIDER; } else { mCryptoApp = cryptoApp; } } public boolean isCryptoAppDeprecatedApg() { return mCryptoAppIsDeprecatedApg; } public long getCryptoKey() { return mCryptoKey; } Loading k9mail/src/main/java/com/fsck/k9/activity/setup/AccountSettings.java +17 −1 Original line number Diff line number Diff line package com.fsck.k9.activity.setup; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import android.app.Dialog; import android.app.FragmentTransaction; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; Loading Loading @@ -45,7 +47,7 @@ import com.fsck.k9.mail.Store; import com.fsck.k9.mailstore.LocalFolder; import com.fsck.k9.mailstore.StorageManager; import com.fsck.k9.service.MailService; import com.fsck.k9.ui.dialog.ApgDeprecationWarningDialog; import org.openintents.openpgp.util.OpenPgpAppPreference; import org.openintents.openpgp.util.OpenPgpKeyPreference; import org.openintents.openpgp.util.OpenPgpUtils; Loading Loading @@ -127,6 +129,7 @@ public class AccountSettings extends K9PreferenceActivity { private static final String PREFERENCE_SPAM_FOLDER = "spam_folder"; private static final String PREFERENCE_TRASH_FOLDER = "trash_folder"; private static final String PREFERENCE_ALWAYS_SHOW_CC_BCC = "always_show_cc_bcc"; public static final String APG_DEPRECATION_DIALOG_TAG = "apgDeprecationDialog"; private Account mAccount; Loading Loading @@ -731,6 +734,19 @@ public class AccountSettings extends K9PreferenceActivity { mCryptoMenu.setEnabled(false); mCryptoMenu.setSummary(R.string.account_settings_no_openpgp_provider_installed); } if (mAccount.isCryptoAppDeprecatedApg()) { showApgDeprecationDialog(); mAccount.setCryptoApp(""); saveSettings(); } } private void showApgDeprecationDialog() { ApgDeprecationWarningDialog fragment = ApgDeprecationWarningDialog.newInstance(); FragmentTransaction ta = getFragmentManager().beginTransaction(); ta.add(fragment, APG_DEPRECATION_DIALOG_TAG); ta.commitAllowingStateLoss(); } private void removeListEntry(ListPreference listPreference, String remove) { Loading k9mail/src/main/java/com/fsck/k9/ui/dialog/ApgDeprecationWarningDialog.java 0 → 100644 +52 −0 Original line number Diff line number Diff line package com.fsck.k9.ui.dialog; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.Bundle; import android.text.method.LinkMovementMethod; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; import com.fsck.k9.R; public class ApgDeprecationWarningDialog extends DialogFragment { public static ApgDeprecationWarningDialog newInstance() { return new ApgDeprecationWarningDialog(); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Context context = getActivity(); if (context == null) { return null; } LayoutInflater inflater = LayoutInflater.from(context); View contentView = inflater.inflate(R.layout.dialog_apg_deprecated, null, false); ((TextView) contentView.findViewById(R.id.apg_learn_more)).setMovementMethod(LinkMovementMethod.getInstance()); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.ic_apg_small); builder.setTitle(R.string.apg_deprecated_title); builder.setView(contentView); builder.setNeutralButton(R.string.apg_deprecated_ok, new OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dismiss(); } }); builder.setCancelable(false); return builder.create(); } } k9mail/src/main/res/drawable-hdpi/ic_apg_small.png 0 → 100644 +4.43 KiB Loading image diff... k9mail/src/main/res/drawable-mdpi/ic_apg_small.png 0 → 100644 +2.51 KiB Loading image diff... Loading
k9mail/src/main/java/com/fsck/k9/Account.java +8 −1 Original line number Diff line number Diff line Loading @@ -221,6 +221,7 @@ public class Account implements BaseAccount, StoreConfig { private boolean mStripSignature; private boolean mSyncRemoteDeletions; private String mCryptoApp; private boolean mCryptoAppIsDeprecatedApg; private long mCryptoKey; private boolean mCryptoSupportSignOnly; private boolean mMarkMessageAsReadOnView; Loading Loading @@ -1607,13 +1608,19 @@ public class Account implements BaseAccount, StoreConfig { } public void setCryptoApp(String cryptoApp) { if (cryptoApp == null || cryptoApp.equals("apg")) { boolean isApgCryptoProvider = "apg".equals(cryptoApp); if (cryptoApp == null || isApgCryptoProvider) { mCryptoAppIsDeprecatedApg = isApgCryptoProvider; mCryptoApp = NO_OPENPGP_PROVIDER; } else { mCryptoApp = cryptoApp; } } public boolean isCryptoAppDeprecatedApg() { return mCryptoAppIsDeprecatedApg; } public long getCryptoKey() { return mCryptoKey; } Loading
k9mail/src/main/java/com/fsck/k9/activity/setup/AccountSettings.java +17 −1 Original line number Diff line number Diff line package com.fsck.k9.activity.setup; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import android.app.Dialog; import android.app.FragmentTransaction; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; Loading Loading @@ -45,7 +47,7 @@ import com.fsck.k9.mail.Store; import com.fsck.k9.mailstore.LocalFolder; import com.fsck.k9.mailstore.StorageManager; import com.fsck.k9.service.MailService; import com.fsck.k9.ui.dialog.ApgDeprecationWarningDialog; import org.openintents.openpgp.util.OpenPgpAppPreference; import org.openintents.openpgp.util.OpenPgpKeyPreference; import org.openintents.openpgp.util.OpenPgpUtils; Loading Loading @@ -127,6 +129,7 @@ public class AccountSettings extends K9PreferenceActivity { private static final String PREFERENCE_SPAM_FOLDER = "spam_folder"; private static final String PREFERENCE_TRASH_FOLDER = "trash_folder"; private static final String PREFERENCE_ALWAYS_SHOW_CC_BCC = "always_show_cc_bcc"; public static final String APG_DEPRECATION_DIALOG_TAG = "apgDeprecationDialog"; private Account mAccount; Loading Loading @@ -731,6 +734,19 @@ public class AccountSettings extends K9PreferenceActivity { mCryptoMenu.setEnabled(false); mCryptoMenu.setSummary(R.string.account_settings_no_openpgp_provider_installed); } if (mAccount.isCryptoAppDeprecatedApg()) { showApgDeprecationDialog(); mAccount.setCryptoApp(""); saveSettings(); } } private void showApgDeprecationDialog() { ApgDeprecationWarningDialog fragment = ApgDeprecationWarningDialog.newInstance(); FragmentTransaction ta = getFragmentManager().beginTransaction(); ta.add(fragment, APG_DEPRECATION_DIALOG_TAG); ta.commitAllowingStateLoss(); } private void removeListEntry(ListPreference listPreference, String remove) { Loading
k9mail/src/main/java/com/fsck/k9/ui/dialog/ApgDeprecationWarningDialog.java 0 → 100644 +52 −0 Original line number Diff line number Diff line package com.fsck.k9.ui.dialog; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.Bundle; import android.text.method.LinkMovementMethod; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; import com.fsck.k9.R; public class ApgDeprecationWarningDialog extends DialogFragment { public static ApgDeprecationWarningDialog newInstance() { return new ApgDeprecationWarningDialog(); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Context context = getActivity(); if (context == null) { return null; } LayoutInflater inflater = LayoutInflater.from(context); View contentView = inflater.inflate(R.layout.dialog_apg_deprecated, null, false); ((TextView) contentView.findViewById(R.id.apg_learn_more)).setMovementMethod(LinkMovementMethod.getInstance()); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.ic_apg_small); builder.setTitle(R.string.apg_deprecated_title); builder.setView(contentView); builder.setNeutralButton(R.string.apg_deprecated_ok, new OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dismiss(); } }); builder.setCancelable(false); return builder.create(); } }