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;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean startIntegratedInbox()
|
public static boolean startIntegratedInbox()
|
||||||
{
|
{
|
||||||
|
@ -2971,14 +2971,16 @@ public class MessageList
|
|||||||
animation.setAnimationListener(this);
|
animation.setAnimationListener(this);
|
||||||
mBatchButtonArea.startAnimation(animation);
|
mBatchButtonArea.startAnimation(animation);
|
||||||
|
|
||||||
|
|
||||||
// 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();
|
{
|
||||||
if (K9.FOLDER_NONE.equalsIgnoreCase(folderName)
|
String folderName = mAccount.getSpamFolderName();
|
||||||
|| !mController.isMoveCapable(mAccount)) {
|
if (K9.FOLDER_NONE.equalsIgnoreCase(folderName)
|
||||||
mBatchSpamButton.setVisibility(View.GONE);
|
|| !mController.isMoveCapable(mAccount))
|
||||||
}
|
{
|
||||||
|
mBatchSpamButton.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2986,55 +2988,55 @@ public class MessageList
|
|||||||
private void toggleBatchButtons()
|
private void toggleBatchButtons()
|
||||||
{
|
{
|
||||||
|
|
||||||
runOnUiThread(new Runnable()
|
runOnUiThread(new Runnable()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (mSelectedCount < 0)
|
if (mSelectedCount < 0)
|
||||||
{
|
{
|
||||||
mSelectedCount = 0;
|
mSelectedCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int readButtonIconId;
|
int readButtonIconId;
|
||||||
int flagButtonIconId;
|
int flagButtonIconId;
|
||||||
|
|
||||||
if (mSelectedCount==0)
|
if (mSelectedCount==0)
|
||||||
{
|
{
|
||||||
readButtonIconId = R.drawable.ic_button_mark_read;
|
readButtonIconId = R.drawable.ic_button_mark_read;
|
||||||
flagButtonIconId = R.drawable.ic_button_flag;
|
flagButtonIconId = R.drawable.ic_button_flag;
|
||||||
hideBatchButtons();
|
hideBatchButtons();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boolean newReadState = computeBatchDirection(false);
|
boolean newReadState = computeBatchDirection(false);
|
||||||
if (newReadState)
|
if (newReadState)
|
||||||
{
|
{
|
||||||
readButtonIconId = R.drawable.ic_button_mark_read;
|
readButtonIconId = R.drawable.ic_button_mark_read;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
readButtonIconId = R.drawable.ic_button_mark_unread;
|
readButtonIconId = R.drawable.ic_button_mark_unread;
|
||||||
}
|
}
|
||||||
boolean newFlagState = computeBatchDirection(true);
|
boolean newFlagState = computeBatchDirection(true);
|
||||||
if (newFlagState)
|
if (newFlagState)
|
||||||
{
|
{
|
||||||
flagButtonIconId = R.drawable.ic_button_flag;
|
flagButtonIconId = R.drawable.ic_button_flag;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flagButtonIconId = R.drawable.ic_button_unflag;
|
flagButtonIconId = R.drawable.ic_button_unflag;
|
||||||
}
|
}
|
||||||
showBatchButtons();
|
showBatchButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
mBatchReadButton.setImageResource(readButtonIconId);
|
mBatchReadButton.setImageResource(readButtonIconId);
|
||||||
mBatchFlagButton.setImageResource(flagButtonIconId);
|
mBatchFlagButton.setImageResource(flagButtonIconId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6056,12 +6056,15 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
|
|||||||
|
|
||||||
public boolean hasAttachments()
|
public boolean hasAttachments()
|
||||||
{
|
{
|
||||||
if (mAttachmentCount > 0) {
|
if (mAttachmentCount > 0)
|
||||||
return true;
|
{
|
||||||
} else{
|
return true;
|
||||||
return false;
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAttachmentCount()
|
public int getAttachmentCount()
|
||||||
@ -6143,21 +6146,25 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
|
|||||||
|
|
||||||
public boolean toMe()
|
public boolean toMe()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{ if (mToMeCalculated == false) {
|
|
||||||
for (Address address : getRecipients(RecipientType.TO))
|
|
||||||
{
|
{
|
||||||
if (mAccount.isAnIdentity(address))
|
if (mToMeCalculated == false)
|
||||||
{
|
{
|
||||||
mToMe = true;
|
for (Address address : getRecipients(RecipientType.TO))
|
||||||
mToMeCalculated = true;
|
{
|
||||||
|
if (mAccount.isAnIdentity(address))
|
||||||
|
{
|
||||||
|
mToMe = true;
|
||||||
|
mToMeCalculated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
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
|
||||||
}
|
}
|
||||||
return mToMe;
|
return mToMe;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6167,26 +6174,30 @@ 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))
|
|
||||||
{
|
{
|
||||||
if (mAccount.isAnIdentity(address))
|
for(Address address : getRecipients(RecipientType.CC))
|
||||||
{
|
{
|
||||||
mCcMe = true;
|
if (mAccount.isAnIdentity(address))
|
||||||
mCcMeCalculated = true;
|
{
|
||||||
|
mCcMe = true;
|
||||||
|
mCcMeCalculated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (MessagingException e) {
|
}
|
||||||
// do something better than ignore this
|
catch (MessagingException e)
|
||||||
// getRecipients can throw a messagingexception
|
{
|
||||||
}
|
// do something better than ignore this
|
||||||
|
// getRecipients can throw a messagingexception
|
||||||
|
}
|
||||||
|
|
||||||
return mCcMe;
|
return mCcMe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -452,7 +452,7 @@ public class StorageManager
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Storage provider to allow access the Samsung Galaxy S 'internal SD card'.
|
* Storage provider to allow access the Samsung Galaxy S 'internal SD card'.
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* This implementation is experimental and _untested_.
|
* This implementation is experimental and _untested_.
|
||||||
* </p>
|
* </p>
|
||||||
@ -585,8 +585,8 @@ public class StorageManager
|
|||||||
*
|
*
|
||||||
* HTC Incredible storage and Samsung Galaxy S are omitted on purpose
|
* HTC Incredible storage and Samsung Galaxy S are omitted on purpose
|
||||||
* (they're experimental and I don't have those devices to test).
|
* (they're experimental and I don't have those devices to test).
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* !!! Make sure InternalStorageProvider is the first provider as it'll
|
* !!! Make sure InternalStorageProvider is the first provider as it'll
|
||||||
* be considered as the default provider !!!
|
* be considered as the default provider !!!
|
||||||
*/
|
*/
|
||||||
|
@ -3,143 +3,158 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
package com.fsck.k9.preferences;
|
package com.fsck.k9.preferences;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.preference.DialogPreference;
|
import android.preference.DialogPreference;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TimePicker;
|
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
|
||||||
private static final String VALIDATION_EXPRESSION = "[0-2]*[0-9]:[0-5]*[0-9]";
|
*/
|
||||||
|
private static final String VALIDATION_EXPRESSION = "[0-2]*[0-9]:[0-5]*[0-9]";
|
||||||
/**
|
|
||||||
* The default value for this preference
|
/**
|
||||||
*/
|
* The default value for this preference
|
||||||
private String defaultValue;
|
*/
|
||||||
|
private String defaultValue;
|
||||||
/**
|
|
||||||
* @param context
|
/**
|
||||||
* @param attrs
|
* @param context
|
||||||
*/
|
* @param attrs
|
||||||
public TimePickerPreference(Context context, AttributeSet attrs) {
|
*/
|
||||||
super(context, attrs);
|
public TimePickerPreference(Context context, AttributeSet attrs)
|
||||||
initialize();
|
{
|
||||||
}
|
super(context, attrs);
|
||||||
|
initialize();
|
||||||
/**
|
}
|
||||||
* @param context
|
|
||||||
* @param attrs
|
/**
|
||||||
* @param defStyle
|
* @param context
|
||||||
*/
|
* @param attrs
|
||||||
public TimePickerPreference(Context context, AttributeSet attrs,
|
* @param defStyle
|
||||||
int defStyle) {
|
*/
|
||||||
super(context, attrs, defStyle);
|
public TimePickerPreference(Context context, AttributeSet attrs,
|
||||||
initialize();
|
int defStyle)
|
||||||
}
|
{
|
||||||
|
super(context, attrs, defStyle);
|
||||||
/**
|
initialize();
|
||||||
* Initialize this preference
|
}
|
||||||
*/
|
|
||||||
private void initialize() {
|
/**
|
||||||
setPersistent(true);
|
* Initialize this preference
|
||||||
}
|
*/
|
||||||
|
private void initialize()
|
||||||
/*
|
{
|
||||||
* (non-Javadoc)
|
setPersistent(true);
|
||||||
*
|
}
|
||||||
* @see android.preference.DialogPreference#onCreateDialogView()
|
|
||||||
*/
|
/*
|
||||||
@Override
|
* (non-Javadoc)
|
||||||
protected View onCreateDialogView() {
|
*
|
||||||
|
* @see android.preference.DialogPreference#onCreateDialogView()
|
||||||
TimePicker tp = new TimePicker(getContext());
|
*/
|
||||||
tp.setOnTimeChangedListener(this);
|
@Override
|
||||||
|
protected View onCreateDialogView()
|
||||||
int h = getHour();
|
{
|
||||||
int m = getMinute();
|
|
||||||
if (h >= 0 && m >= 0) {
|
TimePicker tp = new TimePicker(getContext());
|
||||||
tp.setCurrentHour(h);
|
tp.setOnTimeChangedListener(this);
|
||||||
tp.setCurrentMinute(m);
|
|
||||||
}
|
int h = getHour();
|
||||||
|
int m = getMinute();
|
||||||
return tp;
|
if (h >= 0 && m >= 0)
|
||||||
}
|
{
|
||||||
|
tp.setCurrentHour(h);
|
||||||
/*
|
tp.setCurrentMinute(m);
|
||||||
* (non-Javadoc)
|
}
|
||||||
*
|
|
||||||
* @see
|
return tp;
|
||||||
* android.widget.TimePicker.OnTimeChangedListener#onTimeChanged(android
|
}
|
||||||
* .widget.TimePicker, int, int)
|
|
||||||
*/
|
/*
|
||||||
@Override
|
* (non-Javadoc)
|
||||||
public void onTimeChanged(TimePicker view, int hour, int minute) {
|
*
|
||||||
|
* @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));
|
persistString(String.format("%02d:%02d",hour,minute));
|
||||||
callChangeListener(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