null
.
* @throws Exception
*/
void initializeComponent(K9 application);
}
public static Application app = null;
public static File tempDirectory;
public static final String LOG_TAG = "k9";
/**
* Components that are interested in knowing when the K9 instance is
* available and ready.
*
* @see ApplicationAware
*/
private static Listnull
.
*/
public static void registerApplicationAware(final ApplicationAware component) {
if (!observers.contains(component)) {
observers.add(component);
}
}
public static String getK9Language() {
return language;
}
public static void setK9Language(String nlanguage) {
language = nlanguage;
}
public static int getK9Theme() {
return theme;
}
public static void setK9Theme(int ntheme) {
theme = ntheme;
}
public static BACKGROUND_OPS getBackgroundOps() {
return backgroundOps;
}
public static boolean setBackgroundOps(BACKGROUND_OPS backgroundOps) {
BACKGROUND_OPS oldBackgroundOps = K9.backgroundOps;
K9.backgroundOps = backgroundOps;
return backgroundOps != oldBackgroundOps;
}
public static boolean setBackgroundOps(String nbackgroundOps) {
return setBackgroundOps(BACKGROUND_OPS.valueOf(nbackgroundOps));
}
public static boolean gesturesEnabled() {
return mGesturesEnabled;
}
public static void setGesturesEnabled(boolean gestures) {
mGesturesEnabled = gestures;
}
public static boolean useVolumeKeysForNavigationEnabled() {
return mUseVolumeKeysForNavigation;
}
public static void setUseVolumeKeysForNavigation(boolean volume) {
mUseVolumeKeysForNavigation = volume;
}
public static boolean useVolumeKeysForListNavigationEnabled() {
return mUseVolumeKeysForListNavigation;
}
public static void setUseVolumeKeysForListNavigation(boolean enabled) {
mUseVolumeKeysForListNavigation = enabled;
}
public static boolean manageBack() {
return mManageBack;
}
public static void setManageBack(boolean manageBack) {
mManageBack = manageBack;
}
public static boolean zoomControlsEnabled() {
return mZoomControlsEnabled;
}
public static void setZoomControlsEnabled(boolean zoomControlsEnabled) {
mZoomControlsEnabled = zoomControlsEnabled;
}
public static boolean mobileOptimizedLayout() {
return mMobileOptimizedLayout;
}
public static void setMobileOptimizedLayout(boolean mobileOptimizedLayout) {
mMobileOptimizedLayout = mobileOptimizedLayout;
}
public static boolean getQuietTimeEnabled() {
return mQuietTimeEnabled;
}
public static void setQuietTimeEnabled(boolean quietTimeEnabled) {
mQuietTimeEnabled = quietTimeEnabled;
}
public static String getQuietTimeStarts() {
return mQuietTimeStarts;
}
public static void setQuietTimeStarts(String quietTimeStarts) {
mQuietTimeStarts = quietTimeStarts;
}
public static String getQuietTimeEnds() {
return mQuietTimeEnds;
}
public static void setQuietTimeEnds(String quietTimeEnds) {
mQuietTimeEnds = quietTimeEnds;
}
public static boolean isQuietTime() {
if (!mQuietTimeEnabled) {
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]);
Integer now = (time.hour * 60) + time.minute;
Integer quietStarts = startHour * 60 + startMinute;
Integer quietEnds = endHour * 60 + endMinute;
// If start and end times are the same, we're never quiet
if (quietStarts.equals(quietEnds)) {
return false;
}
// 21:00 - 05:00 means we want to be quiet if it's after 9 or before 5
if (quietStarts > quietEnds) {
// if it's 22:00 or 03:00 but not 8:00
if (now >= quietStarts || now <= quietEnds) {
return true;
}
}
// 01:00 - 05:00
else {
// if it' 2:00 or 4:00 but not 8:00 or 0:00
if (now >= quietStarts && now <= quietEnds) {
return true;
}
}
return false;
}
public static boolean startIntegratedInbox() {
return mStartIntegratedInbox;
}
public static void setStartIntegratedInbox(boolean startIntegratedInbox) {
mStartIntegratedInbox = startIntegratedInbox;
}
public static boolean showAnimations() {
return mAnimations;
}
public static void setAnimations(boolean animations) {
mAnimations = animations;
}
public static boolean messageListTouchable() {
return mMessageListTouchable;
}
public static void setMessageListTouchable(boolean touchy) {
mMessageListTouchable = touchy;
}
public static int messageListPreviewLines() {
return mMessageListPreviewLines;
}
public static void setMessageListPreviewLines(int lines) {
mMessageListPreviewLines = lines;
}
public static boolean messageListStars() {
return mMessageListStars;
}
public static void setMessageListStars(boolean stars) {
mMessageListStars = stars;
}
public static boolean messageListCheckboxes() {
return mMessageListCheckboxes;
}
public static void setMessageListCheckboxes(boolean checkboxes) {
mMessageListCheckboxes = checkboxes;
}
public static boolean showCorrespondentNames() {
return mShowCorrespondentNames;
}
public static void setShowCorrespondentNames(boolean showCorrespondentNames) {
mShowCorrespondentNames = showCorrespondentNames;
}
public static boolean showContactName() {
return mShowContactName;
}
public static void setShowContactName(boolean showContactName) {
mShowContactName = showContactName;
}
public static boolean changeContactNameColor() {
return mChangeContactNameColor;
}
public static void setChangeContactNameColor(boolean changeContactNameColor) {
mChangeContactNameColor = changeContactNameColor;
}
public static int getContactNameColor() {
return mContactNameColor;
}
public static void setContactNameColor(int contactNameColor) {
mContactNameColor = contactNameColor;
}
public static boolean messageViewFixedWidthFont() {
return mMessageViewFixedWidthFont;
}
public static void setMessageViewFixedWidthFont(boolean fixed) {
mMessageViewFixedWidthFont = fixed;
}
public static boolean messageViewReturnToList() {
return mMessageViewReturnToList;
}
public static void setMessageViewReturnToList(boolean messageViewReturnToList) {
mMessageViewReturnToList = messageViewReturnToList;
}
public static boolean messageViewShowNext() {
return mMessageViewShowNext;
}
public static void setMessageViewShowNext(boolean messageViewShowNext) {
mMessageViewShowNext = messageViewShowNext;
}
public static Method getMethod(Class> classObject, String methodName) {
try {
return classObject.getMethod(methodName, boolean.class);
} catch (NoSuchMethodException e) {
Log.i(K9.LOG_TAG, "Can't get method " +
classObject.toString() + "." + methodName);
} catch (Exception e) {
Log.e(K9.LOG_TAG, "Error while using reflection to get method " +
classObject.toString() + "." + methodName, e);
}
return null;
}
public static FontSizes getFontSizes() {
return fontSizes;
}
public static boolean measureAccounts() {
return mMeasureAccounts;
}
public static void setMeasureAccounts(boolean measureAccounts) {
mMeasureAccounts = measureAccounts;
}
public static boolean countSearchMessages() {
return mCountSearchMessages;
}
public static void setCountSearchMessages(boolean countSearchMessages) {
mCountSearchMessages = countSearchMessages;
}
public static boolean isHideSpecialAccounts() {
return mHideSpecialAccounts;
}
public static void setHideSpecialAccounts(boolean hideSpecialAccounts) {
mHideSpecialAccounts = hideSpecialAccounts;
}
public static boolean useGalleryBugWorkaround() {
return useGalleryBugWorkaround;
}
public static void setUseGalleryBugWorkaround(boolean useGalleryBugWorkaround) {
K9.useGalleryBugWorkaround = useGalleryBugWorkaround;
}
public static boolean isGalleryBuggy() {
return galleryBuggy;
}
public static boolean confirmDelete() {
return mConfirmDelete;
}
public static void setConfirmDelete(final boolean confirm) {
mConfirmDelete = confirm;
}
public static boolean confirmSpam() {
return mConfirmSpam;
}
public static void setConfirmSpam(final boolean confirm) {
mConfirmSpam = confirm;
}
public static boolean confirmMarkAllAsRead() {
return mConfirmMarkAllAsRead;
}
public static void setConfirmMarkAllAsRead(final boolean confirm) {
mConfirmMarkAllAsRead = 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;
}
public static boolean useCompactLayouts() {
return compactLayouts;
}
public static void setCompactLayouts(boolean compactLayouts) {
K9.compactLayouts = compactLayouts;
}
/**
* Check if this system contains a buggy Gallery 3D package.
*
* 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.
*
* @return true, if a buggy Gallery 3D package was found. False, otherwise.
*/
private boolean checkForBuggyGallery() {
try {
PackageInfo pi = getPackageManager().getPackageInfo("com.cooliris.media", 0);
return (pi.versionCode == 30682);
} catch (NameNotFoundException e) {
return false;
}
}
public static String getAttachmentDefaultPath() {
return mAttachmentDefaultPath;
}
public static void setAttachmentDefaultPath(String attachmentDefaultPath) {
K9.mAttachmentDefaultPath = attachmentDefaultPath;
}
/**
* Creates an {@link AbsoluteSizeSpan} object.
*
* * Android versions prior to 2.0 don't support the constructor with two parameters * ({@link AbsoluteSizeSpan#AbsoluteSizeSpan(int, boolean)}). So we have to perform some * reflection magic to dynamically load the new constructor on devices that support it. * For devices with old Android versions we just use the size as pixels (instead of dip). *
* * @param size This is used as the {@code size} parameter for the AbsoluteSizeSpan constructor. * @return a AbsoluteSizeSpan object with the specified text size. */ public static AbsoluteSizeSpan createAbsoluteSizeSpan(int size) { if (Integer.parseInt(android.os.Build.VERSION.SDK) < 5) { // For Android 1.5/1.6 simply use the constructor with only the size parameter. // Yes, that will most likely look wrong! return new AbsoluteSizeSpan(size); } if (sAbsoluteSizeSpanConstructor == null) { try { sAbsoluteSizeSpanConstructor = AbsoluteSizeSpan.class.getConstructor(int.class, boolean.class); } catch (Exception e) { Log.e(K9.LOG_TAG, "Couldn't get the AbsoluteSizeSpan(int, boolean) constructor", e); // Fallback return new AbsoluteSizeSpan(size); } } AbsoluteSizeSpan result; try { result = sAbsoluteSizeSpanConstructor.newInstance(size, true); } catch (Exception e) { Log.e(K9.LOG_TAG, "Couldn't call the AbsoluteSizeSpan(int, boolean) constructor", e); // Fallback result = new AbsoluteSizeSpan(size); } return result; } }