diff --git a/api/src/com/todoroo/andlib/data/AbstractModel.java b/api/src/com/todoroo/andlib/data/AbstractModel.java index fd92829ac..3f9fbc2a6 100644 --- a/api/src/com/todoroo/andlib/data/AbstractModel.java +++ b/api/src/com/todoroo/andlib/data/AbstractModel.java @@ -619,9 +619,6 @@ public abstract class AbstractModel implements Parcelable, Cloneable { return (TYPE[]) Array.newInstance(cls, size); } - ; } - ; - } diff --git a/api/src/com/todoroo/andlib/data/DatabaseDao.java b/api/src/com/todoroo/andlib/data/DatabaseDao.java index 25b252ac3..e1c23cf0a 100644 --- a/api/src/com/todoroo/andlib/data/DatabaseDao.java +++ b/api/src/com/todoroo/andlib/data/DatabaseDao.java @@ -300,7 +300,7 @@ public class DatabaseDao { } protected boolean shouldRecordOutstanding(TYPE item) { - return (outstandingTable != null) && + return outstandingTable != null && !item.checkAndClearTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES); } @@ -328,7 +328,7 @@ public class DatabaseDao { try { result.set(op.makeChange()); if (result.get()) { - if (recordOutstanding && ((numOutstanding = createOutstandingEntries(item.getId(), values)) != -1)) // Create entries for setValues in outstanding table + if (recordOutstanding && (numOutstanding = createOutstandingEntries(item.getId(), values)) != -1) // Create entries for setValues in outstanding table { database.getDatabase().setTransactionSuccessful(); } diff --git a/api/src/com/todoroo/andlib/data/Property.java b/api/src/com/todoroo/andlib/data/Property.java index 3163b382f..43827c026 100644 --- a/api/src/com/todoroo/andlib/data/Property.java +++ b/api/src/com/todoroo/andlib/data/Property.java @@ -28,7 +28,7 @@ import static com.todoroo.andlib.sql.SqlConstants.SPACE; * @author Tim Su */ @SuppressWarnings("nls") -public abstract class Property extends Field implements Cloneable { +public abstract class Property extends Field { // --- implementation @@ -74,7 +74,7 @@ public abstract class Property extends Field implements Cloneable { * expression which is derived from default table name */ protected Property(Table table, String columnName) { - this(table, columnName, (table == null) ? (columnName) : (table.name() + "." + columnName)); + this(table, columnName, table == null ? columnName : table.name() + "." + columnName); } /** @@ -82,7 +82,7 @@ public abstract class Property extends Field implements Cloneable { * expression which is derived from default table name */ protected Property(Table table, String columnName, int flags) { - this(table, columnName, (table == null) ? (columnName) : (table.name() + "." + columnName)); + this(table, columnName, table == null ? columnName : table.name() + "." + columnName); this.flags = flags; } @@ -185,7 +185,7 @@ public abstract class Property extends Field implements Cloneable { @Override public IntegerProperty cloneAs(String tableAlias, String columnAlias) { - return (IntegerProperty) this.cloneAs(tableAlias, columnAlias); + return this.cloneAs(tableAlias, columnAlias); } } diff --git a/api/src/com/todoroo/andlib/service/HttpRestClient.java b/api/src/com/todoroo/andlib/service/HttpRestClient.java index 3b766b3ea..21fff33c6 100644 --- a/api/src/com/todoroo/andlib/service/HttpRestClient.java +++ b/api/src/com/todoroo/andlib/service/HttpRestClient.java @@ -122,8 +122,8 @@ public class HttpRestClient implements RestClient { Header ceheader = entity.getContentEncoding(); if (ceheader != null) { HeaderElement[] codecs = ceheader.getElements(); - for (int i = 0; i < codecs.length; i++) { - if (codecs[i].getName().equalsIgnoreCase("gzip")) { + for (HeaderElement codec : codecs) { + if (codec.getName().equalsIgnoreCase("gzip")) { response.setEntity( new GzipDecompressingEntity(response.getEntity())); return; diff --git a/api/src/com/todoroo/andlib/utility/AndroidUtilities.java b/api/src/com/todoroo/andlib/utility/AndroidUtilities.java index fc3ac1a21..21f286286 100644 --- a/api/src/com/todoroo/andlib/utility/AndroidUtilities.java +++ b/api/src/com/todoroo/andlib/utility/AndroidUtilities.java @@ -138,7 +138,7 @@ public class AndroidUtilities { Bitmap bitmap = null; int tries = 0; BitmapFactory.Options opts = new BitmapFactory.Options(); - while ((bitmap == null || (bitmap.getWidth() > MAX_DIM || bitmap.getHeight() > MAX_DIM)) && tries < SAMPLE_SIZES.length) { + while ((bitmap == null || bitmap.getWidth() > MAX_DIM || bitmap.getHeight() > MAX_DIM) && tries < SAMPLE_SIZES.length) { opts.inSampleSize = SAMPLE_SIZES[tries]; try { bitmap = BitmapFactory.decodeFile(file, opts); @@ -605,7 +605,7 @@ public class AndroidUtilities { Arrays.sort(files, new Comparator() { @Override public int compare(File o1, File o2) { - return Long.valueOf(o2.lastModified()).compareTo(Long.valueOf(o1.lastModified())); + return Long.valueOf(o2.lastModified()).compareTo(o1.lastModified()); } }); } @@ -973,7 +973,7 @@ public class AndroidUtilities { float effectiveWidth = Math.min(width, height); float effectiveHeight = Math.max(width, height); - return (effectiveWidth >= MIN_TABLET_WIDTH && effectiveHeight >= MIN_TABLET_HEIGHT); + return effectiveWidth >= MIN_TABLET_WIDTH && effectiveHeight >= MIN_TABLET_HEIGHT; } else { return false; } diff --git a/api/src/com/todoroo/andlib/utility/DateUtilities.java b/api/src/com/todoroo/andlib/utility/DateUtilities.java index f2b712eac..263fbdebf 100644 --- a/api/src/com/todoroo/andlib/utility/DateUtilities.java +++ b/api/src/com/todoroo/andlib/utility/DateUtilities.java @@ -28,7 +28,7 @@ public class DateUtilities { /** * Convert unixtime into date */ - public static final Date unixtimeToDate(long millis) { + public static Date unixtimeToDate(long millis) { if (millis == 0) { return null; } @@ -38,7 +38,7 @@ public class DateUtilities { /** * Convert date into unixtime */ - public static final long dateToUnixtime(Date date) { + public static long dateToUnixtime(Date date) { if (date == null) { return 0; } @@ -53,7 +53,7 @@ public class DateUtilities { * @param interval the amount of months to be added * @return the calculated time in milliseconds */ - public static final long addCalendarMonthsToUnixtime(long time, int interval) { + public static long addCalendarMonthsToUnixtime(long time, int interval) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(time); c.add(Calendar.MONTH, interval); @@ -63,14 +63,14 @@ public class DateUtilities { /** * Returns unixtime for current time */ - public static final long now() { + public static long now() { return System.currentTimeMillis(); } /** * Returns unixtime one month from now */ - public static final long oneMonthFromNow() { + public static long oneMonthFromNow() { Date date = new Date(); date.setMonth(date.getMonth() + 1); return date.getTime(); @@ -193,7 +193,7 @@ public class DateUtilities { value = "d '#'"; } - if (date.getYear() != (new Date()).getYear()) { + if (date.getYear() != new Date().getYear()) { value = value + "\nyyyy"; } if (arrayBinaryContains(locale.getLanguage(), "ja", "zh")) //$NON-NLS-1$ diff --git a/api/src/com/todoroo/andlib/utility/Pair.java b/api/src/com/todoroo/andlib/utility/Pair.java index d933c9eb6..09f781c4d 100644 --- a/api/src/com/todoroo/andlib/utility/Pair.java +++ b/api/src/com/todoroo/andlib/utility/Pair.java @@ -44,7 +44,7 @@ public class Pair { return equal(getLeft(), other.getLeft()) && equal(getRight(), other.getRight()); } - public static final boolean equal(Object o1, Object o2) { + public static boolean equal(Object o1, Object o2) { if (o1 == null) { return o2 == null; } @@ -56,6 +56,6 @@ public class Pair { int hLeft = getLeft() == null ? 0 : getLeft().hashCode(); int hRight = getRight() == null ? 0 : getRight().hashCode(); - return hLeft + (57 * hRight); + return hLeft + 57 * hRight; } } diff --git a/api/src/com/todoroo/astrid/api/Addon.java b/api/src/com/todoroo/astrid/api/Addon.java index b432aa93d..f3d75f165 100644 --- a/api/src/com/todoroo/astrid/api/Addon.java +++ b/api/src/com/todoroo/astrid/api/Addon.java @@ -94,7 +94,6 @@ public class Addon implements Parcelable { return new Addon[size]; } - ; }; } diff --git a/api/src/com/todoroo/astrid/api/CustomFilterCriterion.java b/api/src/com/todoroo/astrid/api/CustomFilterCriterion.java index bbf671057..b5b7cf072 100644 --- a/api/src/com/todoroo/astrid/api/CustomFilterCriterion.java +++ b/api/src/com/todoroo/astrid/api/CustomFilterCriterion.java @@ -85,8 +85,8 @@ abstract public class CustomFilterCriterion implements Parcelable { identifier = source.readString(); text = source.readString(); sql = source.readString(); - valuesForNewTasks = (ContentValues) source.readParcelable(ContentValues.class.getClassLoader()); - icon = (Bitmap) source.readParcelable(Bitmap.class.getClassLoader()); + valuesForNewTasks = source.readParcelable(ContentValues.class.getClassLoader()); + icon = source.readParcelable(Bitmap.class.getClassLoader()); name = source.readString(); } } diff --git a/api/src/com/todoroo/astrid/api/Filter.java b/api/src/com/todoroo/astrid/api/Filter.java index 650f18b1d..d97d711fc 100644 --- a/api/src/com/todoroo/astrid/api/Filter.java +++ b/api/src/com/todoroo/astrid/api/Filter.java @@ -145,8 +145,8 @@ public class Filter extends FilterListItem { final int prime = 31; int result = 1; result = prime * result - + ((sqlQuery == null) ? 0 : sqlQuery.hashCode()); - result = prime * result + ((title == null) ? 0 : title.hashCode()); + + (sqlQuery == null ? 0 : sqlQuery.hashCode()); + result = prime * result + (title == null ? 0 : title.hashCode()); return result; } diff --git a/api/src/com/todoroo/astrid/api/IntentFilter.java b/api/src/com/todoroo/astrid/api/IntentFilter.java index 9b1892876..354920a62 100644 --- a/api/src/com/todoroo/astrid/api/IntentFilter.java +++ b/api/src/com/todoroo/astrid/api/IntentFilter.java @@ -15,7 +15,7 @@ import android.os.Parcelable; * * @author Tim Su */ -public final class IntentFilter extends FilterListItem implements Parcelable { +public final class IntentFilter extends FilterListItem { /** * PendingIntent to trigger when pressed diff --git a/api/src/com/todoroo/astrid/api/MultipleSelectCriterion.java b/api/src/com/todoroo/astrid/api/MultipleSelectCriterion.java index 5d9db208a..2bea88d2d 100644 --- a/api/src/com/todoroo/astrid/api/MultipleSelectCriterion.java +++ b/api/src/com/todoroo/astrid/api/MultipleSelectCriterion.java @@ -16,7 +16,7 @@ import android.os.Parcelable; * * @author Tim Su */ -public class MultipleSelectCriterion extends CustomFilterCriterion implements Parcelable { +public class MultipleSelectCriterion extends CustomFilterCriterion { /** * Array of entries for user to select from @@ -74,7 +74,7 @@ public class MultipleSelectCriterion extends CustomFilterCriterion implements Pa public void writeToParcel(Parcel dest, int flags) { dest.writeStringArray(entryTitles); dest.writeStringArray(entryValues); - super.writeToParcel(dest); + writeToParcel(dest); } /** diff --git a/api/src/com/todoroo/astrid/api/SyncAction.java b/api/src/com/todoroo/astrid/api/SyncAction.java index 829f4ea34..977e54521 100644 --- a/api/src/com/todoroo/astrid/api/SyncAction.java +++ b/api/src/com/todoroo/astrid/api/SyncAction.java @@ -104,7 +104,6 @@ public class SyncAction implements Parcelable { return new SyncAction[size]; } - ; }; } diff --git a/api/src/com/todoroo/astrid/api/TaskDecoration.java b/api/src/com/todoroo/astrid/api/TaskDecoration.java index f211a1cdf..67fccb513 100644 --- a/api/src/com/todoroo/astrid/api/TaskDecoration.java +++ b/api/src/com/todoroo/astrid/api/TaskDecoration.java @@ -96,7 +96,6 @@ public final class TaskDecoration implements Parcelable { return new TaskDecoration[size]; } - ; }; } diff --git a/api/src/com/todoroo/astrid/api/TextInputCriterion.java b/api/src/com/todoroo/astrid/api/TextInputCriterion.java index 252b2ec40..45d4f8733 100644 --- a/api/src/com/todoroo/astrid/api/TextInputCriterion.java +++ b/api/src/com/todoroo/astrid/api/TextInputCriterion.java @@ -16,7 +16,7 @@ import android.os.Parcelable; * * @author Tim Su */ -public class TextInputCriterion extends CustomFilterCriterion implements Parcelable { +public class TextInputCriterion extends CustomFilterCriterion { /** * Text area prompt @@ -75,7 +75,7 @@ public class TextInputCriterion extends CustomFilterCriterion implements Parcela public void writeToParcel(Parcel dest, int flags) { dest.writeString(prompt); dest.writeString(hint); - super.writeToParcel(dest); + writeToParcel(dest); } /** diff --git a/api/src/com/todoroo/astrid/core/SortHelper.java b/api/src/com/todoroo/astrid/core/SortHelper.java index 50881cfd5..e1bf40489 100644 --- a/api/src/com/todoroo/astrid/core/SortHelper.java +++ b/api/src/com/todoroo/astrid/core/SortHelper.java @@ -86,7 +86,7 @@ public class SortHelper { } public static int setManualSort(int flags, boolean status) { - flags = (flags & ~FLAG_DRAG_DROP); + flags = flags & ~FLAG_DRAG_DROP; if (status) { flags |= FLAG_DRAG_DROP; } @@ -106,7 +106,7 @@ public class SortHelper { "+3*" + Task.COMPLETION_DATE); break; case SORT_IMPORTANCE: - order = Order.asc(Task.IMPORTANCE + "*" + (2 * DateUtilities.now()) + //$NON-NLS-1$ + order = Order.asc(Task.IMPORTANCE + "*" + 2 * DateUtilities.now() + //$NON-NLS-1$ "+" + Functions.caseStatement(Task.DUE_DATE.eq(0), //$NON-NLS-1$ 2 * DateUtilities.now(), Task.DUE_DATE) + "+8*" + Task.COMPLETION_DATE); @@ -133,7 +133,7 @@ public class SortHelper { public static Order defaultTaskOrder() { return Order.asc(Functions.caseStatement(Task.DUE_DATE.eq(0), Functions.now() + "*2", - adjustedDueDateFunction()) + " + " + (2 * DateUtilities.ONE_DAY) + " * " + + adjustedDueDateFunction()) + " + " + 2 * DateUtilities.ONE_DAY + " * " + Task.IMPORTANCE + " + 2*" + Task.COMPLETION_DATE); } diff --git a/api/src/com/todoroo/astrid/data/Metadata.java b/api/src/com/todoroo/astrid/data/Metadata.java index 0a876f934..bfc6f5da5 100644 --- a/api/src/com/todoroo/astrid/data/Metadata.java +++ b/api/src/com/todoroo/astrid/data/Metadata.java @@ -151,8 +151,6 @@ public class Metadata extends AbstractModel { return getIdHelper(ID); } - ; - // --- parcelable helpers private static final Creator CREATOR = new ModelCreator(Metadata.class); diff --git a/api/src/com/todoroo/astrid/data/RemoteModel.java b/api/src/com/todoroo/astrid/data/RemoteModel.java index a3f58d7bc..9939f1c21 100644 --- a/api/src/com/todoroo/astrid/data/RemoteModel.java +++ b/api/src/com/todoroo/astrid/data/RemoteModel.java @@ -79,7 +79,7 @@ abstract public class RemoteModel extends AbstractModel { */ public static final String NO_UUID = "0"; //$NON-NLS-1$ - public static final boolean isValidUuid(String uuid) { + public static boolean isValidUuid(String uuid) { try { long value = Long.parseLong(uuid); return value > 0; diff --git a/api/src/com/todoroo/astrid/data/StoreObject.java b/api/src/com/todoroo/astrid/data/StoreObject.java index 350ed67a4..d90292921 100644 --- a/api/src/com/todoroo/astrid/data/StoreObject.java +++ b/api/src/com/todoroo/astrid/data/StoreObject.java @@ -124,8 +124,6 @@ public class StoreObject extends AbstractModel { return getIdHelper(ID); } - ; - // --- parcelable helpers private static final Creator CREATOR = new ModelCreator(StoreObject.class); diff --git a/api/src/com/todoroo/astrid/data/Task.java b/api/src/com/todoroo/astrid/data/Task.java index ff5423c8b..cc373a7c4 100644 --- a/api/src/com/todoroo/astrid/data/Task.java +++ b/api/src/com/todoroo/astrid/data/Task.java @@ -636,7 +636,7 @@ public final class Task extends RemoteModel { } public boolean isEditable() { - return (getValue(Task.IS_READONLY) == 0) && + return getValue(Task.IS_READONLY) == 0 && !(getValue(Task.IS_PUBLIC) == 1 && !Task.USER_ID_SELF.equals(getValue(Task.USER_ID))); } @@ -652,7 +652,7 @@ public final class Task extends RemoteModel { * Checks whether provided due date has a due time or only a date */ public static boolean hasDueTime(long dueDate) { - return dueDate > 0 && (dueDate % 60000 > 0); + return dueDate > 0 && dueDate % 60000 > 0; } } diff --git a/api/src/com/todoroo/astrid/data/Update.java b/api/src/com/todoroo/astrid/data/Update.java index 4be766dba..5e91159db 100644 --- a/api/src/com/todoroo/astrid/data/Update.java +++ b/api/src/com/todoroo/astrid/data/Update.java @@ -194,8 +194,6 @@ public class Update extends RemoteModel { return getIdHelper(ID); } - ; - @Override public String getUuid() { return null; diff --git a/api/src/com/todoroo/astrid/sync/SyncProvider.java b/api/src/com/todoroo/astrid/sync/SyncProvider.java index b16ec6741..6b8799791 100644 --- a/api/src/com/todoroo/astrid/sync/SyncProvider.java +++ b/api/src/com/todoroo/astrid/sync/SyncProvider.java @@ -262,7 +262,7 @@ public abstract class SyncProvider { Collections.sort(data.remoteUpdated, new Comparator() { private static final int SENTINEL = -2; - private final int check(TYPE o1, TYPE o2, LongProperty property) { + private int check(TYPE o1, TYPE o2, LongProperty property) { long o1Property = o1.task.getValue(property); long o2Property = o2.task.getValue(property); if (o1Property != 0 && o2Property != 0) { @@ -294,7 +294,7 @@ public abstract class SyncProvider { TYPE remote = data.remoteUpdated.get(i); // don't synchronize new & deleted tasks - if (!remote.task.isSaved() && (remote.task.isDeleted())) { + if (!remote.task.isSaved() && remote.task.isDeleted()) { continue; } @@ -318,7 +318,7 @@ public abstract class SyncProvider { } // if there is a conflict, merge - int remoteIndex = matchTask((ArrayList) data.remoteUpdated, local); + int remoteIndex = matchTask(data.remoteUpdated, local); if (remoteIndex != -1) { TYPE remote = data.remoteUpdated.get(remoteIndex); diff --git a/api/src/com/todoroo/astrid/sync/SyncProviderPreferences.java b/api/src/com/todoroo/astrid/sync/SyncProviderPreferences.java index 9077aa0aa..e3ac77c71 100644 --- a/api/src/com/todoroo/astrid/sync/SyncProviderPreferences.java +++ b/api/src/com/todoroo/astrid/sync/SyncProviderPreferences.java @@ -105,7 +105,7 @@ abstract public class SyncProviderPreferences extends TodorooPreferenceActivity preference.getKey())) { int index = AndroidUtilities.indexOf( r.getStringArray(R.array.sync_SPr_interval_values), - (String) value); + value); if (index <= 0) { preference.setSummary(R.string.sync_SPr_interval_desc_disabled); } else { @@ -262,7 +262,7 @@ abstract public class SyncProviderPreferences extends TodorooPreferenceActivity return exceptionsToDisplayMessages; } - private static final String adjustErrorForDisplay(Resources r, String lastError, String service) { + private static String adjustErrorForDisplay(Resources r, String lastError, String service) { Set exceptions = getExceptionMap().keySet(); Integer resource = null; for (String key : exceptions) { @@ -274,7 +274,7 @@ abstract public class SyncProviderPreferences extends TodorooPreferenceActivity if (resource == null) { return lastError; } - return r.getString(resource.intValue(), service); + return r.getString(resource, service); } @Override diff --git a/astrid/common-src/com/commonsware/cwac/tlv/TouchListView.java b/astrid/common-src/com/commonsware/cwac/tlv/TouchListView.java index bd588b74f..a83e3bb7d 100644 --- a/astrid/common-src/com/commonsware/cwac/tlv/TouchListView.java +++ b/astrid/common-src/com/commonsware/cwac/tlv/TouchListView.java @@ -133,11 +133,11 @@ public class TouchListView extends ErrorCatchingListView { break; } - View item = (View) getChildAt(itemnum - getFirstVisiblePosition()); + View item = getChildAt(itemnum - getFirstVisiblePosition()); if (isDraggableRow(item)) { mDragPoint = y - item.getTop(); - mCoordOffset = ((int) ev.getRawY()) - y; + mCoordOffset = (int) ev.getRawY() - y; View dragger = item.findViewById(grabberId); Rect r = mTempRect; // dragger.getDrawingRect(r); @@ -147,7 +147,7 @@ public class TouchListView extends ErrorCatchingListView { r.top = dragger.getTop(); r.bottom = dragger.getBottom(); - if ((r.left < x) && (x < r.right)) { + if (r.left < x && x < r.right) { item.setDrawingCacheEnabled(true); // Create a copy of the drawing cache so that it does not get recycled // by the framework when the list tries to clean up memory @@ -182,7 +182,7 @@ public class TouchListView extends ErrorCatchingListView { } protected boolean isDraggableRow(View view) { - return (view.findViewById(grabberId) != null); + return view.findViewById(grabberId) != null; } /* @@ -203,7 +203,7 @@ public class TouchListView extends ErrorCatchingListView { } private int getItemForPosition(int y) { - int adjustedy = y - mDragPoint - (mItemHeightNormal / 2); + int adjustedy = y - mDragPoint - mItemHeightNormal / 2; int pos = myPointToPosition(0, adjustedy); if (pos >= 0) { if (pos <= mFirstDragPos) { @@ -444,12 +444,12 @@ public class TouchListView extends ErrorCatchingListView { if (mRemoveMode == SLIDE_RIGHT) { if (x > width / 2) { - alpha = ((float) (width - x)) / (width / 2); + alpha = (float) (width - x) / (width / 2); } mWindowParams.alpha = alpha; } else if (mRemoveMode == SLIDE_LEFT) { if (x < width / 2) { - alpha = ((float) x) / (width / 2); + alpha = (float) x / (width / 2); } mWindowParams.alpha = alpha; } diff --git a/astrid/common-src/com/localytics/android/DatapointHelper.java b/astrid/common-src/com/localytics/android/DatapointHelper.java index 87348d810..0a05a7e88 100755 --- a/astrid/common-src/com/localytics/android/DatapointHelper.java +++ b/astrid/common-src/com/localytics/android/DatapointHelper.java @@ -177,7 +177,7 @@ import java.security.NoSuchAlgorithmException; if (Constants.CURRENT_API_LEVEL >= 8) { final Boolean hasTelephony = ReflectionUtils.tryInvokeInstance(context.getPackageManager(), "hasSystemFeature", new Class[]{String.class}, new Object[]{"android.hardware.telephony"}); //$NON-NLS-1$//$NON-NLS-2$ - if (!hasTelephony.booleanValue()) { + if (!hasTelephony) { if (Constants.IS_LOGGABLE) { Log.i(Constants.LOG_TAG, "Device does not have telephony; cannot read telephony id"); //$NON-NLS-1$ } diff --git a/astrid/common-src/com/localytics/android/LocalyticsProvider.java b/astrid/common-src/com/localytics/android/LocalyticsProvider.java index 82ca4967b..299677ec0 100644 --- a/astrid/common-src/com/localytics/android/LocalyticsProvider.java +++ b/astrid/common-src/com/localytics/android/LocalyticsProvider.java @@ -167,7 +167,7 @@ import java.util.Set; final long result = mDb.insertOrThrow(tableName, null, values); if (Constants.IS_LOGGABLE) { - Log.v(Constants.LOG_TAG, String.format("Inserted row with new id %d", Long.valueOf(result))); //$NON-NLS-1$ + Log.v(Constants.LOG_TAG, String.format("Inserted row with new id %d", result)); //$NON-NLS-1$ } return result; @@ -269,7 +269,7 @@ import java.util.Set; } if (Constants.IS_LOGGABLE) { - Log.v(Constants.LOG_TAG, String.format("Deleted %d rows", Integer.valueOf(count))); //$NON-NLS-1$ + Log.v(Constants.LOG_TAG, String.format("Deleted %d rows", count)); //$NON-NLS-1$ } return count; @@ -434,7 +434,7 @@ import java.util.Set; * Note: the events history should be using foreign key constrains on the upload blobs table, but that is currently * disabled to simplify the implementation of the upload processing. */ - db.execSQL(String.format("CREATE TABLE %s (%s INTEGER PRIMARY KEY AUTOINCREMENT, %s INTEGER REFERENCES %s(%s) NOT NULL, %s TEXT NOT NULL CHECK(%s IN (%s, %s)), %s TEXT NOT NULL, %s INTEGER);", EventHistoryDbColumns.TABLE_NAME, EventHistoryDbColumns._ID, EventHistoryDbColumns.SESSION_KEY_REF, SessionsDbColumns.TABLE_NAME, SessionsDbColumns._ID, EventHistoryDbColumns.TYPE, EventHistoryDbColumns.TYPE, Integer.valueOf(EventHistoryDbColumns.TYPE_EVENT), Integer.valueOf(EventHistoryDbColumns.TYPE_SCREEN), EventHistoryDbColumns.NAME, EventHistoryDbColumns.PROCESSED_IN_BLOB)); //$NON-NLS-1$ + db.execSQL(String.format("CREATE TABLE %s (%s INTEGER PRIMARY KEY AUTOINCREMENT, %s INTEGER REFERENCES %s(%s) NOT NULL, %s TEXT NOT NULL CHECK(%s IN (%s, %s)), %s TEXT NOT NULL, %s INTEGER);", EventHistoryDbColumns.TABLE_NAME, EventHistoryDbColumns._ID, EventHistoryDbColumns.SESSION_KEY_REF, SessionsDbColumns.TABLE_NAME, SessionsDbColumns._ID, EventHistoryDbColumns.TYPE, EventHistoryDbColumns.TYPE, EventHistoryDbColumns.TYPE_EVENT, EventHistoryDbColumns.TYPE_SCREEN, EventHistoryDbColumns.NAME, EventHistoryDbColumns.PROCESSED_IN_BLOB)); //$NON-NLS-1$ //db.execSQL(String.format("CREATE TABLE %s (%s INTEGER PRIMARY KEY AUTOINCREMENT, %s INTEGER REFERENCES %s(%s) NOT NULL, %s TEXT NOT NULL CHECK(%s IN (%s, %s)), %s TEXT NOT NULL, %s INTEGER REFERENCES %s(%s));", EventHistoryDbColumns.TABLE_NAME, EventHistoryDbColumns._ID, EventHistoryDbColumns.SESSION_KEY_REF, SessionsDbColumns.TABLE_NAME, SessionsDbColumns._ID, EventHistoryDbColumns.TYPE, EventHistoryDbColumns.TYPE, Integer.valueOf(EventHistoryDbColumns.TYPE_EVENT), Integer.valueOf(EventHistoryDbColumns.TYPE_SCREEN), EventHistoryDbColumns.NAME, EventHistoryDbColumns.PROCESSED_IN_BLOB, UploadBlobsDbColumns.TABLE_NAME, UploadBlobsDbColumns._ID)); //$NON-NLS-1$ // attributes table diff --git a/astrid/common-src/com/localytics/android/LocalyticsSession.java b/astrid/common-src/com/localytics/android/LocalyticsSession.java index 1ac3d476d..d32d4eaf2 100755 --- a/astrid/common-src/com/localytics/android/LocalyticsSession.java +++ b/astrid/common-src/com/localytics/android/LocalyticsSession.java @@ -262,7 +262,7 @@ public final class LocalyticsSession { * Note that getting the application context may have unpredictable results for apps sharing a process running Android 2.1 * and earlier. See for details. */ - mContext = !(context.getClass().getName().equals("android.test.RenamingDelegatingContext")) && Constants.CURRENT_API_LEVEL >= 8 ? context.getApplicationContext() : context; //$NON-NLS-1$ + mContext = !context.getClass().getName().equals("android.test.RenamingDelegatingContext") && Constants.CURRENT_API_LEVEL >= 8 ? context.getApplicationContext() : context; //$NON-NLS-1$ String localyticsKey = key; mSessionHandler = new SessionHandler(mContext, localyticsKey, sSessionHandlerThread.getLooper()); @@ -506,7 +506,7 @@ public final class LocalyticsSession { final int stepQuantity = (maxValue - minValue + step) / step; final int[] steps = new int[stepQuantity + 1]; for (int currentStep = 0; currentStep <= stepQuantity; currentStep++) { - steps[currentStep] = minValue + (currentStep) * step; + steps[currentStep] = minValue + currentStep * step; } return createRangedAttribute(actualValue, steps); } @@ -548,9 +548,9 @@ public final class LocalyticsSession { if (bucketIndex < 0) { // if the index wasn't found, then we want the value before the insertion point as the lower end // the special case where the insertion point is 0 is covered above, so we don't have to worry about it here - bucketIndex = (-bucketIndex) - 2; + bucketIndex = -bucketIndex - 2; } - if (steps[bucketIndex] == (steps[bucketIndex + 1] - 1)) { + if (steps[bucketIndex] == steps[bucketIndex + 1] - 1) { bucket = Integer.toString(steps[bucketIndex]); } else { bucket = steps[bucketIndex] + "-" + (steps[bucketIndex + 1] - 1); //$NON-NLS-1$ @@ -837,7 +837,7 @@ public final class LocalyticsSession { values.put(ApiKeysDbColumns.API_KEY, mApiKey); values.put(ApiKeysDbColumns.UUID, UUID.randomUUID().toString()); values.put(ApiKeysDbColumns.OPT_OUT, Boolean.FALSE); - values.put(ApiKeysDbColumns.CREATED_TIME, Long.valueOf(System.currentTimeMillis())); + values.put(ApiKeysDbColumns.CREATED_TIME, System.currentTimeMillis()); mApiKeyId = mProvider.insert(ApiKeysDbColumns.TABLE_NAME, values); } @@ -871,7 +871,7 @@ public final class LocalyticsSession { */ /* package */void optOut(final boolean isOptingOut) { if (Constants.IS_LOGGABLE) { - Log.v(Constants.LOG_TAG, String.format("Prior opt-out state is %b, requested opt-out state is %b", Boolean.valueOf(mIsOptedOut), Boolean.valueOf(isOptingOut))); //$NON-NLS-1$ + Log.v(Constants.LOG_TAG, String.format("Prior opt-out state is %b, requested opt-out state is %b", mIsOptedOut, isOptingOut)); //$NON-NLS-1$ } // Do nothing if opt-out is unchanged @@ -883,7 +883,7 @@ public final class LocalyticsSession { @Override public void run() { final ContentValues values = new ContentValues(); - values.put(ApiKeysDbColumns.OPT_OUT, Boolean.valueOf(isOptingOut)); + values.put(ApiKeysDbColumns.OPT_OUT, isOptingOut); mProvider.update(ApiKeysDbColumns.TABLE_NAME, values, String.format("%s = ?", ApiKeysDbColumns._ID), new String[]{Long.toString(mApiKeyId)}); //$NON-NLS-1$ if (!mIsSessionOpen) { @@ -1085,11 +1085,11 @@ public final class LocalyticsSession { final TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); final ContentValues values = new ContentValues(); - values.put(SessionsDbColumns.API_KEY_REF, Long.valueOf(mApiKeyId)); - values.put(SessionsDbColumns.SESSION_START_WALL_TIME, Long.valueOf(System.currentTimeMillis())); + values.put(SessionsDbColumns.API_KEY_REF, mApiKeyId); + values.put(SessionsDbColumns.SESSION_START_WALL_TIME, System.currentTimeMillis()); values.put(SessionsDbColumns.UUID, UUID.randomUUID().toString()); values.put(SessionsDbColumns.APP_VERSION, DatapointHelper.getAppVersion(mContext)); - values.put(SessionsDbColumns.ANDROID_SDK, Integer.valueOf(Constants.CURRENT_API_LEVEL)); + values.put(SessionsDbColumns.ANDROID_SDK, Constants.CURRENT_API_LEVEL); values.put(SessionsDbColumns.ANDROID_VERSION, VERSION.RELEASE); // Try and get the deviceId. If it is unavailable (or invalid) use the installation ID instead. @@ -1233,11 +1233,11 @@ public final class LocalyticsSession { final long eventId; { final ContentValues values = new ContentValues(); - values.put(EventsDbColumns.SESSION_KEY_REF, Long.valueOf(mSessionId)); + values.put(EventsDbColumns.SESSION_KEY_REF, mSessionId); values.put(EventsDbColumns.UUID, UUID.randomUUID().toString()); values.put(EventsDbColumns.EVENT_NAME, event); - values.put(EventsDbColumns.REAL_TIME, Long.valueOf(SystemClock.elapsedRealtime())); - values.put(EventsDbColumns.WALL_TIME, Long.valueOf(System.currentTimeMillis())); + values.put(EventsDbColumns.REAL_TIME, SystemClock.elapsedRealtime()); + values.put(EventsDbColumns.WALL_TIME, System.currentTimeMillis()); /* * Special case for open event: keep the start time in sync with the start time put into the sessions table. @@ -1249,7 +1249,7 @@ public final class LocalyticsSession { {SessionsDbColumns.SESSION_START_WALL_TIME}, String.format("%s = ?", SessionsDbColumns._ID), new String[]{Long.toString(mSessionId)}, null); //$NON-NLS-1$ if (cursor.moveToFirst()) { - values.put(EventsDbColumns.WALL_TIME, Long.valueOf(cursor.getLong(cursor.getColumnIndexOrThrow(SessionsDbColumns.SESSION_START_WALL_TIME)))); + values.put(EventsDbColumns.WALL_TIME, cursor.getLong(cursor.getColumnIndexOrThrow(SessionsDbColumns.SESSION_START_WALL_TIME))); } else { // this should never happen throw new RuntimeException("Session didn't exist"); //$NON-NLS-1$ @@ -1281,13 +1281,13 @@ public final class LocalyticsSession { count++; if (count > Constants.MAX_NUM_ATTRIBUTES) { if (Constants.IS_LOGGABLE) { - Log.w(Constants.LOG_TAG, String.format("Map contains %s keys while the maximum number of attributes is %s. Some attributes were not written. Consider reducing the number of attributes.", Integer.valueOf(attributes.size()), Integer.valueOf(Constants.MAX_NUM_ATTRIBUTES))); //$NON-NLS-1$ + Log.w(Constants.LOG_TAG, String.format("Map contains %s keys while the maximum number of attributes is %s. Some attributes were not written. Consider reducing the number of attributes.", attributes.size(), Constants.MAX_NUM_ATTRIBUTES)); //$NON-NLS-1$ } break; } final ContentValues values = new ContentValues(); - values.put(AttributesDbColumns.EVENTS_KEY_REF, Long.valueOf(eventId)); + values.put(AttributesDbColumns.EVENTS_KEY_REF, eventId); values.put(AttributesDbColumns.ATTRIBUTE_KEY, entry.getKey()); values.put(AttributesDbColumns.ATTRIBUTE_VALUE, entry.getValue()); @@ -1305,8 +1305,8 @@ public final class LocalyticsSession { if (!OPEN_EVENT.equals(event) && !CLOSE_EVENT.equals(event) && !OPT_IN_EVENT.equals(event) && !OPT_OUT_EVENT.equals(event) && !FLOW_EVENT.equals(event)) { final ContentValues values = new ContentValues(); values.put(EventHistoryDbColumns.NAME, event.substring(mContext.getPackageName().length() + 1, event.length())); - values.put(EventHistoryDbColumns.TYPE, Integer.valueOf(EventHistoryDbColumns.TYPE_EVENT)); - values.put(EventHistoryDbColumns.SESSION_KEY_REF, Long.valueOf(mSessionId)); + values.put(EventHistoryDbColumns.TYPE, EventHistoryDbColumns.TYPE_EVENT); + values.put(EventHistoryDbColumns.SESSION_KEY_REF, mSessionId); values.putNull(EventHistoryDbColumns.PROCESSED_IN_BLOB); mProvider.insert(EventHistoryDbColumns.TABLE_NAME, values); @@ -1365,8 +1365,8 @@ public final class LocalyticsSession { */ final ContentValues values = new ContentValues(); values.put(EventHistoryDbColumns.NAME, screen); - values.put(EventHistoryDbColumns.TYPE, Integer.valueOf(EventHistoryDbColumns.TYPE_SCREEN)); - values.put(EventHistoryDbColumns.SESSION_KEY_REF, Long.valueOf(mSessionId)); + values.put(EventHistoryDbColumns.TYPE, EventHistoryDbColumns.TYPE_SCREEN); + values.put(EventHistoryDbColumns.SESSION_KEY_REF, mSessionId); values.putNull(EventHistoryDbColumns.PROCESSED_IN_BLOB); mProvider.insert(EventHistoryDbColumns.TABLE_NAME, values); @@ -1468,7 +1468,7 @@ public final class LocalyticsSession { break; } } - eventIds.add(Long.valueOf(eventsCursor.getLong(idColumn))); + eventIds.add(eventsCursor.getLong(idColumn)); break; } case BOTH: @@ -1500,7 +1500,7 @@ public final class LocalyticsSession { for (final Long x : eventIds) { values.clear(); - values.put(UploadBlobEventsDbColumns.UPLOAD_BLOBS_KEY_REF, Long.valueOf(blobId)); + values.put(UploadBlobEventsDbColumns.UPLOAD_BLOBS_KEY_REF, blobId); values.put(UploadBlobEventsDbColumns.EVENTS_KEY_REF, x); mProvider.insert(UploadBlobEventsDbColumns.TABLE_NAME, values); @@ -1508,7 +1508,7 @@ public final class LocalyticsSession { } final ContentValues values = new ContentValues(); - values.put(EventHistoryDbColumns.PROCESSED_IN_BLOB, Long.valueOf(blobId)); + values.put(EventHistoryDbColumns.PROCESSED_IN_BLOB, blobId); mProvider.update(EventHistoryDbColumns.TABLE_NAME, values, String.format("%s IS NULL", EventHistoryDbColumns.PROCESSED_IN_BLOB), null); //$NON-NLS-1$ } } @@ -1526,7 +1526,7 @@ public final class LocalyticsSession { * @see #MESSAGE_UPLOAD */ /* package */void upload(final Runnable callback) { - if (sIsUploadingMap.get(mApiKey).booleanValue()) { + if (sIsUploadingMap.get(mApiKey)) { if (Constants.IS_LOGGABLE) { Log.d(Constants.LOG_TAG, "Already uploading"); //$NON-NLS-1$ } @@ -1743,7 +1743,7 @@ public final class LocalyticsSession { final StatusLine status = response.getStatusLine(); final int statusCode = status.getStatusCode(); if (Constants.IS_LOGGABLE) { - Log.v(Constants.LOG_TAG, String.format("Upload complete with status %d", Integer.valueOf(statusCode))); //$NON-NLS-1$ + Log.v(Constants.LOG_TAG, String.format("Upload complete with status %d", statusCode)); //$NON-NLS-1$ } /* @@ -1882,7 +1882,7 @@ public final class LocalyticsSession { /* * Add the blob to the list of blobs to be deleted */ - blobsToDelete.add(Long.valueOf(blobId)); + blobsToDelete.add(blobId); // delete all attributes for the event provider.delete(AttributesDbColumns.TABLE_NAME, String.format("%s = ?", AttributesDbColumns.EVENTS_KEY_REF), new String[]{Long.toString(eventId)}); //$NON-NLS-1$ @@ -1904,7 +1904,7 @@ public final class LocalyticsSession { provider.delete(EventHistoryDbColumns.TABLE_NAME, String.format("%s = ?", EventHistoryDbColumns.SESSION_KEY_REF), new String[] //$NON-NLS-1$ {Long.toString(sessionId)}); - sessionsToDelete.add(Long.valueOf(eventCursor.getLong(eventCursor.getColumnIndexOrThrow(EventsDbColumns.SESSION_KEY_REF)))); + sessionsToDelete.add(eventCursor.getLong(eventCursor.getColumnIndexOrThrow(EventsDbColumns.SESSION_KEY_REF))); } } finally { if (null != eventCursor) { diff --git a/astrid/common-src/com/localytics/android/ReflectionUtils.java b/astrid/common-src/com/localytics/android/ReflectionUtils.java index ff1a6146a..c516cd260 100644 --- a/astrid/common-src/com/localytics/android/ReflectionUtils.java +++ b/astrid/common-src/com/localytics/android/ReflectionUtils.java @@ -35,7 +35,7 @@ public final class ReflectionUtils { * @throws RuntimeException if the class or method doesn't exist */ public static T tryInvokeStatic(final Class classObject, final String methodName, final Class[] types, final Object[] args) { - return (T) helper(null, classObject, null, methodName, types, args); + return helper(null, classObject, null, methodName, types, args); } /** @@ -50,7 +50,7 @@ public final class ReflectionUtils { * @throws RuntimeException if the class or method doesn't exist */ public static T tryInvokeStatic(final String className, final String methodName, final Class[] types, final Object[] args) { - return (T) helper(className, null, null, methodName, types, args); + return helper(className, null, null, methodName, types, args); } /** @@ -65,7 +65,7 @@ public final class ReflectionUtils { * @throws RuntimeException if the class or method doesn't exist */ public static T tryInvokeInstance(final Object target, final String methodName, final Class[] types, final Object[] args) { - return (T) helper(target, null, null, methodName, types, args); + return helper(target, null, null, methodName, types, args); } @SuppressWarnings("unchecked") diff --git a/astrid/common-src/com/mdimension/jchronic/AstridChronic.java b/astrid/common-src/com/mdimension/jchronic/AstridChronic.java index 3ef53b0b8..9fddc1a12 100644 --- a/astrid/common-src/com/mdimension/jchronic/AstridChronic.java +++ b/astrid/common-src/com/mdimension/jchronic/AstridChronic.java @@ -184,7 +184,7 @@ public class AstridChronic { } long guessValue; if (span.getWidth() > 1) { - guessValue = span.getBegin() + (span.getWidth() / 2); + guessValue = span.getBegin() + span.getWidth() / 2; } else { guessValue = span.getBegin(); } diff --git a/astrid/common-src/edu/mit/mobile/android/imagecache/DiskCache.java b/astrid/common-src/edu/mit/mobile/android/imagecache/DiskCache.java index 83e4bfdbe..d46d8b323 100644 --- a/astrid/common-src/edu/mit/mobile/android/imagecache/DiskCache.java +++ b/astrid/common-src/edu/mit/mobile/android/imagecache/DiskCache.java @@ -492,8 +492,6 @@ public abstract class DiskCache { } } - ; - private final Comparator mLastModifiedOldestFirstComparator = new Comparator() { @Override diff --git a/astrid/common-src/edu/mit/mobile/android/imagecache/ImageCache.java b/astrid/common-src/edu/mit/mobile/android/imagecache/ImageCache.java index 4e8c599c3..4c5b813e1 100644 --- a/astrid/common-src/edu/mit/mobile/android/imagecache/ImageCache.java +++ b/astrid/common-src/edu/mit/mobile/android/imagecache/ImageCache.java @@ -98,7 +98,7 @@ public class ImageCache extends DiskCache { private final HashSet mImageLoadListeners = new HashSet(); - public static final int DEFAULT_CACHE_SIZE = (24 /* MiB */ * 1024 * 1024); // in bytes + public static final int DEFAULT_CACHE_SIZE = 24 /* MiB */ * 1024 * 1024; // in bytes private DrawableMemCache mMemCache = new DrawableMemCache(DEFAULT_CACHE_SIZE); @@ -144,7 +144,6 @@ public class ImageCache extends DiskCache { } } - ; } private final ImageLoadHandler mHandler = new ImageLoadHandler(this); @@ -565,7 +564,6 @@ public class ImageCache extends DiskCache { return Long.valueOf(another.when).compareTo(when); } - ; } private void oomClear() { diff --git a/astrid/plugin-src/com/timsu/astrid/GCMIntentService.java b/astrid/plugin-src/com/timsu/astrid/GCMIntentService.java index 93f31559e..86a41397d 100644 --- a/astrid/plugin-src/com/timsu/astrid/GCMIntentService.java +++ b/astrid/plugin-src/com/timsu/astrid/GCMIntentService.java @@ -63,7 +63,6 @@ public class GCMIntentService extends GCMBaseIntentService { public static String getDeviceID() { String id = Secure.getString(ContextManager.getContext().getContentResolver(), Secure.ANDROID_ID); - ; if (AndroidUtilities.getSdkVersion() > 8) { //Gingerbread and above //the following uses relection to get android.os.Build.SERIAL to avoid having to build with Gingerbread try { @@ -342,7 +341,7 @@ public class GCMIntentService extends GCMBaseIntentService { } ActFmSyncThread.getInstance().enqueueMessage(new BriefMe(TagData.class, uuid, pushedAt), null); - FilterWithCustomIntent filter = (FilterWithCustomIntent) TagFilterExposer.filterFromTagData(context, tagData); + FilterWithCustomIntent filter = TagFilterExposer.filterFromTagData(context, tagData); if (intent.hasExtra("activity_id")) { UserActivity update = new UserActivity(); @@ -406,7 +405,7 @@ public class GCMIntentService extends GCMBaseIntentService { // ==================== Registration ============== // - public static final void register(Context context) { + public static void register(Context context) { try { if (AndroidUtilities.getSdkVersion() >= 8) { GCMRegistrar.checkDevice(context); @@ -424,7 +423,7 @@ public class GCMIntentService extends GCMBaseIntentService { } } - public static final void unregister(Context context) { + public static void unregister(Context context) { try { if (AndroidUtilities.getSdkVersion() >= 8) { GCMRegistrar.unregister(context); diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmCameraModule.java b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmCameraModule.java index 646bf65f6..4fbd2aa0a 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmCameraModule.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmCameraModule.java @@ -67,7 +67,7 @@ public class ActFmCameraModule { intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(lastTempFile)); } activity.startActivityForResult(intent, REQUEST_CODE_CAMERA); - } else if ((which == 1 && cameraAvailable) || (which == 0 && !cameraAvailable)) { + } else if (which == 1 && cameraAvailable || which == 0 && !cameraAvailable) { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); activity.startActivityForResult(Intent.createChooser(intent, @@ -116,7 +116,7 @@ public class ActFmCameraModule { cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(lastTempFile)); } fragment.startActivityForResult(cameraIntent, REQUEST_CODE_CAMERA); - } else if ((which == 1 && cameraAvailable) || (which == 0 && !cameraAvailable)) { + } else if (which == 1 && cameraAvailable || which == 0 && !cameraAvailable) { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); fragment.startActivityForResult(Intent.createChooser(intent, diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java index 8a9216c54..05edb6434 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java @@ -515,9 +515,9 @@ public class ActFmLoginActivity extends SherlockFragmentActivity { String oSimilar = "oO0"; String puncSimilar = ".,"; - boolean match = (iSimilar.indexOf(last) > 0 && iSimilar.indexOf(check) > 0) - || (oSimilar.indexOf(last) > 0 && oSimilar.indexOf(check) > 0) - || (puncSimilar.indexOf(last) > 0 && puncSimilar.indexOf(check) > 0); + boolean match = iSimilar.indexOf(last) > 0 && iSimilar.indexOf(check) > 0 + || oSimilar.indexOf(last) > 0 && oSimilar.indexOf(check) > 0 + || puncSimilar.indexOf(last) > 0 && puncSimilar.indexOf(check) > 0; if (match) { return false; diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/CommentsFragment.java b/astrid/plugin-src/com/todoroo/astrid/actfm/CommentsFragment.java index ea926fcb1..074e6ecc1 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/CommentsFragment.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/CommentsFragment.java @@ -185,7 +185,7 @@ public abstract class CommentsFragment extends SherlockListFragment { addCommentField.addTextChangedListener(new TextWatcher() { @Override public void afterTextChanged(Editable s) { - commentButton.setVisibility((s.length() > 0) ? View.VISIBLE : View.GONE); + commentButton.setVisibility(s.length() > 0 ? View.VISIBLE : View.GONE); } @Override @@ -241,7 +241,7 @@ public abstract class CommentsFragment extends SherlockListFragment { } Cursor cursor = null; - ListView listView = ((ListView) view.findViewById(android.R.id.list)); + ListView listView = (ListView) view.findViewById(android.R.id.list); if (updateAdapter == null) { cursor = getCursor(); activity.startManagingCursor(cursor); diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java b/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java index 0939ae01c..4bfe37d0c 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/EditPeopleControlSet.java @@ -366,13 +366,12 @@ public class EditPeopleControlSet extends PopupControlSet { private ArrayList convertJsonUsersToAssignedUsers(ArrayList jsonUsers, HashSet userIds, HashSet emails, HashMap names) { ArrayList users = new ArrayList(); - for (int i = 0; i < jsonUsers.size(); i++) { - JSONObject person = jsonUsers.get(i); + for (JSONObject person : jsonUsers) { if (person == null) { continue; } String id = getLongOrStringId(person, Task.USER_ID_EMAIL); - if (ActFmPreferenceService.userId().equals(id) || ((Task.USER_ID_UNASSIGNED.equals(id) || Task.isRealUserId(id)) && userIds.contains(id))) { + if (ActFmPreferenceService.userId().equals(id) || (Task.USER_ID_UNASSIGNED.equals(id) || Task.isRealUserId(id)) && userIds.contains(id)) { continue; } userIds.add(id); @@ -446,16 +445,16 @@ public class EditPeopleControlSet extends PopupControlSet { int index = 0; for (ArrayList userList : userLists) { - for (int i = 0; i < userList.size(); i++) { - JSONObject user = userList.get(i).user; + for (AssignedToUser anUserList : userList) { + JSONObject user = anUserList.user; if (user != null) { if (user.optBoolean(CONTACT_CHOOSER_USER)) { index++; continue; } if (getLongOrStringId(user, Task.USER_ID_EMAIL).equals(assignedId) || - (user.optString("email").equals(assignedEmail) && - !(TextUtils.isEmpty(assignedEmail)))) { + user.optString("email").equals(assignedEmail) && + !TextUtils.isEmpty(assignedEmail)) { return index; } } @@ -683,7 +682,7 @@ public class EditPeopleControlSet extends PopupControlSet { String userEmail = userJson.optString("email"); boolean match = userId.equals(taskUserId); - match = match || (userEmail.equals(taskUserEmail) && !TextUtils.isEmpty(userEmail)); + match = match || userEmail.equals(taskUserEmail) && !TextUtils.isEmpty(userEmail); dirty = match ? dirty : true; String willAssignToId = getLongOrStringId(userJson, Task.USER_ID_EMAIL); diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TagCommentsFragment.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TagCommentsFragment.java index 71d6cad99..00c765198 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/TagCommentsFragment.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TagCommentsFragment.java @@ -95,7 +95,7 @@ public class TagCommentsFragment extends CommentsFragment { @Override protected String getSourceIdentifier() { - return (tagData == null) ? UpdateAdapter.FROM_RECENT_ACTIVITY_VIEW : UpdateAdapter.FROM_TAG_VIEW; + return tagData == null ? UpdateAdapter.FROM_RECENT_ACTIVITY_VIEW : UpdateAdapter.FROM_TAG_VIEW; } @Override diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java index 8ce570ae2..47a8c122a 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TagSettingsActivity.java @@ -141,10 +141,10 @@ public class TagSettingsActivity extends SherlockFragmentActivity { params.height = LayoutParams.WRAP_CONTENT; DisplayMetrics metrics = getResources().getDisplayMetrics(); - if ((metrics.widthPixels / metrics.density) >= AndroidUtilities.MIN_TABLET_HEIGHT) { - params.width = (3 * metrics.widthPixels) / 5; - } else if ((metrics.widthPixels / metrics.density) >= AndroidUtilities.MIN_TABLET_WIDTH) { - params.width = (4 * metrics.widthPixels) / 5; + if (metrics.widthPixels / metrics.density >= AndroidUtilities.MIN_TABLET_HEIGHT) { + params.width = 3 * metrics.widthPixels / 5; + } else if (metrics.widthPixels / metrics.density >= AndroidUtilities.MIN_TABLET_WIDTH) { + params.width = 4 * metrics.widthPixels / 5; } getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); } diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java index 987590179..78784b6f5 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TagViewFragment.java @@ -171,7 +171,7 @@ public class TagViewFragment extends TaskListFragment { } }; - ((EditText) getView().findViewById(R.id.quickAddText)).setOnTouchListener(onTouch); + getView().findViewById(R.id.quickAddText).setOnTouchListener(onTouch); View membersEdit = getView().findViewById(R.id.members_edit); if (membersEdit != null) { @@ -752,7 +752,7 @@ public class TagViewFragment extends TaskListFragment { parentOnResume(); // tag was deleted locally in settings // go back to active tasks - AstridActivity activity = ((AstridActivity) getActivity()); + AstridActivity activity = (AstridActivity) getActivity(); FilterListFragment fl = activity.getFilterListFragment(); if (fl != null) { fl.clear(); // Should auto refresh diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/TaskCommentsFragment.java b/astrid/plugin-src/com/todoroo/astrid/actfm/TaskCommentsFragment.java index 6062fe879..df4387b33 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/TaskCommentsFragment.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/TaskCommentsFragment.java @@ -72,7 +72,7 @@ public class TaskCommentsFragment extends CommentsFragment { @Override protected String getSourceIdentifier() { - return (task == null) ? UpdateAdapter.FROM_RECENT_ACTIVITY_VIEW : UpdateAdapter.FROM_TASK_VIEW; + return task == null ? UpdateAdapter.FROM_RECENT_ACTIVITY_VIEW : UpdateAdapter.FROM_TASK_VIEW; } @Override diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmInvoker.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmInvoker.java index 196329a0f..013915f0d 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmInvoker.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmInvoker.java @@ -251,9 +251,9 @@ public class ActFmInvoker { for (int i = 0; i < getParameters.length; i += 2) { if (getParameters[i + 1] instanceof ArrayList) { ArrayList list = (ArrayList) getParameters[i + 1]; - for (int j = 0; j < list.size(); j++) { + for (Object aList : list) { params.add(new Pair(getParameters[i].toString() + "[]", - list.get(j))); + aList)); } } else { params.add(new Pair(getParameters[i].toString(), getParameters[i + 1])); diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java index 41a1de104..094bc9219 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncThread.java @@ -256,7 +256,7 @@ public class ActFmSyncThread { List> messageBatch = new ArrayList>(); while (true) { synchronized (monitor) { - while ((pendingMessages.isEmpty() && !timeForBackgroundSync()) || !actFmPreferenceService.isLoggedIn() || !syncMigration) { + while (pendingMessages.isEmpty() && !timeForBackgroundSync() || !actFmPreferenceService.isLoggedIn() || !syncMigration) { try { if ((pendingMessages.isEmpty() || !actFmPreferenceService.isLoggedIn()) && notificationId >= 0) { notificationManager.cancel(notificationId); @@ -339,7 +339,7 @@ public class ActFmSyncThread { } } errors = response.optJSONArray("errors"); - boolean errorsExist = (errors != null && errors.length() > 0); + boolean errorsExist = errors != null && errors.length() > 0; replayOutstandingChanges(errorsExist); setWidgetSuppression(false); } diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/AstridNewSyncMigrator.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/AstridNewSyncMigrator.java index d8b935593..deabb097d 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/AstridNewSyncMigrator.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/AstridNewSyncMigrator.java @@ -174,7 +174,7 @@ public class AstridNewSyncMigrator { @Override public boolean shouldCreateOutstandingEntries(TagData instance) { - boolean result = lastFetchTime == 0 || (instance.containsNonNullValue(TagData.MODIFICATION_DATE) && instance.getValue(TagData.MODIFICATION_DATE) > lastFetchTime); + boolean result = lastFetchTime == 0 || instance.containsNonNullValue(TagData.MODIFICATION_DATE) && instance.getValue(TagData.MODIFICATION_DATE) > lastFetchTime; return result && RemoteModelDao.getOutstandingEntryFlag(RemoteModelDao.OUTSTANDING_ENTRY_FLAG_RECORD_OUTSTANDING); } @@ -191,7 +191,7 @@ public class AstridNewSyncMigrator { return RemoteModelDao.getOutstandingEntryFlag(RemoteModelDao.OUTSTANDING_ENTRY_FLAG_RECORD_OUTSTANDING); } - return (instance.getValue(Task.LAST_SYNC) < instance.getValue(Task.MODIFICATION_DATE)) && RemoteModelDao.getOutstandingEntryFlag(RemoteModelDao.OUTSTANDING_ENTRY_FLAG_RECORD_OUTSTANDING); + return instance.getValue(Task.LAST_SYNC) < instance.getValue(Task.MODIFICATION_DATE) && RemoteModelDao.getOutstandingEntryFlag(RemoteModelDao.OUTSTANDING_ENTRY_FLAG_RECORD_OUTSTANDING); } @Override @@ -473,7 +473,6 @@ public class AstridNewSyncMigrator { Criterion.or(TaskToTagMetadata.TASK_UUID.eq(0), TaskToTagMetadata.TASK_UUID.isNull(), TaskToTagMetadata.TAG_UUID.eq(0), TaskToTagMetadata.TAG_UUID.isNull()))); incompleteMetadata = metadataService.query(incompleteQuery); - ; Metadata m = new Metadata(); for (incompleteMetadata.moveToFirst(); !incompleteMetadata.isAfterLast(); incompleteMetadata.moveToNext()) { try { @@ -605,7 +604,7 @@ public class AstridNewSyncMigrator { instance.putTransitory(SyncFlags.GTASKS_SUPPRESS_SYNC, true); dao.saveExisting(instance); boolean createdOutstanding = false; - if (propertiesForOutstanding != null && (unsyncedModel || (extras != null && extras.shouldCreateOutstandingEntries(instance)))) { + if (propertiesForOutstanding != null && (unsyncedModel || extras != null && extras.shouldCreateOutstandingEntries(instance))) { createdOutstanding = true; createOutstandingEntries(instance.getId(), dao, oeDao, oe, propertiesForOutstanding); } diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ClientToServerMessage.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ClientToServerMessage.java index beed230b2..210312230 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ClientToServerMessage.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/ClientToServerMessage.java @@ -89,8 +89,8 @@ public abstract class ClientToServerMessage { public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((table == null) ? 0 : table.hashCode()); - result = prime * result + ((uuid == null) ? 0 : uuid.hashCode()); + result = prime * result + (table == null ? 0 : table.hashCode()); + result = prime * result + (uuid == null ? 0 : uuid.hashCode()); return result; } diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/JSONChangeToPropertyVisitor.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/JSONChangeToPropertyVisitor.java index f1b4f8e91..efb27f032 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/JSONChangeToPropertyVisitor.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/messages/JSONChangeToPropertyVisitor.java @@ -43,7 +43,7 @@ public class JSONChangeToPropertyVisitor implements PropertyVisitor property, String key) { try { double value = data.getDouble(key); - model.setValue((DoubleProperty) property, value); + model.setValue(property, value); } catch (JSONException e) { Log.e(ERROR_TAG, "Error reading double value with key " + key + " from JSON " + data, e); } @@ -96,12 +96,12 @@ public class JSONChangeToPropertyVisitor implements PropertyVisitor extends ServerToClientMessage @Override public void performChanges() { JSONArray addMembers = changes.optJSONArray("member_added"); - boolean membersAdded = (addMembers != null && addMembers.length() > 0); + boolean membersAdded = addMembers != null && addMembers.length() > 0; if (membersAdded) { model.setValue(TagData.MEMBERS, ""); // Clear this value for migration purposes } @@ -248,7 +248,7 @@ public class MakeChanges extends ServerToClientMessage changes.has(NameMaps.localPropertyToServerColumnName(NameMaps.TABLE_ID_TASKS, Task.COMPLETION_DATE))) { Task t = PluginServices.getTaskDao().fetch(uuid, ReminderService.NOTIFICATION_PROPERTIES); if (t != null) { - if ((changes.has("task_repeated") && t.getValue(Task.DUE_DATE) > DateUtilities.now()) || t.getValue(Task.COMPLETION_DATE) > 0) { + if (changes.has("task_repeated") && t.getValue(Task.DUE_DATE) > DateUtilities.now() || t.getValue(Task.COMPLETION_DATE) > 0) { Notifications.cancelNotifications(t.getId()); } ReminderService.getInstance().scheduleAlarm(t); @@ -257,8 +257,8 @@ public class MakeChanges extends ServerToClientMessage JSONArray addTags = changes.optJSONArray("tag_added"); JSONArray removeTags = changes.optJSONArray("tag_removed"); - boolean tagsAdded = (addTags != null && addTags.length() > 0); - boolean tagsRemoved = (removeTags != null && removeTags.length() > 0); + boolean tagsAdded = addTags != null && addTags.length() > 0; + boolean tagsRemoved = removeTags != null && removeTags.length() > 0; if (!tagsAdded && !tagsRemoved) { return; } @@ -369,8 +369,8 @@ public class MakeChanges extends ServerToClientMessage JSONArray addMembers = changes.optJSONArray("member_added"); JSONArray removeMembers = changes.optJSONArray("member_removed"); - boolean membersAdded = (addMembers != null && addMembers.length() > 0); - boolean membersRemoved = (removeMembers != null && removeMembers.length() > 0); + boolean membersAdded = addMembers != null && addMembers.length() > 0; + boolean membersRemoved = removeMembers != null && removeMembers.length() > 0; long localId = AbstractModel.NO_ID; if (membersAdded || membersRemoved) { diff --git a/astrid/plugin-src/com/todoroo/astrid/alarms/AlarmTaskRepeatListener.java b/astrid/plugin-src/com/todoroo/astrid/alarms/AlarmTaskRepeatListener.java index 4cbf13bc2..9507b47fc 100644 --- a/astrid/plugin-src/com/todoroo/astrid/alarms/AlarmTaskRepeatListener.java +++ b/astrid/plugin-src/com/todoroo/astrid/alarms/AlarmTaskRepeatListener.java @@ -46,7 +46,7 @@ public class AlarmTaskRepeatListener extends BroadcastReceiver { LinkedHashSet alarms = new LinkedHashSet(cursor.getCount()); for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { metadata.readFromCursor(cursor); - alarms.add(metadata.getValue(AlarmFields.TIME) + (newDueDate - oldDueDate)); + alarms.add(metadata.getValue(AlarmFields.TIME) + newDueDate - oldDueDate); } AlarmService.getInstance().synchronizeAlarms(taskId, alarms); diff --git a/astrid/plugin-src/com/todoroo/astrid/backup/BackupActivity.java b/astrid/plugin-src/com/todoroo/astrid/backup/BackupActivity.java index 96f28e40d..96f9d6088 100644 --- a/astrid/plugin-src/com/todoroo/astrid/backup/BackupActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/backup/BackupActivity.java @@ -24,14 +24,14 @@ public class BackupActivity extends Activity { setContentView(R.layout.backup_activity); setTitle(R.string.backup_BAc_title); - ((Button) findViewById(R.id.importButton)).setOnClickListener(new OnClickListener() { + findViewById(R.id.importButton).setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { importTasks(); } }); - ((Button) findViewById(R.id.exportButton)).setOnClickListener(new OnClickListener() { + findViewById(R.id.exportButton).setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { exportTasks(); diff --git a/astrid/plugin-src/com/todoroo/astrid/backup/BackupService.java b/astrid/plugin-src/com/todoroo/astrid/backup/BackupService.java index 15a8a2e9b..1416b6e5e 100644 --- a/astrid/plugin-src/com/todoroo/astrid/backup/BackupService.java +++ b/astrid/plugin-src/com/todoroo/astrid/backup/BackupService.java @@ -141,7 +141,7 @@ public class BackupService extends Service { Arrays.sort(files, new Comparator() { @Override public int compare(File file1, File file2) { - return -Long.valueOf(file1.lastModified()).compareTo(Long.valueOf(file2.lastModified())); + return -Long.valueOf(file1.lastModified()).compareTo(file2.lastModified()); } }); for (int i = DAYS_TO_KEEP_BACKUP; i < files.length; i++) { diff --git a/astrid/plugin-src/com/todoroo/astrid/backup/TasksXmlExporter.java b/astrid/plugin-src/com/todoroo/astrid/backup/TasksXmlExporter.java index f1cdaa485..9d4bed8a2 100644 --- a/astrid/plugin-src/com/todoroo/astrid/backup/TasksXmlExporter.java +++ b/astrid/plugin-src/com/todoroo/astrid/backup/TasksXmlExporter.java @@ -256,7 +256,7 @@ public class TasksXmlExporter { public Void visitInteger(Property property, AbstractModel data) { try { Integer value = data.getValue(property); - String valueString = (value == null) ? XML_NULL : value.toString(); + String valueString = value == null ? XML_NULL : value.toString(); xml.attribute(null, property.name, valueString); } catch (UnsupportedOperationException e) { // didn't read this value, do nothing @@ -274,7 +274,7 @@ public class TasksXmlExporter { public Void visitLong(Property property, AbstractModel data) { try { Long value = data.getValue(property); - String valueString = (value == null) ? XML_NULL : value.toString(); + String valueString = value == null ? XML_NULL : value.toString(); xml.attribute(null, property.name, valueString); } catch (UnsupportedOperationException e) { // didn't read this value, do nothing @@ -292,7 +292,7 @@ public class TasksXmlExporter { public Void visitDouble(Property property, AbstractModel data) { try { Double value = data.getValue(property); - String valueString = (value == null) ? XML_NULL : value.toString(); + String valueString = value == null ? XML_NULL : value.toString(); xml.attribute(null, property.name, valueString); } catch (UnsupportedOperationException e) { // didn't read this value, do nothing diff --git a/astrid/plugin-src/com/todoroo/astrid/backup/TasksXmlImporter.java b/astrid/plugin-src/com/todoroo/astrid/backup/TasksXmlImporter.java index 0af68362d..2bc83ac21 100644 --- a/astrid/plugin-src/com/todoroo/astrid/backup/TasksXmlImporter.java +++ b/astrid/plugin-src/com/todoroo/astrid/backup/TasksXmlImporter.java @@ -468,9 +468,9 @@ public class TasksXmlImporter { Metadata metadata = new Metadata(); metadata.setValue(Metadata.TASK, currentTask.getId()); - metadata.setValue(Metadata.VALUE1, (listId)); - metadata.setValue(Metadata.VALUE2, (taskSeriesId)); - metadata.setValue(Metadata.VALUE3, (taskId)); + metadata.setValue(Metadata.VALUE1, listId); + metadata.setValue(Metadata.VALUE2, taskSeriesId); + metadata.setValue(Metadata.VALUE3, taskId); metadata.setValue(Metadata.VALUE4, syncOnComplete ? "1" : "0"); //$NON-NLS-1$ //$NON-NLS-2$ metadataService.save(metadata); return true; @@ -560,7 +560,7 @@ public class TasksXmlImporter { * helper method to set field on a task */ @SuppressWarnings("nls") - private final boolean setTaskField(Task task, String field, String value) { + private boolean setTaskField(Task task, String field, String value) { if (field.equals(LegacyTaskModel.ID)) { // ignore } else if (field.equals(LegacyTaskModel.NAME)) { @@ -591,7 +591,7 @@ public class TasksXmlImporter { } else if (field.equals(LegacyTaskModel.PREFERRED_DUE_DATE)) { String definite = xpp.getAttributeValue(null, LegacyTaskModel.DEFINITE_DUE_DATE); if (definite != null) { - ; // handled above + // handled above } else { task.setValue(Task.DUE_DATE, BackupDateUtilities.getTaskDueDateFromIso8601String(value).getTime()); diff --git a/astrid/plugin-src/com/todoroo/astrid/calls/MissedCallActivity.java b/astrid/plugin-src/com/todoroo/astrid/calls/MissedCallActivity.java index 8a7ba4873..2eabed18b 100644 --- a/astrid/plugin-src/com/todoroo/astrid/calls/MissedCallActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/calls/MissedCallActivity.java @@ -131,7 +131,7 @@ public class MissedCallActivity extends Activity { .setText(getString(R.string.MCA_title, TextUtils.isEmpty(name) ? number : name, timeString)); - ImageView pictureView = ((ImageView) findViewById(R.id.contact_picture)); + ImageView pictureView = (ImageView) findViewById(R.id.contact_picture); if (contactId >= 0) { Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, contactId); InputStream input = ContactsContract.Contacts.openContactPhotoInputStream(getContentResolver(), uri); diff --git a/astrid/plugin-src/com/todoroo/astrid/core/CoreFilterExposer.java b/astrid/plugin-src/com/todoroo/astrid/core/CoreFilterExposer.java index f24126b90..28fd3891b 100644 --- a/astrid/plugin-src/com/todoroo/astrid/core/CoreFilterExposer.java +++ b/astrid/plugin-src/com/todoroo/astrid/core/CoreFilterExposer.java @@ -134,11 +134,11 @@ public final class CoreFilterExposer extends BroadcastReceiver implements Astrid * @return */ public static boolean isInbox(Filter filter) { - return (filter != null && filter.equals(buildInboxFilter(ContextManager.getContext().getResources()))); + return filter != null && filter.equals(buildInboxFilter(ContextManager.getContext().getResources())); } public static boolean isTodayFilter(Filter filter) { - return (filter != null && filter.equals(getTodayFilter(ContextManager.getContext().getResources()))); + return filter != null && filter.equals(getTodayFilter(ContextManager.getContext().getResources())); } @Override diff --git a/astrid/plugin-src/com/todoroo/astrid/core/CustomFilterActivity.java b/astrid/plugin-src/com/todoroo/astrid/core/CustomFilterActivity.java index cdb0c1771..6291c0d5c 100644 --- a/astrid/plugin-src/com/todoroo/astrid/core/CustomFilterActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/core/CustomFilterActivity.java @@ -314,14 +314,14 @@ public class CustomFilterActivity extends SherlockFragmentActivity { } private void setUpListeners() { - ((Button) findViewById(R.id.add)).setOnClickListener(new View.OnClickListener() { + findViewById(R.id.add).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listView.showContextMenu(); } }); - final Button saveAndView = ((Button) findViewById(R.id.saveAndView)); + final Button saveAndView = (Button) findViewById(R.id.saveAndView); saveAndView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/astrid/plugin-src/com/todoroo/astrid/core/DefaultsPreferences.java b/astrid/plugin-src/com/todoroo/astrid/core/DefaultsPreferences.java index cb30ae250..bd6535be8 100644 --- a/astrid/plugin-src/com/todoroo/astrid/core/DefaultsPreferences.java +++ b/astrid/plugin-src/com/todoroo/astrid/core/DefaultsPreferences.java @@ -61,7 +61,7 @@ public class DefaultsPreferences extends TodorooPreferenceActivity { updateTaskListPreference(preference, value, r, R.array.EPr_default_reminders_mode, R.array.EPr_default_reminders_mode_values, R.string.EPr_default_reminders_mode_desc); } else if (r.getString(R.string.p_rmd_default_random_hours).equals(preference.getKey())) { - int index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_reminder_random_hours), (String) value); + int index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_reminder_random_hours), value); if (index <= 0) { preference.setSummary(r.getString(R.string.rmd_EPr_defaultRemind_desc_disabled)); } else { @@ -70,7 +70,7 @@ public class DefaultsPreferences extends TodorooPreferenceActivity { } } else if (r.getString(R.string.gcal_p_default).equals(preference.getKey())) { ListPreference listPreference = (ListPreference) preference; - int index = AndroidUtilities.indexOf(listPreference.getEntryValues(), (String) value); + int index = AndroidUtilities.indexOf(listPreference.getEntryValues(), value); if (index <= 0) { preference.setSummary(r.getString(R.string.EPr_default_addtocalendar_desc_disabled)); } else { @@ -89,7 +89,7 @@ public class DefaultsPreferences extends TodorooPreferenceActivity { private void updateTaskListPreference(Preference preference, Object value, Resources r, int keyArray, int valueArray, int summaryResource) { - int index = AndroidUtilities.indexOf(r.getStringArray(valueArray), (String) value); + int index = AndroidUtilities.indexOf(r.getStringArray(valueArray), value); if (index == -1) { // force the zeroth index index = 0; diff --git a/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java b/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java index 24e0ab751..065855e3b 100644 --- a/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/files/FilesControlSet.java @@ -375,7 +375,7 @@ public class FilesControlSet extends PopupControlSet { fileOutput.write(buffer, 0, bufferLength); downloadedSize += bufferLength; - int progress = (int) (downloadedSize * 100 / totalSize); + int progress = downloadedSize * 100 / totalSize; pd.setProgress(progress); } diff --git a/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarAlarmReceiver.java b/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarAlarmReceiver.java index c73ae6942..0da053eef 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarAlarmReceiver.java +++ b/astrid/plugin-src/com/todoroo/astrid/gcal/CalendarAlarmReceiver.java @@ -95,10 +95,10 @@ public class CalendarAlarmReceiver extends BroadcastReceiver { boolean shouldShowReminder; if (fromPostpone) { long timeAfter = DateUtilities.now() - endTime; - shouldShowReminder = (timeAfter > DateUtilities.ONE_MINUTE * 2); + shouldShowReminder = timeAfter > DateUtilities.ONE_MINUTE * 2; } else { long timeUntil = startTime - DateUtilities.now(); - shouldShowReminder = (timeUntil > 0 && timeUntil < DateUtilities.ONE_MINUTE * 20); + shouldShowReminder = timeUntil > 0 && timeUntil < DateUtilities.ONE_MINUTE * 20; } if (shouldShowReminder) { diff --git a/astrid/plugin-src/com/todoroo/astrid/gcal/Calendars.java b/astrid/plugin-src/com/todoroo/astrid/gcal/Calendars.java index 21596e920..fbfc2a51f 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gcal/Calendars.java +++ b/astrid/plugin-src/com/todoroo/astrid/gcal/Calendars.java @@ -32,14 +32,14 @@ public class Calendars { private static final boolean USE_ICS_NAMES = AndroidUtilities.getSdkVersion() >= 14; public static final String ID_COLUMN_NAME = "_id"; - public static final String CALENDARS_DISPLAY_COL = (USE_ICS_NAMES ? CalendarContract.Calendars.CALENDAR_DISPLAY_NAME : "displayName"); - public static final String CALENDARS_ACCESS_LEVEL_COL = (USE_ICS_NAMES ? CalendarContract.Calendars.CALENDAR_ACCESS_LEVEL : "access_level"); - public static final String EVENTS_DTSTART_COL = (USE_ICS_NAMES ? CalendarContract.Events.DTSTART : "dtstart"); - public static final String EVENTS_DTEND_COL = (USE_ICS_NAMES ? CalendarContract.Events.DTEND : "dtend"); - public static final String EVENTS_NAME_COL = (USE_ICS_NAMES ? CalendarContract.Events.TITLE : "title"); - public static final String ATTENDEES_EVENT_ID_COL = (USE_ICS_NAMES ? CalendarContract.Attendees.EVENT_ID : "event_id"); - public static final String ATTENDEES_NAME_COL = (USE_ICS_NAMES ? CalendarContract.Attendees.ATTENDEE_NAME : "attendeeName"); - public static final String ATTENDEES_EMAIL_COL = (USE_ICS_NAMES ? CalendarContract.Attendees.ATTENDEE_EMAIL : "attendeeEmail"); + public static final String CALENDARS_DISPLAY_COL = USE_ICS_NAMES ? CalendarContract.Calendars.CALENDAR_DISPLAY_NAME : "displayName"; + public static final String CALENDARS_ACCESS_LEVEL_COL = USE_ICS_NAMES ? CalendarContract.Calendars.CALENDAR_ACCESS_LEVEL : "access_level"; + public static final String EVENTS_DTSTART_COL = USE_ICS_NAMES ? CalendarContract.Events.DTSTART : "dtstart"; + public static final String EVENTS_DTEND_COL = USE_ICS_NAMES ? CalendarContract.Events.DTEND : "dtend"; + public static final String EVENTS_NAME_COL = USE_ICS_NAMES ? CalendarContract.Events.TITLE : "title"; + public static final String ATTENDEES_EVENT_ID_COL = USE_ICS_NAMES ? CalendarContract.Attendees.EVENT_ID : "event_id"; + public static final String ATTENDEES_NAME_COL = USE_ICS_NAMES ? CalendarContract.Attendees.ATTENDEE_NAME : "attendeeName"; + public static final String ATTENDEES_EMAIL_COL = USE_ICS_NAMES ? CalendarContract.Attendees.ATTENDEE_EMAIL : "attendeeEmail"; private static final String[] CALENDARS_PROJECTION = new String[]{ diff --git a/astrid/plugin-src/com/todoroo/astrid/gcal/GCalHelper.java b/astrid/plugin-src/com/todoroo/astrid/gcal/GCalHelper.java index 9c9df2388..b7590f887 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gcal/GCalHelper.java +++ b/astrid/plugin-src/com/todoroo/astrid/gcal/GCalHelper.java @@ -87,8 +87,8 @@ public class GCalHelper { values.put("transparency", 0); values.put("visibility", 0); } - boolean valuesContainCalendarId = (values.containsKey(CALENDAR_ID_COLUMN) && - !TextUtils.isEmpty(values.getAsString(CALENDAR_ID_COLUMN))); + boolean valuesContainCalendarId = values.containsKey(CALENDAR_ID_COLUMN) && + !TextUtils.isEmpty(values.getAsString(CALENDAR_ID_COLUMN)); if (!valuesContainCalendarId) { String calendarId = Calendars.getDefaultCalendar(); if (!TextUtils.isEmpty(calendarId)) { diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksMetadataService.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksMetadataService.java index 8ea15d22c..021c51745 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksMetadataService.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/GtasksMetadataService.java @@ -106,7 +106,7 @@ public final class GtasksMetadataService extends SyncMetadataService 0) { metadata.moveToFirst(); - return (new Metadata(metadata).getValue(Metadata.TASK)); + return new Metadata(metadata).getValue(Metadata.TASK); } else { return AbstractModel.NO_ID; } @@ -198,8 +198,8 @@ public final class GtasksMetadataService extends SyncMetadataService sibling = new AtomicReference(); OrderedListIterator iterator = new OrderedListIterator() { @Override @@ -208,7 +208,7 @@ public final class GtasksMetadataService extends SyncMetadataService 0 || pendingCommentPicture != null) ? View.VISIBLE + commentButton.setVisibility(s.length() > 0 || pendingCommentPicture != null ? View.VISIBLE : View.GONE); if (showTimerShortcut) { - timerView.setVisibility((s.length() > 0 || pendingCommentPicture != null) ? View.GONE + timerView.setVisibility(s.length() > 0 || pendingCommentPicture != null ? View.GONE : View.VISIBLE); } } @@ -699,8 +699,8 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene } }; - return (ActFmCameraModule.activityResult((Activity) getContext(), - requestCode, resultCode, data, callback)); + return ActFmCameraModule.activityResult((Activity) getContext(), + requestCode, resultCode, data, callback); } else { return false; } diff --git a/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java b/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java index 5753b4e29..abdf712fb 100644 --- a/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java +++ b/astrid/plugin-src/com/todoroo/astrid/people/PersonViewFragment.java @@ -70,7 +70,7 @@ public class PersonViewFragment extends TaskListFragment { if (extras.containsKey(EXTRA_USER_ID_LOCAL)) { user = userDao.fetch(extras.getLong(EXTRA_USER_ID_LOCAL), User.PROPERTIES); } - emptyView = ((TextView) getView().findViewById(android.R.id.empty)); + emptyView = (TextView) getView().findViewById(android.R.id.empty); emptyView.setText(getEmptyDisplayString()); setupUserHeader(); diff --git a/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java b/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java index 6ada7d9b2..348db6c2d 100644 --- a/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java +++ b/astrid/plugin-src/com/todoroo/astrid/reminders/Notifications.java @@ -202,7 +202,7 @@ public class Notifications extends BroadcastReceiver { String taskTitle = task.getValue(Task.TITLE); boolean nonstopMode = task.getFlag(Task.REMINDER_FLAGS, Task.NOTIFY_MODE_NONSTOP); boolean ringFiveMode = task.getFlag(Task.REMINDER_FLAGS, Task.NOTIFY_MODE_FIVE); - int ringTimes = nonstopMode ? -1 : (ringFiveMode ? 5 : 1); + int ringTimes = nonstopMode ? -1 : ringFiveMode ? 5 : 1; // update last reminder time task.setValue(Task.REMINDER_LAST, DateUtilities.now()); @@ -306,7 +306,7 @@ public class Notifications extends BroadcastReceiver { } // quiet hours? unless alarm clock - boolean quietHours = (type == ReminderService.TYPE_ALARM || type == ReminderService.TYPE_DUE) ? false : isQuietHours(); + boolean quietHours = type == ReminderService.TYPE_ALARM || type == ReminderService.TYPE_DUE ? false : isQuietHours(); PendingIntent pendingIntent = PendingIntent.getActivity(context, notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT); @@ -358,7 +358,7 @@ public class Notifications extends BroadcastReceiver { boolean maxOutVolumeForMultipleRingReminders = Preferences.getBoolean(R.string.p_rmd_maxvolume, true); // remember it to set it to the old value after the alarm int previousAlarmVolume = audioManager.getStreamVolume(AudioManager.STREAM_ALARM); - if (ringTimes != 1 && (type != ReminderService.TYPE_RANDOM)) { + if (ringTimes != 1 && type != ReminderService.TYPE_RANDOM) { notification.audioStreamType = AudioManager.STREAM_ALARM; if (maxOutVolumeForMultipleRingReminders) { audioManager.setStreamVolume(AudioManager.STREAM_ALARM, @@ -456,7 +456,7 @@ public class Notifications extends BroadcastReceiver { AndroidUtilities.sleepDeep(500); } Flags.set(Flags.REFRESH); // Forces a reload when app launches - if ((voiceReminder || maxOutVolumeForMultipleRingReminders)) { + if (voiceReminder || maxOutVolumeForMultipleRingReminders) { AndroidUtilities.sleepDeep(2000); for (int i = 0; i < 50; i++) { AndroidUtilities.sleepDeep(500); diff --git a/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderPreferences.java b/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderPreferences.java index 7f320256a..74072649a 100644 --- a/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderPreferences.java +++ b/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderPreferences.java @@ -33,7 +33,7 @@ public class ReminderPreferences extends TodorooPreferenceActivity { Resources r = getResources(); if (r.getString(R.string.p_rmd_quietStart).equals(preference.getKey())) { - int index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_quiet_hours_start_values), (String) value); + int index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_quiet_hours_start_values), value); Preference endPreference = findPreference(getString(R.string.p_rmd_quietEnd)); if (index <= 0) { preference.setSummary(r.getString(R.string.rmd_EPr_quiet_hours_desc_none)); @@ -44,7 +44,7 @@ public class ReminderPreferences extends TodorooPreferenceActivity { endPreference.setEnabled(true); } } else if (r.getString(R.string.p_rmd_quietEnd).equals(preference.getKey())) { - int index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_quiet_hours_end_values), (String) value); + int index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_quiet_hours_end_values), value); int quietHoursStart = Preferences.getIntegerFromString(R.string.p_rmd_quietStart, -1); if (index == -1 || quietHoursStart == -1) { preference.setSummary(r.getString(R.string.rmd_EPr_quiet_hours_desc_none)); @@ -53,7 +53,7 @@ public class ReminderPreferences extends TodorooPreferenceActivity { preference.setSummary(r.getString(R.string.rmd_EPr_quiet_hours_end_desc, setting)); } } else if (r.getString(R.string.p_rmd_time).equals(preference.getKey())) { - int index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_rmd_time_values), (String) value); + int index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_rmd_time_values), value); if (index != -1 && index < r.getStringArray(R.array.EPr_rmd_time).length) { // FIXME this does not fix the underlying cause of the ArrayIndexOutofBoundsException // https://www.crittercism.com/developers/crash-details/e0886dbfcf9e78a21d9f2e2a385c4c13e2f6ad2132ac24a3fa811144 @@ -95,7 +95,7 @@ public class ReminderPreferences extends TodorooPreferenceActivity { preference.setSummary(r.getString(R.string.rmd_EPr_nagging_desc_false)); } } else if (r.getString(R.string.p_rmd_snooze_dialog).equals(preference.getKey())) { - if (value == null || ((Boolean) value) == true) { + if (value == null || (Boolean) value == true) { preference.setSummary(r.getString(R.string.rmd_EPr_snooze_dialog_desc_true)); } else { preference.setSummary(r.getString(R.string.rmd_EPr_snooze_dialog_desc_false)); diff --git a/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java b/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java index e1f0d6e6c..aa466026c 100644 --- a/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java +++ b/astrid/plugin-src/com/todoroo/astrid/reminders/ReminderService.java @@ -155,7 +155,7 @@ public final class ReminderService { private long getNowValue() { // If we're in the midst of mass scheduling, use the prestored now var - return (now == -1 ? DateUtilities.now() : now); + return now == -1 ? DateUtilities.now() : now; } public static final long NO_ALARM = Long.MAX_VALUE; @@ -375,14 +375,14 @@ public final class ReminderService { long millisAfterQuiet = dueDate - quietHoursEndDate.getTime(); // if there is more time after quiethours today, select quiethours-end for reminder - if (millisAfterQuiet > (millisToQuiet / ((float) (1 - (1 / periodDivFactor))))) { + if (millisAfterQuiet > millisToQuiet / (float) (1 - 1 / periodDivFactor)) { dueDateAlarm = quietHoursEndDate.getTime(); } else { - dueDateAlarm = getNowValue() + (long) (millisToQuiet / periodDivFactor); + dueDateAlarm = getNowValue() + millisToQuiet / periodDivFactor; } } else { // after quietHours, reuse dueDate for end of day - dueDateAlarm = getNowValue() + (long) (millisToEndOfDay / periodDivFactor); + dueDateAlarm = getNowValue() + millisToEndOfDay / periodDivFactor; } } else { // wrap across 24/hour boundary if (hour >= quietHoursStart) { @@ -394,12 +394,12 @@ public final class ReminderService { } else { // quietHours didnt start yet millisToQuiet = quietHoursStartDate.getTime() - getNowValue(); - dueDateAlarm = getNowValue() + (long) (millisToQuiet / periodDivFactor); + dueDateAlarm = getNowValue() + millisToQuiet / periodDivFactor; } } } else { // Quiet hours not activated, simply schedule the reminder on 1/periodDivFactor towards the end of day - dueDateAlarm = getNowValue() + (long) (millisToEndOfDay / periodDivFactor); + dueDateAlarm = getNowValue() + millisToEndOfDay / periodDivFactor; } if (dueDate > getNowValue() && dueDateAlarm < getNowValue()) { @@ -429,7 +429,7 @@ public final class ReminderService { */ private long calculateNextRandomReminder(Task task) { long reminderPeriod = task.getValue(Task.REMINDER_PERIOD); - if ((reminderPeriod) > 0) { + if (reminderPeriod > 0) { long when = task.getValue(Task.REMINDER_LAST); if (when == 0) { diff --git a/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatControlSet.java b/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatControlSet.java index 4ff860fe0..d64c107d4 100644 --- a/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatControlSet.java @@ -355,9 +355,9 @@ public class RepeatControlSet extends PopupControlSet { rrule.setFreq(Frequency.WEEKLY); ArrayList days = new ArrayList(); - for (int i = 0; i < daysOfWeek.length; i++) { - if (daysOfWeek[i].isChecked()) { - days.add(new WeekdayNum(0, (Weekday) daysOfWeek[i].getTag())); + for (CompoundButton aDaysOfWeek : daysOfWeek) { + if (aDaysOfWeek.isChecked()) { + days.add(new WeekdayNum(0, (Weekday) aDaysOfWeek.getTag())); } } rrule.setByDay(days); diff --git a/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatTaskCompleteListener.java b/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatTaskCompleteListener.java index 2f9031f90..01f1add6f 100644 --- a/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatTaskCompleteListener.java +++ b/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatTaskCompleteListener.java @@ -194,8 +194,7 @@ public class RepeatTaskCompleteListener extends BroadcastReceiver { private static WeekdayNum findNextWeekday(List byDay, Calendar date) { WeekdayNum next = byDay.get(0); - for (int i = 0; i < byDay.size(); i++) { - WeekdayNum weekday = byDay.get(i); + for (WeekdayNum weekday : byDay) { if (weekday.wday.javaDayNum > date.get(Calendar.DAY_OF_WEEK)) { return weekday; } diff --git a/astrid/plugin-src/com/todoroo/astrid/subtasks/AstridOrderedListFragmentHelper.java b/astrid/plugin-src/com/todoroo/astrid/subtasks/AstridOrderedListFragmentHelper.java index 02dcd7013..a74136c8d 100644 --- a/astrid/plugin-src/com/todoroo/astrid/subtasks/AstridOrderedListFragmentHelper.java +++ b/astrid/plugin-src/com/todoroo/astrid/subtasks/AstridOrderedListFragmentHelper.java @@ -188,7 +188,7 @@ public class AstridOrderedListFragmentHelper implements OrderedListFragmen if (v == null) { return; } - ((DraggableTaskAdapter) taskAdapter).getListener().onClick(v); + taskAdapter.getListener().onClick(v); } }; diff --git a/astrid/plugin-src/com/todoroo/astrid/subtasks/OrderedMetadataListFragmentHelper.java b/astrid/plugin-src/com/todoroo/astrid/subtasks/OrderedMetadataListFragmentHelper.java index b9e630197..68af98542 100644 --- a/astrid/plugin-src/com/todoroo/astrid/subtasks/OrderedMetadataListFragmentHelper.java +++ b/astrid/plugin-src/com/todoroo/astrid/subtasks/OrderedMetadataListFragmentHelper.java @@ -203,7 +203,7 @@ public class OrderedMetadataListFragmentHelper implements OrderedListFragm if (v == null) { return; } - ((DraggableTaskAdapter) taskAdapter).getListener().onClick(v); + taskAdapter.getListener().onClick(v); } }; diff --git a/astrid/plugin-src/com/todoroo/astrid/subtasks/SubtasksMetadataMigration.java b/astrid/plugin-src/com/todoroo/astrid/subtasks/SubtasksMetadataMigration.java index 65d4c2d04..652d2c137 100644 --- a/astrid/plugin-src/com/todoroo/astrid/subtasks/SubtasksMetadataMigration.java +++ b/astrid/plugin-src/com/todoroo/astrid/subtasks/SubtasksMetadataMigration.java @@ -103,7 +103,7 @@ public class SubtasksMetadataMigration { if (item.containsNonNullValue(SubtasksMetadata.INDENT)) { Integer i = item.getValue(SubtasksMetadata.INDENT); if (i != null) { - indent = i.intValue(); + indent = i; } } Node parent = findNextParentForIndent(root, indent); diff --git a/astrid/plugin-src/com/todoroo/astrid/tags/TagFilterExposer.java b/astrid/plugin-src/com/todoroo/astrid/tags/TagFilterExposer.java index baf61ccaa..e8f7b3d0e 100644 --- a/astrid/plugin-src/com/todoroo/astrid/tags/TagFilterExposer.java +++ b/astrid/plugin-src/com/todoroo/astrid/tags/TagFilterExposer.java @@ -187,8 +187,8 @@ public class TagFilterExposer extends BroadcastReceiver implements AstridFilterE filters.add(untagged); } - for (int i = 0; i < tags.length; i++) { - Filter f = constructFilter(context, tags[i]); + for (Tag tag : tags) { + Filter f = constructFilter(context, tag); if (f != null) { filters.add(f); } diff --git a/astrid/plugin-src/com/todoroo/astrid/tags/TagService.java b/astrid/plugin-src/com/todoroo/astrid/tags/TagService.java index 382ee19b9..a2dedb2fc 100644 --- a/astrid/plugin-src/com/todoroo/astrid/tags/TagService.java +++ b/astrid/plugin-src/com/todoroo/astrid/tags/TagService.java @@ -584,6 +584,6 @@ public final class TagService { int random = (int) (Math.random() * 4); return default_tag_images[random]; } - return default_tag_images[((int) Math.abs(nameOrUUID.hashCode())) % 4]; + return default_tag_images[Math.abs(nameOrUUID.hashCode()) % 4]; } } diff --git a/astrid/plugin-src/com/todoroo/astrid/tags/TagsControlSet.java b/astrid/plugin-src/com/todoroo/astrid/tags/TagsControlSet.java index f854654b3..14120b030 100644 --- a/astrid/plugin-src/com/todoroo/astrid/tags/TagsControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/tags/TagsControlSet.java @@ -84,8 +84,8 @@ public final class TagsControlSet extends PopupControlSet { private ArrayList getTagNames(Tag[] tags) { ArrayList names = new ArrayList(); - for (int i = 0; i < tags.length; i++) { - names.add(tags[i].toString()); + for (Tag tag : tags) { + names.add(tag.toString()); } return names; } diff --git a/astrid/plugin-src/com/todoroo/astrid/tags/reusable/FeaturedTaskListFragment.java b/astrid/plugin-src/com/todoroo/astrid/tags/reusable/FeaturedTaskListFragment.java index 7069a2b92..2c403d753 100644 --- a/astrid/plugin-src/com/todoroo/astrid/tags/reusable/FeaturedTaskListFragment.java +++ b/astrid/plugin-src/com/todoroo/astrid/tags/reusable/FeaturedTaskListFragment.java @@ -53,7 +53,7 @@ public class FeaturedTaskListFragment extends TagViewFragment { protected void setupQuickAddBar() { super.setupQuickAddBar(); quickAddBar.setVisibility(View.GONE); - ((TextView) getView().findViewById(android.R.id.empty)).setOnClickListener(null); + getView().findViewById(android.R.id.empty).setOnClickListener(null); } @Override diff --git a/astrid/plugin-src/com/todoroo/astrid/timers/TimerActionControlSet.java b/astrid/plugin-src/com/todoroo/astrid/timers/TimerActionControlSet.java index 29452868e..7d4f57403 100644 --- a/astrid/plugin-src/com/todoroo/astrid/timers/TimerActionControlSet.java +++ b/astrid/plugin-src/com/todoroo/astrid/timers/TimerActionControlSet.java @@ -30,7 +30,7 @@ public class TimerActionControlSet extends TaskEditControlSet { private boolean timerActive; private final List listeners = new LinkedList(); - public TimerActionControlSet(Activity activity, View parent) { + public TimerActionControlSet(final Activity activity, View parent) { super(activity, -1); LinearLayout timerContainer = (LinearLayout) parent.findViewById(R.id.timer_container); timerButton = (ImageView) parent.findViewById(R.id.timer_button); diff --git a/astrid/plugin-src/com/todoroo/astrid/timers/TimerDecorationExposer.java b/astrid/plugin-src/com/todoroo/astrid/timers/TimerDecorationExposer.java index e7c8d9ffa..300df87f8 100644 --- a/astrid/plugin-src/com/todoroo/astrid/timers/TimerDecorationExposer.java +++ b/astrid/plugin-src/com/todoroo/astrid/timers/TimerDecorationExposer.java @@ -32,8 +32,8 @@ public class TimerDecorationExposer implements TaskDecorationExposer { @Override public TaskDecoration expose(Task task) { - if (task == null || (task.getValue(Task.ELAPSED_SECONDS) == 0 && - task.getValue(Task.TIMER_START) == 0)) { + if (task == null || task.getValue(Task.ELAPSED_SECONDS) == 0 && + task.getValue(Task.TIMER_START) == 0) { return null; } diff --git a/astrid/src-legacy/com/timsu/astrid/data/task/TaskController.java b/astrid/src-legacy/com/timsu/astrid/data/task/TaskController.java index 5b9480642..0eb7233bb 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/task/TaskController.java +++ b/astrid/src-legacy/com/timsu/astrid/data/task/TaskController.java @@ -594,7 +594,7 @@ public class TaskController extends LegacyAbstractController { final String where = AbstractTaskModel.NAME + " = ? AND " + AbstractTaskModel.CREATION_DATE + " LIKE ?"; - String approximateCreationDate = (creationDate / 1000) + "%"; + String approximateCreationDate = creationDate / 1000 + "%"; Cursor cursor = database.query(true, tasksTable, fieldList, where, new String[]{name, approximateCreationDate}, null, null, null, null); if (cursor == null) { @@ -649,9 +649,9 @@ public class TaskController extends LegacyAbstractController { AbstractTaskModel.COMPLETE_PERCENTAGE + " AND (" + AbstractTaskModel.HIDDEN_UNTIL + " ISNULL OR " + AbstractTaskModel.HIDDEN_UNTIL + " < " + System.currentTimeMillis() + ")", null, null, null, - AbstractTaskModel.IMPORTANCE + " * " + (5 * 24 * 3600 * 1000L) + + AbstractTaskModel.IMPORTANCE + " * " + 5 * 24 * 3600 * 1000L + " + CASE WHEN MAX(pdd, ddd) = 0 THEN " + - (System.currentTimeMillis() + (7 * 24 * 3600 * 1000L)) + + (System.currentTimeMillis() + 7 * 24 * 3600 * 1000L) + " ELSE (CASE WHEN pdd = 0 THEN ddd ELSE pdd END) END ASC", limit); try { @@ -672,9 +672,9 @@ public class TaskController extends LegacyAbstractController { AbstractTaskModel.COMPLETE_PERCENTAGE + " AND (" + AbstractTaskModel.HIDDEN_UNTIL + " ISNULL OR " + AbstractTaskModel.HIDDEN_UNTIL + " < " + System.currentTimeMillis() + ")", null, null, null, - AbstractTaskModel.IMPORTANCE + " * " + (5 * 24 * 3600 * 1000L) + + AbstractTaskModel.IMPORTANCE + " * " + 5 * 24 * 3600 * 1000L + " + CASE WHEN MAX(pdd, ddd) = 0 THEN " + - (System.currentTimeMillis() + (7 * 24 * 3600 * 1000L)) + + (System.currentTimeMillis() + 7 * 24 * 3600 * 1000L) + " ELSE (CASE WHEN pdd = 0 THEN ddd ELSE pdd END) END ASC", limit); try { diff --git a/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForList.java b/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForList.java index 42b9769d0..04999310b 100644 --- a/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForList.java +++ b/astrid/src-legacy/com/timsu/astrid/data/task/TaskModelForList.java @@ -67,7 +67,7 @@ public class TaskModelForList extends AbstractTaskModel { int hoursLeft = (int) ((getDefiniteDueDate().getTime() - System.currentTimeMillis()) / 1000 / 3600); if (hoursLeft < 5 * 24) { - weight += (hoursLeft - 5 * 24); + weight += hoursLeft - 5 * 24; } weight -= 20; } diff --git a/astrid/src/com/commonsware/cwac/merge/MergeAdapter.java b/astrid/src/com/commonsware/cwac/merge/MergeAdapter.java index 838c31776..90ff57a41 100644 --- a/astrid/src/com/commonsware/cwac/merge/MergeAdapter.java +++ b/astrid/src/com/commonsware/cwac/merge/MergeAdapter.java @@ -118,13 +118,13 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { int size = piece.getCount(); if (position < size) { - return (piece.getItem(position)); + return piece.getItem(position); } position -= size; } - return (null); + return null; } /** @@ -138,13 +138,13 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { int size = piece.getCount(); if (position < size) { - return (piece); + return piece; } position -= size; } - return (null); + return null; } /** @@ -159,7 +159,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { total += piece.getCount(); } - return (total); + return total; } /** @@ -174,7 +174,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { total += piece.getViewTypeCount(); } - return (Math.max(total, 1)); // needed for setListAdapter() before content add' + return Math.max(total, 1); // needed for setListAdapter() before content add' } /** @@ -200,7 +200,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { typeOffset += piece.getViewTypeCount(); } - return (result); + return result; } /** @@ -209,7 +209,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { */ @Override public boolean areAllItemsEnabled() { - return (false); + return false; } /** @@ -224,13 +224,13 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { int size = piece.getCount(); if (position < size) { - return (piece.isEnabled(position)); + return piece.isEnabled(position); } position -= size; } - return (false); + return false; } /** @@ -249,13 +249,13 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { if (position < size) { - return (piece.getView(position, convertView, parent)); + return piece.getView(position, convertView, parent); } position -= size; } - return (null); + return null; } /** @@ -270,13 +270,13 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { int size = piece.getCount(); if (position < size) { - return (piece.getItemId(position)); + return piece.getItemId(position); } position -= size; } - return (-1); + return -1; } @Override @@ -293,7 +293,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { } if (section < numSections) { - return (position + ((SectionIndexer) piece).getPositionForSection(section)); + return position + ((SectionIndexer) piece).getPositionForSection(section); } else if (sections != null) { section -= numSections; } @@ -302,7 +302,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { position += piece.getCount(); } - return (0); + return 0; } @Override @@ -314,10 +314,10 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { if (position < size) { if (piece instanceof SectionIndexer) { - return (section + ((SectionIndexer) piece).getSectionForPosition(position)); + return section + ((SectionIndexer) piece).getSectionForPosition(position); } - return (0); + return 0; } else { if (piece instanceof SectionIndexer) { Object[] sections = ((SectionIndexer) piece).getSections(); @@ -331,7 +331,7 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { position -= size; } - return (0); + return 0; } @Override @@ -351,10 +351,10 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { } if (sections.size() == 0) { - return (null); + return null; } - return (sections.toArray(new Object[0])); + return sections.toArray(new Object[0]); } private static class EnabledSackAdapter extends SackOfViewsAdapter { @@ -364,12 +364,12 @@ public class MergeAdapter extends BaseAdapter implements SectionIndexer { @Override public boolean areAllItemsEnabled() { - return (true); + return true; } @Override public boolean isEnabled(int position) { - return (true); + return true; } } diff --git a/astrid/src/com/commonsware/cwac/merge/MergeSpinnerAdapter.java b/astrid/src/com/commonsware/cwac/merge/MergeSpinnerAdapter.java index 907f11a82..17698b2fb 100644 --- a/astrid/src/com/commonsware/cwac/merge/MergeSpinnerAdapter.java +++ b/astrid/src/com/commonsware/cwac/merge/MergeSpinnerAdapter.java @@ -47,15 +47,15 @@ public class MergeSpinnerAdapter extends MergeAdapter { int size = piece.getCount(); if (position < size) { - return (((SpinnerAdapter) piece).getDropDownView(position, + return ((SpinnerAdapter) piece).getDropDownView(position, convertView, - parent)); + parent); } position -= size; } - return (null); + return null; } /** diff --git a/astrid/src/com/todoroo/astrid/activity/AstridActivity.java b/astrid/src/com/todoroo/astrid/activity/AstridActivity.java index c8a84c6fc..146ccb079 100644 --- a/astrid/src/com/todoroo/astrid/activity/AstridActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/AstridActivity.java @@ -146,7 +146,7 @@ public class AstridActivity extends SherlockFragmentActivity */ @Override public boolean onFilterItemClicked(FilterListItem item) { - if (this instanceof TaskListActivity && (item instanceof Filter)) { + if (this instanceof TaskListActivity && item instanceof Filter) { ((TaskListActivity) this).setSelectedItem((Filter) item); } if (item instanceof SearchFilter) { diff --git a/astrid/src/com/todoroo/astrid/activity/BeastModePreferences.java b/astrid/src/com/todoroo/astrid/activity/BeastModePreferences.java index 20bb5a451..7a5f5a431 100644 --- a/astrid/src/com/todoroo/astrid/activity/BeastModePreferences.java +++ b/astrid/src/com/todoroo/astrid/activity/BeastModePreferences.java @@ -73,7 +73,7 @@ public class BeastModePreferences extends ListActivity { builder.append(BEAST_MODE_PREF_ITEM_SEPARATOR); order = builder.toString(); } else if (!order.contains(hideSectionPref)) { - order += (hideSectionPref + BEAST_MODE_PREF_ITEM_SEPARATOR); + order += hideSectionPref + BEAST_MODE_PREF_ITEM_SEPARATOR; } Preferences.setString(BEAST_MODE_ORDER_PREF, order); diff --git a/astrid/src/com/todoroo/astrid/activity/EditPreferences.java b/astrid/src/com/todoroo/astrid/activity/EditPreferences.java index f1c3471e8..da24261aa 100644 --- a/astrid/src/com/todoroo/astrid/activity/EditPreferences.java +++ b/astrid/src/com/todoroo/astrid/activity/EditPreferences.java @@ -352,8 +352,7 @@ public class EditPreferences extends TodorooPreferenceActivity { // Loop through a list of all packages (including plugins, addons) // that have a settings action - for (int i = 0; i < length; i++) { - ResolveInfo resolveInfo = resolveInfoList.get(i); + for (ResolveInfo resolveInfo : resolveInfoList) { final Intent intent = new Intent(AstridApiConstants.ACTION_SETTINGS); intent.setClassName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name); @@ -538,7 +537,6 @@ public class EditPreferences extends TodorooPreferenceActivity { return super.onPreferenceChange(p, newValue); } - ; }); } else if (r.getString(R.string.p_showNotes).equals(preference.getKey())) { @@ -564,7 +562,7 @@ public class EditPreferences extends TodorooPreferenceActivity { } else { int index = 0; if (value instanceof String && !TextUtils.isEmpty((String) value)) { - index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_theme_settings), (String) value); + index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_theme_settings), value); } if (index < 0) { index = 0; @@ -579,7 +577,7 @@ public class EditPreferences extends TodorooPreferenceActivity { } else { int index = 0; if (value instanceof String && !TextUtils.isEmpty((String) value)) { - index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_theme_widget_settings), (String) value); + index = AndroidUtilities.indexOf(r.getStringArray(R.array.EPr_theme_widget_settings), value); } if (index < 0) { index = 0; @@ -599,19 +597,14 @@ public class EditPreferences extends TodorooPreferenceActivity { preference.setSummary(r.getString(R.string.p_files_dir_desc, dir)); } else if (booleanPreference(preference, value, R.string.p_statistics, R.string.EPr_statistics_desc_disabled, R.string.EPr_statistics_desc_enabled)) { - ; } else if (booleanPreference(preference, value, R.string.p_field_missed_calls, R.string.MCA_missed_calls_pref_desc_disabled, R.string.MCA_missed_calls_pref_desc_enabled)) { - ; } else if (booleanPreference(preference, value, R.string.p_calendar_reminders, R.string.CRA_calendar_reminders_pref_desc_disabled, R.string.CRA_calendar_reminders_pref_desc_enabled)) { - ; } else if (booleanPreference(preference, value, R.string.p_use_contact_picker, R.string.EPr_use_contact_picker_desc_disabled, R.string.EPr_use_contact_picker_desc_enabled)) { - ; } else if (booleanPreference(preference, value, R.string.p_end_at_deadline, R.string.EPr_cal_end_at_due_time, R.string.EPr_cal_start_at_due_time)) { - ; } else if (r.getString(R.string.p_swipe_lists_enabled).equals(preference.getKey())) { preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(RESULT_CODE_PERFORMANCE_PREF_CHANGED) { @Override @@ -716,7 +709,7 @@ public class EditPreferences extends TodorooPreferenceActivity { findPreference(getString(R.string.p_calendar_reminders)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { - if (newValue != null && ((Boolean) newValue)) { + if (newValue != null && (Boolean) newValue) { CalendarStartupReceiver.scheduleCalendarAlarms(EditPreferences.this, true); } return true; @@ -729,7 +722,7 @@ public class EditPreferences extends TodorooPreferenceActivity { public boolean onPreferenceChange(Preference preference, Object newValue) { Boolean value = (Boolean) newValue; try { - if (!value.booleanValue()) { + if (!value) { Crittercism.setOptOutStatus(true); } else { Crittercism.setOptOutStatus(false); diff --git a/astrid/src/com/todoroo/astrid/activity/ExpandableListFragment.java b/astrid/src/com/todoroo/astrid/activity/ExpandableListFragment.java index a381b015a..2b3744a77 100644 --- a/astrid/src/com/todoroo/astrid/activity/ExpandableListFragment.java +++ b/astrid/src/com/todoroo/astrid/activity/ExpandableListFragment.java @@ -24,7 +24,7 @@ import android.widget.TextView; @SuppressWarnings("nls") public class ExpandableListFragment extends Fragment - implements OnCreateContextMenuListener, + implements ExpandableListView.OnChildClickListener, ExpandableListView.OnGroupCollapseListener, ExpandableListView.OnGroupExpandListener { diff --git a/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java b/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java index cd656b747..297b1a7e9 100644 --- a/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java +++ b/astrid/src/com/todoroo/astrid/activity/FilterListFragment.java @@ -299,7 +299,7 @@ public class FilterListFragment extends SherlockListFragment { android.view.MenuItem menuItem; if (item instanceof Filter) { - Filter filter = (Filter) item; + Filter filter = item; menuItem = menu.add(0, CONTEXT_MENU_SHORTCUT, 0, R.string.FLA_context_shortcut); menuItem.setIntent(ShortcutActivity.createIntent(filter)); } diff --git a/astrid/src/com/todoroo/astrid/activity/FilterShortcutActivity.java b/astrid/src/com/todoroo/astrid/activity/FilterShortcutActivity.java index a94cd517e..f40d346af 100644 --- a/astrid/src/com/todoroo/astrid/activity/FilterShortcutActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/FilterShortcutActivity.java @@ -55,7 +55,7 @@ public class FilterShortcutActivity extends ListActivity { return; } Intent shortcutIntent = ShortcutActivity.createIntent( - (Filter) filter); + filter); Bitmap bitmap = FilterListFragment.superImposeListIcon(FilterShortcutActivity.this, filter.listingIcon, filter.listingTitle); diff --git a/astrid/src/com/todoroo/astrid/activity/ShortcutActivity.java b/astrid/src/com/todoroo/astrid/activity/ShortcutActivity.java index 8d824aeea..8173a39c4 100644 --- a/astrid/src/com/todoroo/astrid/activity/ShortcutActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/ShortcutActivity.java @@ -186,7 +186,7 @@ public class ShortcutActivity extends Activity { ShortcutActivity.class); if (filter instanceof FilterWithCustomIntent) { - FilterWithCustomIntent customFilter = ((FilterWithCustomIntent) filter); + FilterWithCustomIntent customFilter = (FilterWithCustomIntent) filter; if (customFilter.customExtras != null) { shortcutIntent.putExtras(customFilter.customExtras); } diff --git a/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java index 35cf43eec..7efca1d85 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskEditActivity.java @@ -50,7 +50,7 @@ public class TaskEditActivity extends AstridActivity { public void updateTitle(boolean isNewTask) { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { - TextView title = ((TextView) actionBar.getCustomView().findViewById(R.id.title)); + TextView title = (TextView) actionBar.getCustomView().findViewById(R.id.title); if (ActFmPreferenceService.isPremiumUser()) { title.setText(""); //$NON-NLS-1$ } else { @@ -66,7 +66,7 @@ public class TaskEditActivity extends AstridActivity { protected void onResume() { super.onResume(); - Fragment frag = (Fragment) getSupportFragmentManager() + Fragment frag = getSupportFragmentManager() .findFragmentByTag(TaskListFragment.TAG_TASKLIST_FRAGMENT); if (frag != null) { fragmentLayout = LAYOUT_DOUBLE; diff --git a/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java b/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java index ebb95c121..10040515c 100755 --- a/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java @@ -380,8 +380,8 @@ public final class TaskEditFragment extends SherlockFragment implements } private void loadMoreContainer() { - View moreTab = (View) getView().findViewById(R.id.more_container); - View commentsBar = (View) getView().findViewById(R.id.updatesFooter); + View moreTab = getView().findViewById(R.id.more_container); + View commentsBar = getView().findViewById(R.id.updatesFooter); long idParam = getActivity().getIntent().getLongExtra(TOKEN_ID, -1L); @@ -651,11 +651,11 @@ public final class TaskEditFragment extends SherlockFragment implements TaskEditControlSet curr = controlSetMap.get(item); if (curr != null) { - controlSet = (LinearLayout) curr.getDisplayView(); + controlSet = curr.getDisplayView(); } if (controlSet != null) { - if ((i + 1 >= itemOrder.length || itemOrder[i + 1].equals(moreSectionTrigger))) { + if (i + 1 >= itemOrder.length || itemOrder[i + 1].equals(moreSectionTrigger)) { removeTeaSeparator(controlSet); } section.addView(controlSet); @@ -665,7 +665,7 @@ public final class TaskEditFragment extends SherlockFragment implements } if (curr != null && curr.getClass().equals(openControl) && curr instanceof PopupControlSet) { - ((PopupControlSet) curr).getDisplayView().performClick(); + curr.getDisplayView().performClick(); } } } @@ -996,7 +996,7 @@ public final class TaskEditFragment extends SherlockFragment implements taskService.save(model); if (!onPause && !cancelFinish) { - boolean taskEditActivity = (getActivity() instanceof TaskEditActivity); + boolean taskEditActivity = getActivity() instanceof TaskEditActivity; boolean isAssignedToMe = peopleControlSet.isAssignedToMe(); boolean showRepeatAlert = model.getTransitory(TaskService.TRANS_REPEAT_CHANGED) != null && !TextUtils.isEmpty(model.getValue(Task.RECURRENCE)); @@ -1016,7 +1016,6 @@ public final class TaskEditFragment extends SherlockFragment implements data.putExtra(TOKEN_ASSIGNED_TO_EMAIL, assignedEmail); } if (Task.isRealUserId(assignedId)) { - ; } data.putExtra(TOKEN_ASSIGNED_TO_ID, assignedId); } @@ -1493,7 +1492,6 @@ public final class TaskEditFragment extends SherlockFragment implements MeasureSpec.AT_MOST); view.measure(desiredWidth, MeasureSpec.UNSPECIFIED); height = Math.max(view.getMeasuredHeight(), height); - ; LayoutParams pagerParams = mPager.getLayoutParams(); if (height > 0 && height != pagerParams.height) { pagerParams.height = height; diff --git a/astrid/src/com/todoroo/astrid/activity/TaskEditViewPager.java b/astrid/src/com/todoroo/astrid/activity/TaskEditViewPager.java index 9f2d9409c..f8061d10d 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskEditViewPager.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskEditViewPager.java @@ -39,7 +39,7 @@ public class TaskEditViewPager extends PagerAdapter implements TitleProvider { public static int getPageForPosition(int position, int tabStyle) { int numOnesEncountered = 0; for (int i = 0; i <= 2; i++) { - if ((tabStyle & (1 << i)) > 0) { + if ((tabStyle & 1 << i) > 0) { numOnesEncountered++; } if (numOnesEncountered == position + 1) { diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java index f44a516b3..10cff8607 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskListActivity.java @@ -387,7 +387,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener layout = R.layout.main_menu_popover; } - mainMenuPopover = new MainMenuPopover(this, layout, (fragmentLayout != LAYOUT_SINGLE), this); + mainMenuPopover = new MainMenuPopover(this, layout, fragmentLayout != LAYOUT_SINGLE, this); mainMenuPopover.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss() { @@ -449,7 +449,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener public void setupActivityFragment(TagData tagData) { super.setupActivityFragment(tagData); - int visibility = (filterModeSpec.showComments() ? View.VISIBLE : View.GONE); + int visibility = filterModeSpec.showComments() ? View.VISIBLE : View.GONE; if (fragmentLayout != LAYOUT_TRIPLE) { commentsButton.setVisibility(visibility); @@ -467,8 +467,8 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener private void setListsDropdownSelected(boolean selected) { int oldTextColor = lists.getTextColors().getDefaultColor(); - int textStyle = (selected ? R.style.TextAppearance_ActionBar_ListsHeader_Selected : - R.style.TextAppearance_ActionBar_ListsHeader); + int textStyle = selected ? R.style.TextAppearance_ActionBar_ListsHeader_Selected : + R.style.TextAppearance_ActionBar_ListsHeader; TypedValue listDisclosure = new TypedValue(); getTheme().resolveAttribute(R.attr.asListsDisclosure, listDisclosure, false); diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java b/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java index ec7813c1a..74c8fe45f 100644 --- a/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java @@ -367,7 +367,7 @@ public class TaskListFragment extends SherlockListFragment implements OnSortSele Fragment filterlistFrame = getFragmentManager().findFragmentByTag( FilterListFragment.TAG_FILTERLIST_FRAGMENT); - mDualFragments = (filterlistFrame != null) + mDualFragments = filterlistFrame != null && filterlistFrame.isInLayout(); if (mDualFragments) { @@ -481,7 +481,7 @@ public class TaskListFragment extends SherlockListFragment implements OnSortSele protected void addMenuItem(Menu menu, int title, int imageRes, int id, boolean showAsAction) { AstridActivity activity = (AstridActivity) getActivity(); - if ((activity.getFragmentLayout() != AstridActivity.LAYOUT_SINGLE && showAsAction) || !(activity instanceof TaskListActivity)) { + if (activity.getFragmentLayout() != AstridActivity.LAYOUT_SINGLE && showAsAction || !(activity instanceof TaskListActivity)) { MenuItem item = menu.add(Menu.NONE, id, Menu.NONE, title); item.setIcon(imageRes); if (activity instanceof TaskListActivity) { @@ -553,8 +553,7 @@ public class TaskListFragment extends SherlockListFragment implements OnSortSele List resolveInfoList = pm.queryIntentActivities( queryIntent, 0); int length = resolveInfoList.size(); - for (int i = 0; i < length; i++) { - ResolveInfo resolveInfo = resolveInfoList.get(i); + for (ResolveInfo resolveInfo : resolveInfoList) { Intent intent = new Intent(AstridApiConstants.ACTION_TASK_LIST_MENU); intent.setClassName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name); @@ -624,7 +623,7 @@ public class TaskListFragment extends SherlockListFragment implements OnSortSele }); // set listener for astrid icon - ((TextView) getView().findViewById(android.R.id.empty)).setOnClickListener(new OnClickListener() { + getView().findViewById(android.R.id.empty).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { quickAddBar.performButtonClick(); @@ -732,7 +731,7 @@ public class TaskListFragment extends SherlockListFragment implements OnSortSele private void showFeedbackPrompt() { if (!(this instanceof TagViewFragment) && - (DateUtilities.now() - Preferences.getLong(PREF_LAST_FEEDBACK_TIME, 0)) > FEEDBACK_TIME_INTERVAL && + DateUtilities.now() - Preferences.getLong(PREF_LAST_FEEDBACK_TIME, 0) > FEEDBACK_TIME_INTERVAL && taskService.getUserActivationStatus()) { final LinearLayout root = (LinearLayout) getView().findViewById(R.id.taskListParent); if (root.findViewById(R.id.feedback_banner) == null) { diff --git a/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java b/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java index a9351ed4e..4b2bbbb47 100644 --- a/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java +++ b/astrid/src/com/todoroo/astrid/adapter/FilterAdapter.java @@ -163,7 +163,7 @@ public class FilterAdapter extends ArrayAdapter { this.selectable = selectable; this.filterCounts = new HashMap(); - this.nook = (Constants.MARKET_STRATEGY instanceof NookMarketStrategy); + this.nook = Constants.MARKET_STRATEGY instanceof NookMarketStrategy; if (activity instanceof AstridActivity && ((AstridActivity) activity).getFragmentLayout() != AstridActivity.LAYOUT_SINGLE) { filterStyle = R.style.TextAppearance_FLA_Filter_Tablet; @@ -333,7 +333,7 @@ public class FilterAdapter extends ArrayAdapter { convertView = newView(convertView, parent); ViewHolder viewHolder = (ViewHolder) convertView.getTag(); - viewHolder.item = (FilterListItem) getItem(position); + viewHolder.item = getItem(position); populateView(viewHolder); Filter selected = null; @@ -547,7 +547,7 @@ public class FilterAdapter extends ArrayAdapter { // title / size int countInt = -1; - if (filterCounts.containsKey(filter) || (!TextUtils.isEmpty(filter.listingTitle) && filter.listingTitle.matches(".* \\(\\d+\\)$"))) { //$NON-NLS-1$ + if (filterCounts.containsKey(filter) || !TextUtils.isEmpty(filter.listingTitle) && filter.listingTitle.matches(".* \\(\\d+\\)$")) { //$NON-NLS-1$ viewHolder.size.setVisibility(View.VISIBLE); String count; if (filterCounts.containsKey(filter)) { diff --git a/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java b/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java index 80ae06ce7..7a1a0155e 100644 --- a/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java +++ b/astrid/src/com/todoroo/astrid/adapter/TaskAdapter.java @@ -97,7 +97,7 @@ import java.util.concurrent.atomic.AtomicReference; * * @author Tim Su */ -public class TaskAdapter extends CursorAdapter implements Filterable { +public class TaskAdapter extends CursorAdapter { public interface OnCompletedTaskListener { public void onCompletedTask(Task item, boolean newState); @@ -269,7 +269,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { displayMetrics = new DisplayMetrics(); fragment.getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); - this.simpleLayout = (resource == R.layout.task_adapter_row_simple); + this.simpleLayout = resource == R.layout.task_adapter_row_simple; this.minRowHeight = computeMinRowHeight(); startDetailThread(); @@ -409,7 +409,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { @Override public void bindView(View view, Context context, Cursor c) { TodorooCursor cursor = (TodorooCursor) c; - ViewHolder viewHolder = ((ViewHolder) view.getTag()); + ViewHolder viewHolder = (ViewHolder) view.getTag(); if (!titleOnlyLayout) { viewHolder.tagsString = cursor.get(TAGS); @@ -520,7 +520,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { } else if (Preferences.getBoolean(R.string.p_showNotes, false)) { viewHolder.details1.setVisibility(View.VISIBLE); if (details.startsWith(DETAIL_SEPARATOR)) { - StringBuffer buffer = new StringBuffer(details); + StringBuilder buffer = new StringBuilder(details); int length = DETAIL_SEPARATOR.length(); while (buffer.lastIndexOf(DETAIL_SEPARATOR, length) == 0) { buffer.delete(0, length); @@ -1092,7 +1092,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable { return; } - final CheckBox completeBox = ((CheckBox) container.findViewById(R.id.completeBox)); + final CheckBox completeBox = (CheckBox) container.findViewById(R.id.completeBox); completeBox.performClick(); } diff --git a/astrid/src/com/todoroo/astrid/adapter/UpdateAdapter.java b/astrid/src/com/todoroo/astrid/adapter/UpdateAdapter.java index 81b5ed2b1..cba118fa1 100644 --- a/astrid/src/com/todoroo/astrid/adapter/UpdateAdapter.java +++ b/astrid/src/com/todoroo/astrid/adapter/UpdateAdapter.java @@ -226,7 +226,7 @@ public class UpdateAdapter extends CursorAdapter { @Override public void bindView(View view, Context context, Cursor c) { TodorooCursor cursor = (TodorooCursor) c; - ModelHolder mh = ((ModelHolder) view.getTag()); + ModelHolder mh = (ModelHolder) view.getTag(); String type = cursor.getString(TYPE_PROPERTY_INDEX); @@ -377,7 +377,7 @@ public class UpdateAdapter extends CursorAdapter { public static void setupImagePopupForCommentView(View view, AsyncImageView commentPictureView, final String pictureThumb, final String pictureFull, final Bitmap updateBitmap, final String message, final Fragment fragment, ImageCache imageCache) { - if ((!TextUtils.isEmpty(pictureThumb) && !"null".equals(pictureThumb)) || updateBitmap != null) { //$NON-NLS-1$ + if (!TextUtils.isEmpty(pictureThumb) && !"null".equals(pictureThumb) || updateBitmap != null) { //$NON-NLS-1$ commentPictureView.setVisibility(View.VISIBLE); if (updateBitmap != null) { commentPictureView.setImageBitmap(updateBitmap); @@ -602,11 +602,11 @@ public class UpdateAdapter extends CursorAdapter { int newLength = AndroidUtilities.tryParseInt(newValue, 0); if (oldLength > 0 && newLength > oldLength) { - result = context.getString(R.string.history_added_description_characters, (newLength - oldLength), itemPosessive); + result = context.getString(R.string.history_added_description_characters, newLength - oldLength, itemPosessive); } else if (newLength == 0) { result = context.getString(R.string.history_removed_description, itemPosessive); } else if (oldLength > 0 && newLength < oldLength) { - result = context.getString(R.string.history_removed_description_characters, (oldLength - newLength), itemPosessive); + result = context.getString(R.string.history_removed_description_characters, oldLength - newLength, itemPosessive); } else if (oldLength > 0 && oldLength == newLength) { result = context.getString(R.string.history_updated_description, itemPosessive); } @@ -714,7 +714,7 @@ public class UpdateAdapter extends CursorAdapter { } private static String dateString(Context context, String value, String other) { - boolean includeYear = (!TextUtils.isEmpty(other) && !value.substring(0, 4).equals(other.substring(0, 4))); + boolean includeYear = !TextUtils.isEmpty(other) && !value.substring(0, 4).equals(other.substring(0, 4)); boolean hasTime = DateUtilities.isoStringHasTime(value); long time = 0; @@ -816,11 +816,11 @@ public class UpdateAdapter extends CursorAdapter { } byDayDisplay.delete(byDayDisplay.length() - 2, byDayDisplay.length()); - result += (" " + context.getString(R.string.history_repeat_on, byDayDisplay.toString())); + result += " " + context.getString(R.string.history_repeat_on, byDayDisplay.toString()); } if ("COMPLETION".equals(repeat.optString("from"))) { - result += (" " + context.getString(R.string.history_repeat_from_completion)); + result += " " + context.getString(R.string.history_repeat_from_completion); } return result; diff --git a/astrid/src/com/todoroo/astrid/billing/Base64.java b/astrid/src/com/todoroo/astrid/billing/Base64.java index 96d18e29a..fa216e4cb 100644 --- a/astrid/src/com/todoroo/astrid/billing/Base64.java +++ b/astrid/src/com/todoroo/astrid/billing/Base64.java @@ -219,26 +219,26 @@ public class Base64 { // We have to shift left 24 in order to flush out the 1's that appear // when Java treats a value as negative that is cast from a byte to an int. int inBuff = - (numSigBytes > 0 ? ((source[srcOffset] << 24) >>> 8) : 0) - | (numSigBytes > 1 ? ((source[srcOffset + 1] << 24) >>> 16) : 0) - | (numSigBytes > 2 ? ((source[srcOffset + 2] << 24) >>> 24) : 0); + (numSigBytes > 0 ? source[srcOffset] << 24 >>> 8 : 0) + | (numSigBytes > 1 ? source[srcOffset + 1] << 24 >>> 16 : 0) + | (numSigBytes > 2 ? source[srcOffset + 2] << 24 >>> 24 : 0); switch (numSigBytes) { case 3: - destination[destOffset] = alphabet[(inBuff >>> 18)]; - destination[destOffset + 1] = alphabet[(inBuff >>> 12) & 0x3f]; - destination[destOffset + 2] = alphabet[(inBuff >>> 6) & 0x3f]; - destination[destOffset + 3] = alphabet[(inBuff) & 0x3f]; + destination[destOffset] = alphabet[inBuff >>> 18]; + destination[destOffset + 1] = alphabet[inBuff >>> 12 & 0x3f]; + destination[destOffset + 2] = alphabet[inBuff >>> 6 & 0x3f]; + destination[destOffset + 3] = alphabet[inBuff & 0x3f]; return destination; case 2: - destination[destOffset] = alphabet[(inBuff >>> 18)]; - destination[destOffset + 1] = alphabet[(inBuff >>> 12) & 0x3f]; - destination[destOffset + 2] = alphabet[(inBuff >>> 6) & 0x3f]; + destination[destOffset] = alphabet[inBuff >>> 18]; + destination[destOffset + 1] = alphabet[inBuff >>> 12 & 0x3f]; + destination[destOffset + 2] = alphabet[inBuff >>> 6 & 0x3f]; destination[destOffset + 3] = EQUALS_SIGN; return destination; case 1: - destination[destOffset] = alphabet[(inBuff >>> 18)]; - destination[destOffset + 1] = alphabet[(inBuff >>> 12) & 0x3f]; + destination[destOffset] = alphabet[inBuff >>> 18]; + destination[destOffset + 1] = alphabet[inBuff >>> 12 & 0x3f]; destination[destOffset + 2] = EQUALS_SIGN; destination[destOffset + 3] = EQUALS_SIGN; return destination; @@ -313,7 +313,7 @@ public class Base64 { int lenDiv3 = (len + 2) / 3; // ceil(len / 3) int len43 = lenDiv3 * 4; byte[] outBuff = new byte[len43 // Main 4:3 - + (len43 / maxLineLength)]; // New lines + + len43 / maxLineLength]; // New lines int d = 0; int e = 0; @@ -325,13 +325,13 @@ public class Base64 { // encode3to4( source, d + off, 3, outBuff, e, alphabet ); // but inlined for faster encoding (~20% improvement) int inBuff = - ((source[d + off] << 24) >>> 8) - | ((source[d + 1 + off] << 24) >>> 16) - | ((source[d + 2 + off] << 24) >>> 24); - outBuff[e] = alphabet[(inBuff >>> 18)]; - outBuff[e + 1] = alphabet[(inBuff >>> 12) & 0x3f]; - outBuff[e + 2] = alphabet[(inBuff >>> 6) & 0x3f]; - outBuff[e + 3] = alphabet[(inBuff) & 0x3f]; + source[d + off] << 24 >>> 8 + | source[d + 1 + off] << 24 >>> 16 + | source[d + 2 + off] << 24 >>> 24; + outBuff[e] = alphabet[inBuff >>> 18]; + outBuff[e + 1] = alphabet[inBuff >>> 12 & 0x3f]; + outBuff[e + 2] = alphabet[inBuff >>> 6 & 0x3f]; + outBuff[e + 3] = alphabet[inBuff & 0x3f]; lineLength += 4; if (lineLength == maxLineLength) { @@ -353,7 +353,7 @@ public class Base64 { e += 4; } - assert (e == outBuff.length); + assert e == outBuff.length; return outBuff; } @@ -388,17 +388,17 @@ public class Base64 { // Example: Dk== if (source[srcOffset + 2] == EQUALS_SIGN) { int outBuff = - ((decodabet[source[srcOffset]] << 24) >>> 6) - | ((decodabet[source[srcOffset + 1]] << 24) >>> 12); + decodabet[source[srcOffset]] << 24 >>> 6 + | decodabet[source[srcOffset + 1]] << 24 >>> 12; destination[destOffset] = (byte) (outBuff >>> 16); return 1; } else if (source[srcOffset + 3] == EQUALS_SIGN) { // Example: DkL= int outBuff = - ((decodabet[source[srcOffset]] << 24) >>> 6) - | ((decodabet[source[srcOffset + 1]] << 24) >>> 12) - | ((decodabet[source[srcOffset + 2]] << 24) >>> 18); + decodabet[source[srcOffset]] << 24 >>> 6 + | decodabet[source[srcOffset + 1]] << 24 >>> 12 + | decodabet[source[srcOffset + 2]] << 24 >>> 18; destination[destOffset] = (byte) (outBuff >>> 16); destination[destOffset + 1] = (byte) (outBuff >>> 8); @@ -406,14 +406,14 @@ public class Base64 { } else { // Example: DkLE int outBuff = - ((decodabet[source[srcOffset]] << 24) >>> 6) - | ((decodabet[source[srcOffset + 1]] << 24) >>> 12) - | ((decodabet[source[srcOffset + 2]] << 24) >>> 18) - | ((decodabet[source[srcOffset + 3]] << 24) >>> 24); + decodabet[source[srcOffset]] << 24 >>> 6 + | decodabet[source[srcOffset + 1]] << 24 >>> 12 + | decodabet[source[srcOffset + 2]] << 24 >>> 18 + | decodabet[source[srcOffset + 3]] << 24 >>> 24; destination[destOffset] = (byte) (outBuff >> 16); destination[destOffset + 1] = (byte) (outBuff >> 8); - destination[destOffset + 2] = (byte) (outBuff); + destination[destOffset + 2] = (byte) outBuff; return 3; } } // end decodeToBytes @@ -536,8 +536,8 @@ public class Base64 { if (b4Posn == 0 || b4Posn == 1) { throw new Base64DecoderException( "invalid padding byte '=' at byte offset " + i); - } else if ((b4Posn == 3 && bytesLeft > 2) - || (b4Posn == 4 && bytesLeft > 1)) { + } else if (b4Posn == 3 && bytesLeft > 2 + || b4Posn == 4 && bytesLeft > 1) { throw new Base64DecoderException( "padding byte '=' falsely signals end of encoded value " + "at offset " + i); diff --git a/astrid/src/com/todoroo/astrid/billing/BillingActivity.java b/astrid/src/com/todoroo/astrid/billing/BillingActivity.java index 9b7250105..af07bcf03 100644 --- a/astrid/src/com/todoroo/astrid/billing/BillingActivity.java +++ b/astrid/src/com/todoroo/astrid/billing/BillingActivity.java @@ -192,8 +192,8 @@ public class BillingActivity extends SherlockFragmentActivity implements AstridP StringBuilder builder = new StringBuilder("
    "); - for (int i = 0; i < bullets.length; i++) { - String curr = getString(bullets[i]); + for (int bullet : bullets) { + String curr = getString(bullet); if (curr.contains("\n")) { curr = curr.replace("\n", "
    "); } diff --git a/astrid/src/com/todoroo/astrid/billing/BillingService.java b/astrid/src/com/todoroo/astrid/billing/BillingService.java index 2c04ec3c7..181522d57 100644 --- a/astrid/src/com/todoroo/astrid/billing/BillingService.java +++ b/astrid/src/com/todoroo/astrid/billing/BillingService.java @@ -196,7 +196,7 @@ public class BillingService extends Service implements ServiceConnection { Log.i(TAG, "CheckBillingSupported response code: " + ResponseCode.valueOf(responseCode)); } - boolean billingSupported = (responseCode == ResponseCode.RESULT_OK.ordinal()); + boolean billingSupported = responseCode == ResponseCode.RESULT_OK.ordinal(); ResponseHandler.checkBillingSupportedResponse(billingSupported, mProductType); return BillingConstants.BILLING_RESPONSE_INVALID_REQUEST_ID; } diff --git a/astrid/src/com/todoroo/astrid/billing/PurchaseObserver.java b/astrid/src/com/todoroo/astrid/billing/PurchaseObserver.java index 30ab3685b..a327e8af0 100644 --- a/astrid/src/com/todoroo/astrid/billing/PurchaseObserver.java +++ b/astrid/src/com/todoroo/astrid/billing/PurchaseObserver.java @@ -124,9 +124,9 @@ public abstract class PurchaseObserver { // intent, 0, 0, 0); mStartIntentSenderArgs[0] = pendingIntent.getIntentSender(); mStartIntentSenderArgs[1] = intent; - mStartIntentSenderArgs[2] = Integer.valueOf(0); - mStartIntentSenderArgs[3] = Integer.valueOf(0); - mStartIntentSenderArgs[4] = Integer.valueOf(0); + mStartIntentSenderArgs[2] = 0; + mStartIntentSenderArgs[3] = 0; + mStartIntentSenderArgs[4] = 0; mStartIntentSender.invoke(mActivity, mStartIntentSenderArgs); } catch (Exception e) { Log.e(TAG, "error starting activity", e); //$NON-NLS-1$ diff --git a/astrid/src/com/todoroo/astrid/dao/MetadataDao.java b/astrid/src/com/todoroo/astrid/dao/MetadataDao.java index a1f1d2273..c319bc174 100644 --- a/astrid/src/com/todoroo/astrid/dao/MetadataDao.java +++ b/astrid/src/com/todoroo/astrid/dao/MetadataDao.java @@ -88,10 +88,10 @@ public class MetadataDao extends DatabaseDao { protected boolean shouldRecordOutstanding(Metadata item) { ContentValues cv = item.getSetValues(); return super.shouldRecordOutstanding(item) && cv != null && - ((cv.containsKey(Metadata.KEY.name) && - TaskToTagMetadata.KEY.equals(item.getValue(Metadata.KEY))) || - (cv.containsKey(Metadata.DELETION_DATE.name) && - item.getValue(Metadata.DELETION_DATE) > 0)) && + (cv.containsKey(Metadata.KEY.name) && + TaskToTagMetadata.KEY.equals(item.getValue(Metadata.KEY)) || + cv.containsKey(Metadata.DELETION_DATE.name) && + item.getValue(Metadata.DELETION_DATE) > 0) && RemoteModelDao.getOutstandingEntryFlag(RemoteModelDao.OUTSTANDING_ENTRY_FLAG_RECORD_OUTSTANDING); } diff --git a/astrid/src/com/todoroo/astrid/dao/TagMetadataDao.java b/astrid/src/com/todoroo/astrid/dao/TagMetadataDao.java index 512435073..bfe0357a6 100644 --- a/astrid/src/com/todoroo/astrid/dao/TagMetadataDao.java +++ b/astrid/src/com/todoroo/astrid/dao/TagMetadataDao.java @@ -81,10 +81,10 @@ public class TagMetadataDao extends DatabaseDao { protected boolean shouldRecordOutstanding(TagMetadata item) { ContentValues cv = item.getSetValues(); return super.shouldRecordOutstanding(item) && cv != null && - ((cv.containsKey(TagMetadata.KEY.name) && - TagMemberMetadata.KEY.equals(item.getValue(TagMetadata.KEY))) || - (cv.containsKey(TagMetadata.DELETION_DATE.name) && - item.getValue(TagMetadata.DELETION_DATE) > 0)) && + (cv.containsKey(TagMetadata.KEY.name) && + TagMemberMetadata.KEY.equals(item.getValue(TagMetadata.KEY)) || + cv.containsKey(TagMetadata.DELETION_DATE.name) && + item.getValue(TagMetadata.DELETION_DATE) > 0) && RemoteModelDao.getOutstandingEntryFlag(RemoteModelDao.OUTSTANDING_ENTRY_FLAG_RECORD_OUTSTANDING); } diff --git a/astrid/src/com/todoroo/astrid/helper/SyncActionHelper.java b/astrid/src/com/todoroo/astrid/helper/SyncActionHelper.java index 471cde309..2b924fae9 100644 --- a/astrid/src/com/todoroo/astrid/helper/SyncActionHelper.java +++ b/astrid/src/com/todoroo/astrid/helper/SyncActionHelper.java @@ -183,8 +183,7 @@ public class SyncActionHelper { // Loop through a list of all packages (including plugins, addons) // that have a settings action: filter to sync actions - for (int i = 0; i < length; i++) { - ResolveInfo resolveInfo = resolveInfoList.get(i); + for (ResolveInfo resolveInfo : resolveInfoList) { Intent intent = new Intent(AstridApiConstants.ACTION_SETTINGS); intent.setClassName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name); diff --git a/astrid/src/com/todoroo/astrid/helper/UUIDHelper.java b/astrid/src/com/todoroo/astrid/helper/UUIDHelper.java index cfb06a4e5..829bf30be 100644 --- a/astrid/src/com/todoroo/astrid/helper/UUIDHelper.java +++ b/astrid/src/com/todoroo/astrid/helper/UUIDHelper.java @@ -14,7 +14,6 @@ public class UUIDHelper { long uuid = 0; do { uuid = UUID.randomUUID().getLeastSignificantBits() & 0x7fffffffffffffffL; - ; } while (uuid < MIN_UUID); return Long.toString(uuid); } diff --git a/astrid/src/com/todoroo/astrid/legacy/LegacyImportance.java b/astrid/src/com/todoroo/astrid/legacy/LegacyImportance.java index d96160068..adcfd2a78 100644 --- a/astrid/src/com/todoroo/astrid/legacy/LegacyImportance.java +++ b/astrid/src/com/todoroo/astrid/legacy/LegacyImportance.java @@ -12,7 +12,7 @@ public enum LegacyImportance { LEVEL_1, LEVEL_2, LEVEL_3, - LEVEL_4; + LEVEL_4 // LEAST IMPORTANT } diff --git a/astrid/src/com/todoroo/astrid/legacy/TransitionalAlarm.java b/astrid/src/com/todoroo/astrid/legacy/TransitionalAlarm.java index c0f30c715..7768d023d 100644 --- a/astrid/src/com/todoroo/astrid/legacy/TransitionalAlarm.java +++ b/astrid/src/com/todoroo/astrid/legacy/TransitionalAlarm.java @@ -106,8 +106,6 @@ public class TransitionalAlarm extends AbstractModel { return getIdHelper(ID); } - ; - // --- parcelable helpers private static final Creator CREATOR = new ModelCreator(Task.class); diff --git a/astrid/src/com/todoroo/astrid/provider/Astrid2TaskProvider.java b/astrid/src/com/todoroo/astrid/provider/Astrid2TaskProvider.java index 7724743ed..60c6c871d 100644 --- a/astrid/src/com/todoroo/astrid/provider/Astrid2TaskProvider.java +++ b/astrid/src/com/todoroo/astrid/provider/Astrid2TaskProvider.java @@ -146,10 +146,10 @@ public class Astrid2TaskProvider extends ContentProvider { MatrixCursor ret = new MatrixCursor(TAGS_FIELD_LIST); - for (int i = 0; i < tags.length; i++) { + for (Tag tag : tags) { Object[] values = new Object[2]; - values[0] = tagNameToLong(tags[i].tag); - values[1] = tags[i].tag; + values[0] = tagNameToLong(tag.tag); + values[1] = tag.tag; ret.addRow(values); } diff --git a/astrid/src/com/todoroo/astrid/service/AddOnService.java b/astrid/src/com/todoroo/astrid/service/AddOnService.java index e8a0ece38..6632085cc 100644 --- a/astrid/src/com/todoroo/astrid/service/AddOnService.java +++ b/astrid/src/com/todoroo/astrid/service/AddOnService.java @@ -141,9 +141,9 @@ public class AddOnService { AddOn addon = null; AddOn[] addons = getAddOns(); - for (int i = 0; i < addons.length; i++) { - if (packageName.equals(addons[i].getPackageName()) && title.equals(addons[i].getTitle())) { - addon = addons[i]; + for (AddOn addon1 : addons) { + if (packageName.equals(addon1.getPackageName()) && title.equals(addon1.getTitle())) { + addon = addon1; } } return addon; diff --git a/astrid/src/com/todoroo/astrid/service/Astrid2To3UpgradeHelper.java b/astrid/src/com/todoroo/astrid/service/Astrid2To3UpgradeHelper.java index 39e386a22..674589cf7 100644 --- a/astrid/src/com/todoroo/astrid/service/Astrid2To3UpgradeHelper.java +++ b/astrid/src/com/todoroo/astrid/service/Astrid2To3UpgradeHelper.java @@ -330,7 +330,7 @@ public class Astrid2To3UpgradeHelper { * @param dao */ @SuppressWarnings("nls") - private static final void upgradeTable(Context context, String legacyTable, + private static void upgradeTable(Context context, String legacyTable, HashMap> propertyMap, TYPE model, DatabaseDao dao) { diff --git a/astrid/src/com/todoroo/astrid/service/ThemeService.java b/astrid/src/com/todoroo/astrid/service/ThemeService.java index 30e94bce6..380a936d9 100644 --- a/astrid/src/com/todoroo/astrid/service/ThemeService.java +++ b/astrid/src/com/todoroo/astrid/service/ThemeService.java @@ -267,7 +267,7 @@ public class ThemeService { public static int getDarkVsLight(int resForWhite, int resForDark, boolean altIsDark) { int theme = getTheme(); - if (theme == R.style.Theme || (theme == R.style.Theme_White_Alt && altIsDark) || theme == R.style.Theme_TransparentWhite) { + if (theme == R.style.Theme || theme == R.style.Theme_White_Alt && altIsDark || theme == R.style.Theme_TransparentWhite) { return resForDark; } else { return resForWhite; diff --git a/astrid/src/com/todoroo/astrid/service/UpgradeService.java b/astrid/src/com/todoroo/astrid/service/UpgradeService.java index 7a9c92270..ce56e4513 100644 --- a/astrid/src/com/todoroo/astrid/service/UpgradeService.java +++ b/astrid/src/com/todoroo/astrid/service/UpgradeService.java @@ -286,7 +286,6 @@ public final class UpgradeService { } } - ; }.start(); } else { finished = true; diff --git a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java index c240276de..f06ae53fd 100644 --- a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java +++ b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java @@ -133,7 +133,7 @@ public class ABTests { * (i.e. the arrays should be the same length if this one exists) */ public void addTest(String testKey, int[] newUserProbs, int[] existingUserProbs, String[] descriptions, boolean appliesToAstridLite) { - if (!Constants.ASTRID_LITE || (Constants.ASTRID_LITE && appliesToAstridLite)) { + if (!Constants.ASTRID_LITE || Constants.ASTRID_LITE && appliesToAstridLite) { ABTestBundle bundle = new ABTestBundle(newUserProbs, existingUserProbs, descriptions); bundles.put(testKey, bundle); } diff --git a/astrid/src/com/todoroo/astrid/ui/CalendarView.java b/astrid/src/com/todoroo/astrid/ui/CalendarView.java index 49cdc5bae..1815a4d77 100644 --- a/astrid/src/com/todoroo/astrid/ui/CalendarView.java +++ b/astrid/src/com/todoroo/astrid/ui/CalendarView.java @@ -97,7 +97,7 @@ public class CalendarView extends View { initCalendarView(context); } - private final void initCalendarView(Context context) { + private void initCalendarView(Context context) { Display display = ((WindowManager) context.getSystemService( Context.WINDOW_SERVICE)).getDefaultDisplay(); @@ -277,7 +277,7 @@ public class CalendarView extends View { leftArrowHeight = (int) (leftArrow.getHeight() * density / 2); leftArrowWidth = (int) (leftArrow.getWidth() * density / 2); leftArrowX = 5; - leftArrowY = 4 + (int) ((monthTitleHeight / 2 - leftArrowHeight / 2)); + leftArrowY = 4 + (int) (monthTitleHeight / 2 - leftArrowHeight / 2); canvas.drawBitmap(leftArrow, new Rect(0, 0, leftArrow.getWidth(), leftArrow.getHeight()), new Rect(leftArrowX, leftArrowY, leftArrowX + leftArrowWidth, leftArrowY + leftArrowHeight), null); @@ -287,8 +287,8 @@ public class CalendarView extends View { Bitmap rightArrow = ((BitmapDrawable) getResources().getDrawable(R.drawable.icn_arrow_right)).getBitmap(); rightArrowHeight = (int) (rightArrow.getHeight() * density / 2); rightArrowWidth = (int) (rightArrow.getWidth() * density / 2); - rightArrowX = (int) (getMeasuredWidth() - (2 * density) - (PADDING * 3) - rightArrow.getWidth()); - rightArrowY = 4 + (int) ((monthTitleHeight / 2 - rightArrowHeight / 2)); + rightArrowX = (int) (getMeasuredWidth() - 2 * density - PADDING * 3 - rightArrow.getWidth()); + rightArrowY = 4 + (int) (monthTitleHeight / 2 - rightArrowHeight / 2); canvas.drawBitmap(rightArrow, new Rect(0, 0, rightArrow.getWidth(), rightArrow.getHeight()), new Rect(rightArrowX, rightArrowY, rightArrowX + rightArrowWidth, rightArrowY + rightArrowHeight), null); @@ -307,8 +307,8 @@ public class CalendarView extends View { int dayLeft = 3; int dayTop = (int) (monthTitleHeight + PADDING * 2); - boxWidth = (getMeasuredWidth() - (PADDING * 2)) / 7.0f; - boxHeight = (int) (((getMeasuredHeight() - (monthTitleHeight) - 16) - (PADDING * 8)) / 7); + boxWidth = (getMeasuredWidth() - PADDING * 2) / 7.0f; + boxHeight = (int) ((getMeasuredHeight() - monthTitleHeight - 16 - PADDING * 8) / 7); float textX = 0; float textY = 0; @@ -321,7 +321,7 @@ public class CalendarView extends View { calendar.add(Calendar.DATE, 1); textX = dayLeft + boxWidth - TEXT_PADDING * 3; - textY = dayTop + (boxHeight - boxHeight / 8) - TEXT_PADDING * 2; + textY = dayTop + boxHeight - boxHeight / 8 - TEXT_PADDING * 2; canvas.drawText(day, textX, textY, rightAlignPaint); dayLeft += boxWidth; @@ -414,8 +414,8 @@ public class CalendarView extends View { private void performClick(int x, int y) { // System.out.println("---------------------Current x, y : " + x + ", " + y); // Handle left-right arrow click -- start - if ((x > leftArrowX && x < (leftArrowX + leftArrowWidth * 2)) - && (y > leftArrowY - leftArrowHeight / 2 && y < (leftArrowY + 3 * leftArrowHeight / 2))) { + if (x > leftArrowX && x < leftArrowX + leftArrowWidth * 2 + && y > leftArrowY - leftArrowHeight / 2 && y < leftArrowY + 3 * leftArrowHeight / 2) { Calendar calendar = Calendar.getInstance(); calendar.setTime(getCoercedDate(getToday(calendar), calendarDate)); int currentDay = calendar.get(Calendar.DATE); @@ -430,8 +430,8 @@ public class CalendarView extends View { if (onSelectedDateListener != null) { onSelectedDateListener.onSelectedDate(calendarDate); } - } else if ((x > rightArrowX - rightArrowWidth && x < (rightArrowX + rightArrowWidth)) - && (y > rightArrowY - rightArrowHeight / 2 && y < (rightArrowY + 3 * rightArrowHeight / 2))) { + } else if (x > rightArrowX - rightArrowWidth && x < rightArrowX + rightArrowWidth + && y > rightArrowY - rightArrowHeight / 2 && y < rightArrowY + 3 * rightArrowHeight / 2) { Calendar calendar = Calendar.getInstance(); calendar.setTime(getCoercedDate(getToday(calendar), calendarDate)); int currentDay = calendar.get(Calendar.DATE); @@ -454,7 +454,7 @@ public class CalendarView extends View { return; } for (int i = 0; i < dayLeftArr.length; i++) { - if ((x > dayLeftArr[i] && x < dayLeftArr[i] + boxWidth) && (y > dayTopArr[i] && y < dayTopArr[i] + boxHeight)) { + if (x > dayLeftArr[i] && x < dayLeftArr[i] + boxWidth && y > dayTopArr[i] && y < dayTopArr[i] + boxHeight) { currentHighlightDay = i + 1; Calendar calendar = Calendar.getInstance(); Date today = getToday(calendar); @@ -482,7 +482,7 @@ public class CalendarView extends View { } public Date getCoercedDate(Date ifZero, Date ifNotZero) { - return (calendarDate.getTime() == 0 ? ifZero : ifNotZero); + return calendarDate.getTime() == 0 ? ifZero : ifNotZero; } public Date getCalendarDate() { diff --git a/astrid/src/com/todoroo/astrid/ui/DateAndTimeDialog.java b/astrid/src/com/todoroo/astrid/ui/DateAndTimeDialog.java index 2c8f883e8..7645b790c 100644 --- a/astrid/src/com/todoroo/astrid/ui/DateAndTimeDialog.java +++ b/astrid/src/com/todoroo/astrid/ui/DateAndTimeDialog.java @@ -47,7 +47,7 @@ public class DateAndTimeDialog extends Dialog { LayoutParams params = getWindow().getAttributes(); params.height = LayoutParams.FILL_PARENT; params.width = LayoutParams.FILL_PARENT; - getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); + getWindow().setAttributes(params); dateAndTimePicker = (DateAndTimePicker) findViewById(R.id.date_and_time); dateAndTimePicker.initializeWithDate(startDate); diff --git a/astrid/src/com/todoroo/astrid/ui/DeadlineControlSet.java b/astrid/src/com/todoroo/astrid/ui/DeadlineControlSet.java index 9742fd66f..54a2eabb4 100644 --- a/astrid/src/com/todoroo/astrid/ui/DeadlineControlSet.java +++ b/astrid/src/com/todoroo/astrid/ui/DeadlineControlSet.java @@ -131,7 +131,7 @@ public class DeadlineControlSet extends PopupControlSet { } public boolean isDeadlineSet() { - return (dateAndTimePicker != null && dateAndTimePicker.constructDueDate() != 0); + return dateAndTimePicker != null && dateAndTimePicker.constructDueDate() != 0; } /** diff --git a/astrid/src/com/todoroo/astrid/ui/DraggableListView.java b/astrid/src/com/todoroo/astrid/ui/DraggableListView.java index 53af6e9ed..5069dca96 100644 --- a/astrid/src/com/todoroo/astrid/ui/DraggableListView.java +++ b/astrid/src/com/todoroo/astrid/ui/DraggableListView.java @@ -133,7 +133,7 @@ public class DraggableListView extends ListView { } private int getItemForPosition(int y) { - int adjustedy = y - mDragPoint.y - (mItemHeightNormal / 2); + int adjustedy = y - mDragPoint.y - mItemHeightNormal / 2; int pos = myPointToPosition(0, adjustedy); if (pos >= 0) { if (pos <= mFirstDragPos) { @@ -318,7 +318,7 @@ public class DraggableListView extends ListView { return null; } - return (View) getChildAt(itemNum - getFirstVisiblePosition()); + return getChildAt(itemNum - getFirstVisiblePosition()); } // --- drag logic @@ -363,8 +363,6 @@ public class DraggableListView extends ListView { } } - ; - /** * @return true if drag was initiated */ @@ -377,7 +375,7 @@ public class DraggableListView extends ListView { return false; } - View item = (View) getChildAt(itemNum - getFirstVisiblePosition()); + View item = getChildAt(itemNum - getFirstVisiblePosition()); if (!isDraggableRow(item)) { return false; diff --git a/astrid/src/com/todoroo/astrid/ui/EditTitleControlSet.java b/astrid/src/com/todoroo/astrid/ui/EditTitleControlSet.java index bd0933eb7..f43d1babb 100644 --- a/astrid/src/com/todoroo/astrid/ui/EditTitleControlSet.java +++ b/astrid/src/com/todoroo/astrid/ui/EditTitleControlSet.java @@ -116,8 +116,8 @@ public class EditTitleControlSet extends TaskEditControlSet implements Importanc private void updateCompleteBox() { boolean checked = completeBox.isChecked(); - int[] resourceArray = isRepeating ? (checked ? TaskAdapter.IMPORTANCE_REPEAT_RESOURCES_CHECKED : TaskAdapter.IMPORTANCE_REPEAT_RESOURCES) - : (checked ? TaskAdapter.IMPORTANCE_RESOURCES_CHECKED : TaskAdapter.IMPORTANCE_RESOURCES); + int[] resourceArray = isRepeating ? checked ? TaskAdapter.IMPORTANCE_REPEAT_RESOURCES_CHECKED : TaskAdapter.IMPORTANCE_REPEAT_RESOURCES + : checked ? TaskAdapter.IMPORTANCE_RESOURCES_CHECKED : TaskAdapter.IMPORTANCE_RESOURCES; int valueToUse = importanceValue; if (valueToUse >= resourceArray.length) { valueToUse = resourceArray.length - 1; diff --git a/astrid/src/com/todoroo/astrid/ui/FragmentPopover.java b/astrid/src/com/todoroo/astrid/ui/FragmentPopover.java index 69cd1e2c1..20466b81a 100644 --- a/astrid/src/com/todoroo/astrid/ui/FragmentPopover.java +++ b/astrid/src/com/todoroo/astrid/ui/FragmentPopover.java @@ -63,8 +63,8 @@ public class FragmentPopover extends QuickActionWidget { int dyTop = anchorRect.top; int dyBottom = getScreenHeight() - anchorRect.bottom; - boolean onTop = (dyTop > dyBottom); - int popupY = (onTop) ? anchorRect.top - rootHeight + offsetY : anchorRect.bottom - offsetY; + boolean onTop = dyTop > dyBottom; + int popupY = onTop ? anchorRect.top - rootHeight + offsetY : anchorRect.bottom - offsetY; setWidgetSpecs(popupY, onTop); } diff --git a/astrid/src/com/todoroo/astrid/ui/NestableScrollView.java b/astrid/src/com/todoroo/astrid/ui/NestableScrollView.java index 37f0b9d81..1a72e1d40 100644 --- a/astrid/src/com/todoroo/astrid/ui/NestableScrollView.java +++ b/astrid/src/com/todoroo/astrid/ui/NestableScrollView.java @@ -22,8 +22,8 @@ public class NestableScrollView extends ScrollView { @Override public boolean onInterceptTouchEvent(MotionEvent event) { if (scrollableViews != null) { - for (int i = 0; i < scrollableViews.length; i++) { - View view = findViewById(scrollableViews[i]); + for (int scrollableView : scrollableViews) { + View view = findViewById(scrollableView); if (view != null) { Rect rect = new Rect(); view.getHitRect(rect); diff --git a/astrid/src/com/todoroo/astrid/ui/NestedListView.java b/astrid/src/com/todoroo/astrid/ui/NestedListView.java index d0af8ab13..ffdc92c09 100644 --- a/astrid/src/com/todoroo/astrid/ui/NestedListView.java +++ b/astrid/src/com/todoroo/astrid/ui/NestedListView.java @@ -38,7 +38,7 @@ public class NestedListView extends ListView { } newHeight += getDividerHeight() * listPosition; } - if ((heightMode == MeasureSpec.AT_MOST) && (newHeight > heightSize)) { + if (heightMode == MeasureSpec.AT_MOST && newHeight > heightSize) { if (newHeight > heightSize) { newHeight = heightSize; } diff --git a/astrid/src/com/todoroo/astrid/ui/NumberPicker.java b/astrid/src/com/todoroo/astrid/ui/NumberPicker.java index 43a4c4edc..3533d95b8 100644 --- a/astrid/src/com/todoroo/astrid/ui/NumberPicker.java +++ b/astrid/src/com/todoroo/astrid/ui/NumberPicker.java @@ -248,7 +248,7 @@ public class NumberPicker extends LinearLayout implements OnClickListener, } private String formatNumber(int value) { - return (mFormatter != null) ? mFormatter.toString(value) : String + return mFormatter != null ? mFormatter.toString(value) : String .valueOf(value); } @@ -257,8 +257,7 @@ public class NumberPicker extends LinearLayout implements OnClickListener, // Wrap around the values if we go past the start or end if (current > mEnd) { - ; - current = mStart + (current - mEnd) - 1; + current = mStart + current - mEnd - 1; } else if (current < mStart) { current = mEnd - (mStart - current) + 1; } @@ -302,7 +301,7 @@ public class NumberPicker extends LinearLayout implements OnClickListener, private void validateCurrentView(CharSequence str, boolean notifyChange) { if (!TextUtils.isEmpty(str)) { int val = getSelectedPos(str.toString()); - if ((val >= mStart) && (val <= mEnd)) { + if (val >= mStart && val <= mEnd) { mPrevious = mCurrent; mCurrent = val; if (notifyChange) { diff --git a/astrid/src/com/todoroo/astrid/ui/NumberPickerButton.java b/astrid/src/com/todoroo/astrid/ui/NumberPickerButton.java index 8a8f51812..0966baf47 100644 --- a/astrid/src/com/todoroo/astrid/ui/NumberPickerButton.java +++ b/astrid/src/com/todoroo/astrid/ui/NumberPickerButton.java @@ -51,16 +51,16 @@ public class NumberPickerButton extends ImageButton { @Override public boolean onKeyUp(int keyCode, KeyEvent event) { - if ((keyCode == KeyEvent.KEYCODE_DPAD_CENTER) - || (keyCode == KeyEvent.KEYCODE_ENTER)) { + if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER + || keyCode == KeyEvent.KEYCODE_ENTER) { cancelLongpress(); } return super.onKeyUp(keyCode, event); } private void cancelLongpressIfRequired(MotionEvent event) { - if ((event.getAction() == MotionEvent.ACTION_CANCEL) - || (event.getAction() == MotionEvent.ACTION_UP)) { + if (event.getAction() == MotionEvent.ACTION_CANCEL + || event.getAction() == MotionEvent.ACTION_UP) { cancelLongpress(); } } diff --git a/astrid/src/com/todoroo/astrid/ui/PopupControlSet.java b/astrid/src/com/todoroo/astrid/ui/PopupControlSet.java index 8b5abc603..89f1d9bd5 100644 --- a/astrid/src/com/todoroo/astrid/ui/PopupControlSet.java +++ b/astrid/src/com/todoroo/astrid/ui/PopupControlSet.java @@ -55,7 +55,7 @@ public abstract class PopupControlSet extends TaskEditControlSet { this.displayView = null; } - titleString = (title > 0) ? activity.getString(title) : ""; //$NON-NLS-1$ + titleString = title > 0 ? activity.getString(title) : ""; //$NON-NLS-1$ if (displayView != null) { displayView.setOnClickListener(getDisplayClickListener()); @@ -97,10 +97,10 @@ public abstract class PopupControlSet extends TaskEditControlSet { if (AndroidUtilities.isTabletSized(activity)) { DisplayMetrics metrics = activity.getResources().getDisplayMetrics(); - if ((metrics.widthPixels / metrics.density) >= AndroidUtilities.MIN_TABLET_HEIGHT) { - params.width = (3 * metrics.widthPixels) / 5; - } else if ((metrics.widthPixels / metrics.density) >= AndroidUtilities.MIN_TABLET_WIDTH) { - params.width = (4 * metrics.widthPixels) / 5; + if (metrics.widthPixels / metrics.density >= AndroidUtilities.MIN_TABLET_HEIGHT) { + params.width = 3 * metrics.widthPixels / 5; + } else if (metrics.widthPixels / metrics.density >= AndroidUtilities.MIN_TABLET_WIDTH) { + params.width = 4 * metrics.widthPixels / 5; } } diff --git a/astrid/src/com/todoroo/astrid/ui/QuickAddBar.java b/astrid/src/com/todoroo/astrid/ui/QuickAddBar.java index 482c99d8d..23c6f1005 100644 --- a/astrid/src/com/todoroo/astrid/ui/QuickAddBar.java +++ b/astrid/src/com/todoroo/astrid/ui/QuickAddBar.java @@ -154,8 +154,8 @@ public class QuickAddBar extends LinearLayout { quickAddControlsContainer.postDelayed(new Runnable() { @Override public void run() { - quickAddButton.setVisibility((plusVisible || !hidePlus) ? View.VISIBLE : View.GONE); - quickAddControlsContainer.setVisibility((showControls && controlsVisible) ? View.VISIBLE : View.GONE); + quickAddButton.setVisibility(plusVisible || !hidePlus ? View.VISIBLE : View.GONE); + quickAddControlsContainer.setVisibility(showControls && controlsVisible ? View.VISIBLE : View.GONE); } }, 10); } @@ -170,8 +170,8 @@ public class QuickAddBar extends LinearLayout { int fontSize = Preferences.getIntegerFromString(R.string.p_fontSize, 18); quickAddBox.setTextSize(Math.min(fontSize, 22)); - quickAddButton = ((ImageButton) findViewById( - R.id.quickAddButton)); + quickAddButton = (ImageButton) findViewById( + R.id.quickAddButton); quickAddButton.setVisibility(Preferences.getBoolean(R.string.p_hide_plus_button, false) ? View.GONE : View.VISIBLE); // set listener for quick add button @@ -371,9 +371,9 @@ public class QuickAddBar extends LinearLayout { fragment.loadTaskListContent(true); fragment.selectCustomId(task.getId()); if (task.getTransitory(TaskService.TRANS_QUICK_ADD_MARKUP) != null) { - showAlertForMarkupTask((AstridActivity) activity, task, title); + showAlertForMarkupTask(activity, task, title); } else if (!TextUtils.isEmpty(task.getValue(Task.RECURRENCE))) { - showAlertForRepeatingTask((AstridActivity) activity, task); + showAlertForRepeatingTask(activity, task); } } diff --git a/astrid/src/com/todoroo/astrid/ui/ReminderControlSet.java b/astrid/src/com/todoroo/astrid/ui/ReminderControlSet.java index ff31154ac..5f991569c 100644 --- a/astrid/src/com/todoroo/astrid/ui/ReminderControlSet.java +++ b/astrid/src/com/todoroo/astrid/ui/ReminderControlSet.java @@ -169,7 +169,7 @@ public class ReminderControlSet extends PopupControlSet { StringBuilder reminderString = new StringBuilder(); // Has random reminder? - if ((randomControlSet != null && randomControlSet.hasRandomReminder()) || (randomControlSet == null && model.getValue(Task.REMINDER_PERIOD) > 0)) { + if (randomControlSet != null && randomControlSet.hasRandomReminder() || randomControlSet == null && model.getValue(Task.REMINDER_PERIOD) > 0) { reminderString.append(activity.getString(R.string.TEA_reminder_randomly_short)); reminderCount++; } diff --git a/astrid/src/com/todoroo/astrid/utility/Entities.java b/astrid/src/com/todoroo/astrid/utility/Entities.java index 946470e84..1da332db3 100644 --- a/astrid/src/com/todoroo/astrid/utility/Entities.java +++ b/astrid/src/com/todoroo/astrid/utility/Entities.java @@ -442,7 +442,7 @@ class Entities { */ @Override public void add(String name, int value) { - mapNameToValue.put(name, new Integer(value)); + mapNameToValue.put(name, value); mapValueToName.put(value, name); } @@ -463,7 +463,7 @@ class Entities { if (value == null) { return -1; } - return ((Integer) value).intValue(); + return (Integer) value; } } @@ -477,8 +477,8 @@ class Entities { */ @Override public void add(String name, int value) { - mapNameToValue.put(name, new Integer(value)); - mapValueToName.put(new Integer(value), name); + mapNameToValue.put(name, value); + mapValueToName.put(value, name); } /** @@ -486,7 +486,7 @@ class Entities { */ @Override public String name(int value) { - return (String) mapValueToName.get(new Integer(value)); + return (String) mapValueToName.get(value); } /** @@ -498,7 +498,7 @@ class Entities { if (value == null) { return -1; } - return ((Integer) value).intValue(); + return (Integer) value; } } @@ -679,7 +679,7 @@ class Entities { int high = size - 1; while (low <= high) { - int mid = (low + high) >> 1; + int mid = low + high >> 1; int midVal = values[mid]; if (midVal < key) { @@ -735,8 +735,8 @@ class Entities { * @param entityArray array of entities to be added */ public void addEntities(String[][] entityArray) { - for (int i = 0; i < entityArray.length; ++i) { - addEntity(entityArray[i][0], Integer.parseInt(entityArray[i][1])); + for (String[] anEntityArray : entityArray) { + addEntity(anEntityArray[0], Integer.parseInt(anEntityArray[1])); } } @@ -872,7 +872,7 @@ class Entities { * @return A newly created StringWriter */ private StringWriter createStringWriter(String str) { - return new StringWriter((int) (str.length() + (str.length() * 0.1))); + return new StringWriter((int) (str.length() + str.length() * 0.1)); } /** diff --git a/astrid/src/com/todoroo/astrid/utility/TitleParser.java b/astrid/src/com/todoroo/astrid/utility/TitleParser.java index 81d9fb0f0..575b51067 100644 --- a/astrid/src/com/todoroo/astrid/utility/TitleParser.java +++ b/astrid/src/com/todoroo/astrid/utility/TitleParser.java @@ -252,7 +252,7 @@ public class TitleParser { setCalendarToDefaultTime(dCal); dCal.set(Calendar.MONTH, Integer.parseInt(match.group(2).trim()) - 1); dCal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(match.group(4))); - if (match.group(6) != null && !(match.group(6).trim()).equals("")) { + if (match.group(6) != null && !match.group(6).trim().equals("")) { String yearString = match.group(6); if (match.group(6).length() == 2) { yearString = "20" + match.group(6); @@ -337,12 +337,12 @@ public class TitleParser { } //sets it to the next occurrence of that hour if no am/pm is provided. doesn't include military time - if (Integer.parseInt(m.group(2)) <= 12 && (m.group(4) == null || (m.group(4).trim()).equals(""))) { + if (Integer.parseInt(m.group(2)) <= 12 && (m.group(4) == null || m.group(4).trim().equals(""))) { while (timeCal.getTime().getTime() < today.getTime().getTime()) { timeCal.set(Calendar.HOUR_OF_DAY, timeCal.get(Calendar.HOUR_OF_DAY) + 12); } } else { //if am/pm is provided and the time is in the past, set it to the next day. Military time included. - if (timeCal.get(Calendar.HOUR) != 0 && (timeCal.getTime().getTime() < today.getTime().getTime())) { + if (timeCal.get(Calendar.HOUR) != 0 && timeCal.getTime().getTime() < today.getTime().getTime()) { timeCal.set(Calendar.DAY_OF_MONTH, timeCal.get(Calendar.DAY_OF_MONTH) + 1); } if (timeCal.get(Calendar.HOUR) == 0) { diff --git a/astrid/src/com/todoroo/astrid/voice/Api6VoiceOutputAssistant.java b/astrid/src/com/todoroo/astrid/voice/Api6VoiceOutputAssistant.java index c347149d5..bf7289b26 100644 --- a/astrid/src/com/todoroo/astrid/voice/Api6VoiceOutputAssistant.java +++ b/astrid/src/com/todoroo/astrid/voice/Api6VoiceOutputAssistant.java @@ -71,7 +71,7 @@ public class Api6VoiceOutputAssistant implements OnInitListener, VoiceOutputAssi } private void initTTS() { - mTts = new TextToSpeech(context, (OnInitListener) this); + mTts = new TextToSpeech(context, this); } @Override diff --git a/astrid/src/com/todoroo/astrid/voice/VoiceRecognizer.java b/astrid/src/com/todoroo/astrid/voice/VoiceRecognizer.java index 86b1652de..6b3a9ab91 100644 --- a/astrid/src/com/todoroo/astrid/voice/VoiceRecognizer.java +++ b/astrid/src/com/todoroo/astrid/voice/VoiceRecognizer.java @@ -53,7 +53,7 @@ public class VoiceRecognizer { PackageManager pm = context.getPackageManager(); List activities = pm.queryIntentActivities( new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0); - return (activities.size() != 0); + return activities.size() != 0; } private VoiceRecognizer() { diff --git a/astrid/src/com/todoroo/astrid/welcome/HelpInfoPopover.java b/astrid/src/com/todoroo/astrid/welcome/HelpInfoPopover.java index bc89086fa..522b17982 100644 --- a/astrid/src/com/todoroo/astrid/welcome/HelpInfoPopover.java +++ b/astrid/src/com/todoroo/astrid/welcome/HelpInfoPopover.java @@ -98,8 +98,8 @@ public class HelpInfoPopover extends QuickActionWidget { int dyTop = anchorRect.top; int dyBottom = getScreenHeight() - anchorRect.bottom; - boolean onTop = (dyTop > dyBottom); - int popupY = (onTop) ? anchorRect.top - rootHeight + offsetY : anchorRect.bottom - offsetY; + boolean onTop = dyTop > dyBottom; + int popupY = onTop ? anchorRect.top - rootHeight + offsetY : anchorRect.bottom - offsetY; setWidgetSpecs(popupY, onTop); } diff --git a/astrid/src/com/todoroo/astrid/welcome/tutorial/WelcomeWalkthrough.java b/astrid/src/com/todoroo/astrid/welcome/tutorial/WelcomeWalkthrough.java index 4103c5ee7..7b98dd977 100644 --- a/astrid/src/com/todoroo/astrid/welcome/tutorial/WelcomeWalkthrough.java +++ b/astrid/src/com/todoroo/astrid/welcome/tutorial/WelcomeWalkthrough.java @@ -234,7 +234,7 @@ public class WelcomeWalkthrough extends ActFmLoginActivity { } } } - ((CirclePageIndicator) mIndicator).setVisibility(currentPage == mAdapter.getCount() - 1 ? View.GONE : View.VISIBLE); + mIndicator.setVisibility(currentPage == mAdapter.getCount() - 1 ? View.GONE : View.VISIBLE); } protected void setupPWLogin() { diff --git a/astrid/src/com/todoroo/astrid/widget/TasksWidget.java b/astrid/src/com/todoroo/astrid/widget/TasksWidget.java index 20f225a5c..4fcfedc8c 100644 --- a/astrid/src/com/todoroo/astrid/widget/TasksWidget.java +++ b/astrid/src/com/todoroo/astrid/widget/TasksWidget.java @@ -230,7 +230,7 @@ public class TasksWidget extends AppWidgetProvider { views.addView(R.id.taskbody, row); RemoteViews separator = new RemoteViews(Constants.PACKAGE, R.layout.widget_separator); - boolean isLastRow = (i == cursor.getCount() - 1) || (i == numberOfTasks - 1); + boolean isLastRow = i == cursor.getCount() - 1 || i == numberOfTasks - 1; if (!isLastRow) { views.addView(R.id.taskbody, separator); } @@ -319,7 +319,7 @@ public class TasksWidget extends AppWidgetProvider { private boolean isDarkTheme() { int theme = ThemeService.getWidgetTheme(); - return (theme == R.style.Theme || theme == R.style.Theme_Transparent); + return theme == R.style.Theme || theme == R.style.Theme_Transparent; } private boolean isLegacyTheme() { @@ -355,7 +355,7 @@ public class TasksWidget extends AppWidgetProvider { views.setViewVisibility(R.id.widget_header_separator, View.GONE); return views; } else if (isDarkTheme()) { - layout = (theme == R.style.Theme_Transparent ? R.layout.widget_initialized_dark_transparent : R.layout.widget_initialized_dark); + layout = theme == R.style.Theme_Transparent ? R.layout.widget_initialized_dark_transparent : R.layout.widget_initialized_dark; titleColor = r.getColor(R.color.widget_text_color_dark); buttonDrawable = R.drawable.plus_button_blue; } else if (theme == R.style.Theme_White) { @@ -367,7 +367,7 @@ public class TasksWidget extends AppWidgetProvider { titleColor = r.getColor(R.color.widget_text_color_light); buttonDrawable = R.drawable.plus_button_blue; } else { - layout = (theme == R.style.Theme_TransparentWhite ? R.layout.widget_initialized_transparent : R.layout.widget_initialized); + layout = theme == R.style.Theme_TransparentWhite ? R.layout.widget_initialized_transparent : R.layout.widget_initialized; titleColor = r.getColor(R.color.widget_text_color_light); buttonDrawable = R.drawable.plus_button_dark_blue; } diff --git a/facebook/facebook/facebook.iml b/facebook/facebook/facebook.iml index bc3e1adeb..264d89f42 100644 --- a/facebook/facebook/facebook.iml +++ b/facebook/facebook/facebook.iml @@ -1,5 +1,5 @@ - +