mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
Fixes issue 1711
Owner: fiouzy Don't display message subject in notification bar when keyguard is active (system locked)
This commit is contained in:
parent
f21d86d8ce
commit
f43db5235c
@ -326,6 +326,9 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
|
||||
<string name="global_settings_confirm_action_spam">Spam</string>
|
||||
<string name="global_settings_confirm_action_send">Send</string>
|
||||
|
||||
<string name="global_settings_privacy_mode_title">Privacy mode</string>
|
||||
<string name="global_settings_privacy_mode_summary">Don\'t display message subject in notification bar when system is locked</string>
|
||||
|
||||
<string name="account_setup_basics_title">Set up a new account</string>
|
||||
<string name="account_setup_basics_instructions">Enter this account\'s email address:</string>
|
||||
<string name="account_setup_basics_instructions2_fmt">(You may add <xliff:g id="number_accounts">%d</xliff:g> more accounts.)</string>
|
||||
|
@ -79,6 +79,11 @@
|
||||
android:negativeButtonText="@android:string/cancel"
|
||||
/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="privacy_mode"
|
||||
android:title="@string/global_settings_privacy_mode_title"
|
||||
android:summary="@string/global_settings_privacy_mode_summary"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/accountlist_preferences" android:key="accountlist_preferences">
|
||||
|
@ -107,6 +107,7 @@ public class K9 extends Application
|
||||
private static boolean mAnimations = true;
|
||||
|
||||
private static boolean mConfirmDelete = false;
|
||||
private static boolean mKeyguardPrivacy = false;
|
||||
|
||||
private static boolean mMessageListStars = true;
|
||||
private static boolean mMessageListCheckboxes = false;
|
||||
@ -356,6 +357,8 @@ public class K9 extends Application
|
||||
|
||||
editor.putBoolean("confirmDelete", mConfirmDelete);
|
||||
|
||||
editor.putBoolean("keyguardPrivacy", mKeyguardPrivacy);
|
||||
|
||||
fontSizes.save(editor);
|
||||
}
|
||||
|
||||
@ -389,6 +392,8 @@ public class K9 extends Application
|
||||
|
||||
mConfirmDelete = sprefs.getBoolean("confirmDelete", false);
|
||||
|
||||
mKeyguardPrivacy = sprefs.getBoolean("keyguardPrivacy", false);
|
||||
|
||||
fontSizes.load(sprefs);
|
||||
|
||||
try
|
||||
@ -699,6 +704,19 @@ public class K9 extends Application
|
||||
mConfirmDelete = confirm;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether privacy rules should be applied when system is locked
|
||||
*/
|
||||
public static boolean keyguardPrivacy()
|
||||
{
|
||||
return mKeyguardPrivacy;
|
||||
}
|
||||
|
||||
public static void setKeyguardPrivacy(final boolean state)
|
||||
{
|
||||
mKeyguardPrivacy = state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this system contains a buggy Gallery 3D package.
|
||||
*
|
||||
|
@ -58,6 +58,8 @@ public class Prefs extends K9PreferenceActivity
|
||||
|
||||
private static final String PREFERENCE_CONFIRM_ACTIONS = "confirm_actions";
|
||||
|
||||
private static final String PREFERENCE_PRIVACY_MODE = "privacy_mode";
|
||||
|
||||
private ListPreference mLanguage;
|
||||
private ListPreference mTheme;
|
||||
private ListPreference mDateFormat;
|
||||
@ -82,6 +84,8 @@ public class Prefs extends K9PreferenceActivity
|
||||
|
||||
private CheckboxListPreference mConfirmActions;
|
||||
|
||||
private CheckBoxPreference mPrivacyMode;
|
||||
|
||||
private String initBackgroundOps;
|
||||
|
||||
|
||||
@ -243,6 +247,9 @@ public class Prefs extends K9PreferenceActivity
|
||||
mConfirmActions = (CheckboxListPreference) findPreference(PREFERENCE_CONFIRM_ACTIONS);
|
||||
mConfirmActions.setItems(new CharSequence[] {getString(R.string.global_settings_confirm_action_delete)});
|
||||
mConfirmActions.setCheckedItems(new boolean[] {K9.confirmDelete()});
|
||||
|
||||
mPrivacyMode = (CheckBoxPreference) findPreference(PREFERENCE_PRIVACY_MODE);
|
||||
mPrivacyMode.setChecked(K9.keyguardPrivacy());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -284,6 +291,8 @@ public class Prefs extends K9PreferenceActivity
|
||||
|
||||
K9.setConfirmDelete(mConfirmActions.getCheckedItems()[0]);
|
||||
|
||||
K9.setKeyguardPrivacy(mPrivacyMode.isChecked());
|
||||
|
||||
Editor editor = preferences.edit();
|
||||
K9.save(editor);
|
||||
DateFormatter.setDateFormat(editor, mDateFormat.getValue());
|
||||
|
@ -22,6 +22,7 @@ import java.util.concurrent.PriorityBlockingQueue;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import android.app.Application;
|
||||
import android.app.KeyguardManager;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
@ -4565,6 +4566,9 @@ public class MessagingController implements Runnable
|
||||
{
|
||||
// If we have a message, set the notification to "<From>: <Subject>"
|
||||
StringBuffer messageNotice = new StringBuffer();
|
||||
final KeyguardManager keyguardService = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
|
||||
if (!K9.keyguardPrivacy() || !keyguardService.inKeyguardRestrictedInputMode())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (message != null && message.getFrom() != null)
|
||||
@ -4612,6 +4616,7 @@ public class MessagingController implements Runnable
|
||||
{
|
||||
Log.e(K9.LOG_TAG, "Unable to get message information for notification.", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If we could not set a per-message notification, revert to a default message
|
||||
|
Loading…
Reference in New Issue
Block a user