Miscellaneous cleanup

* Remove unnecessary casts
* Remove unnecessary boxing/unboxing
* Remove unnecessary parentheses
* Replace for with for each
* Remove more cruft
Alex Baker 13 years ago
parent b6036faff9
commit ccae55568d

@ -619,9 +619,6 @@ public abstract class AbstractModel implements Parcelable, Cloneable {
return (TYPE[]) Array.newInstance(cls, size);
}
;
}
;
}

@ -300,7 +300,7 @@ public class DatabaseDao<TYPE extends AbstractModel> {
}
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<TYPE extends AbstractModel> {
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();
}

@ -28,7 +28,7 @@ import static com.todoroo.andlib.sql.SqlConstants.SPACE;
* @author Tim Su <tim@todoroo.com>
*/
@SuppressWarnings("nls")
public abstract class Property<TYPE> extends Field implements Cloneable {
public abstract class Property<TYPE> extends Field {
// --- implementation
@ -74,7 +74,7 @@ public abstract class Property<TYPE> 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<TYPE> 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<TYPE> extends Field implements Cloneable {
@Override
public IntegerProperty cloneAs(String tableAlias, String columnAlias) {
return (IntegerProperty) this.cloneAs(tableAlias, columnAlias);
return this.cloneAs(tableAlias, columnAlias);
}
}

@ -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;

@ -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<File>() {
@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;
}

@ -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$

@ -44,7 +44,7 @@ public class Pair<L, R> {
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<L, R> {
int hLeft = getLeft() == null ? 0 : getLeft().hashCode();
int hRight = getRight() == null ? 0 : getRight().hashCode();
return hLeft + (57 * hRight);
return hLeft + 57 * hRight;
}
}

@ -94,7 +94,6 @@ public class Addon implements Parcelable {
return new Addon[size];
}
;
};
}

@ -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();
}
}

@ -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;
}

@ -15,7 +15,7 @@ import android.os.Parcelable;
*
* @author Tim Su <tim@todoroo.com>
*/
public final class IntentFilter extends FilterListItem implements Parcelable {
public final class IntentFilter extends FilterListItem {
/**
* PendingIntent to trigger when pressed

@ -16,7 +16,7 @@ import android.os.Parcelable;
*
* @author Tim Su <tim@todoroo.com>
*/
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);
}
/**

@ -104,7 +104,6 @@ public class SyncAction implements Parcelable {
return new SyncAction[size];
}
;
};
}

@ -96,7 +96,6 @@ public final class TaskDecoration implements Parcelable {
return new TaskDecoration[size];
}
;
};
}

@ -16,7 +16,7 @@ import android.os.Parcelable;
*
* @author Tim Su <tim@todoroo.com>
*/
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);
}
/**

@ -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);
}

@ -151,8 +151,6 @@ public class Metadata extends AbstractModel {
return getIdHelper(ID);
}
;
// --- parcelable helpers
private static final Creator<Metadata> CREATOR = new ModelCreator<Metadata>(Metadata.class);

@ -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;

@ -124,8 +124,6 @@ public class StoreObject extends AbstractModel {
return getIdHelper(ID);
}
;
// --- parcelable helpers
private static final Creator<StoreObject> CREATOR = new ModelCreator<StoreObject>(StoreObject.class);

@ -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;
}
}

@ -194,8 +194,6 @@ public class Update extends RemoteModel {
return getIdHelper(ID);
}
;
@Override
public String getUuid() {
return null;

@ -262,7 +262,7 @@ public abstract class SyncProvider<TYPE extends SyncContainer> {
Collections.sort(data.remoteUpdated, new Comparator<TYPE>() {
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 extends SyncContainer> {
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<TYPE extends SyncContainer> {
}
// if there is a conflict, merge
int remoteIndex = matchTask((ArrayList<TYPE>) data.remoteUpdated, local);
int remoteIndex = matchTask(data.remoteUpdated, local);
if (remoteIndex != -1) {
TYPE remote = data.remoteUpdated.get(remoteIndex);

@ -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<String> 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

@ -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;
}

@ -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$
}

@ -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

@ -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 <http://code.google.com/p/android/issues/detail?id=4469> 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) {

@ -35,7 +35,7 @@ public final class ReflectionUtils {
* @throws RuntimeException if the class or method doesn't exist
*/
public static <T> 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> 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> 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")

@ -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();
}

@ -492,8 +492,6 @@ public abstract class DiskCache<K, V> {
}
}
;
private final Comparator<File> mLastModifiedOldestFirstComparator = new Comparator<File>() {
@Override

@ -98,7 +98,7 @@ public class ImageCache extends DiskCache<String, Bitmap> {
private final HashSet<OnImageLoadListener> mImageLoadListeners = new HashSet<ImageCache.OnImageLoadListener>();
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<String> mMemCache = new DrawableMemCache<String>(DEFAULT_CACHE_SIZE);
@ -144,7 +144,6 @@ public class ImageCache extends DiskCache<String, Bitmap> {
}
}
;
}
private final ImageLoadHandler mHandler = new ImageLoadHandler(this);
@ -565,7 +564,6 @@ public class ImageCache extends DiskCache<String, Bitmap> {
return Long.valueOf(another.when).compareTo(when);
}
;
}
private void oomClear() {

@ -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>(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);

@ -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,

@ -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;

@ -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);

@ -366,13 +366,12 @@ public class EditPeopleControlSet extends PopupControlSet {
private ArrayList<AssignedToUser> convertJsonUsersToAssignedUsers(ArrayList<JSONObject> jsonUsers,
HashSet<String> userIds, HashSet<String> emails, HashMap<String, AssignedToUser> names) {
ArrayList<AssignedToUser> users = new ArrayList<AssignedToUser>();
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<AssignedToUser> 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);

@ -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

@ -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);
}

@ -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

@ -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

@ -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<String, Object>(getParameters[i].toString() + "[]",
list.get(j)));
aList));
}
} else {
params.add(new Pair<String, Object>(getParameters[i].toString(), getParameters[i + 1]));

@ -256,7 +256,7 @@ public class ActFmSyncThread {
List<ClientToServerMessage<?>> messageBatch = new ArrayList<ClientToServerMessage<?>>();
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);
}

@ -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);
}

@ -89,8 +89,8 @@ public abstract class ClientToServerMessage<TYPE extends RemoteModel> {
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;
}

@ -43,7 +43,7 @@ public class JSONChangeToPropertyVisitor implements PropertyVisitor<Void, String
} else {
value = data.getInt(key);
}
model.setValue((IntegerProperty) property, value);
model.setValue(property, value);
} catch (JSONException e) {
Log.e(ERROR_TAG, "Error reading int value with key " + key + " from JSON " + data, e);
}
@ -65,7 +65,7 @@ public class JSONChangeToPropertyVisitor implements PropertyVisitor<Void, String
value = 0;
}
}
model.setValue((LongProperty) property, value);
model.setValue(property, value);
} catch (JSONException e) {
Log.e(ERROR_TAG, "Error reading long value with key " + key + " from JSON " + data, e);
}
@ -76,7 +76,7 @@ public class JSONChangeToPropertyVisitor implements PropertyVisitor<Void, String
public Void visitDouble(Property<Double> 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<Void, String
model.setValue(Task.USER, ""); // Clear this value for migration purposes
}
model.setValue((StringProperty) property, value);
model.setValue(property, value);
} catch (JSONException e) {
try {
JSONObject object = data.getJSONObject(key);
if (object != null) {
model.setValue((StringProperty) property, object.toString());
model.setValue(property, object.toString());
}
} catch (JSONException e2) {
Log.e(ERROR_TAG, "Error reading JSON value with key " + key + " from JSON " + data, e);

@ -221,7 +221,7 @@ public class MakeChanges<TYPE extends RemoteModel> 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<TYPE extends RemoteModel> 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<TYPE extends RemoteModel> 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<TYPE extends RemoteModel> 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) {

@ -46,7 +46,7 @@ public class AlarmTaskRepeatListener extends BroadcastReceiver {
LinkedHashSet<Long> alarms = new LinkedHashSet<Long>(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);

@ -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();

@ -141,7 +141,7 @@ public class BackupService extends Service {
Arrays.sort(files, new Comparator<File>() {
@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++) {

@ -256,7 +256,7 @@ public class TasksXmlExporter {
public Void visitInteger(Property<Integer> 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<Long> 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<Double> 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

@ -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());

@ -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);

@ -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

@ -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) {

@ -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;

@ -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);
}

@ -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) {

@ -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[]{

@ -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)) {

@ -106,7 +106,7 @@ public final class GtasksMetadataService extends SyncMetadataService<GtasksTaskC
try {
if (metadata.getCount() > 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<GtasksTaskC
* @return
*/
public String getRemoteSiblingId(String listId, Metadata gtasksMetadata) {
final AtomicInteger indentToMatch = new AtomicInteger(gtasksMetadata.getValue(GtasksMetadata.INDENT).intValue());
final AtomicLong parentToMatch = new AtomicLong(gtasksMetadata.getValue(GtasksMetadata.PARENT_TASK).longValue());
final AtomicInteger indentToMatch = new AtomicInteger(gtasksMetadata.getValue(GtasksMetadata.INDENT));
final AtomicLong parentToMatch = new AtomicLong(gtasksMetadata.getValue(GtasksMetadata.PARENT_TASK));
final AtomicReference<String> sibling = new AtomicReference<String>();
OrderedListIterator iterator = new OrderedListIterator() {
@Override
@ -208,7 +208,7 @@ public final class GtasksMetadataService extends SyncMetadataService<GtasksTaskC
if (t == null || t.isDeleted()) {
return;
}
int currIndent = metadata.getValue(GtasksMetadata.INDENT).intValue();
int currIndent = metadata.getValue(GtasksMetadata.INDENT);
long currParent = metadata.getValue(GtasksMetadata.PARENT_TASK);
if (currIndent == indentToMatch.get() && currParent == parentToMatch.get()) {

@ -214,12 +214,12 @@ public class ModernAuthManager implements AuthManager {
private void runWhenFinished() {
if (whenFinished != null) {
(new Thread() {
new Thread() {
@Override
public void run() {
whenFinished.run();
}
}).start();
}.start();
}
}

@ -356,12 +356,12 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
task.setValue(Task.TITLE, remoteTask.getTitle());
task.setValue(Task.CREATION_DATE, DateUtilities.now());
task.setValue(Task.COMPLETION_DATE, GtasksApiUtilities.gtasksCompletedTimeToUnixTime(remoteTask.getCompleted(), 0));
if (remoteTask.getDeleted() == null || !remoteTask.getDeleted().booleanValue()) {
if (remoteTask.getDeleted() == null || !remoteTask.getDeleted()) {
task.setValue(Task.DELETION_DATE, 0L);
} else if (remoteTask.getDeleted().booleanValue()) {
} else if (remoteTask.getDeleted()) {
task.setValue(Task.DELETION_DATE, DateUtilities.now());
}
if (remoteTask.getHidden() != null && remoteTask.getHidden().booleanValue()) {
if (remoteTask.getHidden() != null && remoteTask.getHidden()) {
task.setValue(Task.DELETION_DATE, DateUtilities.now());
}

@ -258,10 +258,10 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
commentField.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
commentButton.setVisibility((s.length() > 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;
}

@ -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();

@ -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);

@ -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));

@ -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) {

@ -355,9 +355,9 @@ public class RepeatControlSet extends PopupControlSet {
rrule.setFreq(Frequency.WEEKLY);
ArrayList<WeekdayNum> days = new ArrayList<WeekdayNum>();
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);

@ -194,8 +194,7 @@ public class RepeatTaskCompleteListener extends BroadcastReceiver {
private static WeekdayNum findNextWeekday(List<WeekdayNum> 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;
}

@ -188,7 +188,7 @@ public class AstridOrderedListFragmentHelper<LIST> implements OrderedListFragmen
if (v == null) {
return;
}
((DraggableTaskAdapter) taskAdapter).getListener().onClick(v);
taskAdapter.getListener().onClick(v);
}
};

@ -203,7 +203,7 @@ public class OrderedMetadataListFragmentHelper<LIST> implements OrderedListFragm
if (v == null) {
return;
}
((DraggableTaskAdapter) taskAdapter).getListener().onClick(v);
taskAdapter.getListener().onClick(v);
}
};

@ -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);

@ -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);
}

@ -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];
}
}

@ -84,8 +84,8 @@ public final class TagsControlSet extends PopupControlSet {
private ArrayList<String> getTagNames(Tag[] tags) {
ArrayList<String> names = new ArrayList<String>();
for (int i = 0; i < tags.length; i++) {
names.add(tags[i].toString());
for (Tag tag : tags) {
names.add(tag.toString());
}
return names;
}

@ -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

@ -30,7 +30,7 @@ public class TimerActionControlSet extends TaskEditControlSet {
private boolean timerActive;
private final List<TimerActionListener> listeners = new LinkedList<TimerActionListener>();
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);

@ -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;
}

@ -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 {

@ -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;
}

@ -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;
}
}

@ -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;
}
/**

@ -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) {

@ -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);

@ -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);

@ -24,7 +24,7 @@ import android.widget.TextView;
@SuppressWarnings("nls")
public class ExpandableListFragment extends Fragment
implements OnCreateContextMenuListener,
implements
ExpandableListView.OnChildClickListener, ExpandableListView.OnGroupCollapseListener,
ExpandableListView.OnGroupExpandListener {

@ -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));
}

@ -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);

@ -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);
}

@ -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;

@ -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;

@ -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) {

@ -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);

@ -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<ResolveInfo> 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) {

@ -163,7 +163,7 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
this.selectable = selectable;
this.filterCounts = new HashMap<Filter, Integer>();
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<Filter> {
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<Filter> {
// 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)) {

@ -97,7 +97,7 @@ import java.util.concurrent.atomic.AtomicReference;
*
* @author Tim Su <tim@todoroo.com>
*/
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<Task> cursor = (TodorooCursor<Task>) 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();
}

@ -226,7 +226,7 @@ public class UpdateAdapter extends CursorAdapter {
@Override
public void bindView(View view, Context context, Cursor c) {
TodorooCursor<UserActivity> cursor = (TodorooCursor<UserActivity>) 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;

@ -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);

@ -192,8 +192,8 @@ public class BillingActivity extends SherlockFragmentActivity implements AstridP
StringBuilder builder = new StringBuilder("<html><style type=\"text/css\">li { padding-bottom: 13px } </style><body><ul>");
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", "<br>");
}

@ -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;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save