mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 09:08:49 -05:00
astyle
This commit is contained in:
parent
a75098013a
commit
4f376e8332
@ -723,29 +723,35 @@ public class K9 extends Application
|
||||
mMobileOptimizedLayout = mobileOptimizedLayout;
|
||||
}
|
||||
|
||||
public static boolean getQuietTimeEnabled() {
|
||||
return mQuietTimeEnabled;
|
||||
}
|
||||
public static boolean getQuietTimeEnabled()
|
||||
{
|
||||
return mQuietTimeEnabled;
|
||||
}
|
||||
|
||||
public static void setQuietTimeEnabled(boolean quietTimeEnabled) {
|
||||
mQuietTimeEnabled = quietTimeEnabled;
|
||||
}
|
||||
public static void setQuietTimeEnabled(boolean quietTimeEnabled)
|
||||
{
|
||||
mQuietTimeEnabled = quietTimeEnabled;
|
||||
}
|
||||
|
||||
public static String getQuietTimeStarts() {
|
||||
return mQuietTimeStarts;
|
||||
}
|
||||
public static String getQuietTimeStarts()
|
||||
{
|
||||
return mQuietTimeStarts;
|
||||
}
|
||||
|
||||
public static void setQuietTimeStarts(String quietTimeStarts) {
|
||||
mQuietTimeStarts = quietTimeStarts;
|
||||
}
|
||||
public static void setQuietTimeStarts(String quietTimeStarts)
|
||||
{
|
||||
mQuietTimeStarts = quietTimeStarts;
|
||||
}
|
||||
|
||||
public static String getQuietTimeEnds() {
|
||||
return mQuietTimeEnds;
|
||||
}
|
||||
public static String getQuietTimeEnds()
|
||||
{
|
||||
return mQuietTimeEnds;
|
||||
}
|
||||
|
||||
public static void setQuietTimeEnds(String quietTimeEnds) {
|
||||
mQuietTimeEnds = quietTimeEnds;
|
||||
}
|
||||
public static void setQuietTimeEnds(String quietTimeEnds)
|
||||
{
|
||||
mQuietTimeEnds = quietTimeEnds;
|
||||
}
|
||||
|
||||
public static boolean startIntegratedInbox()
|
||||
{
|
||||
|
@ -2971,14 +2971,16 @@ public class MessageList
|
||||
animation.setAnimationListener(this);
|
||||
mBatchButtonArea.startAnimation(animation);
|
||||
|
||||
|
||||
// hide spam button if there is no spam folder
|
||||
if (mAccount != null) {
|
||||
String folderName = mAccount.getSpamFolderName();
|
||||
if (K9.FOLDER_NONE.equalsIgnoreCase(folderName)
|
||||
|| !mController.isMoveCapable(mAccount)) {
|
||||
mBatchSpamButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// hide spam button if there is no spam folder
|
||||
if (mAccount != null)
|
||||
{
|
||||
String folderName = mAccount.getSpamFolderName();
|
||||
if (K9.FOLDER_NONE.equalsIgnoreCase(folderName)
|
||||
|| !mController.isMoveCapable(mAccount))
|
||||
{
|
||||
mBatchSpamButton.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2986,55 +2988,55 @@ public class MessageList
|
||||
private void toggleBatchButtons()
|
||||
{
|
||||
|
||||
runOnUiThread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
runOnUiThread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
|
||||
if (mSelectedCount < 0)
|
||||
{
|
||||
mSelectedCount = 0;
|
||||
}
|
||||
if (mSelectedCount < 0)
|
||||
{
|
||||
mSelectedCount = 0;
|
||||
}
|
||||
|
||||
int readButtonIconId;
|
||||
int flagButtonIconId;
|
||||
int readButtonIconId;
|
||||
int flagButtonIconId;
|
||||
|
||||
if (mSelectedCount==0)
|
||||
{
|
||||
readButtonIconId = R.drawable.ic_button_mark_read;
|
||||
flagButtonIconId = R.drawable.ic_button_flag;
|
||||
hideBatchButtons();
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean newReadState = computeBatchDirection(false);
|
||||
if (newReadState)
|
||||
{
|
||||
readButtonIconId = R.drawable.ic_button_mark_read;
|
||||
}
|
||||
else
|
||||
{
|
||||
readButtonIconId = R.drawable.ic_button_mark_unread;
|
||||
}
|
||||
boolean newFlagState = computeBatchDirection(true);
|
||||
if (newFlagState)
|
||||
{
|
||||
flagButtonIconId = R.drawable.ic_button_flag;
|
||||
}
|
||||
else
|
||||
{
|
||||
flagButtonIconId = R.drawable.ic_button_unflag;
|
||||
}
|
||||
showBatchButtons();
|
||||
}
|
||||
if (mSelectedCount==0)
|
||||
{
|
||||
readButtonIconId = R.drawable.ic_button_mark_read;
|
||||
flagButtonIconId = R.drawable.ic_button_flag;
|
||||
hideBatchButtons();
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean newReadState = computeBatchDirection(false);
|
||||
if (newReadState)
|
||||
{
|
||||
readButtonIconId = R.drawable.ic_button_mark_read;
|
||||
}
|
||||
else
|
||||
{
|
||||
readButtonIconId = R.drawable.ic_button_mark_unread;
|
||||
}
|
||||
boolean newFlagState = computeBatchDirection(true);
|
||||
if (newFlagState)
|
||||
{
|
||||
flagButtonIconId = R.drawable.ic_button_flag;
|
||||
}
|
||||
else
|
||||
{
|
||||
flagButtonIconId = R.drawable.ic_button_unflag;
|
||||
}
|
||||
showBatchButtons();
|
||||
}
|
||||
|
||||
mBatchReadButton.setImageResource(readButtonIconId);
|
||||
mBatchFlagButton.setImageResource(flagButtonIconId);
|
||||
mBatchReadButton.setImageResource(readButtonIconId);
|
||||
mBatchFlagButton.setImageResource(flagButtonIconId);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
@ -6056,12 +6056,15 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
|
||||
|
||||
public boolean hasAttachments()
|
||||
{
|
||||
if (mAttachmentCount > 0) {
|
||||
return true;
|
||||
} else{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mAttachmentCount > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getAttachmentCount()
|
||||
@ -6143,21 +6146,25 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
|
||||
|
||||
public boolean toMe()
|
||||
{
|
||||
try
|
||||
{ if (mToMeCalculated == false) {
|
||||
for (Address address : getRecipients(RecipientType.TO))
|
||||
try
|
||||
{
|
||||
if (mAccount.isAnIdentity(address))
|
||||
if (mToMeCalculated == false)
|
||||
{
|
||||
mToMe = true;
|
||||
mToMeCalculated = true;
|
||||
for (Address address : getRecipients(RecipientType.TO))
|
||||
{
|
||||
if (mAccount.isAnIdentity(address))
|
||||
{
|
||||
mToMe = true;
|
||||
mToMeCalculated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
// do something better than ignore this
|
||||
// getRecipients can throw a messagingexception
|
||||
}
|
||||
catch (MessagingException e)
|
||||
{
|
||||
// do something better than ignore this
|
||||
// getRecipients can throw a messagingexception
|
||||
}
|
||||
return mToMe;
|
||||
}
|
||||
|
||||
@ -6167,26 +6174,30 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
|
||||
|
||||
public boolean ccMe()
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
|
||||
if (mCcMeCalculated == false) {
|
||||
for(Address address : getRecipients(RecipientType.CC))
|
||||
if (mCcMeCalculated == false)
|
||||
{
|
||||
if (mAccount.isAnIdentity(address))
|
||||
for(Address address : getRecipients(RecipientType.CC))
|
||||
{
|
||||
mCcMe = true;
|
||||
mCcMeCalculated = true;
|
||||
if (mAccount.isAnIdentity(address))
|
||||
{
|
||||
mCcMe = true;
|
||||
mCcMeCalculated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
// do something better than ignore this
|
||||
// getRecipients can throw a messagingexception
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MessagingException e)
|
||||
{
|
||||
// do something better than ignore this
|
||||
// getRecipients can throw a messagingexception
|
||||
}
|
||||
|
||||
return mCcMe;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -452,7 +452,7 @@ public class StorageManager
|
||||
|
||||
/**
|
||||
* Storage provider to allow access the Samsung Galaxy S 'internal SD card'.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* This implementation is experimental and _untested_.
|
||||
* </p>
|
||||
@ -585,8 +585,8 @@ public class StorageManager
|
||||
*
|
||||
* HTC Incredible storage and Samsung Galaxy S are omitted on purpose
|
||||
* (they're experimental and I don't have those devices to test).
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* !!! Make sure InternalStorageProvider is the first provider as it'll
|
||||
* be considered as the default provider !!!
|
||||
*/
|
||||
|
@ -3,143 +3,158 @@
|
||||
*/
|
||||
|
||||
package com.fsck.k9.preferences;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.preference.DialogPreference;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.TimePicker;
|
||||
|
||||
|
||||
/**
|
||||
* A preference type that allows a user to choose a time
|
||||
*/
|
||||
public class TimePickerPreference extends DialogPreference implements
|
||||
TimePicker.OnTimeChangedListener {
|
||||
|
||||
/**
|
||||
* The validation expression for this preference
|
||||
*/
|
||||
private static final String VALIDATION_EXPRESSION = "[0-2]*[0-9]:[0-5]*[0-9]";
|
||||
|
||||
/**
|
||||
* The default value for this preference
|
||||
*/
|
||||
private String defaultValue;
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param attrs
|
||||
*/
|
||||
public TimePickerPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param attrs
|
||||
* @param defStyle
|
||||
*/
|
||||
public TimePickerPreference(Context context, AttributeSet attrs,
|
||||
int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize this preference
|
||||
*/
|
||||
private void initialize() {
|
||||
setPersistent(true);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see android.preference.DialogPreference#onCreateDialogView()
|
||||
*/
|
||||
@Override
|
||||
protected View onCreateDialogView() {
|
||||
|
||||
TimePicker tp = new TimePicker(getContext());
|
||||
tp.setOnTimeChangedListener(this);
|
||||
|
||||
int h = getHour();
|
||||
int m = getMinute();
|
||||
if (h >= 0 && m >= 0) {
|
||||
tp.setCurrentHour(h);
|
||||
tp.setCurrentMinute(m);
|
||||
}
|
||||
|
||||
return tp;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* android.widget.TimePicker.OnTimeChangedListener#onTimeChanged(android
|
||||
* .widget.TimePicker, int, int)
|
||||
*/
|
||||
@Override
|
||||
public void onTimeChanged(TimePicker view, int hour, int minute) {
|
||||
|
||||
TimePicker.OnTimeChangedListener
|
||||
{
|
||||
|
||||
/**
|
||||
* The validation expression for this preference
|
||||
*/
|
||||
private static final String VALIDATION_EXPRESSION = "[0-2]*[0-9]:[0-5]*[0-9]";
|
||||
|
||||
/**
|
||||
* The default value for this preference
|
||||
*/
|
||||
private String defaultValue;
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param attrs
|
||||
*/
|
||||
public TimePickerPreference(Context context, AttributeSet attrs)
|
||||
{
|
||||
super(context, attrs);
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param attrs
|
||||
* @param defStyle
|
||||
*/
|
||||
public TimePickerPreference(Context context, AttributeSet attrs,
|
||||
int defStyle)
|
||||
{
|
||||
super(context, attrs, defStyle);
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize this preference
|
||||
*/
|
||||
private void initialize()
|
||||
{
|
||||
setPersistent(true);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see android.preference.DialogPreference#onCreateDialogView()
|
||||
*/
|
||||
@Override
|
||||
protected View onCreateDialogView()
|
||||
{
|
||||
|
||||
TimePicker tp = new TimePicker(getContext());
|
||||
tp.setOnTimeChangedListener(this);
|
||||
|
||||
int h = getHour();
|
||||
int m = getMinute();
|
||||
if (h >= 0 && m >= 0)
|
||||
{
|
||||
tp.setCurrentHour(h);
|
||||
tp.setCurrentMinute(m);
|
||||
}
|
||||
|
||||
return tp;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* android.widget.TimePicker.OnTimeChangedListener#onTimeChanged(android
|
||||
* .widget.TimePicker, int, int)
|
||||
*/
|
||||
@Override
|
||||
public void onTimeChanged(TimePicker view, int hour, int minute)
|
||||
{
|
||||
|
||||
persistString(String.format("%02d:%02d",hour,minute));
|
||||
callChangeListener(String.format("%02d:%02d",hour,minute));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see android.preference.Preference#setDefaultValue(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
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)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!((String) defaultValue).matches(VALIDATION_EXPRESSION)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.defaultValue = (String) defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the hour value (in 24 hour time)
|
||||
*
|
||||
* @return The hour value, will be 0 to 23 (inclusive)
|
||||
*/
|
||||
private int getHour() {
|
||||
String time = getPersistedString(this.defaultValue);
|
||||
if (time == null || !time.matches(VALIDATION_EXPRESSION)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return Integer.valueOf(time.split(":")[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the minute value
|
||||
*
|
||||
* @return the minute value, will be 0 to 59 (inclusive)
|
||||
*/
|
||||
private int getMinute() {
|
||||
String time = getPersistedString(this.defaultValue);
|
||||
if (time == null || !time.matches(VALIDATION_EXPRESSION)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return Integer.valueOf(time.split(":")[1]);
|
||||
}
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return getPersistedString(this.defaultValue);
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see android.preference.Preference#setDefaultValue(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
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))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!((String) defaultValue).matches(VALIDATION_EXPRESSION))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.defaultValue = (String) defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the hour value (in 24 hour time)
|
||||
*
|
||||
* @return The hour value, will be 0 to 23 (inclusive)
|
||||
*/
|
||||
private int getHour()
|
||||
{
|
||||
String time = getPersistedString(this.defaultValue);
|
||||
if (time == null || !time.matches(VALIDATION_EXPRESSION))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return Integer.valueOf(time.split(":")[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the minute value
|
||||
*
|
||||
* @return the minute value, will be 0 to 59 (inclusive)
|
||||
*/
|
||||
private int getMinute()
|
||||
{
|
||||
String time = getPersistedString(this.defaultValue);
|
||||
if (time == null || !time.matches(VALIDATION_EXPRESSION))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return Integer.valueOf(time.split(":")[1]);
|
||||
}
|
||||
|
||||
public String getTime()
|
||||
{
|
||||
return getPersistedString(this.defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user