mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 00:58:50 -05:00
find src/com/fsck/ -name \*.java|xargs astyle --style=ansi --mode=java --indent-switches --indent=spaces=4 --convert-tabs --unpad=paren
This commit is contained in:
parent
2775795abe
commit
8af7f4a7b6
@ -505,11 +505,13 @@ public class Account implements BaseAccount
|
||||
}
|
||||
|
||||
|
||||
public void setChipColor(int color) {
|
||||
public void setChipColor(int color)
|
||||
{
|
||||
mChipColor = color;
|
||||
}
|
||||
|
||||
public int getChipColor() {
|
||||
public int getChipColor()
|
||||
{
|
||||
return mChipColor;
|
||||
}
|
||||
|
||||
|
@ -25,25 +25,30 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
|
||||
public class ColorPickerDialog extends Dialog {
|
||||
public class ColorPickerDialog extends Dialog
|
||||
{
|
||||
|
||||
public interface OnColorChangedListener {
|
||||
public interface OnColorChangedListener
|
||||
{
|
||||
void colorChanged(int color);
|
||||
}
|
||||
|
||||
private OnColorChangedListener mListener;
|
||||
private int mInitialColor;
|
||||
|
||||
private static class ColorPickerView extends View {
|
||||
private static class ColorPickerView extends View
|
||||
{
|
||||
private Paint mPaint;
|
||||
private Paint mCenterPaint;
|
||||
private final int[] mColors;
|
||||
private OnColorChangedListener mListener;
|
||||
|
||||
ColorPickerView(Context c, OnColorChangedListener l, int color) {
|
||||
ColorPickerView(Context c, OnColorChangedListener l, int color)
|
||||
{
|
||||
super(c);
|
||||
mListener = l;
|
||||
mColors = new int[] {
|
||||
mColors = new int[]
|
||||
{
|
||||
0xFF800000, 0xFF800080, 0xFF000080, 0xFF008080, 0xFF008000,
|
||||
0xFF808000, 0xFF800000
|
||||
};
|
||||
@ -63,7 +68,8 @@ public class ColorPickerDialog extends Dialog {
|
||||
private boolean mHighlightCenter;
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
protected void onDraw(Canvas canvas)
|
||||
{
|
||||
float r = CENTER_X - mPaint.getStrokeWidth()*0.5f;
|
||||
|
||||
canvas.translate(CENTER_X, CENTER_X);
|
||||
@ -71,13 +77,17 @@ public class ColorPickerDialog extends Dialog {
|
||||
canvas.drawOval(new RectF(-r, -r, r, r), mPaint);
|
||||
canvas.drawCircle(0, 0, CENTER_RADIUS, mCenterPaint);
|
||||
|
||||
if (mTrackingCenter) {
|
||||
if (mTrackingCenter)
|
||||
{
|
||||
int c = mCenterPaint.getColor();
|
||||
mCenterPaint.setStyle(Paint.Style.STROKE);
|
||||
|
||||
if (mHighlightCenter) {
|
||||
if (mHighlightCenter)
|
||||
{
|
||||
mCenterPaint.setAlpha(0xFF);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
mCenterPaint.setAlpha(0x80);
|
||||
}
|
||||
canvas.drawCircle(0, 0,
|
||||
@ -90,7 +100,8 @@ public class ColorPickerDialog extends Dialog {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
||||
{
|
||||
setMeasuredDimension(CENTER_X*2, CENTER_Y*2);
|
||||
}
|
||||
|
||||
@ -98,28 +109,37 @@ public class ColorPickerDialog extends Dialog {
|
||||
private static final int CENTER_Y = 100;
|
||||
private static final int CENTER_RADIUS = 32;
|
||||
|
||||
private int floatToByte(float x) {
|
||||
private int floatToByte(float x)
|
||||
{
|
||||
int n = java.lang.Math.round(x);
|
||||
return n;
|
||||
}
|
||||
private int pinToByte(int n) {
|
||||
if (n < 0) {
|
||||
private int pinToByte(int n)
|
||||
{
|
||||
if (n < 0)
|
||||
{
|
||||
n = 0;
|
||||
} else if (n > 255) {
|
||||
}
|
||||
else if (n > 255)
|
||||
{
|
||||
n = 255;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
private int ave(int s, int d, float p) {
|
||||
private int ave(int s, int d, float p)
|
||||
{
|
||||
return s + java.lang.Math.round(p *(d - s));
|
||||
}
|
||||
|
||||
private int interpColor(int colors[], float unit) {
|
||||
if (unit <= 0) {
|
||||
private int interpColor(int colors[], float unit)
|
||||
{
|
||||
if (unit <= 0)
|
||||
{
|
||||
return colors[0];
|
||||
}
|
||||
if (unit >= 1) {
|
||||
if (unit >= 1)
|
||||
{
|
||||
return colors[colors.length - 1];
|
||||
}
|
||||
|
||||
@ -138,7 +158,8 @@ public class ColorPickerDialog extends Dialog {
|
||||
return Color.argb(a, r, g, b);
|
||||
}
|
||||
|
||||
private int rotateColor(int color, float rad) {
|
||||
private int rotateColor(int color, float rad)
|
||||
{
|
||||
float deg = rad * 180 / 3.1415927f;
|
||||
int r = Color.red(color);
|
||||
int g = Color.green(color);
|
||||
@ -166,30 +187,38 @@ public class ColorPickerDialog extends Dialog {
|
||||
private static final float PI = 3.1415926f;
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
public boolean onTouchEvent(MotionEvent event)
|
||||
{
|
||||
float x = event.getX() - CENTER_X;
|
||||
float y = event.getY() - CENTER_Y;
|
||||
boolean inCenter = java.lang.Math.sqrt(x*x + y*y) <= CENTER_RADIUS;
|
||||
|
||||
switch (event.getAction()) {
|
||||
switch (event.getAction())
|
||||
{
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
mTrackingCenter = inCenter;
|
||||
if (inCenter) {
|
||||
if (inCenter)
|
||||
{
|
||||
mHighlightCenter = true;
|
||||
invalidate();
|
||||
break;
|
||||
}
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (mTrackingCenter) {
|
||||
if (mHighlightCenter != inCenter) {
|
||||
if (mTrackingCenter)
|
||||
{
|
||||
if (mHighlightCenter != inCenter)
|
||||
{
|
||||
mHighlightCenter = inCenter;
|
||||
invalidate();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
float angle = (float)java.lang.Math.atan2(y, x);
|
||||
// need to turn angle [-PI ... PI] into unit [0....1]
|
||||
float unit = angle/(2*PI);
|
||||
if (unit < 0) {
|
||||
if (unit < 0)
|
||||
{
|
||||
unit += 1;
|
||||
}
|
||||
mCenterPaint.setColor(interpColor(mColors, unit));
|
||||
@ -197,8 +226,10 @@ public class ColorPickerDialog extends Dialog {
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
if (mTrackingCenter) {
|
||||
if (inCenter) {
|
||||
if (mTrackingCenter)
|
||||
{
|
||||
if (inCenter)
|
||||
{
|
||||
mListener.colorChanged(mCenterPaint.getColor());
|
||||
}
|
||||
mTrackingCenter = false; // so we draw w/o halo
|
||||
@ -214,7 +245,8 @@ public class ColorPickerDialog extends Dialog {
|
||||
|
||||
public ColorPickerDialog(Context context,
|
||||
OnColorChangedListener listener,
|
||||
int initialColor) {
|
||||
int initialColor)
|
||||
{
|
||||
super(context);
|
||||
|
||||
mListener = listener;
|
||||
@ -222,10 +254,13 @@ public class ColorPickerDialog extends Dialog {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
OnColorChangedListener l = new OnColorChangedListener() {
|
||||
public void colorChanged(int color) {
|
||||
OnColorChangedListener l = new OnColorChangedListener()
|
||||
{
|
||||
public void colorChanged(int color)
|
||||
{
|
||||
mListener.colorChanged(color);
|
||||
dismiss();
|
||||
}
|
||||
|
@ -34,7 +34,8 @@ public class EmailAddressAdapterSdk5 extends EmailAddressAdapter
|
||||
private static final String SORT_ORDER = Contacts.TIMES_CONTACTED
|
||||
+ " DESC, " + Contacts.DISPLAY_NAME;
|
||||
|
||||
private static final String[] PROJECTION = {
|
||||
private static final String[] PROJECTION =
|
||||
{
|
||||
Data._ID, // 0
|
||||
Contacts.DISPLAY_NAME, // 1
|
||||
Email.DATA // 2
|
||||
|
@ -325,12 +325,17 @@ public class FontSizes
|
||||
{
|
||||
switch (messageViewContent)
|
||||
{
|
||||
case SMALLEST: return 1;
|
||||
case SMALLER: return 2;
|
||||
case SMALLEST:
|
||||
return 1;
|
||||
case SMALLER:
|
||||
return 2;
|
||||
default:
|
||||
case NORMAL: return 3;
|
||||
case LARGER: return 4;
|
||||
case LARGEST: return 5;
|
||||
case NORMAL:
|
||||
return 3;
|
||||
case LARGER:
|
||||
return 4;
|
||||
case LARGEST:
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,11 +343,21 @@ public class FontSizes
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
case 1: messageViewContent = TextSize.SMALLEST; break;
|
||||
case 2: messageViewContent = TextSize.SMALLER; break;
|
||||
case 3: messageViewContent = TextSize.NORMAL; break;
|
||||
case 4: messageViewContent = TextSize.LARGER; break;
|
||||
case 5: messageViewContent = TextSize.LARGEST; break;
|
||||
case 1:
|
||||
messageViewContent = TextSize.SMALLEST;
|
||||
break;
|
||||
case 2:
|
||||
messageViewContent = TextSize.SMALLER;
|
||||
break;
|
||||
case 3:
|
||||
messageViewContent = TextSize.NORMAL;
|
||||
break;
|
||||
case 4:
|
||||
messageViewContent = TextSize.LARGER;
|
||||
break;
|
||||
case 5:
|
||||
messageViewContent = TextSize.LARGEST;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,8 @@ public class EditIdentity extends K9Activity
|
||||
mSignatureUse = (CheckBox)findViewById(R.id.signature_use);
|
||||
mSignatureView = (EditText)findViewById(R.id.signature);
|
||||
mSignatureUse.setChecked(mIdentity.getSignatureUse());
|
||||
mSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
mSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
|
||||
{
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
|
||||
{
|
||||
if (isChecked)
|
||||
|
@ -980,11 +980,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
File f = new File(uriString.substring("file://".length()));
|
||||
attachment.size = f.length();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Log.v(K9.LOG_TAG, "Not a file: " + uriString);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Log.v(K9.LOG_TAG, "old attachment.size: " + attachment.size);
|
||||
}
|
||||
Log.v(K9.LOG_TAG, "new attachment.size: " + attachment.size);
|
||||
@ -1602,7 +1604,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
*
|
||||
* @mailToString the href (which must start with "mailto:").
|
||||
*/
|
||||
private void initializeFromMailTo(String mailToString) {
|
||||
private void initializeFromMailTo(String mailToString)
|
||||
{
|
||||
|
||||
// Chop up everything between mailto: and ? to find recipients
|
||||
int index = mailToString.indexOf("?");
|
||||
|
@ -325,7 +325,8 @@ public class AccountSettings extends K9PreferenceActivity
|
||||
mAutoExpandFolder.setSummary(translateFolder(mAccount.getAutoExpandFolderName()));
|
||||
|
||||
mAutoExpandFolder.setOnPreferenceClickListener(
|
||||
new Preference.OnPreferenceClickListener() {
|
||||
new Preference.OnPreferenceClickListener()
|
||||
{
|
||||
public boolean onPreferenceClick(Preference preference)
|
||||
{
|
||||
onChooseAutoExpandFolder();
|
||||
@ -338,7 +339,8 @@ public class AccountSettings extends K9PreferenceActivity
|
||||
mChipColor = (Preference)findPreference(PREFERENCE_CHIP_COLOR);
|
||||
|
||||
mChipColor.setOnPreferenceClickListener(
|
||||
new Preference.OnPreferenceClickListener() {
|
||||
new Preference.OnPreferenceClickListener()
|
||||
{
|
||||
public boolean onPreferenceClick(Preference preference)
|
||||
{
|
||||
onChooseChipColor();
|
||||
@ -509,8 +511,13 @@ public class AccountSettings extends K9PreferenceActivity
|
||||
|
||||
public void onChooseChipColor()
|
||||
{
|
||||
new ColorPickerDialog(this, new ColorPickerDialog.OnColorChangedListener () {
|
||||
public void colorChanged (int color) { mAccount.setChipColor(color); } },
|
||||
new ColorPickerDialog(this, new ColorPickerDialog.OnColorChangedListener()
|
||||
{
|
||||
public void colorChanged(int color)
|
||||
{
|
||||
mAccount.setChipColor(color);
|
||||
}
|
||||
},
|
||||
mAccount.getChipColor()).show();
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,8 @@ public class AccountSetupComposition extends K9Activity
|
||||
mAccountSignatureUse = (CheckBox)findViewById(R.id.account_signature_use);
|
||||
boolean useSignature = mAccount.getSignatureUse();
|
||||
mAccountSignatureUse.setChecked(useSignature);
|
||||
mAccountSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
mAccountSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
|
||||
{
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
|
||||
{
|
||||
if (isChecked)
|
||||
|
@ -166,7 +166,8 @@ public class AttachmentProvider extends ContentProvider
|
||||
if (!file.exists())
|
||||
{
|
||||
file = new File("/sdcard" + attachmentsDir.getCanonicalPath().substring("/data".length()), id);
|
||||
if (!file.exists()) {
|
||||
if (!file.exists())
|
||||
{
|
||||
throw new FileNotFoundException();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user