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;
}
public static boolean getQuietTimeEnabled() {
public static boolean getQuietTimeEnabled()
{
return mQuietTimeEnabled;
}
public static void setQuietTimeEnabled(boolean quietTimeEnabled) {
public static void setQuietTimeEnabled(boolean quietTimeEnabled)
{
mQuietTimeEnabled = quietTimeEnabled;
}
public static String getQuietTimeStarts() {
public static String getQuietTimeStarts()
{
return mQuietTimeStarts;
}
public static void setQuietTimeStarts(String quietTimeStarts) {
public static void setQuietTimeStarts(String quietTimeStarts)
{
mQuietTimeStarts = quietTimeStarts;
}
public static String getQuietTimeEnds() {
public static String getQuietTimeEnds()
{
return mQuietTimeEnds;
}
public static void setQuietTimeEnds(String quietTimeEnds) {
public static void setQuietTimeEnds(String quietTimeEnds)
{
mQuietTimeEnds = quietTimeEnds;
}

View file

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

View file

@ -6056,9 +6056,12 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
public boolean hasAttachments()
{
if (mAttachmentCount > 0) {
if (mAttachmentCount > 0)
{
return true;
} else{
}
else
{
return false;
}
@ -6144,7 +6147,9 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
public boolean toMe()
{
try
{ if (mToMeCalculated == false) {
{
if (mToMeCalculated == false)
{
for (Address address : getRecipients(RecipientType.TO))
{
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
// getRecipients can throw a messagingexception
}
@ -6167,9 +6174,11 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
public boolean ccMe()
{
try {
try
{
if (mCcMeCalculated == false) {
if (mCcMeCalculated == false)
{
for(Address address : getRecipients(RecipientType.CC))
{
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
// 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
*/
public class TimePickerPreference extends DialogPreference implements
TimePicker.OnTimeChangedListener {
TimePicker.OnTimeChangedListener
{
/**
* The validation expression for this preference
@ -30,7 +31,8 @@ public class TimePickerPreference extends DialogPreference implements
* @param context
* @param attrs
*/
public TimePickerPreference(Context context, AttributeSet attrs) {
public TimePickerPreference(Context context, AttributeSet attrs)
{
super(context, attrs);
initialize();
}
@ -41,7 +43,8 @@ public class TimePickerPreference extends DialogPreference implements
* @param defStyle
*/
public TimePickerPreference(Context context, AttributeSet attrs,
int defStyle) {
int defStyle)
{
super(context, attrs, defStyle);
initialize();
}
@ -49,7 +52,8 @@ public class TimePickerPreference extends DialogPreference implements
/**
* Initialize this preference
*/
private void initialize() {
private void initialize()
{
setPersistent(true);
}
@ -59,14 +63,16 @@ public class TimePickerPreference extends DialogPreference implements
* @see android.preference.DialogPreference#onCreateDialogView()
*/
@Override
protected View onCreateDialogView() {
protected View onCreateDialogView()
{
TimePicker tp = new TimePicker(getContext());
tp.setOnTimeChangedListener(this);
int h = getHour();
int m = getMinute();
if (h >= 0 && m >= 0) {
if (h >= 0 && m >= 0)
{
tp.setCurrentHour(h);
tp.setCurrentMinute(m);
}
@ -82,7 +88,8 @@ public class TimePickerPreference extends DialogPreference implements
* .widget.TimePicker, int, int)
*/
@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));
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)
*/
@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
super.setDefaultValue(defaultValue);
if (!(defaultValue instanceof String)) {
if (!(defaultValue instanceof String))
{
return;
}
if (!((String) defaultValue).matches(VALIDATION_EXPRESSION)) {
if (!((String) defaultValue).matches(VALIDATION_EXPRESSION))
{
return;
}
@ -115,9 +125,11 @@ public class TimePickerPreference extends DialogPreference implements
*
* @return The hour value, will be 0 to 23 (inclusive)
*/
private int getHour() {
private int getHour()
{
String time = getPersistedString(this.defaultValue);
if (time == null || !time.matches(VALIDATION_EXPRESSION)) {
if (time == null || !time.matches(VALIDATION_EXPRESSION))
{
return -1;
}
@ -129,16 +141,19 @@ public class TimePickerPreference extends DialogPreference implements
*
* @return the minute value, will be 0 to 59 (inclusive)
*/
private int getMinute() {
private int getMinute()
{
String time = getPersistedString(this.defaultValue);
if (time == null || !time.matches(VALIDATION_EXPRESSION)) {
if (time == null || !time.matches(VALIDATION_EXPRESSION))
{
return -1;
}
return Integer.valueOf(time.split(":")[1]);
}
public String getTime() {
public String getTime()
{
return getPersistedString(this.defaultValue);
}