1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

Issue 1711 (don't display subject when phone locked)

Modified code so that subject is still visible after unlock when notification bar is expanded
This commit is contained in:
Fiouz 2010-09-01 22:37:11 +00:00
parent f43db5235c
commit 08f10f1fe5

View File

@ -21,6 +21,7 @@ import java.util.concurrent.CountDownLatch;
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;
@ -50,6 +51,8 @@ import com.fsck.k9.mail.Address;
import com.fsck.k9.mail.FetchProfile;
import com.fsck.k9.mail.Flag;
import com.fsck.k9.mail.Folder;
import com.fsck.k9.mail.Folder.FolderType;
import com.fsck.k9.mail.Folder.OpenMode;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.Part;
@ -57,8 +60,6 @@ import com.fsck.k9.mail.PushReceiver;
import com.fsck.k9.mail.Pusher;
import com.fsck.k9.mail.Store;
import com.fsck.k9.mail.Transport;
import com.fsck.k9.mail.Folder.FolderType;
import com.fsck.k9.mail.Folder.OpenMode;
import com.fsck.k9.mail.internet.MimeMessage;
import com.fsck.k9.mail.internet.MimeUtility;
import com.fsck.k9.mail.internet.TextBody;
@ -4565,10 +4566,8 @@ public class MessagingController implements Runnable
private boolean notifyAccount(Context context, Account account, Message message, int previousUnreadMessageCount, AtomicInteger newMessageCount)
{
// If we have a message, set the notification to "<From>: <Subject>"
StringBuffer messageNotice = new StringBuffer();
StringBuilder messageNotice = new StringBuilder();
final KeyguardManager keyguardService = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
if (!K9.keyguardPrivacy() || !keyguardService.inKeyguardRestrictedInputMode())
{
try
{
if (message != null && message.getFrom() != null)
@ -4616,13 +4615,13 @@ public class MessagingController implements Runnable
{
Log.e(K9.LOG_TAG, "Unable to get message information for notification.", e);
}
}
// If privacy mode active and keyguard active
// OR
// If we could not set a per-message notification, revert to a default message
if (messageNotice.length() == 0)
if ((K9.keyguardPrivacy() && keyguardService.inKeyguardRestrictedInputMode()) || messageNotice.length() == 0)
{
messageNotice.append(context.getString(R.string.notification_new_title));
messageNotice = new StringBuilder(context.getString(R.string.notification_new_title));
}
NotificationManager notifMgr =