1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-26 01:28:50 -05:00
This commit is contained in:
Jesse Vincent 2010-11-28 20:28:37 +00:00
parent a75098013a
commit 4f376e8332
5 changed files with 261 additions and 227 deletions

View File

@ -723,27 +723,33 @@ public class K9 extends Application
mMobileOptimizedLayout = mobileOptimizedLayout; mMobileOptimizedLayout = mobileOptimizedLayout;
} }
public static boolean getQuietTimeEnabled() { public static boolean getQuietTimeEnabled()
{
return mQuietTimeEnabled; return mQuietTimeEnabled;
} }
public static void setQuietTimeEnabled(boolean quietTimeEnabled) { public static void setQuietTimeEnabled(boolean quietTimeEnabled)
{
mQuietTimeEnabled = quietTimeEnabled; mQuietTimeEnabled = quietTimeEnabled;
} }
public static String getQuietTimeStarts() { public static String getQuietTimeStarts()
{
return mQuietTimeStarts; return mQuietTimeStarts;
} }
public static void setQuietTimeStarts(String quietTimeStarts) { public static void setQuietTimeStarts(String quietTimeStarts)
{
mQuietTimeStarts = quietTimeStarts; mQuietTimeStarts = quietTimeStarts;
} }
public static String getQuietTimeEnds() { public static String getQuietTimeEnds()
{
return mQuietTimeEnds; return mQuietTimeEnds;
} }
public static void setQuietTimeEnds(String quietTimeEnds) { public static void setQuietTimeEnds(String quietTimeEnds)
{
mQuietTimeEnds = quietTimeEnds; mQuietTimeEnds = quietTimeEnds;
} }

View File

@ -2973,10 +2973,12 @@ public class MessageList
// hide spam button if there is no spam folder // hide spam button if there is no spam folder
if (mAccount != null) { if (mAccount != null)
{
String folderName = mAccount.getSpamFolderName(); String folderName = mAccount.getSpamFolderName();
if (K9.FOLDER_NONE.equalsIgnoreCase(folderName) if (K9.FOLDER_NONE.equalsIgnoreCase(folderName)
|| !mController.isMoveCapable(mAccount)) { || !mController.isMoveCapable(mAccount))
{
mBatchSpamButton.setVisibility(View.GONE); mBatchSpamButton.setVisibility(View.GONE);
} }
} }

View File

@ -6056,9 +6056,12 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
public boolean hasAttachments() public boolean hasAttachments()
{ {
if (mAttachmentCount > 0) { if (mAttachmentCount > 0)
{
return true; return true;
} else{ }
else
{
return false; return false;
} }
@ -6144,7 +6147,9 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
public boolean toMe() public boolean toMe()
{ {
try try
{ if (mToMeCalculated == false) { {
if (mToMeCalculated == false)
{
for (Address address : getRecipients(RecipientType.TO)) for (Address address : getRecipients(RecipientType.TO))
{ {
if (mAccount.isAnIdentity(address)) if (mAccount.isAnIdentity(address))
@ -6154,7 +6159,9 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
} }
} }
} }
} catch (MessagingException e) { }
catch (MessagingException e)
{
// do something better than ignore this // do something better than ignore this
// getRecipients can throw a messagingexception // getRecipients can throw a messagingexception
} }
@ -6167,9 +6174,11 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
public boolean ccMe() public boolean ccMe()
{ {
try { try
{
if (mCcMeCalculated == false) { if (mCcMeCalculated == false)
{
for(Address address : getRecipients(RecipientType.CC)) for(Address address : getRecipients(RecipientType.CC))
{ {
if (mAccount.isAnIdentity(address)) if (mAccount.isAnIdentity(address))
@ -6180,7 +6189,9 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
} }
} }
} catch (MessagingException e) { }
catch (MessagingException e)
{
// do something better than ignore this // do something better than ignore this
// getRecipients can throw a messagingexception // getRecipients can throw a messagingexception
} }

View File

@ -14,7 +14,8 @@ import android.widget.TimePicker;
* A preference type that allows a user to choose a time * A preference type that allows a user to choose a time
*/ */
public class TimePickerPreference extends DialogPreference implements public class TimePickerPreference extends DialogPreference implements
TimePicker.OnTimeChangedListener { TimePicker.OnTimeChangedListener
{
/** /**
* The validation expression for this preference * The validation expression for this preference
@ -30,7 +31,8 @@ public class TimePickerPreference extends DialogPreference implements
* @param context * @param context
* @param attrs * @param attrs
*/ */
public TimePickerPreference(Context context, AttributeSet attrs) { public TimePickerPreference(Context context, AttributeSet attrs)
{
super(context, attrs); super(context, attrs);
initialize(); initialize();
} }
@ -41,7 +43,8 @@ public class TimePickerPreference extends DialogPreference implements
* @param defStyle * @param defStyle
*/ */
public TimePickerPreference(Context context, AttributeSet attrs, public TimePickerPreference(Context context, AttributeSet attrs,
int defStyle) { int defStyle)
{
super(context, attrs, defStyle); super(context, attrs, defStyle);
initialize(); initialize();
} }
@ -49,7 +52,8 @@ public class TimePickerPreference extends DialogPreference implements
/** /**
* Initialize this preference * Initialize this preference
*/ */
private void initialize() { private void initialize()
{
setPersistent(true); setPersistent(true);
} }
@ -59,14 +63,16 @@ public class TimePickerPreference extends DialogPreference implements
* @see android.preference.DialogPreference#onCreateDialogView() * @see android.preference.DialogPreference#onCreateDialogView()
*/ */
@Override @Override
protected View onCreateDialogView() { protected View onCreateDialogView()
{
TimePicker tp = new TimePicker(getContext()); TimePicker tp = new TimePicker(getContext());
tp.setOnTimeChangedListener(this); tp.setOnTimeChangedListener(this);
int h = getHour(); int h = getHour();
int m = getMinute(); int m = getMinute();
if (h >= 0 && m >= 0) { if (h >= 0 && m >= 0)
{
tp.setCurrentHour(h); tp.setCurrentHour(h);
tp.setCurrentMinute(m); tp.setCurrentMinute(m);
} }
@ -82,7 +88,8 @@ public class TimePickerPreference extends DialogPreference implements
* .widget.TimePicker, int, int) * .widget.TimePicker, int, int)
*/ */
@Override @Override
public void onTimeChanged(TimePicker view, int hour, int minute) { public void onTimeChanged(TimePicker view, int hour, int minute)
{
persistString(String.format("%02d:%02d",hour,minute)); persistString(String.format("%02d:%02d",hour,minute));
callChangeListener(String.format("%02d:%02d",hour,minute)); callChangeListener(String.format("%02d:%02d",hour,minute));
@ -94,16 +101,19 @@ public class TimePickerPreference extends DialogPreference implements
* @see android.preference.Preference#setDefaultValue(java.lang.Object) * @see android.preference.Preference#setDefaultValue(java.lang.Object)
*/ */
@Override @Override
public void setDefaultValue(Object defaultValue) { public void setDefaultValue(Object defaultValue)
{
// BUG this method is never called if you use the 'android:defaultValue' attribute in your XML preference file, not sure why it isn't // BUG this method is never called if you use the 'android:defaultValue' attribute in your XML preference file, not sure why it isn't
super.setDefaultValue(defaultValue); super.setDefaultValue(defaultValue);
if (!(defaultValue instanceof String)) { if (!(defaultValue instanceof String))
{
return; return;
} }
if (!((String) defaultValue).matches(VALIDATION_EXPRESSION)) { if (!((String) defaultValue).matches(VALIDATION_EXPRESSION))
{
return; return;
} }
@ -115,9 +125,11 @@ public class TimePickerPreference extends DialogPreference implements
* *
* @return The hour value, will be 0 to 23 (inclusive) * @return The hour value, will be 0 to 23 (inclusive)
*/ */
private int getHour() { private int getHour()
{
String time = getPersistedString(this.defaultValue); String time = getPersistedString(this.defaultValue);
if (time == null || !time.matches(VALIDATION_EXPRESSION)) { if (time == null || !time.matches(VALIDATION_EXPRESSION))
{
return -1; return -1;
} }
@ -129,16 +141,19 @@ public class TimePickerPreference extends DialogPreference implements
* *
* @return the minute value, will be 0 to 59 (inclusive) * @return the minute value, will be 0 to 59 (inclusive)
*/ */
private int getMinute() { private int getMinute()
{
String time = getPersistedString(this.defaultValue); String time = getPersistedString(this.defaultValue);
if (time == null || !time.matches(VALIDATION_EXPRESSION)) { if (time == null || !time.matches(VALIDATION_EXPRESSION))
{
return -1; return -1;
} }
return Integer.valueOf(time.split(":")[1]); return Integer.valueOf(time.split(":")[1]);
} }
public String getTime() { public String getTime()
{
return getPersistedString(this.defaultValue); return getPersistedString(this.defaultValue);
} }