2009-12-14 21:50:53 -05:00
|
|
|
|
2008-12-18 19:14:49 -05:00
|
|
|
package com.fsck.k9;
|
|
|
|
|
2010-10-01 15:41:39 -04:00
|
|
|
import java.io.File;
|
|
|
|
import java.util.ArrayList;
|
2012-04-12 22:12:22 -04:00
|
|
|
import java.util.HashMap;
|
2010-10-01 15:41:39 -04:00
|
|
|
import java.util.List;
|
2010-11-13 16:40:56 -05:00
|
|
|
import java.util.concurrent.BlockingQueue;
|
|
|
|
import java.util.concurrent.SynchronousQueue;
|
2010-10-01 15:41:39 -04:00
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
import android.app.Application;
|
|
|
|
import android.content.ComponentName;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
2010-11-13 16:40:56 -05:00
|
|
|
import android.content.IntentFilter;
|
2009-12-14 21:50:53 -05:00
|
|
|
import android.content.SharedPreferences;
|
2012-12-01 02:02:55 -05:00
|
|
|
import android.content.SharedPreferences.Editor;
|
2013-06-08 20:36:12 -04:00
|
|
|
import android.content.pm.ApplicationInfo;
|
2010-05-02 14:24:33 -04:00
|
|
|
import android.content.pm.PackageInfo;
|
2009-12-14 21:50:53 -05:00
|
|
|
import android.content.pm.PackageManager;
|
2010-05-02 14:24:33 -04:00
|
|
|
import android.content.pm.PackageManager.NameNotFoundException;
|
2009-12-14 21:50:53 -05:00
|
|
|
import android.net.Uri;
|
2012-12-21 21:00:42 -05:00
|
|
|
import android.os.Debug;
|
2011-04-23 23:54:28 -04:00
|
|
|
import android.os.Environment;
|
2010-11-13 16:40:56 -05:00
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.Looper;
|
2014-01-09 12:33:43 -05:00
|
|
|
import android.os.StrictMode;
|
2010-11-28 21:21:16 -05:00
|
|
|
import android.text.format.Time;
|
2009-12-14 21:50:53 -05:00
|
|
|
import android.util.Log;
|
2010-02-07 22:23:41 -05:00
|
|
|
|
2012-04-12 22:12:22 -04:00
|
|
|
import com.fsck.k9.Account.SortType;
|
2009-12-14 21:50:53 -05:00
|
|
|
import com.fsck.k9.activity.MessageCompose;
|
2012-12-01 02:02:55 -05:00
|
|
|
import com.fsck.k9.activity.UpgradeDatabases;
|
2010-05-19 14:17:06 -04:00
|
|
|
import com.fsck.k9.controller.MessagingController;
|
|
|
|
import com.fsck.k9.controller.MessagingListener;
|
2009-12-14 21:50:53 -05:00
|
|
|
import com.fsck.k9.mail.Address;
|
|
|
|
import com.fsck.k9.mail.Message;
|
|
|
|
import com.fsck.k9.mail.MessagingException;
|
|
|
|
import com.fsck.k9.mail.internet.BinaryTempFileBody;
|
2012-12-01 02:02:55 -05:00
|
|
|
import com.fsck.k9.mail.store.LocalStore;
|
2012-02-07 10:32:13 -05:00
|
|
|
import com.fsck.k9.provider.UnreadWidgetProvider;
|
2013-12-03 19:20:20 -05:00
|
|
|
import com.fsck.k9.security.LocalKeyStore;
|
2009-12-14 21:50:53 -05:00
|
|
|
import com.fsck.k9.service.BootReceiver;
|
|
|
|
import com.fsck.k9.service.MailService;
|
2010-11-13 16:40:56 -05:00
|
|
|
import com.fsck.k9.service.ShutdownReceiver;
|
|
|
|
import com.fsck.k9.service.StorageGoneReceiver;
|
2009-12-14 21:50:53 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public class K9 extends Application {
|
2010-10-01 15:41:39 -04:00
|
|
|
/**
|
|
|
|
* Components that are interested in knowing when the K9 instance is
|
|
|
|
* available and ready (Android invokes Application.onCreate() after other
|
|
|
|
* components') should implement this interface and register using
|
|
|
|
* {@link K9#registerApplicationAware(ApplicationAware)}.
|
|
|
|
*/
|
2011-02-06 17:09:48 -05:00
|
|
|
public static interface ApplicationAware {
|
2010-10-01 15:41:39 -04:00
|
|
|
/**
|
|
|
|
* Called when the Application instance is available and ready.
|
2010-10-05 02:04:28 -04:00
|
|
|
*
|
2010-10-01 15:41:39 -04:00
|
|
|
* @param application
|
|
|
|
* The application instance. Never <code>null</code>.
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
2013-11-29 04:49:52 -05:00
|
|
|
void initializeComponent(Application application);
|
2010-10-01 15:41:39 -04:00
|
|
|
}
|
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
public static Application app = null;
|
|
|
|
public static File tempDirectory;
|
|
|
|
public static final String LOG_TAG = "k9";
|
|
|
|
|
2012-12-01 02:02:55 -05:00
|
|
|
/**
|
|
|
|
* Name of the {@link SharedPreferences} file used to store the last known version of the
|
|
|
|
* accounts' databases.
|
|
|
|
*
|
|
|
|
* <p>
|
|
|
|
* See {@link UpgradeDatabases} for a detailed explanation of the database upgrade process.
|
|
|
|
* </p>
|
|
|
|
*/
|
|
|
|
private static final String DATABASE_VERSION_CACHE = "database_version_cache";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Key used to store the last known database version of the accounts' databases.
|
|
|
|
*
|
|
|
|
* @see #DATABASE_VERSION_CACHE
|
|
|
|
*/
|
|
|
|
private static final String KEY_LAST_ACCOUNT_DATABASE_VERSION = "last_account_database_version";
|
|
|
|
|
2010-10-01 15:41:39 -04:00
|
|
|
/**
|
|
|
|
* Components that are interested in knowing when the K9 instance is
|
|
|
|
* available and ready.
|
2010-10-05 02:04:28 -04:00
|
|
|
*
|
2010-10-01 15:41:39 -04:00
|
|
|
* @see ApplicationAware
|
|
|
|
*/
|
|
|
|
private static List<ApplicationAware> observers = new ArrayList<ApplicationAware>();
|
|
|
|
|
2013-11-29 04:49:52 -05:00
|
|
|
/**
|
|
|
|
* This will be {@code true} once the initialization is complete and {@link #notifyObservers()}
|
|
|
|
* was called.
|
|
|
|
* Afterwards calls to {@link #registerApplicationAware(com.fsck.k9.K9.ApplicationAware)} will
|
|
|
|
* immediately call {@link com.fsck.k9.K9.ApplicationAware#initializeComponent(K9)} for the
|
|
|
|
* supplied argument.
|
|
|
|
*/
|
|
|
|
private static boolean sInitialized = false;
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public enum BACKGROUND_OPS {
|
2010-05-15 17:26:15 -04:00
|
|
|
WHEN_CHECKED, ALWAYS, NEVER, WHEN_CHECKED_AUTO_SYNC
|
2009-12-14 21:50:53 -05:00
|
|
|
}
|
|
|
|
|
2010-07-08 20:27:47 -04:00
|
|
|
private static String language = "";
|
2013-02-06 14:08:57 -05:00
|
|
|
private static Theme theme = Theme.LIGHT;
|
|
|
|
private static Theme messageViewTheme = Theme.USE_GLOBAL;
|
|
|
|
private static Theme composerTheme = Theme.USE_GLOBAL;
|
2013-02-06 03:47:16 -05:00
|
|
|
private static boolean useFixedMessageTheme = true;
|
2009-12-14 21:50:53 -05:00
|
|
|
|
2010-04-20 12:37:03 -04:00
|
|
|
private static final FontSizes fontSizes = new FontSizes();
|
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
private static BACKGROUND_OPS backgroundOps = BACKGROUND_OPS.WHEN_CHECKED;
|
|
|
|
/**
|
|
|
|
* Some log messages can be sent to a file, so that the logs
|
|
|
|
* can be read using unprivileged access (eg. Terminal Emulator)
|
|
|
|
* on the phone, without adb. Set to null to disable
|
|
|
|
*/
|
|
|
|
public static final String logFile = null;
|
2010-05-29 17:56:09 -04:00
|
|
|
//public static final String logFile = Environment.getExternalStorageDirectory() + "/k9mail/debug.log";
|
2009-12-14 21:50:53 -05:00
|
|
|
|
2010-12-24 13:55:01 -05:00
|
|
|
/**
|
|
|
|
* If this is enabled, various development settings will be enabled
|
|
|
|
* It should NEVER be on for Market builds
|
|
|
|
* Right now, it just governs strictmode
|
|
|
|
**/
|
|
|
|
public static boolean DEVELOPER_MODE = true;
|
|
|
|
|
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
/**
|
|
|
|
* If this is enabled there will be additional logging information sent to
|
|
|
|
* Log.d, including protocol dumps.
|
|
|
|
* Controlled by Preferences at run-time
|
|
|
|
*/
|
|
|
|
public static boolean DEBUG = false;
|
|
|
|
|
2010-07-13 17:16:42 -04:00
|
|
|
/**
|
|
|
|
* Should K-9 log the conversation it has over the wire with
|
|
|
|
* SMTP servers?
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static boolean DEBUG_PROTOCOL_SMTP = true;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Should K-9 log the conversation it has over the wire with
|
|
|
|
* IMAP servers?
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static boolean DEBUG_PROTOCOL_IMAP = true;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Should K-9 log the conversation it has over the wire with
|
|
|
|
* POP3 servers?
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static boolean DEBUG_PROTOCOL_POP3 = true;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Should K-9 log the conversation it has over the wire with
|
|
|
|
* WebDAV servers?
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static boolean DEBUG_PROTOCOL_WEBDAV = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
/**
|
|
|
|
* If this is enabled than logging that normally hides sensitive information
|
|
|
|
* like passwords will show that information.
|
|
|
|
*/
|
|
|
|
public static boolean DEBUG_SENSITIVE = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Can create messages containing stack traces that can be forwarded
|
|
|
|
* to the development team.
|
|
|
|
*/
|
|
|
|
public static boolean ENABLE_ERROR_FOLDER = true;
|
|
|
|
public static String ERROR_FOLDER_NAME = "K9mail-errors";
|
2010-01-02 20:50:51 -05:00
|
|
|
|
2012-12-01 02:02:55 -05:00
|
|
|
/**
|
|
|
|
* A reference to the {@link SharedPreferences} used for caching the last known database
|
|
|
|
* version.
|
|
|
|
*
|
|
|
|
* @see #checkCachedDatabaseVersion()
|
|
|
|
* @see #setDatabasesUpToDate(boolean)
|
|
|
|
*/
|
|
|
|
private static SharedPreferences sDatabaseVersionCache;
|
|
|
|
|
2013-06-08 20:36:12 -04:00
|
|
|
/**
|
|
|
|
* {@code true} if this is a debuggable build.
|
|
|
|
*/
|
|
|
|
private static boolean sIsDebuggable;
|
2012-12-01 02:02:55 -05:00
|
|
|
|
2009-12-26 19:54:19 -05:00
|
|
|
private static boolean mAnimations = true;
|
2009-12-14 21:50:53 -05:00
|
|
|
|
2010-09-01 16:59:09 -04:00
|
|
|
private static boolean mConfirmDelete = false;
|
2011-11-15 01:28:41 -05:00
|
|
|
private static boolean mConfirmDeleteStarred = false;
|
2011-03-31 17:34:09 -04:00
|
|
|
private static boolean mConfirmSpam = false;
|
2013-01-04 02:24:03 -05:00
|
|
|
private static boolean mConfirmDeleteFromNotification = true;
|
2012-08-01 20:31:54 -04:00
|
|
|
|
|
|
|
private static NotificationHideSubject sNotificationHideSubject = NotificationHideSubject.NEVER;
|
|
|
|
|
2012-08-01 19:41:40 -04:00
|
|
|
/**
|
2012-08-01 20:31:54 -04:00
|
|
|
* Controls when to hide the subject in the notification area.
|
2012-08-01 19:41:40 -04:00
|
|
|
*/
|
|
|
|
public enum NotificationHideSubject {
|
|
|
|
ALWAYS,
|
|
|
|
WHEN_LOCKED,
|
|
|
|
NEVER
|
|
|
|
}
|
2010-01-09 18:02:40 -05:00
|
|
|
|
2013-01-04 02:24:03 -05:00
|
|
|
private static NotificationQuickDelete sNotificationQuickDelete = NotificationQuickDelete.NEVER;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Controls behaviour of delete button in notifications.
|
|
|
|
*/
|
|
|
|
public enum NotificationQuickDelete {
|
|
|
|
ALWAYS,
|
|
|
|
FOR_SINGLE_MSG,
|
|
|
|
NEVER
|
|
|
|
}
|
|
|
|
|
2013-01-24 14:30:07 -05:00
|
|
|
/**
|
|
|
|
* Controls when to use the message list split view.
|
|
|
|
*/
|
|
|
|
public enum SplitViewMode {
|
|
|
|
ALWAYS,
|
|
|
|
NEVER,
|
|
|
|
WHEN_IN_LANDSCAPE
|
|
|
|
}
|
|
|
|
|
2013-04-02 23:48:32 -04:00
|
|
|
private static boolean mMessageListCheckboxes = true;
|
2013-08-16 02:48:41 -04:00
|
|
|
private static boolean mMessageListStars = true;
|
2010-11-04 22:59:26 -04:00
|
|
|
private static int mMessageListPreviewLines = 2;
|
2010-06-06 17:33:33 -04:00
|
|
|
|
2011-01-22 19:55:46 -05:00
|
|
|
private static boolean mShowCorrespondentNames = true;
|
2012-09-24 19:11:21 -04:00
|
|
|
private static boolean mMessageListSenderAboveSubject = false;
|
2010-10-08 19:50:33 -04:00
|
|
|
private static boolean mShowContactName = false;
|
2010-10-08 20:38:52 -04:00
|
|
|
private static boolean mChangeContactNameColor = false;
|
|
|
|
private static int mContactNameColor = 0xff00008f;
|
2013-02-07 14:23:53 -05:00
|
|
|
private static boolean sShowContactPicture = true;
|
2010-06-06 17:33:33 -04:00
|
|
|
private static boolean mMessageViewFixedWidthFont = false;
|
2010-06-20 08:15:29 -04:00
|
|
|
private static boolean mMessageViewReturnToList = false;
|
2011-10-11 05:01:06 -04:00
|
|
|
private static boolean mMessageViewShowNext = false;
|
2010-06-06 17:33:33 -04:00
|
|
|
|
2010-03-07 18:43:27 -05:00
|
|
|
private static boolean mGesturesEnabled = true;
|
2010-08-29 22:15:59 -04:00
|
|
|
private static boolean mUseVolumeKeysForNavigation = false;
|
2010-09-03 17:41:32 -04:00
|
|
|
private static boolean mUseVolumeKeysForListNavigation = false;
|
2010-07-02 20:26:35 -04:00
|
|
|
private static boolean mStartIntegratedInbox = false;
|
2010-04-18 22:55:02 -04:00
|
|
|
private static boolean mMeasureAccounts = true;
|
|
|
|
private static boolean mCountSearchMessages = true;
|
2011-02-25 15:36:47 -05:00
|
|
|
private static boolean mHideSpecialAccounts = false;
|
2010-10-21 16:49:48 -04:00
|
|
|
private static boolean mMobileOptimizedLayout = false;
|
2013-04-04 17:11:17 -04:00
|
|
|
private static boolean mAutofitWidth;
|
2010-11-28 15:28:32 -05:00
|
|
|
private static boolean mQuietTimeEnabled = false;
|
|
|
|
private static String mQuietTimeStarts = null;
|
|
|
|
private static String mQuietTimeEnds = null;
|
2011-04-23 23:54:28 -04:00
|
|
|
private static String mAttachmentDefaultPath = "";
|
2012-11-26 17:50:43 -05:00
|
|
|
private static boolean mWrapFolderNames = false;
|
2011-02-06 17:09:48 -05:00
|
|
|
|
2010-05-02 14:24:33 -04:00
|
|
|
private static boolean useGalleryBugWorkaround = false;
|
|
|
|
private static boolean galleryBuggy;
|
|
|
|
|
2012-04-12 22:12:22 -04:00
|
|
|
private static SortType mSortType;
|
|
|
|
private static HashMap<SortType, Boolean> mSortAscending = new HashMap<SortType, Boolean>();
|
2010-02-07 22:23:41 -05:00
|
|
|
|
2012-10-02 16:56:06 -04:00
|
|
|
private static boolean sUseBackgroundAsUnreadIndicator = true;
|
2012-10-28 15:10:52 -04:00
|
|
|
private static boolean sThreadedViewEnabled = true;
|
2013-01-31 21:37:47 -05:00
|
|
|
private static SplitViewMode sSplitViewMode = SplitViewMode.NEVER;
|
2013-08-16 12:42:13 -04:00
|
|
|
private static boolean sColorizeMissingContactPictures = true;
|
2013-08-29 11:32:35 -04:00
|
|
|
|
2013-08-24 05:34:52 -04:00
|
|
|
private static boolean sMessageViewArchiveActionVisible = false;
|
|
|
|
private static boolean sMessageViewDeleteActionVisible = true;
|
|
|
|
private static boolean sMessageViewMoveActionVisible = false;
|
|
|
|
private static boolean sMessageViewCopyActionVisible = false;
|
|
|
|
private static boolean sMessageViewSpamActionVisible = false;
|
2013-08-29 11:32:35 -04:00
|
|
|
|
2012-10-28 15:10:52 -04:00
|
|
|
|
2012-12-01 02:02:55 -05:00
|
|
|
/**
|
|
|
|
* @see #areDatabasesUpToDate()
|
|
|
|
*/
|
|
|
|
private static boolean sDatabasesUpToDate = false;
|
|
|
|
|
2012-10-02 16:56:06 -04:00
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
/**
|
|
|
|
* The MIME type(s) of attachments we're willing to view.
|
|
|
|
*/
|
2011-02-06 17:09:48 -05:00
|
|
|
public static final String[] ACCEPTABLE_ATTACHMENT_VIEW_TYPES = new String[] {
|
2009-12-14 21:50:53 -05:00
|
|
|
"*/*",
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The MIME type(s) of attachments we're not willing to view.
|
|
|
|
*/
|
2011-02-06 17:09:48 -05:00
|
|
|
public static final String[] UNACCEPTABLE_ATTACHMENT_VIEW_TYPES = new String[] {
|
2009-12-14 21:50:53 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The MIME type(s) of attachments we're willing to download to SD.
|
|
|
|
*/
|
2011-02-06 17:09:48 -05:00
|
|
|
public static final String[] ACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES = new String[] {
|
2009-12-14 21:50:53 -05:00
|
|
|
"*/*",
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The MIME type(s) of attachments we're not willing to download to SD.
|
|
|
|
*/
|
2011-02-06 17:09:48 -05:00
|
|
|
public static final String[] UNACCEPTABLE_ATTACHMENT_DOWNLOAD_TYPES = new String[] {
|
2009-12-14 21:50:53 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* For use when displaying that no folder is selected
|
|
|
|
*/
|
|
|
|
public static final String FOLDER_NONE = "-NONE-";
|
|
|
|
|
|
|
|
public static final String LOCAL_UID_PREFIX = "K9LOCAL:";
|
|
|
|
|
|
|
|
public static final String REMOTE_UID_PREFIX = "K9REMOTE:";
|
|
|
|
|
2011-01-12 18:48:28 -05:00
|
|
|
public static final String IDENTITY_HEADER = "X-K9mail-Identity";
|
2009-12-14 21:50:53 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Specifies how many messages will be shown in a folder by default. This number is set
|
|
|
|
* on each new folder and can be incremented with "Load more messages..." by the
|
|
|
|
* VISIBLE_LIMIT_INCREMENT
|
|
|
|
*/
|
|
|
|
public static int DEFAULT_VISIBLE_LIMIT = 25;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The maximum size of an attachment we're willing to download (either View or Save)
|
|
|
|
* Attachments that are base64 encoded (most) will be about 1.375x their actual size
|
|
|
|
* so we should probably factor that in. A 5MB attachment will generally be around
|
|
|
|
* 6.8MB downloaded but only 5MB saved.
|
|
|
|
*/
|
2010-07-18 21:55:09 -04:00
|
|
|
public static final int MAX_ATTACHMENT_DOWNLOAD_SIZE = (128 * 1024 * 1024);
|
2009-12-14 21:50:53 -05:00
|
|
|
|
2011-03-09 22:42:54 -05:00
|
|
|
|
|
|
|
/* How many times should K-9 try to deliver a message before giving up
|
|
|
|
* until the app is killed and restarted
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static int MAX_SEND_ATTEMPTS = 5;
|
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
/**
|
|
|
|
* Max time (in millis) the wake lock will be held for when background sync is happening
|
|
|
|
*/
|
|
|
|
public static final int WAKE_LOCK_TIMEOUT = 600000;
|
|
|
|
|
|
|
|
public static final int MANUAL_WAKE_LOCK_TIMEOUT = 120000;
|
|
|
|
|
|
|
|
public static final int PUSH_WAKE_LOCK_TIMEOUT = 60000;
|
|
|
|
|
2011-10-28 23:08:37 -04:00
|
|
|
public static final int MAIL_SERVICE_WAKE_LOCK_TIMEOUT = 60000;
|
2009-12-14 21:50:53 -05:00
|
|
|
|
|
|
|
public static final int BOOT_RECEIVER_WAKE_LOCK_TIMEOUT = 60000;
|
|
|
|
|
|
|
|
/**
|
2010-11-28 16:48:25 -05:00
|
|
|
* Time the LED is on/off when blinking on new email notification
|
2009-12-14 21:50:53 -05:00
|
|
|
*/
|
|
|
|
public static final int NOTIFICATION_LED_ON_TIME = 500;
|
|
|
|
public static final int NOTIFICATION_LED_OFF_TIME = 2000;
|
|
|
|
|
|
|
|
public static final boolean NOTIFICATION_LED_WHILE_SYNCING = false;
|
|
|
|
public static final int NOTIFICATION_LED_FAST_ON_TIME = 100;
|
|
|
|
public static final int NOTIFICATION_LED_FAST_OFF_TIME = 100;
|
|
|
|
|
2010-11-28 16:48:25 -05:00
|
|
|
|
|
|
|
public static final int NOTIFICATION_LED_BLINK_SLOW = 0;
|
|
|
|
public static final int NOTIFICATION_LED_BLINK_FAST = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-08 18:16:26 -05:00
|
|
|
public static final int NOTIFICATION_LED_FAILURE_COLOR = 0xffff0000;
|
2009-12-14 21:50:53 -05:00
|
|
|
|
|
|
|
// Must not conflict with an account number
|
2010-05-11 23:06:11 -04:00
|
|
|
public static final int FETCHING_EMAIL_NOTIFICATION = -5000;
|
2010-12-18 20:30:03 -05:00
|
|
|
public static final int SEND_FAILED_NOTIFICATION = -1500;
|
2013-01-17 09:24:22 -05:00
|
|
|
public static final int CERTIFICATE_EXCEPTION_NOTIFICATION_INCOMING = -2000;
|
|
|
|
public static final int CERTIFICATE_EXCEPTION_NOTIFICATION_OUTGOING = -2500;
|
2009-12-14 21:50:53 -05:00
|
|
|
public static final int CONNECTIVITY_ID = -3;
|
|
|
|
|
2010-01-13 20:07:28 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static class Intents {
|
2009-12-14 21:50:53 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static class EmailReceived {
|
2009-12-14 21:50:53 -05:00
|
|
|
public static final String ACTION_EMAIL_RECEIVED = "com.fsck.k9.intent.action.EMAIL_RECEIVED";
|
|
|
|
public static final String ACTION_EMAIL_DELETED = "com.fsck.k9.intent.action.EMAIL_DELETED";
|
2010-08-17 22:49:13 -04:00
|
|
|
public static final String ACTION_REFRESH_OBSERVER = "com.fsck.k9.intent.action.REFRESH_OBSERVER";
|
2009-12-14 21:50:53 -05:00
|
|
|
public static final String EXTRA_ACCOUNT = "com.fsck.k9.intent.extra.ACCOUNT";
|
|
|
|
public static final String EXTRA_FOLDER = "com.fsck.k9.intent.extra.FOLDER";
|
|
|
|
public static final String EXTRA_SENT_DATE = "com.fsck.k9.intent.extra.SENT_DATE";
|
|
|
|
public static final String EXTRA_FROM = "com.fsck.k9.intent.extra.FROM";
|
|
|
|
public static final String EXTRA_TO = "com.fsck.k9.intent.extra.TO";
|
|
|
|
public static final String EXTRA_CC = "com.fsck.k9.intent.extra.CC";
|
|
|
|
public static final String EXTRA_BCC = "com.fsck.k9.intent.extra.BCC";
|
|
|
|
public static final String EXTRA_SUBJECT = "com.fsck.k9.intent.extra.SUBJECT";
|
|
|
|
public static final String EXTRA_FROM_SELF = "com.fsck.k9.intent.extra.FROM_SELF";
|
|
|
|
}
|
|
|
|
|
2011-02-12 23:23:18 -05:00
|
|
|
public static class Share {
|
|
|
|
/*
|
|
|
|
* We don't want to use EmailReceived.EXTRA_FROM ("com.fsck.k9.intent.extra.FROM")
|
|
|
|
* because of different semantics (String array vs. string with comma separated
|
|
|
|
* email addresses)
|
|
|
|
*/
|
|
|
|
public static final String EXTRA_FROM = "com.fsck.k9.intent.extra.SENDER";
|
|
|
|
}
|
2009-12-14 21:50:53 -05:00
|
|
|
}
|
2008-12-18 19:14:49 -05:00
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
/**
|
|
|
|
* Called throughout the application when the number of accounts has changed. This method
|
|
|
|
* enables or disables the Compose activity, the boot receiver and the service based on
|
|
|
|
* whether any accounts are configured.
|
|
|
|
*/
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setServicesEnabled(Context context) {
|
2010-11-13 16:40:56 -05:00
|
|
|
int acctLength = Preferences.getPreferences(context).getAvailableAccounts().size();
|
2009-12-14 21:50:53 -05:00
|
|
|
|
|
|
|
setServicesEnabled(context, acctLength > 0, null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-03-10 00:04:05 -05:00
|
|
|
private static void setServicesEnabled(Context context, boolean enabled, Integer wakeLockId) {
|
2009-12-14 21:50:53 -05:00
|
|
|
|
|
|
|
PackageManager pm = context.getPackageManager();
|
|
|
|
|
|
|
|
if (!enabled && pm.getComponentEnabledSetting(new ComponentName(context, MailService.class)) ==
|
2011-02-06 17:09:48 -05:00
|
|
|
PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
|
2009-12-14 21:50:53 -05:00
|
|
|
/*
|
|
|
|
* If no accounts now exist but the service is still enabled we're about to disable it
|
|
|
|
* so we'll reschedule to kill off any existing alarms.
|
|
|
|
*/
|
2010-02-07 16:23:33 -05:00
|
|
|
MailService.actionReset(context, wakeLockId);
|
2009-12-14 21:50:53 -05:00
|
|
|
}
|
2010-04-16 08:20:10 -04:00
|
|
|
Class<?>[] classes = { MessageCompose.class, BootReceiver.class, MailService.class };
|
2009-12-14 21:50:53 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
for (Class<?> clazz : classes) {
|
2009-12-14 21:50:53 -05:00
|
|
|
|
|
|
|
boolean alreadyEnabled = pm.getComponentEnabledSetting(new ComponentName(context, clazz)) ==
|
|
|
|
PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
if (enabled != alreadyEnabled) {
|
2009-12-14 21:50:53 -05:00
|
|
|
pm.setComponentEnabledSetting(
|
|
|
|
new ComponentName(context, clazz),
|
|
|
|
enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED :
|
|
|
|
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
|
|
|
|
PackageManager.DONT_KILL_APP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (enabled && pm.getComponentEnabledSetting(new ComponentName(context, MailService.class)) ==
|
2011-02-06 17:09:48 -05:00
|
|
|
PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
|
2009-12-14 21:50:53 -05:00
|
|
|
/*
|
|
|
|
* And now if accounts do exist then we've just enabled the service and we want to
|
|
|
|
* schedule alarms for the new accounts.
|
|
|
|
*/
|
2010-02-07 16:23:33 -05:00
|
|
|
MailService.actionReset(context, wakeLockId);
|
2009-12-14 21:50:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-11-13 16:40:56 -05:00
|
|
|
/**
|
|
|
|
* Register BroadcastReceivers programmaticaly because doing it from manifest
|
|
|
|
* would make K-9 auto-start. We don't want auto-start because the initialization
|
|
|
|
* sequence isn't safe while some events occur (SD card unmount).
|
|
|
|
*/
|
2011-02-06 17:09:48 -05:00
|
|
|
protected void registerReceivers() {
|
2010-11-13 16:40:56 -05:00
|
|
|
final StorageGoneReceiver receiver = new StorageGoneReceiver();
|
|
|
|
final IntentFilter filter = new IntentFilter();
|
|
|
|
filter.addAction(Intent.ACTION_MEDIA_EJECT);
|
|
|
|
filter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
|
|
|
|
filter.addDataScheme("file");
|
|
|
|
|
|
|
|
final BlockingQueue<Handler> queue = new SynchronousQueue<Handler>();
|
|
|
|
|
|
|
|
// starting a new thread to handle unmount events
|
2011-02-06 17:09:48 -05:00
|
|
|
new Thread(new Runnable() {
|
2010-11-13 16:40:56 -05:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void run() {
|
2010-11-13 16:40:56 -05:00
|
|
|
Looper.prepare();
|
2011-02-06 17:09:48 -05:00
|
|
|
try {
|
2010-11-13 16:40:56 -05:00
|
|
|
queue.put(new Handler());
|
2011-02-06 17:09:48 -05:00
|
|
|
} catch (InterruptedException e) {
|
2010-11-13 16:40:56 -05:00
|
|
|
Log.e(K9.LOG_TAG, "", e);
|
|
|
|
}
|
|
|
|
Looper.loop();
|
|
|
|
}
|
|
|
|
|
|
|
|
}, "Unmount-thread").start();
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
try {
|
2010-11-13 16:40:56 -05:00
|
|
|
final Handler storageGoneHandler = queue.take();
|
|
|
|
registerReceiver(receiver, filter, null, storageGoneHandler);
|
|
|
|
Log.i(K9.LOG_TAG, "Registered: unmount receiver");
|
2011-02-06 17:09:48 -05:00
|
|
|
} catch (InterruptedException e) {
|
2010-11-13 16:40:56 -05:00
|
|
|
Log.e(K9.LOG_TAG, "Unable to register unmount receiver", e);
|
|
|
|
}
|
|
|
|
|
|
|
|
registerReceiver(new ShutdownReceiver(), new IntentFilter(Intent.ACTION_SHUTDOWN));
|
|
|
|
Log.i(K9.LOG_TAG, "Registered: shutdown receiver");
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void save(SharedPreferences.Editor editor) {
|
2009-12-14 21:50:53 -05:00
|
|
|
editor.putBoolean("enableDebugLogging", K9.DEBUG);
|
|
|
|
editor.putBoolean("enableSensitiveLogging", K9.DEBUG_SENSITIVE);
|
|
|
|
editor.putString("backgroundOperations", K9.backgroundOps.toString());
|
2009-12-26 19:54:19 -05:00
|
|
|
editor.putBoolean("animations", mAnimations);
|
2010-03-07 18:43:27 -05:00
|
|
|
editor.putBoolean("gesturesEnabled", mGesturesEnabled);
|
2010-08-29 22:15:59 -04:00
|
|
|
editor.putBoolean("useVolumeKeysForNavigation", mUseVolumeKeysForNavigation);
|
2010-09-03 17:41:32 -04:00
|
|
|
editor.putBoolean("useVolumeKeysForListNavigation", mUseVolumeKeysForListNavigation);
|
2010-10-11 10:54:15 -04:00
|
|
|
editor.putBoolean("mobileOptimizedLayout", mMobileOptimizedLayout);
|
2013-04-04 17:11:17 -04:00
|
|
|
editor.putBoolean("autofitWidth", mAutofitWidth);
|
2010-11-28 15:28:32 -05:00
|
|
|
editor.putBoolean("quietTimeEnabled", mQuietTimeEnabled);
|
|
|
|
editor.putString("quietTimeStarts", mQuietTimeStarts);
|
|
|
|
editor.putString("quietTimeEnds", mQuietTimeEnds);
|
2010-10-11 10:54:15 -04:00
|
|
|
|
2010-07-02 20:26:35 -04:00
|
|
|
editor.putBoolean("startIntegratedInbox", mStartIntegratedInbox);
|
2010-04-18 22:55:02 -04:00
|
|
|
editor.putBoolean("measureAccounts", mMeasureAccounts);
|
|
|
|
editor.putBoolean("countSearchMessages", mCountSearchMessages);
|
2012-09-24 19:11:21 -04:00
|
|
|
editor.putBoolean("messageListSenderAboveSubject", mMessageListSenderAboveSubject);
|
2011-02-25 15:36:47 -05:00
|
|
|
editor.putBoolean("hideSpecialAccounts", mHideSpecialAccounts);
|
2013-08-16 02:48:41 -04:00
|
|
|
editor.putBoolean("messageListStars", mMessageListStars);
|
2011-02-06 17:09:48 -05:00
|
|
|
editor.putInt("messageListPreviewLines", mMessageListPreviewLines);
|
2012-10-09 18:22:00 -04:00
|
|
|
editor.putBoolean("messageListCheckboxes", mMessageListCheckboxes);
|
2011-02-06 17:09:48 -05:00
|
|
|
editor.putBoolean("showCorrespondentNames", mShowCorrespondentNames);
|
|
|
|
editor.putBoolean("showContactName", mShowContactName);
|
2013-02-07 14:23:53 -05:00
|
|
|
editor.putBoolean("showContactPicture", sShowContactPicture);
|
2011-02-06 17:09:48 -05:00
|
|
|
editor.putBoolean("changeRegisteredNameColor", mChangeContactNameColor);
|
|
|
|
editor.putInt("registeredNameColor", mContactNameColor);
|
|
|
|
editor.putBoolean("messageViewFixedWidthFont", mMessageViewFixedWidthFont);
|
2010-06-20 08:15:29 -04:00
|
|
|
editor.putBoolean("messageViewReturnToList", mMessageViewReturnToList);
|
2011-10-11 05:01:06 -04:00
|
|
|
editor.putBoolean("messageViewShowNext", mMessageViewShowNext);
|
2012-11-26 17:50:43 -05:00
|
|
|
editor.putBoolean("wrapFolderNames", mWrapFolderNames);
|
2010-06-06 17:33:33 -04:00
|
|
|
|
2010-07-08 20:27:47 -04:00
|
|
|
editor.putString("language", language);
|
2013-02-06 14:08:57 -05:00
|
|
|
editor.putInt("theme", theme.ordinal());
|
|
|
|
editor.putInt("messageViewTheme", messageViewTheme.ordinal());
|
|
|
|
editor.putInt("messageComposeTheme", composerTheme.ordinal());
|
2013-02-06 03:47:16 -05:00
|
|
|
editor.putBoolean("fixedMessageViewTheme", useFixedMessageTheme);
|
2010-05-02 14:24:33 -04:00
|
|
|
editor.putBoolean("useGalleryBugWorkaround", useGalleryBugWorkaround);
|
2010-04-20 12:37:03 -04:00
|
|
|
|
2010-09-01 16:59:09 -04:00
|
|
|
editor.putBoolean("confirmDelete", mConfirmDelete);
|
2011-11-15 01:28:41 -05:00
|
|
|
editor.putBoolean("confirmDeleteStarred", mConfirmDeleteStarred);
|
2011-03-31 17:34:09 -04:00
|
|
|
editor.putBoolean("confirmSpam", mConfirmSpam);
|
2013-01-04 02:24:03 -05:00
|
|
|
editor.putBoolean("confirmDeleteFromNotification", mConfirmDeleteFromNotification);
|
2010-09-01 16:59:09 -04:00
|
|
|
|
2012-05-16 14:35:55 -04:00
|
|
|
editor.putString("sortTypeEnum", mSortType.name());
|
|
|
|
editor.putBoolean("sortAscending", mSortAscending.get(mSortType));
|
|
|
|
|
2012-08-01 20:31:54 -04:00
|
|
|
editor.putString("notificationHideSubject", sNotificationHideSubject.toString());
|
2013-01-04 02:24:03 -05:00
|
|
|
editor.putString("notificationQuickDelete", sNotificationQuickDelete.toString());
|
2011-02-06 17:09:48 -05:00
|
|
|
|
2011-04-23 23:54:28 -04:00
|
|
|
editor.putString("attachmentdefaultpath", mAttachmentDefaultPath);
|
2012-10-02 16:56:06 -04:00
|
|
|
editor.putBoolean("useBackgroundAsUnreadIndicator", sUseBackgroundAsUnreadIndicator);
|
2012-10-28 15:10:52 -04:00
|
|
|
editor.putBoolean("threadedView", sThreadedViewEnabled);
|
2013-01-24 14:30:07 -05:00
|
|
|
editor.putString("splitViewMode", sSplitViewMode.name());
|
2013-08-16 12:42:13 -04:00
|
|
|
editor.putBoolean("colorizeMissingContactPictures", sColorizeMissingContactPictures);
|
2013-08-29 11:32:35 -04:00
|
|
|
|
2013-08-24 05:34:52 -04:00
|
|
|
editor.putBoolean("messageViewArchiveActionVisible", sMessageViewArchiveActionVisible);
|
|
|
|
editor.putBoolean("messageViewDeleteActionVisible", sMessageViewDeleteActionVisible);
|
|
|
|
editor.putBoolean("messageViewMoveActionVisible", sMessageViewMoveActionVisible);
|
|
|
|
editor.putBoolean("messageViewCopyActionVisible", sMessageViewCopyActionVisible);
|
|
|
|
editor.putBoolean("messageViewSpamActionVisible", sMessageViewSpamActionVisible);
|
2013-08-29 11:32:35 -04:00
|
|
|
|
2010-04-20 12:37:03 -04:00
|
|
|
fontSizes.save(editor);
|
2009-12-14 21:50:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void onCreate() {
|
2014-01-09 12:33:43 -05:00
|
|
|
if (K9.DEVELOPER_MODE) {
|
|
|
|
StrictMode.enableDefaults();
|
|
|
|
}
|
|
|
|
|
2013-08-16 13:49:30 -04:00
|
|
|
PRNGFixes.apply();
|
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
super.onCreate();
|
|
|
|
app = this;
|
2010-05-02 14:24:33 -04:00
|
|
|
|
|
|
|
galleryBuggy = checkForBuggyGallery();
|
|
|
|
|
2013-06-08 20:36:12 -04:00
|
|
|
sIsDebuggable = ((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0);
|
|
|
|
|
2012-12-01 02:02:55 -05:00
|
|
|
checkCachedDatabaseVersion();
|
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
Preferences prefs = Preferences.getPreferences(this);
|
2011-10-14 14:33:25 -04:00
|
|
|
loadPrefs(prefs);
|
2009-12-14 21:50:53 -05:00
|
|
|
|
|
|
|
/*
|
|
|
|
* We have to give MimeMessage a temp directory because File.createTempFile(String, String)
|
|
|
|
* doesn't work in Android and MimeMessage does not have access to a Context.
|
|
|
|
*/
|
|
|
|
BinaryTempFileBody.setTempDirectory(getCacheDir());
|
|
|
|
|
2013-12-03 19:20:20 -05:00
|
|
|
LocalKeyStore.setKeyStoreLocation(getDir("KeyStore", MODE_PRIVATE).toString());
|
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
/*
|
|
|
|
* Enable background sync of messages
|
|
|
|
*/
|
|
|
|
|
|
|
|
setServicesEnabled(this);
|
2010-11-13 16:40:56 -05:00
|
|
|
registerReceivers();
|
2009-12-14 21:50:53 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
MessagingController.getInstance(this).addListener(new MessagingListener() {
|
|
|
|
private void broadcastIntent(String action, Account account, String folder, Message message) {
|
|
|
|
try {
|
2009-12-14 21:50:53 -05:00
|
|
|
Uri uri = Uri.parse("email://messages/" + account.getAccountNumber() + "/" + Uri.encode(folder) + "/" + Uri.encode(message.getUid()));
|
|
|
|
Intent intent = new Intent(action, uri);
|
|
|
|
intent.putExtra(K9.Intents.EmailReceived.EXTRA_ACCOUNT, account.getDescription());
|
|
|
|
intent.putExtra(K9.Intents.EmailReceived.EXTRA_FOLDER, folder);
|
|
|
|
intent.putExtra(K9.Intents.EmailReceived.EXTRA_SENT_DATE, message.getSentDate());
|
|
|
|
intent.putExtra(K9.Intents.EmailReceived.EXTRA_FROM, Address.toString(message.getFrom()));
|
|
|
|
intent.putExtra(K9.Intents.EmailReceived.EXTRA_TO, Address.toString(message.getRecipients(Message.RecipientType.TO)));
|
|
|
|
intent.putExtra(K9.Intents.EmailReceived.EXTRA_CC, Address.toString(message.getRecipients(Message.RecipientType.CC)));
|
|
|
|
intent.putExtra(K9.Intents.EmailReceived.EXTRA_BCC, Address.toString(message.getRecipients(Message.RecipientType.BCC)));
|
|
|
|
intent.putExtra(K9.Intents.EmailReceived.EXTRA_SUBJECT, message.getSubject());
|
|
|
|
intent.putExtra(K9.Intents.EmailReceived.EXTRA_FROM_SELF, account.isAnIdentity(message.getFrom()));
|
|
|
|
K9.this.sendBroadcast(intent);
|
2010-01-02 20:50:41 -05:00
|
|
|
if (K9.DEBUG)
|
|
|
|
Log.d(K9.LOG_TAG, "Broadcasted: action=" + action
|
|
|
|
+ " account=" + account.getDescription()
|
|
|
|
+ " folder=" + folder
|
|
|
|
+ " message uid=" + message.getUid()
|
|
|
|
);
|
2009-12-14 21:50:53 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
} catch (MessagingException e) {
|
2009-12-14 21:50:53 -05:00
|
|
|
Log.w(K9.LOG_TAG, "Error: action=" + action
|
2009-12-20 00:41:43 -05:00
|
|
|
+ " account=" + account.getDescription()
|
|
|
|
+ " folder=" + folder
|
|
|
|
+ " message uid=" + message.getUid()
|
|
|
|
);
|
2009-12-14 21:50:53 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-07 10:32:13 -05:00
|
|
|
private void updateUnreadWidget() {
|
|
|
|
try {
|
|
|
|
UnreadWidgetProvider.updateUnreadCount(K9.this);
|
|
|
|
} catch (Exception e) {
|
|
|
|
if (K9.DEBUG) {
|
|
|
|
Log.e(LOG_TAG, "Error while updating unread widget(s)", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void synchronizeMailboxRemovedMessage(Account account, String folder, Message message) {
|
2009-12-14 21:50:53 -05:00
|
|
|
broadcastIntent(K9.Intents.EmailReceived.ACTION_EMAIL_DELETED, account, folder, message);
|
2012-02-07 10:32:13 -05:00
|
|
|
updateUnreadWidget();
|
2009-12-14 21:50:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void messageDeleted(Account account, String folder, Message message) {
|
2009-12-14 21:50:53 -05:00
|
|
|
broadcastIntent(K9.Intents.EmailReceived.ACTION_EMAIL_DELETED, account, folder, message);
|
2012-02-07 10:32:13 -05:00
|
|
|
updateUnreadWidget();
|
2009-12-14 21:50:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void synchronizeMailboxNewMessage(Account account, String folder, Message message) {
|
2009-12-14 21:50:53 -05:00
|
|
|
broadcastIntent(K9.Intents.EmailReceived.ACTION_EMAIL_RECEIVED, account, folder, message);
|
2012-02-07 10:32:13 -05:00
|
|
|
updateUnreadWidget();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void folderStatusChanged(Account account, String folderName,
|
|
|
|
int unreadMessageCount) {
|
2012-09-10 11:52:29 -04:00
|
|
|
|
2012-08-17 10:29:35 -04:00
|
|
|
updateUnreadWidget();
|
2012-09-10 11:52:29 -04:00
|
|
|
|
|
|
|
// let observers know a change occurred
|
2012-08-17 10:18:00 -04:00
|
|
|
Intent intent = new Intent(K9.Intents.EmailReceived.ACTION_REFRESH_OBSERVER, null);
|
|
|
|
intent.putExtra(K9.Intents.EmailReceived.EXTRA_ACCOUNT, account.getDescription());
|
|
|
|
intent.putExtra(K9.Intents.EmailReceived.EXTRA_FOLDER, folderName);
|
|
|
|
K9.this.sendBroadcast(intent);
|
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
}
|
2009-12-20 00:41:43 -05:00
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
});
|
|
|
|
|
2010-10-01 15:41:39 -04:00
|
|
|
notifyObservers();
|
|
|
|
}
|
|
|
|
|
2012-12-01 02:02:55 -05:00
|
|
|
/**
|
|
|
|
* Loads the last known database version of the accounts' databases from a
|
|
|
|
* {@link SharedPreference}.
|
|
|
|
*
|
|
|
|
* <p>
|
|
|
|
* If the stored version matches {@link LocalStore#DB_VERSION} we know that the databases are
|
|
|
|
* up to date.<br>
|
|
|
|
* Using {@code SharedPreferences} should be a lot faster than opening all SQLite databases to
|
|
|
|
* get the current database version.
|
|
|
|
* </p><p>
|
|
|
|
* See {@link UpgradeDatabases} for a detailed explanation of the database upgrade process.
|
|
|
|
* </p>
|
|
|
|
*
|
|
|
|
* @see #areDatabasesUpToDate()
|
|
|
|
*/
|
|
|
|
public void checkCachedDatabaseVersion() {
|
|
|
|
sDatabaseVersionCache = getSharedPreferences(DATABASE_VERSION_CACHE, MODE_PRIVATE);
|
|
|
|
|
|
|
|
int cachedVersion = sDatabaseVersionCache.getInt(KEY_LAST_ACCOUNT_DATABASE_VERSION, 0);
|
|
|
|
|
2013-01-14 03:32:43 -05:00
|
|
|
if (cachedVersion >= LocalStore.DB_VERSION) {
|
2012-12-01 02:02:55 -05:00
|
|
|
K9.setDatabasesUpToDate(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-14 14:33:25 -04:00
|
|
|
public static void loadPrefs(Preferences prefs) {
|
|
|
|
SharedPreferences sprefs = prefs.getPreferences();
|
2012-10-16 16:48:31 -04:00
|
|
|
DEBUG = sprefs.getBoolean("enableDebugLogging", false);
|
2013-06-08 20:36:12 -04:00
|
|
|
if (!DEBUG && sIsDebuggable && Debug.isDebuggerConnected()) {
|
2012-12-21 21:00:42 -05:00
|
|
|
// If the debugger is attached, we're probably (surprise surprise) debugging something.
|
|
|
|
DEBUG = true;
|
|
|
|
Log.i(K9.LOG_TAG, "Debugger attached; enabling debug logging.");
|
|
|
|
}
|
2012-10-16 16:48:31 -04:00
|
|
|
DEBUG_SENSITIVE = sprefs.getBoolean("enableSensitiveLogging", false);
|
2011-10-14 14:33:25 -04:00
|
|
|
mAnimations = sprefs.getBoolean("animations", true);
|
2012-01-05 15:25:24 -05:00
|
|
|
mGesturesEnabled = sprefs.getBoolean("gesturesEnabled", false);
|
2011-10-14 14:33:25 -04:00
|
|
|
mUseVolumeKeysForNavigation = sprefs.getBoolean("useVolumeKeysForNavigation", false);
|
|
|
|
mUseVolumeKeysForListNavigation = sprefs.getBoolean("useVolumeKeysForListNavigation", false);
|
|
|
|
mStartIntegratedInbox = sprefs.getBoolean("startIntegratedInbox", false);
|
|
|
|
mMeasureAccounts = sprefs.getBoolean("measureAccounts", true);
|
|
|
|
mCountSearchMessages = sprefs.getBoolean("countSearchMessages", true);
|
|
|
|
mHideSpecialAccounts = sprefs.getBoolean("hideSpecialAccounts", false);
|
2012-09-24 19:11:21 -04:00
|
|
|
mMessageListSenderAboveSubject = sprefs.getBoolean("messageListSenderAboveSubject", false);
|
2013-08-16 16:01:35 -04:00
|
|
|
mMessageListCheckboxes = sprefs.getBoolean("messageListCheckboxes", false);
|
2013-08-16 02:48:41 -04:00
|
|
|
mMessageListStars = sprefs.getBoolean("messageListStars", true);
|
2011-10-14 14:33:25 -04:00
|
|
|
mMessageListPreviewLines = sprefs.getInt("messageListPreviewLines", 2);
|
|
|
|
|
|
|
|
mMobileOptimizedLayout = sprefs.getBoolean("mobileOptimizedLayout", false);
|
2013-04-04 17:11:17 -04:00
|
|
|
mAutofitWidth = sprefs.getBoolean("autofitWidth", true);
|
2011-10-14 14:33:25 -04:00
|
|
|
|
|
|
|
mQuietTimeEnabled = sprefs.getBoolean("quietTimeEnabled", false);
|
|
|
|
mQuietTimeStarts = sprefs.getString("quietTimeStarts", "21:00");
|
|
|
|
mQuietTimeEnds = sprefs.getString("quietTimeEnds", "7:00");
|
|
|
|
|
|
|
|
mShowCorrespondentNames = sprefs.getBoolean("showCorrespondentNames", true);
|
|
|
|
mShowContactName = sprefs.getBoolean("showContactName", false);
|
2013-02-07 14:23:53 -05:00
|
|
|
sShowContactPicture = sprefs.getBoolean("showContactPicture", true);
|
2011-10-14 14:33:25 -04:00
|
|
|
mChangeContactNameColor = sprefs.getBoolean("changeRegisteredNameColor", false);
|
|
|
|
mContactNameColor = sprefs.getInt("registeredNameColor", 0xff00008f);
|
|
|
|
mMessageViewFixedWidthFont = sprefs.getBoolean("messageViewFixedWidthFont", false);
|
|
|
|
mMessageViewReturnToList = sprefs.getBoolean("messageViewReturnToList", false);
|
|
|
|
mMessageViewShowNext = sprefs.getBoolean("messageViewShowNext", false);
|
2012-11-26 17:50:43 -05:00
|
|
|
mWrapFolderNames = sprefs.getBoolean("wrapFolderNames", false);
|
2011-10-14 14:33:25 -04:00
|
|
|
|
|
|
|
useGalleryBugWorkaround = sprefs.getBoolean("useGalleryBugWorkaround", K9.isGalleryBuggy());
|
|
|
|
|
|
|
|
mConfirmDelete = sprefs.getBoolean("confirmDelete", false);
|
2011-11-15 01:28:41 -05:00
|
|
|
mConfirmDeleteStarred = sprefs.getBoolean("confirmDeleteStarred", false);
|
2011-10-14 14:33:25 -04:00
|
|
|
mConfirmSpam = sprefs.getBoolean("confirmSpam", false);
|
2013-01-04 02:24:03 -05:00
|
|
|
mConfirmDeleteFromNotification = sprefs.getBoolean("confirmDeleteFromNotification", true);
|
2011-10-14 14:33:25 -04:00
|
|
|
|
2012-05-16 14:35:55 -04:00
|
|
|
try {
|
|
|
|
String value = sprefs.getString("sortTypeEnum", Account.DEFAULT_SORT_TYPE.name());
|
|
|
|
mSortType = SortType.valueOf(value);
|
|
|
|
} catch (Exception e) {
|
|
|
|
mSortType = Account.DEFAULT_SORT_TYPE;
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean sortAscending = sprefs.getBoolean("sortAscending", Account.DEFAULT_SORT_ASCENDING);
|
|
|
|
mSortAscending.put(mSortType, sortAscending);
|
2011-10-14 14:33:25 -04:00
|
|
|
|
2012-08-01 21:09:26 -04:00
|
|
|
String notificationHideSubject = sprefs.getString("notificationHideSubject", null);
|
|
|
|
if (notificationHideSubject == null) {
|
|
|
|
// If the "notificationHideSubject" setting couldn't be found, the app was probably
|
|
|
|
// updated. Look for the old "keyguardPrivacy" setting and map it to the new enum.
|
|
|
|
sNotificationHideSubject = (sprefs.getBoolean("keyguardPrivacy", false)) ?
|
|
|
|
NotificationHideSubject.WHEN_LOCKED : NotificationHideSubject.NEVER;
|
|
|
|
} else {
|
|
|
|
sNotificationHideSubject = NotificationHideSubject.valueOf(notificationHideSubject);
|
|
|
|
}
|
2012-08-01 20:31:54 -04:00
|
|
|
|
2013-01-04 02:24:03 -05:00
|
|
|
String notificationQuickDelete = sprefs.getString("notificationQuickDelete", null);
|
|
|
|
if (notificationQuickDelete != null) {
|
|
|
|
sNotificationQuickDelete = NotificationQuickDelete.valueOf(notificationQuickDelete);
|
|
|
|
}
|
|
|
|
|
2013-01-24 14:30:07 -05:00
|
|
|
String splitViewMode = sprefs.getString("splitViewMode", null);
|
|
|
|
if (splitViewMode != null) {
|
|
|
|
sSplitViewMode = SplitViewMode.valueOf(splitViewMode);
|
|
|
|
}
|
|
|
|
|
2011-10-14 14:33:25 -04:00
|
|
|
mAttachmentDefaultPath = sprefs.getString("attachmentdefaultpath", Environment.getExternalStorageDirectory().toString());
|
2012-10-02 16:56:06 -04:00
|
|
|
sUseBackgroundAsUnreadIndicator = sprefs.getBoolean("useBackgroundAsUnreadIndicator", true);
|
2012-10-28 15:10:52 -04:00
|
|
|
sThreadedViewEnabled = sprefs.getBoolean("threadedView", true);
|
2011-10-14 14:33:25 -04:00
|
|
|
fontSizes.load(sprefs);
|
|
|
|
|
|
|
|
try {
|
|
|
|
setBackgroundOps(BACKGROUND_OPS.valueOf(sprefs.getString("backgroundOperations", "WHEN_CHECKED")));
|
|
|
|
} catch (Exception e) {
|
|
|
|
setBackgroundOps(BACKGROUND_OPS.WHEN_CHECKED);
|
|
|
|
}
|
|
|
|
|
2013-08-16 12:42:13 -04:00
|
|
|
sColorizeMissingContactPictures = sprefs.getBoolean("colorizeMissingContactPictures", true);
|
2013-08-29 11:32:35 -04:00
|
|
|
|
2013-08-24 05:34:52 -04:00
|
|
|
sMessageViewArchiveActionVisible = sprefs.getBoolean("messageViewArchiveActionVisible", false);
|
|
|
|
sMessageViewDeleteActionVisible = sprefs.getBoolean("messageViewDeleteActionVisible", true);
|
|
|
|
sMessageViewMoveActionVisible = sprefs.getBoolean("messageViewMoveActionVisible", false);
|
|
|
|
sMessageViewCopyActionVisible = sprefs.getBoolean("messageViewCopyActionVisible", false);
|
|
|
|
sMessageViewSpamActionVisible = sprefs.getBoolean("messageViewSpamActionVisible", false);
|
2013-08-29 11:32:35 -04:00
|
|
|
|
2013-08-16 12:42:13 -04:00
|
|
|
|
2011-10-14 14:33:25 -04:00
|
|
|
K9.setK9Language(sprefs.getString("language", ""));
|
2012-03-29 00:33:01 -04:00
|
|
|
|
2013-02-06 14:08:57 -05:00
|
|
|
int themeValue = sprefs.getInt("theme", Theme.LIGHT.ordinal());
|
2012-03-29 00:33:01 -04:00
|
|
|
// We used to save the resource ID of the theme. So convert that to the new format if
|
|
|
|
// necessary.
|
2013-02-06 14:08:57 -05:00
|
|
|
if (themeValue == Theme.DARK.ordinal() || themeValue == android.R.style.Theme) {
|
|
|
|
K9.setK9Theme(Theme.DARK);
|
2012-03-29 00:33:01 -04:00
|
|
|
} else {
|
2013-02-06 14:08:57 -05:00
|
|
|
K9.setK9Theme(Theme.LIGHT);
|
2012-03-29 00:33:01 -04:00
|
|
|
}
|
2012-09-13 20:25:39 -04:00
|
|
|
|
2013-02-06 14:08:57 -05:00
|
|
|
themeValue = sprefs.getInt("messageViewTheme", Theme.USE_GLOBAL.ordinal());
|
|
|
|
K9.setK9MessageViewThemeSetting(Theme.values()[themeValue]);
|
|
|
|
themeValue = sprefs.getInt("messageComposeTheme", Theme.USE_GLOBAL.ordinal());
|
|
|
|
K9.setK9ComposerThemeSetting(Theme.values()[themeValue]);
|
2013-02-06 03:47:16 -05:00
|
|
|
K9.setUseFixedMessageViewTheme(sprefs.getBoolean("fixedMessageViewTheme", true));
|
2011-10-14 14:33:25 -04:00
|
|
|
}
|
|
|
|
|
2010-10-01 15:41:39 -04:00
|
|
|
/**
|
|
|
|
* since Android invokes Application.onCreate() only after invoking all
|
|
|
|
* other components' onCreate(), here is a way to notify interested
|
|
|
|
* component that the application is available and ready
|
|
|
|
*/
|
2011-02-06 17:09:48 -05:00
|
|
|
protected void notifyObservers() {
|
2013-11-29 04:49:52 -05:00
|
|
|
synchronized (observers) {
|
|
|
|
for (final ApplicationAware aware : observers) {
|
|
|
|
if (K9.DEBUG) {
|
|
|
|
Log.v(K9.LOG_TAG, "Initializing observer: " + aware);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
aware.initializeComponent(this);
|
|
|
|
} catch (Exception e) {
|
|
|
|
Log.w(K9.LOG_TAG, "Failure when notifying " + aware, e);
|
|
|
|
}
|
2010-10-01 15:41:39 -04:00
|
|
|
}
|
2013-11-29 04:49:52 -05:00
|
|
|
|
|
|
|
sInitialized = true;
|
|
|
|
observers.clear();
|
2010-10-01 15:41:39 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register a component to be notified when the {@link K9} instance is ready.
|
2010-10-05 02:04:28 -04:00
|
|
|
*
|
2010-10-01 15:41:39 -04:00
|
|
|
* @param component
|
|
|
|
* Never <code>null</code>.
|
|
|
|
*/
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void registerApplicationAware(final ApplicationAware component) {
|
2013-11-29 04:49:52 -05:00
|
|
|
synchronized (observers) {
|
|
|
|
if (sInitialized) {
|
|
|
|
component.initializeComponent(K9.app);
|
|
|
|
} else if (!observers.contains(component)) {
|
|
|
|
observers.add(component);
|
|
|
|
}
|
2010-10-01 15:41:39 -04:00
|
|
|
}
|
2009-12-14 21:50:53 -05:00
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static String getK9Language() {
|
2010-07-08 20:27:47 -04:00
|
|
|
return language;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setK9Language(String nlanguage) {
|
2010-07-08 20:27:47 -04:00
|
|
|
language = nlanguage;
|
|
|
|
}
|
|
|
|
|
2013-02-07 10:55:42 -05:00
|
|
|
/**
|
|
|
|
* Possible values for the different theme settings.
|
|
|
|
*
|
|
|
|
* <p><strong>Important:</strong>
|
|
|
|
* Do not change the order of the items! The ordinal value (position) is used when saving the
|
|
|
|
* settings.</p>
|
|
|
|
*/
|
2013-02-06 14:08:57 -05:00
|
|
|
public enum Theme {
|
|
|
|
LIGHT,
|
|
|
|
DARK,
|
|
|
|
USE_GLOBAL
|
|
|
|
}
|
|
|
|
|
|
|
|
public static int getK9ThemeResourceId(Theme themeId) {
|
|
|
|
return (themeId == Theme.LIGHT) ? R.style.Theme_K9_Light : R.style.Theme_K9_Dark;
|
2012-03-29 00:33:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public static int getK9ThemeResourceId() {
|
|
|
|
return getK9ThemeResourceId(theme);
|
|
|
|
}
|
|
|
|
|
2013-02-06 14:08:57 -05:00
|
|
|
public static Theme getK9MessageViewTheme() {
|
|
|
|
return messageViewTheme == Theme.USE_GLOBAL ? theme : messageViewTheme;
|
2013-02-06 03:47:16 -05:00
|
|
|
}
|
|
|
|
|
2013-02-06 14:08:57 -05:00
|
|
|
public static Theme getK9MessageViewThemeSetting() {
|
2012-09-13 20:25:39 -04:00
|
|
|
return messageViewTheme;
|
|
|
|
}
|
|
|
|
|
2013-02-06 14:08:57 -05:00
|
|
|
public static Theme getK9ComposerTheme() {
|
|
|
|
return composerTheme == Theme.USE_GLOBAL ? theme : composerTheme;
|
2013-02-06 10:29:48 -05:00
|
|
|
}
|
|
|
|
|
2013-02-06 14:08:57 -05:00
|
|
|
public static Theme getK9ComposerThemeSetting() {
|
2013-02-06 10:29:48 -05:00
|
|
|
return composerTheme;
|
|
|
|
}
|
|
|
|
|
2013-02-06 14:08:57 -05:00
|
|
|
public static Theme getK9Theme() {
|
2009-12-14 21:50:53 -05:00
|
|
|
return theme;
|
|
|
|
}
|
|
|
|
|
2013-02-06 14:08:57 -05:00
|
|
|
public static void setK9Theme(Theme ntheme) {
|
|
|
|
if (ntheme != Theme.USE_GLOBAL) {
|
|
|
|
theme = ntheme;
|
|
|
|
}
|
2009-12-14 21:50:53 -05:00
|
|
|
}
|
|
|
|
|
2013-02-06 14:08:57 -05:00
|
|
|
public static void setK9MessageViewThemeSetting(Theme nMessageViewTheme) {
|
2012-09-13 20:25:39 -04:00
|
|
|
messageViewTheme = nMessageViewTheme;
|
|
|
|
}
|
|
|
|
|
2013-02-06 03:47:16 -05:00
|
|
|
public static boolean useFixedMessageViewTheme() {
|
|
|
|
return useFixedMessageTheme;
|
|
|
|
}
|
|
|
|
|
2013-02-06 14:08:57 -05:00
|
|
|
public static void setK9ComposerThemeSetting(Theme compTheme) {
|
2013-02-06 10:29:48 -05:00
|
|
|
composerTheme = compTheme;
|
|
|
|
}
|
|
|
|
|
2013-02-06 03:47:16 -05:00
|
|
|
public static void setUseFixedMessageViewTheme(boolean useFixed) {
|
|
|
|
useFixedMessageTheme = useFixed;
|
2013-02-06 14:08:57 -05:00
|
|
|
if (!useFixedMessageTheme && messageViewTheme == Theme.USE_GLOBAL) {
|
2013-02-06 03:47:16 -05:00
|
|
|
messageViewTheme = theme;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static BACKGROUND_OPS getBackgroundOps() {
|
2009-12-14 21:50:53 -05:00
|
|
|
return backgroundOps;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean setBackgroundOps(BACKGROUND_OPS backgroundOps) {
|
2010-02-07 16:23:33 -05:00
|
|
|
BACKGROUND_OPS oldBackgroundOps = K9.backgroundOps;
|
2009-12-14 21:50:53 -05:00
|
|
|
K9.backgroundOps = backgroundOps;
|
2010-02-07 16:23:33 -05:00
|
|
|
return backgroundOps != oldBackgroundOps;
|
2009-12-14 21:50:53 -05:00
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean setBackgroundOps(String nbackgroundOps) {
|
2010-02-07 16:23:33 -05:00
|
|
|
return setBackgroundOps(BACKGROUND_OPS.valueOf(nbackgroundOps));
|
2009-12-14 21:50:53 -05:00
|
|
|
}
|
2009-12-26 19:54:19 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean gesturesEnabled() {
|
2010-03-07 18:43:27 -05:00
|
|
|
return mGesturesEnabled;
|
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setGesturesEnabled(boolean gestures) {
|
2010-03-07 18:43:27 -05:00
|
|
|
mGesturesEnabled = gestures;
|
|
|
|
}
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean useVolumeKeysForNavigationEnabled() {
|
2010-08-29 22:15:59 -04:00
|
|
|
return mUseVolumeKeysForNavigation;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setUseVolumeKeysForNavigation(boolean volume) {
|
2010-08-29 22:15:59 -04:00
|
|
|
mUseVolumeKeysForNavigation = volume;
|
|
|
|
}
|
2010-05-30 00:16:44 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean useVolumeKeysForListNavigationEnabled() {
|
2010-09-03 17:41:32 -04:00
|
|
|
return mUseVolumeKeysForListNavigation;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setUseVolumeKeysForListNavigation(boolean enabled) {
|
2010-09-03 17:41:32 -04:00
|
|
|
mUseVolumeKeysForListNavigation = enabled;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean mobileOptimizedLayout() {
|
2010-10-11 10:54:15 -04:00
|
|
|
return mMobileOptimizedLayout;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setMobileOptimizedLayout(boolean mobileOptimizedLayout) {
|
2010-10-11 10:54:15 -04:00
|
|
|
mMobileOptimizedLayout = mobileOptimizedLayout;
|
|
|
|
}
|
|
|
|
|
2013-04-04 17:11:17 -04:00
|
|
|
public static boolean autofitWidth() {
|
|
|
|
return mAutofitWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setAutofitWidth(boolean autofitWidth) {
|
|
|
|
mAutofitWidth = autofitWidth;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean getQuietTimeEnabled() {
|
2010-11-28 15:28:37 -05:00
|
|
|
return mQuietTimeEnabled;
|
|
|
|
}
|
2010-11-28 15:28:32 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setQuietTimeEnabled(boolean quietTimeEnabled) {
|
2010-11-28 15:28:37 -05:00
|
|
|
mQuietTimeEnabled = quietTimeEnabled;
|
|
|
|
}
|
2010-11-28 15:28:32 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static String getQuietTimeStarts() {
|
2010-11-28 15:28:37 -05:00
|
|
|
return mQuietTimeStarts;
|
|
|
|
}
|
2010-10-11 10:54:15 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setQuietTimeStarts(String quietTimeStarts) {
|
2010-11-28 15:28:37 -05:00
|
|
|
mQuietTimeStarts = quietTimeStarts;
|
|
|
|
}
|
2010-10-11 10:54:15 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static String getQuietTimeEnds() {
|
2010-11-28 15:28:37 -05:00
|
|
|
return mQuietTimeEnds;
|
|
|
|
}
|
2010-10-11 10:54:15 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setQuietTimeEnds(String quietTimeEnds) {
|
2010-11-28 15:28:37 -05:00
|
|
|
mQuietTimeEnds = quietTimeEnds;
|
|
|
|
}
|
2010-10-11 10:54:15 -04:00
|
|
|
|
2010-11-28 21:21:16 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean isQuietTime() {
|
|
|
|
if (!mQuietTimeEnabled) {
|
2010-11-28 21:21:16 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Time time = new Time();
|
|
|
|
time.setToNow();
|
|
|
|
Integer startHour = Integer.parseInt(mQuietTimeStarts.split(":")[0]);
|
|
|
|
Integer startMinute = Integer.parseInt(mQuietTimeStarts.split(":")[1]);
|
|
|
|
Integer endHour = Integer.parseInt(mQuietTimeEnds.split(":")[0]);
|
|
|
|
Integer endMinute = Integer.parseInt(mQuietTimeEnds.split(":")[1]);
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
Integer now = (time.hour * 60) + time.minute;
|
2010-11-28 21:21:16 -05:00
|
|
|
Integer quietStarts = startHour * 60 + startMinute;
|
2011-02-06 17:09:48 -05:00
|
|
|
Integer quietEnds = endHour * 60 + endMinute;
|
2010-11-28 21:21:16 -05:00
|
|
|
|
|
|
|
// If start and end times are the same, we're never quiet
|
2011-02-06 17:09:48 -05:00
|
|
|
if (quietStarts.equals(quietEnds)) {
|
2010-11-28 21:21:16 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 21:00 - 05:00 means we want to be quiet if it's after 9 or before 5
|
2011-02-06 17:09:48 -05:00
|
|
|
if (quietStarts > quietEnds) {
|
2010-11-28 21:21:16 -05:00
|
|
|
// if it's 22:00 or 03:00 but not 8:00
|
2011-02-06 17:09:48 -05:00
|
|
|
if (now >= quietStarts || now <= quietEnds) {
|
2010-11-28 21:21:16 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 01:00 - 05:00
|
2011-02-06 17:09:48 -05:00
|
|
|
else {
|
2010-11-28 21:21:16 -05:00
|
|
|
|
|
|
|
// if it' 2:00 or 4:00 but not 8:00 or 0:00
|
2011-02-06 17:09:48 -05:00
|
|
|
if (now >= quietStarts && now <= quietEnds) {
|
2010-11-28 21:21:16 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean startIntegratedInbox() {
|
2011-02-25 17:49:39 -05:00
|
|
|
return mStartIntegratedInbox;
|
2010-07-02 20:26:35 -04:00
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setStartIntegratedInbox(boolean startIntegratedInbox) {
|
2010-07-02 20:26:35 -04:00
|
|
|
mStartIntegratedInbox = startIntegratedInbox;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean showAnimations() {
|
2009-12-26 19:54:19 -05:00
|
|
|
return mAnimations;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setAnimations(boolean animations) {
|
2009-12-26 19:54:19 -05:00
|
|
|
mAnimations = animations;
|
|
|
|
}
|
2010-01-09 18:02:40 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static int messageListPreviewLines() {
|
2010-11-04 22:59:26 -04:00
|
|
|
return mMessageListPreviewLines;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setMessageListPreviewLines(int lines) {
|
2010-11-04 22:59:26 -04:00
|
|
|
mMessageListPreviewLines = lines;
|
|
|
|
}
|
|
|
|
|
2012-10-09 18:22:00 -04:00
|
|
|
public static boolean messageListCheckboxes() {
|
|
|
|
return mMessageListCheckboxes;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setMessageListCheckboxes(boolean checkboxes) {
|
|
|
|
mMessageListCheckboxes = checkboxes;
|
|
|
|
}
|
|
|
|
|
2013-08-16 02:48:41 -04:00
|
|
|
public static boolean messageListStars() {
|
|
|
|
return mMessageListStars;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setMessageListStars(boolean stars) {
|
|
|
|
mMessageListStars = stars;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean showCorrespondentNames() {
|
2011-01-22 19:55:46 -05:00
|
|
|
return mShowCorrespondentNames;
|
|
|
|
}
|
|
|
|
|
2012-09-24 19:11:21 -04:00
|
|
|
public static boolean messageListSenderAboveSubject() {
|
|
|
|
return mMessageListSenderAboveSubject;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setMessageListSenderAboveSubject(boolean sender) {
|
|
|
|
mMessageListSenderAboveSubject = sender;
|
|
|
|
}
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setShowCorrespondentNames(boolean showCorrespondentNames) {
|
2011-01-22 19:55:46 -05:00
|
|
|
mShowCorrespondentNames = showCorrespondentNames;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean showContactName() {
|
2010-10-08 19:50:33 -04:00
|
|
|
return mShowContactName;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setShowContactName(boolean showContactName) {
|
2010-10-08 19:50:33 -04:00
|
|
|
mShowContactName = showContactName;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean changeContactNameColor() {
|
2010-10-08 20:38:52 -04:00
|
|
|
return mChangeContactNameColor;
|
2010-09-26 10:39:52 -04:00
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setChangeContactNameColor(boolean changeContactNameColor) {
|
2010-10-08 20:48:46 -04:00
|
|
|
mChangeContactNameColor = changeContactNameColor;
|
2010-09-26 10:39:52 -04:00
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static int getContactNameColor() {
|
2010-10-08 20:38:52 -04:00
|
|
|
return mContactNameColor;
|
2010-09-26 10:39:52 -04:00
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setContactNameColor(int contactNameColor) {
|
2010-10-08 20:38:52 -04:00
|
|
|
mContactNameColor = contactNameColor;
|
2010-09-26 10:39:52 -04:00
|
|
|
}
|
2009-12-14 21:50:53 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean messageViewFixedWidthFont() {
|
2010-06-06 17:33:33 -04:00
|
|
|
return mMessageViewFixedWidthFont;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setMessageViewFixedWidthFont(boolean fixed) {
|
2010-06-06 17:33:33 -04:00
|
|
|
mMessageViewFixedWidthFont = fixed;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean messageViewReturnToList() {
|
2010-06-20 08:15:29 -04:00
|
|
|
return mMessageViewReturnToList;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setMessageViewReturnToList(boolean messageViewReturnToList) {
|
2010-06-20 08:15:29 -04:00
|
|
|
mMessageViewReturnToList = messageViewReturnToList;
|
|
|
|
}
|
|
|
|
|
2011-10-11 05:01:06 -04:00
|
|
|
public static boolean messageViewShowNext() {
|
|
|
|
return mMessageViewShowNext;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setMessageViewShowNext(boolean messageViewShowNext) {
|
|
|
|
mMessageViewShowNext = messageViewShowNext;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static FontSizes getFontSizes() {
|
2010-04-20 12:37:03 -04:00
|
|
|
return fontSizes;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean measureAccounts() {
|
2010-04-18 22:55:02 -04:00
|
|
|
return mMeasureAccounts;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setMeasureAccounts(boolean measureAccounts) {
|
2010-04-18 22:55:02 -04:00
|
|
|
mMeasureAccounts = measureAccounts;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean countSearchMessages() {
|
2010-04-18 22:55:02 -04:00
|
|
|
return mCountSearchMessages;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setCountSearchMessages(boolean countSearchMessages) {
|
2010-04-18 22:55:02 -04:00
|
|
|
mCountSearchMessages = countSearchMessages;
|
|
|
|
}
|
2010-05-02 14:24:33 -04:00
|
|
|
|
2011-02-25 15:36:47 -05:00
|
|
|
public static boolean isHideSpecialAccounts() {
|
|
|
|
return mHideSpecialAccounts;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setHideSpecialAccounts(boolean hideSpecialAccounts) {
|
|
|
|
mHideSpecialAccounts = hideSpecialAccounts;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean useGalleryBugWorkaround() {
|
2010-05-02 14:24:33 -04:00
|
|
|
return useGalleryBugWorkaround;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setUseGalleryBugWorkaround(boolean useGalleryBugWorkaround) {
|
2010-05-02 14:24:33 -04:00
|
|
|
K9.useGalleryBugWorkaround = useGalleryBugWorkaround;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean isGalleryBuggy() {
|
2010-05-02 14:24:33 -04:00
|
|
|
return galleryBuggy;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static boolean confirmDelete() {
|
2010-09-01 16:59:09 -04:00
|
|
|
return mConfirmDelete;
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void setConfirmDelete(final boolean confirm) {
|
2010-09-01 16:59:09 -04:00
|
|
|
mConfirmDelete = confirm;
|
|
|
|
}
|
2011-03-31 23:34:27 -04:00
|
|
|
|
2011-11-15 01:28:41 -05:00
|
|
|
public static boolean confirmDeleteStarred() {
|
|
|
|
return mConfirmDeleteStarred;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setConfirmDeleteStarred(final boolean confirm) {
|
|
|
|
mConfirmDeleteStarred = confirm;
|
|
|
|
}
|
|
|
|
|
2011-03-31 23:34:27 -04:00
|
|
|
public static boolean confirmSpam() {
|
2011-04-12 08:16:22 -04:00
|
|
|
return mConfirmSpam;
|
2011-03-31 17:34:09 -04:00
|
|
|
}
|
2011-03-31 23:34:27 -04:00
|
|
|
|
|
|
|
public static void setConfirmSpam(final boolean confirm) {
|
2011-04-12 08:16:22 -04:00
|
|
|
mConfirmSpam = confirm;
|
2011-03-31 17:34:09 -04:00
|
|
|
}
|
2010-09-01 16:59:09 -04:00
|
|
|
|
2013-01-04 02:24:03 -05:00
|
|
|
public static boolean confirmDeleteFromNotification() {
|
|
|
|
return mConfirmDeleteFromNotification;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setConfirmDeleteFromNotification(final boolean confirm) {
|
|
|
|
mConfirmDeleteFromNotification = confirm;
|
|
|
|
}
|
|
|
|
|
2012-08-01 20:31:54 -04:00
|
|
|
public static NotificationHideSubject getNotificationHideSubject() {
|
|
|
|
return sNotificationHideSubject;
|
2010-09-01 18:26:36 -04:00
|
|
|
}
|
|
|
|
|
2012-08-01 20:31:54 -04:00
|
|
|
public static void setNotificationHideSubject(final NotificationHideSubject mode) {
|
|
|
|
sNotificationHideSubject = mode;
|
2010-09-01 18:26:36 -04:00
|
|
|
}
|
2011-02-06 17:09:48 -05:00
|
|
|
|
2013-01-04 02:24:03 -05:00
|
|
|
public static NotificationQuickDelete getNotificationQuickDeleteBehaviour() {
|
|
|
|
return sNotificationQuickDelete;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setNotificationQuickDeleteBehaviour(final NotificationQuickDelete mode) {
|
|
|
|
sNotificationQuickDelete = mode;
|
|
|
|
}
|
|
|
|
|
2010-05-02 14:24:33 -04:00
|
|
|
/**
|
|
|
|
* Check if this system contains a buggy Gallery 3D package.
|
2010-05-11 22:51:59 -04:00
|
|
|
*
|
2010-05-02 14:24:33 -04:00
|
|
|
* We have to work around the fact that those Gallery versions won't show
|
|
|
|
* any images or videos when the pick intent is used with a MIME type other
|
|
|
|
* than image/* or video/*. See issue 1186.
|
2010-05-11 22:51:59 -04:00
|
|
|
*
|
2010-05-02 14:24:33 -04:00
|
|
|
* @return true, if a buggy Gallery 3D package was found. False, otherwise.
|
|
|
|
*/
|
2011-02-06 17:09:48 -05:00
|
|
|
private boolean checkForBuggyGallery() {
|
|
|
|
try {
|
2010-05-02 14:24:33 -04:00
|
|
|
PackageInfo pi = getPackageManager().getPackageInfo("com.cooliris.media", 0);
|
2010-05-11 22:51:59 -04:00
|
|
|
|
2010-05-02 14:24:33 -04:00
|
|
|
return (pi.versionCode == 30682);
|
2011-02-06 17:09:48 -05:00
|
|
|
} catch (NameNotFoundException e) {
|
2010-05-02 14:24:33 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2010-09-01 16:59:09 -04:00
|
|
|
|
2012-11-26 17:50:43 -05:00
|
|
|
public static boolean wrapFolderNames() {
|
2013-01-24 14:30:07 -05:00
|
|
|
return mWrapFolderNames;
|
2012-11-26 17:50:43 -05:00
|
|
|
}
|
|
|
|
public static void setWrapFolderNames(final boolean state) {
|
2013-01-24 14:30:07 -05:00
|
|
|
mWrapFolderNames = state;
|
2012-11-26 17:50:43 -05:00
|
|
|
}
|
|
|
|
|
2011-04-23 23:54:28 -04:00
|
|
|
public static String getAttachmentDefaultPath() {
|
|
|
|
return mAttachmentDefaultPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setAttachmentDefaultPath(String attachmentDefaultPath) {
|
|
|
|
K9.mAttachmentDefaultPath = attachmentDefaultPath;
|
|
|
|
}
|
2012-04-12 22:12:22 -04:00
|
|
|
|
|
|
|
public static synchronized SortType getSortType() {
|
|
|
|
return mSortType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static synchronized void setSortType(SortType sortType) {
|
|
|
|
mSortType = sortType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static synchronized boolean isSortAscending(SortType sortType) {
|
|
|
|
if (mSortAscending.get(sortType) == null) {
|
|
|
|
mSortAscending.put(sortType, sortType.isDefaultAscending());
|
|
|
|
}
|
|
|
|
return mSortAscending.get(sortType);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static synchronized void setSortAscending(SortType sortType, boolean sortAscending) {
|
|
|
|
mSortAscending.put(sortType, sortAscending);
|
|
|
|
}
|
|
|
|
|
2012-10-02 16:56:06 -04:00
|
|
|
public static synchronized boolean useBackgroundAsUnreadIndicator() {
|
|
|
|
return sUseBackgroundAsUnreadIndicator;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static synchronized void setUseBackgroundAsUnreadIndicator(boolean enabled) {
|
|
|
|
sUseBackgroundAsUnreadIndicator = enabled;
|
|
|
|
}
|
2012-10-28 15:10:52 -04:00
|
|
|
|
|
|
|
public static synchronized boolean isThreadedViewEnabled() {
|
|
|
|
return sThreadedViewEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static synchronized void setThreadedViewEnabled(boolean enable) {
|
|
|
|
sThreadedViewEnabled = enable;
|
|
|
|
}
|
2012-12-01 02:02:55 -05:00
|
|
|
|
2013-01-24 14:30:07 -05:00
|
|
|
public static synchronized SplitViewMode getSplitViewMode() {
|
|
|
|
return sSplitViewMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static synchronized void setSplitViewMode(SplitViewMode mode) {
|
|
|
|
sSplitViewMode = mode;
|
|
|
|
}
|
|
|
|
|
2013-02-07 14:23:53 -05:00
|
|
|
public static boolean showContactPicture() {
|
|
|
|
return sShowContactPicture;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setShowContactPicture(boolean show) {
|
|
|
|
sShowContactPicture = show;
|
|
|
|
}
|
|
|
|
|
2013-08-16 12:42:13 -04:00
|
|
|
public static boolean isColorizeMissingContactPictures() {
|
|
|
|
return sColorizeMissingContactPictures;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void setColorizeMissingContactPictures(boolean enabled) {
|
|
|
|
sColorizeMissingContactPictures = enabled;
|
|
|
|
}
|
|
|
|
|
2013-08-24 05:34:52 -04:00
|
|
|
public static boolean isMessageViewArchiveActionVisible() {
|
2013-08-29 11:32:35 -04:00
|
|
|
return sMessageViewArchiveActionVisible;
|
2013-08-24 05:34:52 -04:00
|
|
|
}
|
|
|
|
|
2013-08-29 11:32:35 -04:00
|
|
|
public static void setMessageViewArchiveActionVisible(boolean visible) {
|
|
|
|
sMessageViewArchiveActionVisible = visible;
|
2013-08-24 05:34:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isMessageViewDeleteActionVisible() {
|
2013-08-29 11:32:35 -04:00
|
|
|
return sMessageViewDeleteActionVisible;
|
2013-08-24 05:34:52 -04:00
|
|
|
}
|
|
|
|
|
2013-08-29 11:32:35 -04:00
|
|
|
public static void setMessageViewDeleteActionVisible(boolean visible) {
|
|
|
|
sMessageViewDeleteActionVisible = visible;
|
2013-08-24 05:34:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isMessageViewMoveActionVisible() {
|
2013-08-29 11:32:35 -04:00
|
|
|
return sMessageViewMoveActionVisible;
|
2013-08-24 05:34:52 -04:00
|
|
|
}
|
|
|
|
|
2013-08-29 11:32:35 -04:00
|
|
|
public static void setMessageViewMoveActionVisible(boolean visible) {
|
|
|
|
sMessageViewMoveActionVisible = visible;
|
2013-08-24 05:34:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isMessageViewCopyActionVisible() {
|
2013-08-29 11:32:35 -04:00
|
|
|
return sMessageViewCopyActionVisible;
|
2013-08-24 05:34:52 -04:00
|
|
|
}
|
|
|
|
|
2013-08-29 11:32:35 -04:00
|
|
|
public static void setMessageViewCopyActionVisible(boolean visible) {
|
|
|
|
sMessageViewCopyActionVisible = visible;
|
2013-08-24 05:34:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isMessageViewSpamActionVisible() {
|
2013-08-29 11:32:35 -04:00
|
|
|
return sMessageViewSpamActionVisible;
|
2013-08-24 05:34:52 -04:00
|
|
|
}
|
|
|
|
|
2013-08-29 11:32:35 -04:00
|
|
|
public static void setMessageViewSpamActionVisible(boolean visible) {
|
|
|
|
sMessageViewSpamActionVisible = visible;
|
2013-08-24 05:34:52 -04:00
|
|
|
}
|
|
|
|
|
2012-12-01 02:02:55 -05:00
|
|
|
/**
|
|
|
|
* Check if we already know whether all databases are using the current database schema.
|
|
|
|
*
|
|
|
|
* <p>
|
|
|
|
* This method is only used for optimizations. If it returns {@code true} we can be certain that
|
|
|
|
* getting a {@link LocalStore} instance won't trigger a schema upgrade.
|
|
|
|
* </p>
|
|
|
|
*
|
|
|
|
* @return {@code true}, if we know that all databases are using the current database schema.
|
|
|
|
* {@code false}, otherwise.
|
|
|
|
*/
|
|
|
|
public static synchronized boolean areDatabasesUpToDate() {
|
|
|
|
return sDatabasesUpToDate;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remember that all account databases are using the most recent database schema.
|
|
|
|
*
|
|
|
|
* @param save
|
|
|
|
* Whether or not to write the current database version to the
|
|
|
|
* {@code SharedPreferences} {@link #DATABASE_VERSION_CACHE}.
|
|
|
|
*
|
|
|
|
* @see #areDatabasesUpToDate()
|
|
|
|
*/
|
|
|
|
public static synchronized void setDatabasesUpToDate(boolean save) {
|
|
|
|
sDatabasesUpToDate = true;
|
|
|
|
|
|
|
|
if (save) {
|
|
|
|
Editor editor = sDatabaseVersionCache.edit();
|
|
|
|
editor.putInt(KEY_LAST_ACCOUNT_DATABASE_VERSION, LocalStore.DB_VERSION);
|
|
|
|
editor.commit();
|
|
|
|
}
|
|
|
|
}
|
2010-02-07 22:23:41 -05:00
|
|
|
}
|