Apply Android Studio and Lint inspections

* Remove always true/false/null parameters
* Remove pointless bitwise expressions
* Remove pointless boolean expressions
* Remove unnecessary continue statements
* Convert fields to local variables
* Remove unused resources
pull/46/merge
Alex Baker 11 years ago
parent 75315a4951
commit a1c986d9e2

@ -10,7 +10,6 @@ import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteConstraintException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
@ -133,7 +132,7 @@ abstract public class AbstractDatabase {
throw new NullPointerException("Null context creating database helper");
}
helper = new DatabaseHelper(ContextManager.getContext(),
getName(), null, getVersion());
getName(), getVersion());
}
}
@ -219,11 +218,8 @@ abstract public class AbstractDatabase {
// --- database wrapper
/*
* @see android.database.sqlite.SQLiteDatabase#rawQuery(String sql, String[] selectionArgs)
*/
public synchronized Cursor rawQuery(String sql, String[] selectionArgs) {
return getDatabase().rawQuery(sql, selectionArgs);
public synchronized Cursor rawQuery(String sql) {
return getDatabase().rawQuery(sql, null);
}
/*
@ -252,11 +248,8 @@ abstract public class AbstractDatabase {
return result;
}
/*
* @see android.database.sqlite.SQLiteDatabase#update(String table, ContentValues values, String whereClause, String[] whereArgs)
*/
public synchronized int update(String table, ContentValues values, String whereClause, String[] whereArgs) {
int result = getDatabase().update(table, values, whereClause, whereArgs);
public synchronized int update(String table, ContentValues values, String whereClause) {
int result = getDatabase().update(table, values, whereClause, null);
onDatabaseUpdated();
return result;
}
@ -268,9 +261,8 @@ abstract public class AbstractDatabase {
*/
private class DatabaseHelper extends SQLiteOpenHelper {
public DatabaseHelper(Context context, String name,
CursorFactory factory, int version) {
super(context, name, factory, version);
public DatabaseHelper(Context context, String name, int version) {
super(context, name, null, version);
}
/**

@ -348,7 +348,7 @@ public abstract class AbstractModel implements Parcelable, Cloneable {
if (setValues.containsKey(item.getKey())) {
continue;
}
AndroidUtilities.putInto(setValues, item.getKey(), item.getValue(), true);
AndroidUtilities.putInto(setValues, item.getKey(), item.getValue());
}
}

@ -93,7 +93,7 @@ public class DatabaseDao<TYPE extends AbstractModel> {
if(debug) {
Log.i("SQL-" + modelClass.getSimpleName(), query.toString()); //$NON-NLS-1$
}
Cursor cursor = database.rawQuery(query.toString(), null);
Cursor cursor = database.rawQuery(query.toString());
return new TodorooCursor<TYPE>(cursor, query.getFields());
}
@ -181,7 +181,7 @@ public class DatabaseDao<TYPE extends AbstractModel> {
*/
public int update(Criterion where, TYPE template) {
return database.update(table.name, template.getSetValues(),
where.toString(), null);
where.toString());
}
/**
@ -261,7 +261,7 @@ public class DatabaseDao<TYPE extends AbstractModel> {
@Override
public boolean makeChange() {
return database.update(table.name, values,
AbstractModel.ID_PROPERTY.eq(item.getId()).toString(), null) > 0;
AbstractModel.ID_PROPERTY.eq(item.getId()).toString()) > 0;
}
};
return insertOrUpdateAndRecordChanges(item, update);

@ -40,7 +40,7 @@ public abstract class Property<TYPE> extends Field implements Cloneable {
public final String name;
/** Can this field be null? */
public static final int PROP_FLAG_NULLABLE = 1 << 0;
public static final int PROP_FLAG_NULLABLE = 1;
/** Is this field a date? */
public static final int PROP_FLAG_DATE = 1 << 1;
/** Is this field a user id? */
@ -153,8 +153,8 @@ public abstract class Property<TYPE> extends Field implements Cloneable {
super(table, name, flags);
}
protected IntegerProperty(Table table, String name, String expression) {
super(table, name, expression);
protected IntegerProperty(String name, String expression) {
super(null, name, expression);
}
@Override
@ -271,7 +271,7 @@ public abstract class Property<TYPE> extends Field implements Cloneable {
/** Runs a SQL function and returns the result as a string */
public static class IntegerFunctionProperty extends IntegerProperty {
public IntegerFunctionProperty(String function, String columnName) {
super(null, columnName, function);
super(columnName, function);
alias = columnName;
}
}

@ -32,8 +32,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Map.Entry;
@ -108,7 +106,7 @@ public class AndroidUtilities {
/**
* Put an arbitrary object into a {@link ContentValues}
*/
public static void putInto(ContentValues target, String key, Object value, boolean errorOnFail) {
public static void putInto(ContentValues target, String key, Object value) {
if (value instanceof Boolean) {
target.put(key, (Boolean) value);
} else if (value instanceof Byte) {
@ -125,7 +123,7 @@ public class AndroidUtilities {
target.put(key, (Short) value);
} else if (value instanceof String) {
target.put(key, (String) value);
} else if (errorOnFail) {
} else {
throw new UnsupportedOperationException("Could not handle type " + //$NON-NLS-1$
value.getClass());
}
@ -134,7 +132,7 @@ public class AndroidUtilities {
/**
* Put an arbitrary object into a {@link ContentValues}
*/
public static void putInto(Bundle target, String key, Object value, boolean errorOnFail) {
public static void putInto(Bundle target, String key, Object value) {
if (value instanceof Boolean) {
target.putBoolean(key, (Boolean) value);
} else if (value instanceof Byte) {
@ -151,9 +149,6 @@ public class AndroidUtilities {
target.putShort(key, (Short) value);
} else if (value instanceof String) {
target.putString(key, (String) value);
} else if (errorOnFail) {
throw new UnsupportedOperationException("Could not handle type " + //$NON-NLS-1$
value.getClass());
}
}
@ -448,54 +443,7 @@ public class AndroidUtilities {
* @param exitAnim the outgoing-transition of this activity
*/
public static void callOverridePendingTransition(Activity activity, int enterAnim, int exitAnim) {
callApiMethod(5,
activity,
"overridePendingTransition", //$NON-NLS-1$
new Class<?>[] { Integer.TYPE, Integer.TYPE },
enterAnim, exitAnim);
}
/**
* Call a method via reflection if API level is at least minSdk
* @param minSdk minimum sdk number (i.e. 8)
* @param receiver object to call method on
* @param methodName method name to call
* @param params method parameter types
* @param args arguments
*/
public static void callApiMethod(int minSdk, Object receiver,
String methodName, Class<?>[] params, Object... args) {
if(getSdkVersion() < minSdk) {
return;
}
AndroidUtilities.callMethod(receiver.getClass(),
receiver, methodName, params, args);
}
/**
* Call a method via reflection
* @param receiver object to call method on (can be null)
* @param methodName method name to call
* @param params method parameter types
* @param args arguments
*/
public static void callMethod(Class<?> cls, Object receiver,
String methodName, Class<?>[] params, Object... args) {
try {
Method method = cls.getMethod(methodName, params);
method.invoke(receiver, args);
} catch (SecurityException e) {
getExceptionService().reportError("call-method", e);
} catch (NoSuchMethodException e) {
getExceptionService().reportError("call-method", e);
} catch (IllegalArgumentException e) {
getExceptionService().reportError("call-method", e);
} catch (IllegalAccessException e) {
getExceptionService().reportError("call-method", e);
} catch (InvocationTargetException e) {
getExceptionService().reportError("call-method", e);
}
activity.overridePendingTransition(enterAnim, exitAnim);
}
/**

@ -91,11 +91,11 @@ public class DateUtilities {
* @param date time to format
* @return time, with hours and minutes
*/
public static String getTimeString(Context context, Date date, boolean excludeZeroMinutes) {
public static String getTimeString(Context context, Date date) {
String value;
if (is24HourFormat(context)) {
value = "H:mm";
} else if (date.getMinutes() == 0 && excludeZeroMinutes){
} else if (date.getMinutes() == 0){
value = "h a";
}
else {
@ -104,10 +104,6 @@ public class DateUtilities {
return new SimpleDateFormat(value).format(date);
}
public static String getTimeString(Context context, Date date) {
return getTimeString(context, date, true);
}
/* Returns true if search string is in sortedValues */
private static boolean arrayBinaryContains(String search, String... sortedValues) {
@ -118,7 +114,7 @@ public class DateUtilities {
* @param date date to format
* @return date, with month, day, and year
*/
public static String getDateString(Date date, boolean includeYear) {
public static String getDateString(Date date) {
String month = new SimpleDateFormat("MMM").format(date);
String value;
String standardDate;
@ -130,9 +126,7 @@ public class DateUtilities {
} else {
value = "d'$' '#'";
}
if (includeYear) {
value += ", yyyy";
}
value += ", yyyy";
if (arrayBinaryContains(locale.getLanguage(), "ja", "zh")){
standardDate = new SimpleDateFormat(value).format(date).replace("#", month).replace("$", "\u65E5"); //$NON-NLS-1$
}else if ("ko".equals(Locale.getDefault().getLanguage())){
@ -140,10 +134,7 @@ public class DateUtilities {
}else{
standardDate = new SimpleDateFormat(value).format(date).replace("#", month).replace("$", "");
}
return standardDate;}
public static String getDateString(Date date) {
return getDateString(date, true);
return standardDate;
}
/**

@ -86,8 +86,7 @@ public class DialogUtilities {
* Displays a dialog box with an OK button
*/
public static void okDialog(final Activity activity, final String title,
final int icon, final CharSequence text,
final DialogInterface.OnClickListener okListener) {
final int icon, final CharSequence text) {
if(activity.isFinishing()) {
return;
}
@ -99,7 +98,7 @@ public class DialogUtilities {
.setTitle(title)
.setMessage(text)
.setIcon(icon)
.setPositiveButton(android.R.string.ok, okListener)
.setPositiveButton(android.R.string.ok, null)
.show().setOwnerActivity(activity);
}
});
@ -109,10 +108,9 @@ public class DialogUtilities {
* Displays a dialog box with OK and Cancel buttons and custom title
*/
public static void okCancelDialog(final Activity activity, final String title,
final String text, final DialogInterface.OnClickListener okListener,
final DialogInterface.OnClickListener cancelListener) {
final String text, final DialogInterface.OnClickListener okListener) {
okCancelCustomDialog(activity, title, text, android.R.string.ok, android.R.string.cancel, android.R.drawable.ic_dialog_alert, okListener, cancelListener);
okCancelCustomDialog(activity, title, text, android.R.string.ok, android.R.string.cancel, android.R.drawable.ic_dialog_alert, okListener, null);
}
/**

@ -5,7 +5,6 @@
*/
package com.todoroo.astrid.api;
import android.content.ContentValues;
import android.graphics.Bitmap;
import android.os.Parcel;
import android.os.Parcelable;
@ -34,12 +33,11 @@ public class TextInputCriterion extends CustomFilterCriterion implements Parcela
* Create a new CustomFilterCriteria object
*/
public TextInputCriterion(String identifier, String title, String sql,
ContentValues valuesForNewTasks, String prompt, String hint,
Bitmap icon, String name) {
String prompt, String hint, Bitmap icon, String name) {
this.identifier = identifier;
this.text = title;
this.sql = sql;
this.valuesForNewTasks = valuesForNewTasks;
this.valuesForNewTasks = null;
this.prompt = prompt;
this.hint = hint;
this.icon = icon;

@ -20,7 +20,7 @@ import com.todoroo.astrid.data.TaskApiDao.TaskCriteria;
*/
public class SortHelper {
public static final int FLAG_REVERSE_SORT = 1 << 0;
public static final int FLAG_REVERSE_SORT = 1;
public static final int FLAG_SHOW_COMPLETED = 1 << 1;
public static final int FLAG_SHOW_HIDDEN = 1 << 2;
public static final int FLAG_SHOW_DELETED = 1 << 3;

@ -8,7 +8,6 @@ package com.todoroo.astrid.sync;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.utility.DateUtilities;
@ -81,11 +80,6 @@ abstract public class SyncProviderUtilities {
return getPrefs().getString(getIdentifier() + PREF_LAST_ERROR, null);
}
/** @return Last Error type, or null if no last error */
public String getLastErrorType() {
return getPrefs().getString(getIdentifier() + PREF_LAST_ERROR_TYPE, null);
}
/** @return Last Error, or null if no last error */
public boolean isOngoing() {
return getPrefs().getBoolean(getIdentifier() + PREF_ONGOING, false);

@ -29,14 +29,6 @@
<item quantity="one">1 minut</item>
<item quantity="other">%d Minuts</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 segon</item>
<item quantity="other">%d Segons</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 Seg</item>
<item quantity="other">%d Seg</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 tasca</item>
<item quantity="other">%d tasques</item>

@ -21,10 +21,6 @@
<item quantity="one">1 den</item>
<item quantity="other">%d Dnů</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">1 pracovní den</item>
<item quantity="other">%d pracovních dnů</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1 hodina</item>
<item quantity="other">%d hodin</item>
@ -33,30 +29,10 @@
<item quantity="one">1 minuta</item>
<item quantity="other">%d minut</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 vteřina</item>
<item quantity="other">%d vteřin</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 hod.</item>
<item quantity="other">%d hod.</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 min.</item>
<item quantity="other">%d min.</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 s</item>
<item quantity="other">%d s</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 úkol</item>
<item quantity="other">%d úkolů</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">1 osoba</item>
<item quantity="other">%d lidí</item>
</plurals>
<string name="today">Dnes</string>
<string name="tomorrow">Zítra</string>
<string name="yesterday">Včera</string>

@ -29,22 +29,6 @@
<item quantity="one">1 minut</item>
<item quantity="other">%d minutter</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 sekund</item>
<item quantity="other">%d sekunder</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 time</item>
<item quantity="other">%d timer</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 min.</item>
<item quantity="other">%d min.</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 sek.</item>
<item quantity="other">%d sek.</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 opgave</item>
<item quantity="other">%d opgaver</item>

@ -21,10 +21,6 @@
<item quantity="one">Ein Tag</item>
<item quantity="other">%d Tage</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">Ein Wochentag</item>
<item quantity="other">%d Wochentage</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">Eine Stunde</item>
<item quantity="other">%d Stunden</item>
@ -33,30 +29,10 @@
<item quantity="one">Eine Minute</item>
<item quantity="other">%d Minuten</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">Eine Sekunde</item>
<item quantity="other">%d Sekunden</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 Std</item>
<item quantity="other">%d Std</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 Min</item>
<item quantity="other">%d min</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 Sek</item>
<item quantity="other">%d Sek</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 Aufgabe</item>
<item quantity="other">%d Aufgaben</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">Eine Person</item>
<item quantity="other">%d Personen</item>
</plurals>
<string name="today">Heute</string>
<string name="tomorrow">Morgen</string>
<string name="yesterday">Gestern</string>

@ -21,10 +21,6 @@
<item quantity="one">Un día</item>
<item quantity="other">%d días</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">1 día laborable</item>
<item quantity="other">%d días laborables</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1 hora</item>
<item quantity="other">%d horas</item>
@ -33,30 +29,10 @@
<item quantity="one">1 minuto</item>
<item quantity="other">%d minutos</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 segundo</item>
<item quantity="other">%d segundos</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 hr</item>
<item quantity="other">%d hrs</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 min</item>
<item quantity="other">%d min</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 seg</item>
<item quantity="other">%d seg</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 tarea</item>
<item quantity="other">%d tareas</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">1 persona</item>
<item quantity="other">%d personas</item>
</plurals>
<string name="today">Hoy</string>
<string name="tomorrow">Mañana</string>
<string name="yesterday">Ayer</string>

@ -21,10 +21,6 @@
<item quantity="one">1 jour</item>
<item quantity="other">%d jours</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">1 jour de la semaine</item>
<item quantity="other">%d jours de la semaine</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1 heure</item>
<item quantity="other">%d heures</item>
@ -33,30 +29,10 @@
<item quantity="one">1 minute</item>
<item quantity="other">%d minutes</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 seconde</item>
<item quantity="other">%d secondes</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 h</item>
<item quantity="other">%d h</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 min</item>
<item quantity="other">%d min</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 s</item>
<item quantity="other">%d s</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 tâche</item>
<item quantity="other">%d tâches</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">1 personne</item>
<item quantity="other">%d personnes</item>
</plurals>
<string name="today">Aujourd\'hui</string>
<string name="tomorrow">Demain</string>
<string name="yesterday">Hier</string>

@ -21,10 +21,6 @@
<item quantity="one">1 Giorno</item>
<item quantity="other">%d Giorni</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">1 giorno della settimana</item>
<item quantity="other">%d giorni della settimana</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1 ora</item>
<item quantity="other">%d ore</item>
@ -33,30 +29,10 @@
<item quantity="one">1 minuto</item>
<item quantity="other">%d minuti</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 secondo</item>
<item quantity="other">%d secondi</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 ora</item>
<item quantity="other">%d ore</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 min</item>
<item quantity="other">%d min</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 sec</item>
<item quantity="other">%d sec</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 attività</item>
<item quantity="other">%d attività</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">1 persona</item>
<item quantity="other">%d persone</item>
</plurals>
<string name="today">Oggi</string>
<string name="tomorrow">Domani</string>
<string name="yesterday">Ieri</string>

@ -21,10 +21,6 @@
<item quantity="one">יום אחד</item>
<item quantity="other">%d ימים</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">יום עבודה אחד</item>
<item quantity="other">%d ימי עבודה</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">שעה אחת</item>
<item quantity="other">%d שעות</item>
@ -33,30 +29,10 @@
<item quantity="one">דקה אחת</item>
<item quantity="other">%d דקות</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">שנייה אחת</item>
<item quantity="other">%d שניות</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">שעה</item>
<item quantity="other">%d שע\'</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">דקה</item>
<item quantity="other">%d דק׳</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">שנייה</item>
<item quantity="other">%d שנ\'</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">משימה אחת</item>
<item quantity="other">%d משימות</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">שותף אחד</item>
<item quantity="other">%d שותפים</item>
</plurals>
<string name="today">היום</string>
<string name="tomorrow">מחר</string>
<string name="yesterday">אתמול</string>

@ -29,30 +29,10 @@
<item quantity="one">1 分</item>
<item quantity="other">%d 分</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 秒</item>
<item quantity="other">%d 秒</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 時間</item>
<item quantity="other">%d 時間</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 分</item>
<item quantity="other">%d 分</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 秒</item>
<item quantity="other">%d 秒</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">タスク 1 件</item>
<item quantity="other">タスク %d 件</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">1人</item>
<item quantity="other">%d人</item>
</plurals>
<string name="yesterday">昨日</string>
<string name="tmrw">明日</string>
<string name="yest">昨日</string>

@ -21,10 +21,6 @@
<item quantity="one">1일</item>
<item quantity="other">%d일</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">주중 1일</item>
<item quantity="other">주중 %d일</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1시간</item>
<item quantity="other">%d시간</item>
@ -33,30 +29,10 @@
<item quantity="one">1분</item>
<item quantity="other">%d분</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1초</item>
<item quantity="other">%d초</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1시간</item>
<item quantity="other">%d시간</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1분</item>
<item quantity="other">%d분</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1초</item>
<item quantity="other">%d초</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 일정</item>
<item quantity="other">%d 일정</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">1 사람</item>
<item quantity="other">%d 사람</item>
</plurals>
<string name="today">오늘</string>
<string name="tomorrow">내일</string>
<string name="yesterday">어제</string>

@ -21,10 +21,6 @@
<item quantity="one">1 dag</item>
<item quantity="other">%d dager</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">1 ukesdag</item>
<item quantity="other">%d Weekdays</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1 time</item>
<item quantity="other">%d timer</item>
@ -33,22 +29,6 @@
<item quantity="one">1 minutt</item>
<item quantity="other">%d minutter</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 sekund</item>
<item quantity="other">%d sekunder</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 t</item>
<item quantity="other">%d t</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 min</item>
<item quantity="other">%d min</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 s</item>
<item quantity="other">%d s</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 oppgave</item>
<item quantity="other">%d oppgaver</item>

@ -21,10 +21,6 @@
<item quantity="one">1 dag</item>
<item quantity="other">%d dagen</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">1 weekdag</item>
<item quantity="other">%d weekdagen</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1 uur</item>
<item quantity="other">%d uren</item>
@ -33,30 +29,10 @@
<item quantity="one">1 minuut</item>
<item quantity="other">%d minuten</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 seconde</item>
<item quantity="other">%d seconden</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 u.</item>
<item quantity="other">%d u.</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 m.</item>
<item quantity="other">%d m.</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 s.</item>
<item quantity="other">%d s.</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 taak</item>
<item quantity="other">%d taken</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">1 persoon</item>
<item quantity="other">%d personen</item>
</plurals>
<string name="today">Vandaag</string>
<string name="tomorrow">Morgen</string>
<string name="yesterday">Gisteren</string>

@ -21,10 +21,6 @@
<item quantity="one">1 dzień</item>
<item quantity="other">%d dni</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">1 dzień roboczy</item>
<item quantity="other">%d dni roboczych</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1 godzina</item>
<item quantity="other">%d godzin</item>
@ -33,30 +29,10 @@
<item quantity="one">1 minuta</item>
<item quantity="other">%d minut</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 sekunda</item>
<item quantity="other">%d sekund</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 godz.</item>
<item quantity="other">%d godz.</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 min.</item>
<item quantity="other">%d min.</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 sek.</item>
<item quantity="other">%d sek.</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 zadanie</item>
<item quantity="other">%d zadań</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">1 osoba</item>
<item quantity="other">%d osób</item>
</plurals>
<string name="today">Dzisiaj</string>
<string name="tomorrow">Jutro</string>
<string name="yesterday">Wczoraj</string>

@ -21,10 +21,6 @@
<item quantity="one">1 dia</item>
<item quantity="other">%d dias</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">1 dia útil</item>
<item quantity="other">%d dias úteis</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1 hora</item>
<item quantity="other">%d horas</item>
@ -33,30 +29,10 @@
<item quantity="one">1 minuto</item>
<item quantity="other">%d minutos</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 segundo</item>
<item quantity="other">%d segundos</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 h</item>
<item quantity="other">%d h</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 min</item>
<item quantity="other">%d min</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 s</item>
<item quantity="other">%d s</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 tarefa</item>
<item quantity="other">%d tarefas</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">1 pessoa</item>
<item quantity="other">%d pessoas</item>
</plurals>
<string name="today">Hoje</string>
<string name="tomorrow">Amanhã</string>
<string name="yesterday">Ontem</string>

@ -29,22 +29,6 @@
<item quantity="one">1 Minuto</item>
<item quantity="other">%d Minutos</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 Segundo</item>
<item quantity="other">%d Segundos</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 h</item>
<item quantity="other">%d h</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 min</item>
<item quantity="other">%d min</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 s</item>
<item quantity="other">%d s</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 tarefa</item>
<item quantity="other">%d tarefas</item>

@ -21,10 +21,6 @@
<item quantity="one">1 день</item>
<item quantity="other">%d дня/дней</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">1 рабочий день</item>
<item quantity="other">%d рабочих дня</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1 час</item>
<item quantity="other">%d часа/часов</item>
@ -33,30 +29,10 @@
<item quantity="one">1 минута</item>
<item quantity="other">%d минуты/минут</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 секунда</item>
<item quantity="other">%d секунды/секунд</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 час</item>
<item quantity="other">%d ч</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 мин</item>
<item quantity="other">%d мин</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 с</item>
<item quantity="other">%d с</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 задача</item>
<item quantity="other">%d задач(а/и)</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">1 человек</item>
<item quantity="other">%d человек</item>
</plurals>
<string name="today">Сегодня</string>
<string name="tomorrow">Завтра</string>
<string name="yesterday">Вчера</string>

@ -21,10 +21,6 @@
<item quantity="one">1 dan</item>
<item quantity="other">Št. dni: %d</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">1 delovni dan</item>
<item quantity="other">Št. del. dni: %d</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1 ura</item>
<item quantity="other">Št. ur: %d</item>
@ -33,30 +29,10 @@
<item quantity="one">1 minuta</item>
<item quantity="other">Št. minut: %d</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 sekunda</item>
<item quantity="other">Št. sekund: %d</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 ura</item>
<item quantity="other">%d ur.</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 min.</item>
<item quantity="other">%d min.</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 sek.</item>
<item quantity="other">%d sek.</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 opravek</item>
<item quantity="other">Št. opravkov: %d</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">1 oseba</item>
<item quantity="other">Št. oseb: %d</item>
</plurals>
<string name="today">Danes</string>
<string name="tomorrow">Jutri</string>
<string name="yesterday">Včeraj</string>

@ -21,10 +21,6 @@
<item quantity="one">1 dag</item>
<item quantity="other">%d dagar</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">1 Veckodag</item>
<item quantity="other">%d Veckodagar</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1 timme</item>
<item quantity="other">%d timmar</item>
@ -33,30 +29,10 @@
<item quantity="one">1 minut</item>
<item quantity="other">%d minuter</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 sekund</item>
<item quantity="other">%d sekunder</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 tim</item>
<item quantity="other">%d tim</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 min</item>
<item quantity="other">%d min</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 sek</item>
<item quantity="other">%d sek</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 uppgift</item>
<item quantity="other">%d uppgifter</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">1 person</item>
<item quantity="other">%d personer</item>
</plurals>
<string name="yesterday">Igår</string>
<string name="tmrw">imorn</string>
<string name="yest">Igår</string>

@ -17,22 +17,6 @@
<item quantity="one">1 นาที</item>
<item quantity="other">%d นาที</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 วินาที</item>
<item quantity="other">%d วินาที</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 ช.ม.</item>
<item quantity="other">%d ช.ม.</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 นาที</item>
<item quantity="other">%d นาที</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 วิ.</item>
<item quantity="other">%d วิ.</item>
</plurals>
<string name="today">วันนี้</string>
<string name="tomorrow">พรุ่งนี้</string>
<string name="yesterday">เมื่อวาน</string>

@ -21,10 +21,6 @@
<item quantity="one">1 Gün</item>
<item quantity="other">%d gün</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">1 haftaiçi gün</item>
<item quantity="other">%d haftaiçi günü</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1 Saat</item>
<item quantity="other">%d saat</item>
@ -33,30 +29,10 @@
<item quantity="one">1 Dakika</item>
<item quantity="other">%d dakika</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 Saniye</item>
<item quantity="other">%d saniye</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 saat</item>
<item quantity="other">%d saat</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 dakika</item>
<item quantity="other">%d dakika</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 saniye</item>
<item quantity="other">%d saniye</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 görev</item>
<item quantity="other">%d görev</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">1 kişi</item>
<item quantity="other">%d kişi</item>
</plurals>
<string name="today">Bugün</string>
<string name="tomorrow">Yarın</string>
<string name="yesterday">Dün</string>

@ -21,26 +21,10 @@
<item quantity="one">1 день</item>
<item quantity="other">%d днів</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 год.</item>
<item quantity="other">%d год.</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 хв.</item>
<item quantity="other">%d хв.</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 сек.</item>
<item quantity="other">%d сек.</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 завдання</item>
<item quantity="other">%d завдань</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">1 людина</item>
<item quantity="other">%d людей</item>
</plurals>
<string name="today">Сьогодні</string>
<string name="tomorrow">Завтра</string>
<string name="yesterday">Вчора</string>

@ -21,10 +21,6 @@
<item quantity="one">1 天</item>
<item quantity="other">%d 天</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">1 个任务天</item>
<item quantity="other">%d 个任务天</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1 小时</item>
<item quantity="other">%d 小时</item>
@ -33,30 +29,10 @@
<item quantity="one">1 分钟</item>
<item quantity="other">%d 分钟</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 秒</item>
<item quantity="other">%d 秒</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 小时</item>
<item quantity="other">%d 小时</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 分钟</item>
<item quantity="other">%d 分钟</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 秒</item>
<item quantity="other">%d 秒</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 个任务</item>
<item quantity="other">%d 个任务</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">一个人</item>
<item quantity="other">%d 个人</item>
</plurals>
<string name="today">今天</string>
<string name="tomorrow">明天</string>
<string name="yesterday">昨天</string>

@ -21,10 +21,6 @@
<item quantity="one">1 天</item>
<item quantity="other">%d 天</item>
</plurals>
<plurals name="DUt_weekdays">
<item quantity="one">1 個工作天</item>
<item quantity="other">%d 個工作天</item>
</plurals>
<plurals name="DUt_hours">
<item quantity="one">1 小時</item>
<item quantity="other">%d 小時</item>
@ -33,30 +29,10 @@
<item quantity="one">1 分鐘</item>
<item quantity="other">%d 分鐘</item>
</plurals>
<plurals name="DUt_seconds">
<item quantity="one">1 秒</item>
<item quantity="other">%d 秒</item>
</plurals>
<plurals name="DUt_hoursShort">
<item quantity="one">1 小時</item>
<item quantity="other">%d 小時</item>
</plurals>
<plurals name="DUt_minutesShort">
<item quantity="one">1 分鐘</item>
<item quantity="other">%d 分鐘</item>
</plurals>
<plurals name="DUt_secondsShort">
<item quantity="one">1 秒</item>
<item quantity="other">%d 秒</item>
</plurals>
<plurals name="Ntasks">
<item quantity="one">1 個工作</item>
<item quantity="other">%d 個工作</item>
</plurals>
<plurals name="Npeople">
<item quantity="one">一個人</item>
<item quantity="other">%d個人</item>
</plurals>
<string name="today">今天</string>
<string name="tomorrow">明天</string>
<string name="yesterday">昨天</string>

@ -27,12 +27,6 @@
<!-- plurals: days -->
<item quantity="other">%d Days</item>
</plurals>
<plurals name="DUt_weekdays">
<!-- plurals: days -->
<item quantity="one">1 Weekday</item>
<!-- plurals: days -->
<item quantity="other">%d Weekdays</item>
</plurals>
<plurals name="DUt_hours">
<!-- plurals: hours -->
<item quantity="one">1 Hour</item>
@ -45,43 +39,13 @@
<!-- plurals: minutes -->
<item quantity="other">%d Minutes</item>
</plurals>
<plurals name="DUt_seconds">
<!-- plurals: seconds -->
<item quantity="one">1 Second</item>
<!-- plurals: seconds -->
<item quantity="other">%d Seconds</item>
</plurals>
<plurals name="DUt_hoursShort">
<!-- plurals: hours (abbreviated) -->
<item quantity="one">1 Hr</item>
<!-- plurals: hours (abbreviated) -->
<item quantity="other">%d Hrs</item>
</plurals>
<plurals name="DUt_minutesShort">
<!-- plurals: minutes (abbreviated) -->
<item quantity="one">1 Min</item>
<!-- plurals: minutes (abbreviated) -->
<item quantity="other">%d Min</item>
</plurals>
<plurals name="DUt_secondsShort">
<!-- plurals: seconds (abbreviated) -->
<item quantity="one">1 Sec</item>
<!-- plurals: seconds (abbreviated) -->
<item quantity="other">%d Sec</item>
</plurals>
<plurals name="Ntasks">
<!-- plurals: tasks -->
<item quantity="one">1 task</item>
<!-- plurals: tasks -->
<item quantity="other">%d tasks</item>
</plurals>
<plurals name="Npeople">
<!-- plurals: people -->
<item quantity="one">1 person</item>
<!-- plurals: people -->
<item quantity="other">%d people</item>
</plurals>
<!-- slide 10a, 12c: today -->
<string name="today">Today</string>

@ -32,7 +32,7 @@ public class NotificationTests extends DatabaseTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
Notifications.forceNotificationManager(true);
Notifications.forceNotificationManager();
}
@Override

@ -3,7 +3,6 @@ package com.todoroo.astrid.sync;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.astrid.dao.TagDataDao;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.SyncFlags;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.test.DatabaseTestCase;
@ -19,26 +18,20 @@ public class NewSyncTestCase extends DatabaseTestCase {
super.setUp();
}
protected Task createTask(String title, boolean suppress) {
protected Task createTask(String title) {
Task task = new Task();
task.setValue(Task.TITLE, title);
task.setValue(Task.IMPORTANCE, SYNC_TASK_IMPORTANCE);
if (suppress)
task.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true);
taskDao.createNew(task);
taskDao.createNew(task);
return task;
}
protected Task createTask() {
return createTask(false);
}
public static final String SYNC_TASK_TITLE = "new title";
public static final int SYNC_TASK_IMPORTANCE = Task.IMPORTANCE_MUST_DO;
protected Task createTask(boolean suppress) {
return createTask(SYNC_TASK_TITLE, suppress);
protected Task createTask() {
return createTask(SYNC_TASK_TITLE);
}
protected TagData createTagData(String name) {

@ -36,11 +36,10 @@ public final class Compatibility {
* on API 7 and below.
*
* @param context context to get the external files directory for
* @param type the type of files directory to return (may be null)
* @return the path of the directory holding application files on external
* storage, or null if external storage cannot be accessed
*/
public static File getExternalFilesDir(final Context context, final String type) {
public static File getExternalFilesDir(final Context context) {
if (METHOD_GET_EXTERNAL_FILES_DIR == null) {
final File externalRoot = Environment.getExternalStorageDirectory();
if (externalRoot == null) {
@ -51,7 +50,7 @@ public final class Compatibility {
return new File(externalRoot, "Android/data/" + packageName + "/files");
} else {
try {
return (File) METHOD_GET_EXTERNAL_FILES_DIR.invoke(context, type);
return (File) METHOD_GET_EXTERNAL_FILES_DIR.invoke(context, null);
} catch (Exception e) {
Log.e(LOG_TAG, "Could not invoke getExternalFilesDir: " + e.getMessage(), e);
return null;

@ -203,7 +203,7 @@ public class JUnitReportListener implements TestListener {
return mTargetContext.openFileOutput(fileName, Context.MODE_WORLD_READABLE);
} else {
if (mReportDir.contains(TOKEN_EXTERNAL)) {
File externalDir = Compatibility.getExternalFilesDir(mTargetContext, null);
File externalDir = Compatibility.getExternalFilesDir(mTargetContext);
if (externalDir == null) {
Log.e(LOG_TAG, "reportDir references external storage, but external storage is not available (check mounting and permissions)");
throw new IOException("Cannot access external storage");

@ -179,10 +179,6 @@
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Dialog" />
<activity
android:name="com.todoroo.astrid.service.UpdateMessagePreference"
android:theme="@android:style/Theme" />
<activity
android:name="com.todoroo.astrid.service.UpgradeService$UpgradeActivity"
android:screenOrientation="portrait" />

@ -203,8 +203,7 @@ public abstract class CommentsFragment extends ListFragment {
cursor = getCursor();
activity.startManagingCursor(cursor);
updateAdapter = new UpdateAdapter(this, R.layout.update_adapter_row,
cursor, false);
updateAdapter = new UpdateAdapter(this, R.layout.update_adapter_row, cursor);
addHeaderToListView(listView);
addFooterToListView(listView);
listView.setAdapter(updateAdapter);

@ -65,7 +65,7 @@ public class TagCommentsFragment extends CommentsFragment {
@Override
protected Cursor getCursor() {
return tagDataService.getActivityForTagData(tagData, null);
return tagDataService.getActivityForTagData(tagData);
}
@Override

@ -260,7 +260,7 @@ public class TagViewFragment extends TaskListFragment {
AndroidUtilities.tryUnregisterReceiver(getActivity(), notifyReceiver);
}
protected void reloadTagData(boolean onActivityResult) {
protected void reloadTagData() {
tagData = tagDataService.fetchById(tagData.getId(), TagData.PROPERTIES); // refetch
if (tagData == null) {
// This can happen if a tag has been deleted as part of a sync
@ -279,11 +279,7 @@ public class TagViewFragment extends TaskListFragment {
((TaskListActivity) activity).setListsTitle(filter.title);
FilterListFragment flf = ((TaskListActivity) activity).getFilterListFragment();
if (flf != null) {
if (!onActivityResult) {
flf.refresh();
} else {
flf.clear();
}
flf.clear();
}
}
taskAdapter = null;
@ -293,7 +289,7 @@ public class TagViewFragment extends TaskListFragment {
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_SETTINGS && resultCode == Activity.RESULT_OK) {
reloadTagData(true);
reloadTagData();
} else {
super.onActivityResult(requestCode, resultCode, data);
}

@ -289,11 +289,10 @@ public class AstridActivity extends ActionBarActivity
// --- fragment helpers
protected Fragment setupFragment(String tag, int container, Class<? extends Fragment> cls, boolean createImmediate, boolean replace) {
protected Fragment setupFragment(String tag, int container, Class<? extends Fragment> cls) {
final FragmentManager fm = getSupportFragmentManager();
Fragment fragment = fm.findFragmentByTag(tag);
if(fragment == null || replace) {
Fragment oldFragment = fragment;
if(fragment == null) {
try {
fragment = cls.newInstance();
} catch (InstantiationException e) {
@ -304,23 +303,18 @@ public class AstridActivity extends ActionBarActivity
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
if (container == 0) {
if (oldFragment != null && replace) {
ft.remove(oldFragment);
}
ft.add(fragment, tag);
}
else {
ft.replace(container, fragment, tag);
}
ft.commit();
if (createImmediate) {
runOnUiThread(new Runnable() {
@Override
public void run() {
fm.executePendingTransactions();
}
});
}
runOnUiThread(new Runnable() {
@Override
public void run() {
fm.executePendingTransactions();
}
});
}
return fragment;
}

@ -30,7 +30,6 @@ import java.util.HashMap;
public class BeastModePreferences extends ListActivity {
private TouchListView touchList;
private ArrayAdapter<String> adapter;
private ArrayList<String> items;
@ -81,14 +80,11 @@ public class BeastModePreferences extends ListActivity {
Preferences.setBoolean(BEAST_MODE_ASSERTED_HIDE_ALWAYS, true);
}
public static void setDefaultOrder(Context context, boolean force) {
if (Preferences.getStringValue(BEAST_MODE_ORDER_PREF) != null && !force) {
public static void setDefaultOrder(Context context) {
if (Preferences.getStringValue(BEAST_MODE_ORDER_PREF) != null) {
return;
}
if (force) {
Preferences.clear(BEAST_MODE_ORDER_PREF);
}
ArrayList<String> list = constructOrderedControlList(context);
StringBuilder newSetting = new StringBuilder(30);
for (String item : list) {
@ -107,7 +103,7 @@ public class BeastModePreferences extends ListActivity {
prefsToDescriptions = new HashMap<String, String>();
buildDescriptionMap(getResources());
touchList = (TouchListView) getListView();
TouchListView touchList = (TouchListView) getListView();
items = constructOrderedControlList(this);
adapter = new ArrayAdapter<String>(this, R.layout.preference_draggable_row, R.id.text, items) {

@ -102,8 +102,7 @@ public class FilterListFragment extends ListFragment {
}
private FilterAdapter instantiateAdapter() {
return new FilterAdapter(getActivity(), null,
R.layout.filter_adapter_row, false);
return new FilterAdapter(getActivity(), R.layout.filter_adapter_row);
}
/* (non-Javadoc)
@ -114,7 +113,7 @@ public class FilterListFragment extends ListFragment {
Bundle savedInstanceState) {
Activity activity = getActivity();
int layout = getLayout();
return (ViewGroup) activity.getLayoutInflater().inflate(layout, container, false);
return activity.getLayoutInflater().inflate(layout, container, false);
}
protected int getLayout() {

@ -144,7 +144,7 @@ public class ShortcutActivity extends Activity {
Set<String> keys = extras.keySet();
for (String key : keys) {
if (AndroidUtilities.indexOf(CUSTOM_EXTRAS, key) < 0) {
AndroidUtilities.putInto(customExtras, key, extras.get(key), false);
AndroidUtilities.putInto(customExtras, key, extras.get(key));
}
}

@ -178,11 +178,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
// --- UI components
private ImageButton voiceAddNoteButton;
private EditNotesControlSet notesControlSet = null;
private HideUntilControlSet hideUntilControls = null;
private TagsControlSet tagsControlSet = null;
private FilesControlSet filesControlSet = null;
private TimerActionControlSet timerAction;
private EditText title;
@ -216,8 +212,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
private boolean showEditComments;
private int tabStyle = 0;
/*
* ======================================================================
* ======================================================= initialization
@ -300,7 +294,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
long idParam = getActivity().getIntent().getLongExtra(TOKEN_ID, -1L);
tabStyle = TaskEditViewPager.TAB_SHOW_ACTIVITY;
int tabStyle = TaskEditViewPager.TAB_SHOW_ACTIVITY;
if (!showEditComments) {
tabStyle &= ~TaskEditViewPager.TAB_SHOW_ACTIVITY;
@ -372,7 +366,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
getActivity(), getView());
controls.add(timerAction);
tagsControlSet = new TagsControlSet(getActivity(),
TagsControlSet tagsControlSet = new TagsControlSet(getActivity(),
R.layout.control_set_tags,
R.layout.control_set_default_display, R.string.TEA_tags_label_long);
controls.add(tagsControlSet);
@ -426,7 +420,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
controlSetMap.put(getString(R.string.TEA_ctrl_reminders_pref),
reminderControl);
hideUntilControls = new HideUntilControlSet(getActivity(),
HideUntilControlSet hideUntilControls = new HideUntilControlSet(getActivity(),
R.layout.control_set_hide,
R.layout.control_set_default_display,
R.string.hide_until_prompt);
@ -540,12 +534,12 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
// prepare and set listener for voice-button
if (getActivity() != null) {
if (VoiceRecognizer.voiceInputAvailable(getActivity())) {
voiceAddNoteButton = (ImageButton) notesControlSet.getView().findViewById(
ImageButton voiceAddNoteButton = (ImageButton) notesControlSet.getView().findViewById(
R.id.voiceAddNoteButton);
voiceAddNoteButton.setVisibility(View.VISIBLE);
int prompt = R.string.voice_edit_note_prompt;
voiceNoteAssistant = new VoiceInputAssistant(voiceAddNoteButton, REQUEST_VOICE_RECOG);
voiceNoteAssistant.setAppend(true);
voiceNoteAssistant.setAppend();
voiceNoteAssistant.setLanguageModel(RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
voiceNoteAssistant.configureMicrophoneButton(TaskEditFragment.this, prompt);
}

@ -20,7 +20,7 @@ public class TaskEditViewPager extends PagerAdapter {
private final String[] titles;
public TaskEditFragment parent;
public static final int TAB_SHOW_ACTIVITY = 1 << 0;
public static final int TAB_SHOW_ACTIVITY = 1;
public TaskEditViewPager(Context context, int tabStyleMask) {
ArrayList<String> titleList = new ArrayList<String>();

@ -214,7 +214,7 @@ public class TaskListActivity extends AstridActivity implements OnPageChangeList
}
setupPopoverWithFilterList((FilterListFragment) setupFragment(FilterListFragment.TAG_FILTERLIST_FRAGMENT, 0,
filterModeSpec.getFilterListClass(), true, false));
filterModeSpec.getFilterListClass()));
}
private void setupLayoutTransitions() {

@ -696,8 +696,7 @@ public class TaskListFragment extends ListFragment implements OnSortSelectedList
if (AstridApiConstants.BROADCAST_SEND_DECORATIONS.equals(intent.getAction())) {
TaskDecoration deco = receivedExtras.getParcelable(AstridApiConstants.EXTRAS_RESPONSE);
taskAdapter.decorationManager.addNew(taskId, addOn, deco,
null);
taskAdapter.decorationManager.addNew(taskId, addOn, deco);
} else if (AstridApiConstants.BROADCAST_SEND_DETAILS.equals(intent.getAction())) {
String detail = receivedExtras.getString(AstridApiConstants.EXTRAS_RESPONSE);
taskAdapter.addDetails(taskId, detail);
@ -781,7 +780,7 @@ public class TaskListFragment extends ListFragment implements OnSortSelectedList
protected TaskAdapter createTaskAdapter(TodorooCursor<Task> cursor) {
return new TaskAdapter(this, getTaskRowResource(),
cursor, sqlQueryTemplate, false,
cursor, sqlQueryTemplate,
new OnCompletedTaskListener() {
@Override
public void onCompletedTask(Task item, boolean newState) {

@ -107,9 +107,8 @@ public class FilterAdapter extends ArrayAdapter<Filter> {
// be added).
private final ThreadPoolExecutor filterExecutor = new ThreadPoolExecutor(0, 1, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
public FilterAdapter(Activity activity, ListView listView,
int rowLayout, boolean skipIntentFilters) {
this(activity, listView, rowLayout, skipIntentFilters, false);
public FilterAdapter(Activity activity, int rowLayout) {
this(activity, null, rowLayout, false, false);
}
public FilterAdapter(Activity activity, ListView listView,

@ -18,7 +18,6 @@ import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.text.Html;
import android.text.Html.ImageGetter;
import android.text.Html.TagHandler;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
@ -194,7 +193,6 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
protected OnCompletedTaskListener onCompletedTaskListener = null;
protected final int resource;
protected final LayoutInflater inflater;
private DetailLoaderThread detailLoader;
private int fontSize;
private long mostRecentlyMade = -1;
private final ScaleAnimation scaleAnimation;
@ -223,15 +221,12 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
* layout resource to inflate
* @param c
* database cursor
* @param autoRequery
* whether cursor is automatically re-queried on changes
* @param onCompletedTaskListener
* task listener. can be null
*/
public TaskAdapter(TaskListFragment fragment, int resource,
Cursor c, AtomicReference<String> query, boolean autoRequery,
OnCompletedTaskListener onCompletedTaskListener) {
super(ContextManager.getContext(), c, autoRequery);
Cursor c, AtomicReference<String> query, OnCompletedTaskListener onCompletedTaskListener) {
super(ContextManager.getContext(), c, false);
DependencyInjectionService.getInstance().inject(this);
this.context = ContextManager.getContext();
@ -298,7 +293,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
private void startDetailThread() {
if (Preferences.getBoolean(R.string.p_showNotes, false) && !simpleLayout && !titleOnlyLayout) {
detailLoader = new DetailLoaderThread();
DetailLoaderThread detailLoader = new DetailLoaderThread();
detailLoader.start();
}
}
@ -539,7 +534,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
int i = 0;
for(; i < splitDetails.length; i++) {
Spanned spanned = convertToHtml(splitDetails[i] + " ", detailImageGetter, null);
Spanned spanned = convertToHtml(splitDetails[i] + " ", detailImageGetter);
prospective.insert(prospective.length(), spanned);
viewHolder.details1.setText(prospective);
viewHolder.details1.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
@ -561,7 +556,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
}
for(; i < splitDetails.length; i++) {
actual.insert(actual.length(), convertToHtml(splitDetails[i] + " ", detailImageGetter, null));
actual.insert(actual.length(), convertToHtml(splitDetails[i] + " ", detailImageGetter));
}
viewHolder.details2.setText(actual);
}
@ -662,11 +657,11 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
private final HashMap<String, Spanned> htmlCache = new HashMap<String, Spanned>(8);
private Spanned convertToHtml(String string, ImageGetter imageGetter, TagHandler tagHandler) {
private Spanned convertToHtml(String string, ImageGetter imageGetter) {
if(!htmlCache.containsKey(string)) {
Spanned html;
try {
html = Html.fromHtml(string, imageGetter, tagHandler);
html = Html.fromHtml(string, imageGetter, null);
} catch (RuntimeException e) {
html = Spannable.Factory.getInstance().newSpannable(string);
}

@ -77,12 +77,10 @@ public class UpdateAdapter extends CursorAdapter {
* layout resource to inflate
* @param c
* database cursor
* @param autoRequery
* whether cursor is automatically re-queried on changes
*/
public UpdateAdapter(Fragment fragment, int resource,
Cursor c, boolean autoRequery) {
super(fragment.getActivity(), c, autoRequery);
Cursor c) {
super(fragment.getActivity(), c, false);
DependencyInjectionService.getInstance().inject(this);
inflater = (LayoutInflater) fragment.getActivity().getSystemService(

@ -91,7 +91,7 @@ public class AlarmService {
PendingIntent pendingIntent = pendingIntentForAlarm(m, taskId);
am.cancel(pendingIntent);
}
}, true);
});
if(changed) {
scheduleAlarms(taskId);

@ -75,7 +75,7 @@ public class BackupPreferences extends TodorooPreferenceActivity {
findPreference(getString(R.string.backup_BAc_export)).setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
TasksXmlExporter.exportTasks(BackupPreferences.this, TasksXmlExporter.ExportType.EXPORT_TYPE_MANUAL, null, null);
TasksXmlExporter.exportTasks(BackupPreferences.this, TasksXmlExporter.ExportType.EXPORT_TYPE_MANUAL, null);
return true;
}
});

@ -83,7 +83,7 @@ public class BackupService extends Service {
}
TasksXmlExporter.exportTasks(context, TasksXmlExporter.ExportType.EXPORT_TYPE_SERVICE,
backupDirectorySetting.getBackupDirectory(), null);
backupDirectorySetting.getBackupDirectory());
} catch (Exception e) {
Log.e("error-backup", "Error starting backups", e); //$NON-NLS-1$ //$NON-NLS-2$

@ -52,8 +52,8 @@ public class TasksXmlExporter {
* @param backupDirectoryOverride new backupdirectory, or null to use default
*/
public static void exportTasks(Context context, ExportType exportType,
File backupDirectoryOverride, String versionName) {
new TasksXmlExporter(context, exportType, backupDirectoryOverride, versionName);
File backupDirectoryOverride) {
new TasksXmlExporter(context, exportType, backupDirectoryOverride);
}
public static enum ExportType {
@ -91,12 +91,12 @@ public class TasksXmlExporter {
}
private TasksXmlExporter(final Context context, final ExportType exportType,
File backupDirectoryOverride, String versionName) {
File backupDirectoryOverride) {
this.context = context;
this.exportCount = 0;
this.backupDirectory = backupDirectoryOverride == null ?
BackupConstants.defaultExportDirectory() : backupDirectoryOverride;
this.latestSetVersionName = versionName;
this.latestSetVersionName = null;
handler = new Handler();
progressDialog = new ProgressDialog(context);

@ -436,7 +436,6 @@ public class TasksXmlImporter {
if(BackupConstants.TASK_TAG.equals(tag) && xpp.getEventType() == XmlPullParser.END_TAG) {
saveTags();
} else if (tag == null || xpp.getEventType() == XmlPullParser.END_TAG) {
continue;
} else if (tag.equals(BackupConstants.TASK_TAG)) {
// Parse <task ... >
currentTask = parseTask();

@ -96,7 +96,6 @@ public class MissedCallActivity extends Activity {
private String name;
private String number;
private String timeString;
private TextView returnCallButton;
private TextView callLaterButton;
@ -116,7 +115,7 @@ public class MissedCallActivity extends Activity {
name = intent.getStringExtra(EXTRA_NAME);
number = intent.getStringExtra(EXTRA_NUMBER);
timeString = intent.getStringExtra(EXTRA_TIME);
String timeString = intent.getStringExtra(EXTRA_TIME);
long contactId = intent.getExtras().getLong(EXTRA_CONTACT_ID);
int color = ThemeService.getThemeColor();

@ -136,7 +136,6 @@ public class CustomFilterActivity extends ActionBarActivity {
private ListView listView;
private TextView filterName;
private boolean isDialog;
private CustomFilterAdapter adapter;
private final Map<String,CustomFilterCriterion> criteria = Collections.synchronizedMap(new LinkedHashMap<String,CustomFilterCriterion>());
@ -179,8 +178,7 @@ public class CustomFilterActivity extends ActionBarActivity {
}
private void setupForDialogOrFullscreen() {
isDialog = AstridPreferences.useTabletLayout(this);
if (isDialog) {
if (AstridPreferences.useTabletLayout(this)) {
setTheme(ThemeService.getDialogTheme());
} else {
ThemeService.applyTheme(this);
@ -261,7 +259,7 @@ public class CustomFilterActivity extends ActionBarActivity {
Query.select(Task.ID).from(Task.TABLE).where(
Criterion.and(TaskCriteria.activeVisibleMine(),
Task.TITLE.like("%?%"))).toString(),
null, getString(R.string.CFC_title_contains_name), "",
getString(R.string.CFC_title_contains_name), "",
((BitmapDrawable)r.getDrawable(R.drawable.tango_alpha)).getBitmap(),
getString(R.string.CFC_title_contains_name));
criteria.put(IDENTIFIER_TITLE, criterion);

@ -68,12 +68,12 @@ public class LinkActionExposer {
Resources r = context.getResources();
if (hasAttachments) {
BitmapDrawable icon = getBitmapDrawable(R.drawable.action_attachments, r);
return new FilesAction(null, icon);
return new FilesAction(icon);
}
if (hasNotes && !Preferences.getBoolean(R.string.p_showNotes, false)) {
BitmapDrawable icon = getBitmapDrawable(R.drawable.action_notes, r);
return new NotesAction(null, icon);
return new NotesAction(icon);
}
return null;

@ -141,7 +141,7 @@ public class MetadataDao extends DatabaseDao<Metadata> {
public TodorooCursor<Metadata> fetchDangling(Property<?>... properties) {
Query sql = Query.select(properties).from(Metadata.TABLE).join(Join.left(Task.TABLE,
Metadata.TASK.eq(Task.ID))).where(Task.TITLE.isNull());
Cursor cursor = database.rawQuery(sql.toString(), null);
Cursor cursor = database.rawQuery(sql.toString());
return new TodorooCursor<Metadata>(cursor, properties);
}
}

@ -16,7 +16,6 @@ import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.SyncFlags;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.TagMetadata;
import com.todoroo.astrid.tags.TagMemberMetadata;
@ -63,36 +62,27 @@ public class TagMetadataDao extends DatabaseDao<TagMetadata> {
}
}
public void createMemberLink(long tagId, String tagUuid, String memberId, boolean suppressOutstanding) {
createMemberLink(tagId, tagUuid, memberId, false, suppressOutstanding);
public void createMemberLink(long tagId, String tagUuid, String memberId) {
createMemberLink(tagId, tagUuid, memberId, false);
}
public void createMemberLink(long tagId, String tagUuid, String memberId, boolean removedMember, boolean suppressOutstanding) {
public void createMemberLink(long tagId, String tagUuid, String memberId, boolean removedMember) {
TagMetadata newMetadata = TagMemberMetadata.newMemberMetadata(tagId, tagUuid, memberId);
if (removedMember) {
newMetadata.setValue(TagMetadata.DELETION_DATE, DateUtilities.now());
}
if (suppressOutstanding) {
newMetadata.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true);
}
if (update(Criterion.and(TagMetadataCriteria.byTagAndWithKey(tagUuid, TagMemberMetadata.KEY),
TagMemberMetadata.USER_UUID.eq(memberId)), newMetadata) <= 0) {
if (suppressOutstanding) {
newMetadata.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true);
}
createNew(newMetadata);
}
}
public void removeMemberLink(long tagId, String tagUuid, String memberId, boolean suppressOutstanding) {
public void removeMemberLink(long tagId, String tagUuid, String memberId) {
TagMetadata deleteTemplate = new TagMetadata();
deleteTemplate.setValue(TagMetadata.TAG_ID, tagId); // Need this for recording changes in outstanding table
deleteTemplate.setValue(TagMetadata.DELETION_DATE, DateUtilities.now());
deleteTemplate.setValue(TagMemberMetadata.USER_UUID, memberId); // Need this for recording changes in outstanding table
if (suppressOutstanding) {
deleteTemplate.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true);
}
update(Criterion.and(TagMetadataCriteria.withKey(TagMemberMetadata.KEY), TagMetadata.DELETION_DATE.eq(0),
TagMetadata.TAG_UUID.eq(tagUuid), TagMemberMetadata.USER_UUID.eq(memberId)), deleteTemplate);
}
@ -133,9 +123,9 @@ public class TagMetadataDao extends DatabaseDao<TagMetadata> {
String email = user.optString("email"); //$NON-NLS-1$
if (!TextUtils.isEmpty(id)) {
createMemberLink(tagId, tagUuid, id, !ids.contains(id), false);
createMemberLink(tagId, tagUuid, id, !ids.contains(id));
} else if (!TextUtils.isEmpty(email)) {
createMemberLink(tagId, tagUuid, email, !emails.contains(email), false);
createMemberLink(tagId, tagUuid, email, !emails.contains(email));
}
}
@ -162,7 +152,7 @@ public class TagMetadataDao extends DatabaseDao<TagMetadata> {
}
if (!exists) { // Was in database, but not in new members list
removeMemberLink(tagId, tagUuid, userId, false);
removeMemberLink(tagId, tagUuid, userId);
}
}
} finally {
@ -170,11 +160,11 @@ public class TagMetadataDao extends DatabaseDao<TagMetadata> {
}
for (String email : emails) {
createMemberLink(tagId, tagUuid, email, false);
createMemberLink(tagId, tagUuid, email);
}
for (String id : ids) {
createMemberLink(tagId, tagUuid, id, false);
createMemberLink(tagId, tagUuid, id);
}
}
}

@ -5,14 +5,13 @@
*/
package com.todoroo.astrid.files;
import android.app.PendingIntent;
import android.graphics.drawable.BitmapDrawable;
import com.todoroo.astrid.api.TaskAction;
public class FilesAction extends TaskAction {
public FilesAction(PendingIntent intent, BitmapDrawable icon) {
super(intent, icon);
public FilesAction(BitmapDrawable icon) {
super(null, icon);
}
}

@ -59,7 +59,6 @@ public class FilesControlSet extends PopupControlSet {
private final ArrayList<TaskAttachment> files = new ArrayList<TaskAttachment>();
private final LinearLayout fileDisplayList;
private LinearLayout fileList;
private final LayoutInflater inflater;
private final ImageView image;
@ -150,7 +149,7 @@ public class FilesControlSet extends PopupControlSet {
@Override
protected void afterInflate() {
fileList = (LinearLayout) getView().findViewById(R.id.files_list);
LinearLayout fileList = (LinearLayout) getView().findViewById(R.id.files_list);
final LinearLayout finalList = fileList;
fileList.removeAllViews();
LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
@ -204,7 +203,7 @@ public class FilesControlSet extends PopupControlSet {
public void onClick(DialogInterface d, int which) {
downloadFile(m);
}
}, null);
});
}
});
} else {
@ -287,7 +286,7 @@ public class FilesControlSet extends PopupControlSet {
searchMarket("com.dataviz.docstogo", R.string.search_market_ms_title, R.string.search_market_ms); //$NON-NLS-1$
} else {
DialogUtilities.okDialog(activity, activity.getString(R.string.file_type_unhandled_title),
0, activity.getString(R.string.file_type_unhandled), null);
0, activity.getString(R.string.file_type_unhandled));
}
}
@ -308,7 +307,7 @@ public class FilesControlSet extends PopupControlSet {
null);
}
}
}, null);
});
}
private void downloadFile(final TaskAttachment m) {

@ -34,7 +34,6 @@ public class GtasksInvoker {
private Tasks service;
private GoogleAccessProtectedResource accessProtectedResource;
private String token;
private JsonFactory jsonFactory;
@Autowired ExceptionService exceptionService;
@ -49,7 +48,7 @@ public class GtasksInvoker {
this.token = authToken;
accessProtectedResource = new GoogleAccessProtectedResource(authToken);
jsonFactory = new GsonFactory();
JsonFactory jsonFactory = new GsonFactory();
Context context = ContextManager.getContext();
String key = context.getString(R.string.gapi_key);
service = new Tasks(AndroidHttp.newCompatibleTransport(), accessProtectedResource, jsonFactory);

@ -67,7 +67,7 @@ public final class GtasksSyncService {
if(DateUtilities.now() - creationDate < 1000) {
AndroidUtilities.sleepDeep(1000 - (DateUtilities.now() - creationDate));
}
pushTaskOnSave(model, model.getMergedValues(), invoker, false);
pushTaskOnSave(model, model.getMergedValues(), invoker);
}
}
@ -204,11 +204,7 @@ public final class GtasksSyncService {
/**
* Synchronize with server when data changes
*/
public void pushTaskOnSave(Task task, ContentValues values, GtasksInvoker invoker, boolean sleep) throws IOException {
if (sleep) {
AndroidUtilities.sleepDeep(1000L); //Wait for metadata to be saved
}
public void pushTaskOnSave(Task task, ContentValues values, GtasksInvoker invoker) throws IOException {
Metadata gtasksMetadata = gtasksMetadataService.getTaskMetadata(task.getId());
com.google.api.services.tasks.model.Task remoteModel;
boolean newlyCreated = false;

@ -163,7 +163,7 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
for (queued.moveToFirst(); !queued.isAfterLast(); queued.moveToNext()) {
task.readFromCursor(queued);
try {
gtasksSyncService.pushTaskOnSave(task, task.getMergedValues(), invoker, false);
gtasksSyncService.pushTaskOnSave(task, task.getMergedValues(), invoker);
} catch (GoogleTasksException e) {
handler.handleException("gtasks-sync-io", e, e.getType()); //$NON-NLS-1$
} catch (IOException e) {

@ -90,7 +90,7 @@ public class SyncActionHelper {
public void initiateAutomaticSync() {
long tasksPushedAt = Preferences.getLong(PREF_LAST_AUTO_SYNC, 0);
if (DateUtilities.now() - tasksPushedAt > TaskListFragment.AUTOSYNC_INTERVAL) {
performSyncServiceV2Sync(false);
performSyncServiceV2Sync();
}
}
@ -140,8 +140,8 @@ public class SyncActionHelper {
// --- sync logic
protected void performSyncServiceV2Sync(boolean manual) {
boolean syncOccurred = syncService.synchronizeActiveTasks(manual, syncResultCallback);
protected void performSyncServiceV2Sync() {
boolean syncOccurred = syncService.synchronizeActiveTasks(false, syncResultCallback);
if (syncOccurred) {
Preferences.setLong(PREF_LAST_AUTO_SYNC, DateUtilities.now());
}

@ -31,27 +31,23 @@ abstract public class TaskAdapterAddOnManager<TYPE> {
abstract protected void draw(ViewHolder viewHolder, long taskId, Collection<TYPE> list);
/** on receive an intent */
public void addNew(long taskId, String addOn, TYPE item, ViewHolder thisViewHolder) {
public void addNew(long taskId, String addOn, TYPE item) {
if(item == null) {
return;
}
Collection<TYPE> cacheList = addIfNotExists(taskId, addOn, item);
if(cacheList != null) {
if(thisViewHolder != null) {
draw(thisViewHolder, taskId, cacheList);
} else {
ListView listView = fragment.getListView();
// update view if it is visible
int length = listView.getChildCount();
for(int i = 0; i < length; i++) {
ViewHolder viewHolder = (ViewHolder) listView.getChildAt(i).getTag();
if(viewHolder == null || viewHolder.task.getId() != taskId) {
continue;
}
draw(viewHolder, taskId, cacheList);
break;
ListView listView = fragment.getListView();
// update view if it is visible
int length = listView.getChildCount();
for(int i = 0; i < length; i++) {
ViewHolder viewHolder = (ViewHolder) listView.getChildAt(i).getTag();
if(viewHolder == null || viewHolder.task.getId() != taskId) {
continue;
}
draw(viewHolder, taskId, cacheList);
break;
}
}
}

@ -91,7 +91,6 @@ public abstract class TaskEditControlSet {
/**
* Write to model, if initialization logic has been called
* @return toast text
*/
protected abstract void writeToModelAfterInitialized(Task task);

@ -5,14 +5,13 @@
*/
package com.todoroo.astrid.notes;
import android.app.PendingIntent;
import android.graphics.drawable.BitmapDrawable;
import com.todoroo.astrid.api.TaskAction;
public class NotesAction extends TaskAction {
public NotesAction(PendingIntent intent, BitmapDrawable icon) {
super(intent, icon);
public NotesAction(BitmapDrawable icon) {
super(null, icon);
}
}

@ -128,7 +128,7 @@ public class SqlContentProvider extends ContentProvider {
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
return database.rawQuery(selection, null);
return database.rawQuery(selection);
}
}

@ -46,8 +46,6 @@ public class NotificationFragment extends TaskListFragment {
// --- implementation
private long taskId;
@Override
protected void initializeData() {
displayNotificationPopup();
@ -62,7 +60,7 @@ public class NotificationFragment extends TaskListFragment {
getView().findViewById(R.id.taskListFooter).setVisibility(View.GONE);
String title = extras.getString(Notifications.EXTRAS_TEXT);
taskId = extras.getLong(TOKEN_ID);
long taskId = extras.getLong(TOKEN_ID);
new ReminderDialog((AstridActivity) getActivity(), taskId, title).show();
}

@ -508,8 +508,8 @@ public class Notifications extends BroadcastReceiver {
Notifications.notificationManager = notificationManager;
}
public static void forceNotificationManager(boolean status) {
forceNotificationManager = status;
public static void forceNotificationManager() {
forceNotificationManager = true;
}
}

@ -87,7 +87,7 @@ public class ReminderPreferences extends TodorooPreferenceActivity {
preference.setSummary(r.getString(R.string.rmd_EPr_vibrate_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)) {
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));

@ -21,14 +21,6 @@ public abstract class MarketStrategy {
return null;
}
/**
* Return true if the preference to use the phone layout should be
* turned on by default (only true for Nook)
*/
public boolean defaultPhoneLayout() {
return false;
}
public static class AndroidMarketStrategy extends MarketStrategy {
@Override

@ -100,7 +100,7 @@ public class MetadataService {
* @return true if there were changes
*/
public boolean synchronizeMetadata(long taskId, ArrayList<Metadata> metadata,
Criterion metadataCriterion, SynchronizeMetadataCallback callback, boolean hardDelete) {
Criterion metadataCriterion, SynchronizeMetadataCallback callback) {
boolean dirty = false;
HashSet<ContentValues> newMetadataValues = new HashSet<ContentValues>();
for(Metadata metadatum : metadata) {
@ -142,12 +142,7 @@ public class MetadataService {
if (callback != null) {
callback.beforeDeleteMetadata(item);
}
if (hardDelete) {
metadataDao.delete(id);
} else {
item.setValue(Metadata.DELETION_DATE, DateUtilities.now());
metadataDao.persist(item);
}
metadataDao.delete(id);
dirty = true;
}
} finally {

@ -208,10 +208,7 @@ public class StartupService {
AstridPreferences.setPreferenceDefaults();
CalendarStartupReceiver.scheduleCalendarAlarms(context, false); // This needs to be after set preference defaults for the purposes of ab testing
// check for task killers
if(!Constants.OEM) {
showTaskKillerHelp(context);
}
showTaskKillerHelp(context);
hasStartedUp = true;
}
@ -239,7 +236,7 @@ public class StartupService {
if (context instanceof Activity) {
Activity activity = (Activity) context;
DialogUtilities.okDialog(activity, activity.getString(R.string.DB_corrupted_title),
0, activity.getString(R.string.DB_corrupted_body), null);
0, activity.getString(R.string.DB_corrupted_body));
}
e.printStackTrace();
}

@ -79,7 +79,7 @@ public class TagDataService {
}
}
private static Query queryForTagData(TagData tagData, Criterion extraCriterion, Property<?>[] activityProperties) {
private static Query queryForTagData(TagData tagData, Property<?>[] activityProperties) {
Criterion criteria;
if (tagData == null) {
criteria = UserActivity.DELETED_AT.eq(0);
@ -91,15 +91,11 @@ public class TagDataService {
.from(Metadata.TABLE).where(Criterion.and(MetadataCriteria.withKey(TaskToTagMetadata.KEY), TaskToTagMetadata.TAG_UUID.eq(tagData.getUuid())))))));
}
if (extraCriterion != null) {
criteria = Criterion.and(criteria, extraCriterion);
}
return Query.select(AndroidUtilities.addToArray(Property.class, activityProperties)).where(criteria);
}
public Cursor getActivityForTagData(TagData tagData, Criterion extraCriterion) {
Query activityQuery = queryForTagData(tagData, extraCriterion, UpdateAdapter.USER_ACTIVITY_PROPERTIES)
public Cursor getActivityForTagData(TagData tagData) {
Query activityQuery = queryForTagData(tagData, UpdateAdapter.USER_ACTIVITY_PROPERTIES)
.from(UserActivity.TABLE);
Query resultQuery = activityQuery.orderBy(Order.desc("1")); //$NON-NLS-1$

@ -404,12 +404,12 @@ public class TaskService {
for (Property<?> property : Metadata.PROPERTIES) {
if (property.name.equals(key)) {
AndroidUtilities.putInto(forMetadata, key, value, true);
AndroidUtilities.putInto(forMetadata, key, value);
continue outer;
}
}
AndroidUtilities.putInto(forTask, key, value, true);
AndroidUtilities.putInto(forTask, key, value);
}
task.mergeWithoutReplacement(forTask);
}

@ -1,77 +0,0 @@
package com.todoroo.astrid.service;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceActivity;
import com.todoroo.andlib.utility.Preferences;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.tasks.R;
public class UpdateMessagePreference extends PreferenceActivity {
public static final String TOKEN_PREFS_ARRAY = "prefs_array"; //$NON-NLS-1$
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences_blank);
String prefsArray = getIntent().getStringExtra(TOKEN_PREFS_ARRAY);
try {
JSONArray array = new JSONArray(prefsArray);
if (array.length() == 0) {
finish();
}
for (int i = 0; i < array.length(); i++) {
try {
JSONObject pref = array.getJSONObject(i);
addPreferenceFromJSON(pref);
} catch (JSONException e) {
continue;
}
}
} catch (JSONException e) {
finish();
}
}
private void addPreferenceFromJSON(JSONObject obj) {
String type = obj.optString("type", null);
String key = obj.optString("key", null);
String title = obj.optString("title", null);
if (type == null || key == null || title == null) {
return;
}
Preference pref = null;
if ("bool".equals(type)) { // We can add other types we want to support and handle the preference construction here
pref = new CheckBoxPreference(this);
pref.setKey(key);
pref.setTitle(title);
pref.setDefaultValue(Preferences.getBoolean(key, false));
}
if (pref == null) {
return;
}
if (obj.optBoolean("restart")) {
pref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
setResult(RESULT_OK);
return true;
}
});
}
getPreferenceScreen().addPreference(pref);
}
}

@ -192,7 +192,7 @@ public class AstridOrderedListFragmentHelper<LIST> implements OrderedListFragmen
AtomicReference<String> sqlQueryTemplate) {
taskAdapter = new DraggableTaskAdapter(fragment, TaskListFragment.getTaskRowResource(),
cursor, sqlQueryTemplate, false, null);
cursor, sqlQueryTemplate);
getTouchListView().setItemHightNormal(taskAdapter.computeFullRowHeight());
@ -209,10 +209,8 @@ public class AstridOrderedListFragmentHelper<LIST> implements OrderedListFragmen
private final class DraggableTaskAdapter extends TaskAdapter {
private DraggableTaskAdapter(TaskListFragment activity, int resource,
Cursor c, AtomicReference<String> query, boolean autoRequery,
OnCompletedTaskListener onCompletedTaskListener) {
super(activity, resource, c, query, autoRequery,
onCompletedTaskListener);
Cursor c, AtomicReference<String> query) {
super(activity, resource, c, query, null);
}
@Override
@ -248,7 +246,7 @@ public class AstridOrderedListFragmentHelper<LIST> implements OrderedListFragmen
final Task model = new Task();
final long completionDate = completedState ? DateUtilities.now() : 0;
if(completedState == false) {
if(!completedState) {
ArrayList<String> chained = chainedCompletions.get(itemId);
if(chained != null) {
for(String taskId : chained) {

@ -204,7 +204,7 @@ public class OrderedMetadataListFragmentHelper<LIST> implements OrderedListFragm
AtomicReference<String> sqlQueryTemplate) {
taskAdapter = new DraggableTaskAdapter(fragment, TaskListFragment.getTaskRowResource(),
cursor, sqlQueryTemplate, false, null);
cursor, sqlQueryTemplate);
taskAdapter.addOnCompletedTaskListener(new OnCompletedTaskListener() {
@Override
@ -219,10 +219,8 @@ public class OrderedMetadataListFragmentHelper<LIST> implements OrderedListFragm
private final class DraggableTaskAdapter extends TaskAdapter {
private DraggableTaskAdapter(TaskListFragment activity, int resource,
Cursor c, AtomicReference<String> query, boolean autoRequery,
OnCompletedTaskListener onCompletedTaskListener) {
super(activity, resource, c, query, autoRequery,
onCompletedTaskListener);
Cursor c, AtomicReference<String> query) {
super(activity, resource, c, query, null);
}
@Override
@ -258,7 +256,7 @@ public class OrderedMetadataListFragmentHelper<LIST> implements OrderedListFragm
final Task model = new Task();
final long completionDate = completedState ? DateUtilities.now() : 0;
if(completedState == false) {
if(!completedState) {
ArrayList<Long> chained = chainedCompletions.get(itemId);
if(chained != null) {
for(Long taskId : chained) {

@ -73,7 +73,7 @@ public class TagCustomFilterCriteriaExposer extends BroadcastReceiver {
TaskDao.TaskCriteria.activeAndVisible(),
MetadataDao.MetadataCriteria.withKey(TaskToTagMetadata.KEY),
TaskToTagMetadata.TAG_NAME.like("%?%"), Metadata.DELETION_DATE.eq(0))).toString(),
null, context.getString(R.string.CFC_tag_contains_name), "",
context.getString(R.string.CFC_tag_contains_name), "",
((BitmapDrawable)r.getDrawable(TagService.getDefaultImageIDForTag(RemoteModel.NO_UUID))).getBitmap(),
context.getString(R.string.CFC_tag_contains_name));
ret[j] = criterion;

@ -32,7 +32,6 @@ import com.todoroo.astrid.dao.TagDataDao;
import com.todoroo.astrid.dao.TaskDao.TaskCriteria;
import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.RemoteModel;
import com.todoroo.astrid.data.SyncFlags;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.MetadataService;
@ -216,7 +215,7 @@ public final class TagService {
/**
* Delete all links between the specified task and the list of tags
*/
public void deleteLinks(long taskId, String taskUuid, String[] tagUuids, boolean suppressOutstanding) {
public void deleteLinks(long taskId, String taskUuid, String[] tagUuids) {
Metadata deleteTemplate = new Metadata();
deleteTemplate.setValue(Metadata.TASK, taskId); // Need this for recording changes in outstanding table
deleteTemplate.setValue(Metadata.DELETION_DATE, DateUtilities.now());
@ -225,9 +224,6 @@ public final class TagService {
// TODO: Right now this is in a loop because each deleteTemplate needs the individual tagUuid in order to record
// the outstanding entry correctly. If possible, this should be improved to a single query
deleteTemplate.setValue(TaskToTagMetadata.TAG_UUID, uuid); // Need this for recording changes in outstanding table
if (suppressOutstanding) {
deleteTemplate.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true);
}
metadataDao.update(Criterion.and(MetadataCriteria.withKey(TaskToTagMetadata.KEY), Metadata.DELETION_DATE.eq(0),
TaskToTagMetadata.TASK_UUID.eq(taskUuid), TaskToTagMetadata.TAG_UUID.eq(uuid)), deleteTemplate);
}
@ -348,7 +344,7 @@ public final class TagService {
}
// Mark as deleted links that don't exist anymore
deleteLinks(taskId, taskUuid, existingLinks.toArray(new String[existingLinks.size()]), false);
deleteLinks(taskId, taskUuid, existingLinks.toArray(new String[existingLinks.size()]));
}
/**
@ -402,22 +398,14 @@ public final class TagService {
}
public int rename(String uuid, String newName) {
return rename(uuid, newName, false);
}
public int rename(String uuid, String newName, boolean suppressSync) {
TagData template = new TagData();
template.setValue(TagData.NAME, newName);
if (suppressSync) {
template.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true);
}
int result = tagDataDao.update(TagData.UUID.eq(uuid), template);
tagDataDao.update(TagData.UUID.eq(uuid), template);
Metadata metadataTemplate = new Metadata();
metadataTemplate.setValue(TaskToTagMetadata.TAG_NAME, newName);
result = metadataDao.update(Criterion.and(MetadataCriteria.withKey(TaskToTagMetadata.KEY), TaskToTagMetadata.TAG_UUID.eq(uuid)), metadataTemplate);
return result;
return metadataDao.update(Criterion.and(MetadataCriteria.withKey(TaskToTagMetadata.KEY), TaskToTagMetadata.TAG_UUID.eq(uuid)), metadataTemplate);
}
public static int getDefaultImageIDForTag(String nameOrUUID) {

@ -144,11 +144,11 @@ public final class TagsControlSet extends PopupControlSet {
}
/** Adds a tag to the tag field */
void addTag(String tagName, boolean reuse) {
void addTag(String tagName) {
LayoutInflater inflater = activity.getLayoutInflater();
// check if already exists
TextView lastText = null;
TextView lastText;
for(int i = 0; i < newTags.getChildCount(); i++) {
View view = newTags.getChildAt(i);
lastText = (TextView) view.findViewById(R.id.text1);
@ -158,12 +158,8 @@ public final class TagsControlSet extends PopupControlSet {
}
final View tagItem;
if(reuse && lastText != null && lastText.getText().length() == 0) {
tagItem = (View) lastText.getParent();
} else {
tagItem = inflater.inflate(R.layout.tag_edit_row, null);
newTags.addView(tagItem);
}
tagItem = inflater.inflate(R.layout.tag_edit_row, null);
newTags.addView(tagItem);
if(tagName == null) {
tagName = ""; //$NON-NLS-1$
}
@ -187,7 +183,7 @@ public final class TagsControlSet extends PopupControlSet {
int count) {
if(count > 0 && newTags.getChildAt(newTags.getChildCount()-1) ==
tagItem) {
addTag("", false); //$NON-NLS-1$
addTag(""); //$NON-NLS-1$
}
}
});
@ -199,7 +195,7 @@ public final class TagsControlSet extends PopupControlSet {
return false;
}
if(getLastTextView().getText().length() != 0) {
addTag("", false); //$NON-NLS-1$
addTag(""); //$NON-NLS-1$
}
return true;
}
@ -264,7 +260,7 @@ public final class TagsControlSet extends PopupControlSet {
if(model.getId() != AbstractModel.NO_ID) {
selectTagsFromModel();
}
addTag("", false); //$NON-NLS-1$
addTag(""); //$NON-NLS-1$
refreshDisplayView();
populated = true;
}

@ -28,14 +28,34 @@ public class TimerActionControlSet extends TaskEditControlSet {
private final ImageView timerButton;
private final Chronometer chronometer;
private final LinearLayout timerContainer;
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);
timerContainer = (LinearLayout) parent.findViewById(R.id.timer_container);
LinearLayout timerContainer = (LinearLayout) parent.findViewById(R.id.timer_container);
timerButton = (ImageView) parent.findViewById(R.id.timer_button);
OnClickListener timerListener = new OnClickListener() {
@Override
public void onClick(View v) {
if (timerActive) {
TimerPlugin.updateTimer(activity, model, false);
for (TimerActionListener listener : listeners) {
listener.timerStopped(model);
}
chronometer.stop();
} else {
TimerPlugin.updateTimer(activity, model, true);
for (TimerActionListener listener : listeners) {
listener.timerStarted(model);
}
chronometer.start();
}
timerActive = !timerActive;
updateDisplay();
}
};
timerContainer.setOnClickListener(timerListener);
chronometer = (Chronometer) parent.findViewById(R.id.timer);
}
@ -61,28 +81,6 @@ public class TimerActionControlSet extends TaskEditControlSet {
// Nothing to do here
}
private final OnClickListener timerListener = new OnClickListener() {
@Override
public void onClick(View v) {
if (timerActive) {
TimerPlugin.updateTimer(activity, model, false);
for(TimerActionListener listener : listeners) {
listener.timerStopped(model);
}
chronometer.stop();
} else {
TimerPlugin.updateTimer(activity, model, true);
for(TimerActionListener listener : listeners) {
listener.timerStarted(model);
}
chronometer.start();
}
timerActive = !timerActive;
updateDisplay();
}
};
private void updateDisplay() {
final int drawable;
if(timerActive) {

@ -43,17 +43,14 @@ public class CalendarView extends View {
private float deltaX;
private boolean ignoreNextTouch;
private Paint borderPaint;
private Paint calendarNumberRightAlignPaint;
private Paint calendarNumberRightAlignPaint;
private Paint calendarSelectedNumberRightAlignPaint;
private Paint backgroundColorPaint;
private Paint monthCenterAlignLargePaint;
private Paint centerAlignPaint;
private Paint rightAlignPaint;
private Paint rightAlignPaint;
private Paint todayCalendarPaint;
private Paint selectedCalendarPaint;
private Paint dayPaint;
private float density;
private float density;
private int leftArrowHeight;
private int leftArrowWidth;
@ -107,7 +104,7 @@ public class CalendarView extends View {
Resources r = context.getResources();
borderPaint = new Paint();
Paint borderPaint = new Paint();
borderPaint.setAntiAlias(true);
borderPaint.setColor(r.getColor(R.color.task_edit_deadline_gray));
borderPaint.setStyle(Style.STROKE);
@ -124,7 +121,7 @@ public class CalendarView extends View {
calendarSelectedNumberRightAlignPaint.setTextSize(TEXT_SIZE * density);
calendarSelectedNumberRightAlignPaint.setTextAlign(Paint.Align.RIGHT);
dayPaint = new Paint();
Paint dayPaint = new Paint();
dayPaint.setAntiAlias(true);
dayPaint.setColor(Color.rgb(137, 135, 132));
@ -134,7 +131,7 @@ public class CalendarView extends View {
monthCenterAlignLargePaint.setTextAlign(Paint.Align.CENTER);
monthCenterAlignLargePaint.setTextSize(MONTH_TEXT_SIZE * density);
centerAlignPaint = new Paint();
Paint centerAlignPaint = new Paint();
centerAlignPaint.setAntiAlias(true);
centerAlignPaint.setColor(r.getColor(R.color.task_edit_deadline_gray));
centerAlignPaint.setTextAlign(Paint.Align.CENTER);

@ -25,8 +25,6 @@ public class DateAndTimeDialog extends Dialog {
}
private final DateAndTimePicker dateAndTimePicker;
private final Button okButton;
private final Button cancelButton;
private boolean cancelled = false;
private DateAndTimeDialogListener listener;
@ -54,8 +52,8 @@ public class DateAndTimeDialog extends Dialog {
dateAndTimePicker = (DateAndTimePicker) findViewById(R.id.date_and_time);
dateAndTimePicker.initializeWithDate(startDate);
okButton = (Button) findViewById(R.id.ok);
cancelButton = (Button) findViewById(R.id.cancel);
Button okButton = (Button) findViewById(R.id.ok);
Button cancelButton = (Button) findViewById(R.id.cancel);
okButton.setOnClickListener(new View.OnClickListener() {
@Override

@ -32,8 +32,6 @@ public class DateAndTimePicker extends LinearLayout {
private static final int SHORTCUT_PADDING = 8;
private ArrayList<UrgencyValue> urgencyValues;
private class UrgencyValue {
public String label;
public int setting;
@ -152,7 +150,7 @@ public class DateAndTimePicker extends LinearLayout {
}
String[] labels = context.getResources().getStringArray(arrayResource);
urgencyValues = new ArrayList<UrgencyValue>();
ArrayList<UrgencyValue> urgencyValues = new ArrayList<UrgencyValue>();
todayUrgency = new UrgencyValue(labels[2],
Task.URGENCY_TODAY);
if (useShortcuts) {

@ -138,7 +138,7 @@ public class DeadlineControlSet extends PopupControlSet {
* Set whether date and time should be separated by a newline or a comma
* in the display view
*/
public void setIsQuickadd(boolean isQuickadd) {
this.isQuickadd = isQuickadd;
public void setIsQuickadd() {
this.isQuickadd = true;
}
}

@ -150,18 +150,10 @@ public class DraggableListView extends ListView {
/*
* Restore size and visibility for all list items
*/
private void unExpandViews(boolean deletion) {
private void unExpandViews() {
for (int i = 0;; i++) {
View v = getChildAt(i);
if (v == null) {
if (deletion) {
// HACK force update of mItemCount
int position = getFirstVisiblePosition();
int y = getChildAt(0).getTop();
setAdapter(getAdapter());
setSelectionFromTop(position, y);
// end hack
}
layoutChildren(); // force children to be recreated where needed
v = getChildAt(i);
if (v == null) {
@ -471,7 +463,7 @@ public class DraggableListView extends ListView {
mDragBitmap = null;
}
unExpandViews(false);
unExpandViews();
if (mDragView != null) {
WindowManager wm = (WindowManager) getContext().getSystemService(

@ -68,32 +68,25 @@ public class NumberPicker extends LinearLayout implements OnClickListener,
private final Runnable mRunnable = new Runnable() {
@Override
public void run() {
long speed = 60;
if (mIncrement) {
changeCurrent(mCurrent + incrementBy);
mHandler.postDelayed(this, mSpeed);
mHandler.postDelayed(this, speed);
} else if (mDecrement) {
changeCurrent(mCurrent - incrementBy);
mHandler.postDelayed(this, mSpeed);
mHandler.postDelayed(this, speed);
}
}
};
private final LayoutInflater mInflater;
private final EditText mText;
private final InputFilter mInputFilter;
private final InputFilter mNumberInputFilter;
private final Animation mSlideUpOutAnimation;
private final Animation mSlideUpInAnimation;
private final Animation mSlideDownOutAnimation;
private final Animation mSlideDownInAnimation;
private int mStart;
private int mEnd;
private int mCurrent;
private OnChangedListener mListener;
private Formatter mFormatter;
private long mSpeed = 60;
private boolean mIncrement;
private boolean mDecrement;
@ -117,10 +110,10 @@ public class NumberPicker extends LinearLayout implements OnClickListener,
public NumberPicker(Context context, AttributeSet attrs) {
super(context, attrs);
setOrientation(VERTICAL);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mInflater.inflate(getLayout(), this, true);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(getLayout(), this, true);
mHandler = new Handler();
mInputFilter = new NumberPickerInputFilter();
InputFilter inputFilter = new NumberPickerInputFilter();
mNumberInputFilter = new NumberRangeKeyListener();
mIncrementButton = (NumberPickerButton) findViewById(R.id.increment);
mIncrementButton.setOnClickListener(this);
@ -133,27 +126,27 @@ public class NumberPicker extends LinearLayout implements OnClickListener,
mText = (EditText) findViewById(R.id.timepicker_input);
mText.setOnFocusChangeListener(this);
mText.setFilters(new InputFilter[] { mInputFilter });
mText.setFilters(new InputFilter[] {inputFilter});
// disable keyboard until user requests it
AndroidUtilities.suppressVirtualKeyboard(mText);
mSlideUpOutAnimation = new TranslateAnimation(
Animation slideUpOutAnimation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0,
Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, -100);
mSlideUpOutAnimation.setDuration(200);
mSlideUpInAnimation = new TranslateAnimation(
slideUpOutAnimation.setDuration(200);
Animation slideUpInAnimation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0,
Animation.RELATIVE_TO_SELF, 100, Animation.RELATIVE_TO_SELF, 0);
mSlideUpInAnimation.setDuration(200);
mSlideDownOutAnimation = new TranslateAnimation(
slideUpInAnimation.setDuration(200);
Animation slideDownOutAnimation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0,
Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 100);
mSlideDownOutAnimation.setDuration(200);
mSlideDownInAnimation = new TranslateAnimation(
slideDownOutAnimation.setDuration(200);
Animation slideDownInAnimation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0,
Animation.RELATIVE_TO_SELF, -100, Animation.RELATIVE_TO_SELF, 0);
mSlideDownInAnimation.setDuration(200);
slideDownInAnimation.setDuration(200);
if (!isEnabled()) {
setEnabled(false);

@ -217,7 +217,7 @@ public class QuickAddBar extends LinearLayout {
R.layout.control_set_deadline,
R.layout.control_set_default_display, null,
repeatControl.getDisplayView(), gcalControl.getDisplayView());
deadlineControl.setIsQuickadd(true);
deadlineControl.setIsQuickadd();
resetControlSets();

@ -26,8 +26,6 @@ import org.tasks.R;
*
*/
public class RandomReminderControlSet extends TaskEditControlSet {
/** default interval for spinner if date is unselected */
private final long DEFAULT_INTERVAL = DateUtilities.ONE_WEEK * 2;
private final CheckBox settingCheckbox;
private final Spinner periodSpinner;
@ -81,7 +79,8 @@ public class RandomReminderControlSet extends TaskEditControlSet {
boolean enabled = time > 0;
if(time <= 0) {
time = DEFAULT_INTERVAL;
/* default interval for spinner if date is unselected */
time = DateUtilities.ONE_WEEK * 2;
}
int i;

@ -16,14 +16,14 @@ import org.tasks.R;
public class AstridDefaultPreferenceSpec extends AstridPreferenceSpec {
public static interface PreferenceExtras {
public void setExtras(Context context, SharedPreferences prefs, Editor editor, Resources r, boolean ifUnset);
public void setExtras(Context context);
}
@Override
public void setIfUnset() {
PreferenceExtras extras = new PreferenceExtras() {
@Override
public void setExtras(Context context, SharedPreferences prefs, Editor editor, Resources r, boolean ifUnset) {
public void setExtras(Context context) {
String dragDropTestInitialized = "android_drag_drop_initialized"; //$NON-NLS-1$
if (!Preferences.getBoolean(dragDropTestInitialized, false)) {
SharedPreferences publicPrefs = AstridPreferences.getPublicPrefs(context);
@ -38,66 +38,62 @@ public class AstridDefaultPreferenceSpec extends AstridPreferenceSpec {
}
Preferences.setBoolean(dragDropTestInitialized, true);
}
BeastModePreferences.setDefaultOrder(context, false);
if (Constants.MARKET_STRATEGY.defaultPhoneLayout()) {
setPreference(prefs, editor, r, R.string.p_force_phone_layout, true, ifUnset);
}
BeastModePreferences.setDefaultOrder(context);
}
};
setPrefs(extras, true);
setPrefs(extras);
}
private static void setPrefs(PreferenceExtras extras, boolean ifUnset) {
private static void setPrefs(PreferenceExtras extras) {
Context context = ContextManager.getContext();
SharedPreferences prefs = Preferences.getPrefs(context);
Editor editor = prefs.edit();
Resources r = context.getResources();
setPreference(prefs, editor, r, R.string.p_default_urgency_key, 0, ifUnset);
setPreference(prefs, editor, r, R.string.p_default_importance_key, 2, ifUnset);
setPreference(prefs, editor, r, R.string.p_default_hideUntil_key, 0, ifUnset);
setPreference(prefs, editor, r, R.string.p_default_reminders_key, Task.NOTIFY_AT_DEADLINE | Task.NOTIFY_AFTER_DEADLINE, ifUnset);
setPreference(prefs, editor, r, R.string.p_rmd_default_random_hours, 0, ifUnset);
setPreference(prefs, editor, r, R.string.p_fontSize, 16, ifUnset);
setPreference(prefs, editor, r, R.string.p_showNotes, false, ifUnset);
setPreference(prefs, editor, r, R.string.p_default_urgency_key, 0);
setPreference(prefs, editor, r, R.string.p_default_importance_key, 2);
setPreference(prefs, editor, r, R.string.p_default_hideUntil_key, 0);
setPreference(prefs, editor, r, R.string.p_default_reminders_key, Task.NOTIFY_AT_DEADLINE | Task.NOTIFY_AFTER_DEADLINE);
setPreference(prefs, editor, r, R.string.p_rmd_default_random_hours, 0);
setPreference(prefs, editor, r, R.string.p_fontSize, 16);
setPreference(prefs, editor, r, R.string.p_showNotes, false);
setPreference(prefs, editor, r, R.string.p_field_missed_calls, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_field_missed_calls, true);
setPreference(prefs, editor, r, R.string.p_end_at_deadline, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_end_at_deadline, true);
setPreference(prefs, editor, r, R.string.p_rmd_persistent, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_rmd_persistent, true);
setPreference(prefs, editor, r, R.string.p_show_today_filter, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_recently_modified_filter, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_not_in_list_filter, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_today_filter, true);
setPreference(prefs, editor, r, R.string.p_show_recently_modified_filter, true);
setPreference(prefs, editor, r, R.string.p_show_not_in_list_filter, true);
setPreference(prefs, editor, r, R.string.p_show_menu_search, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_menu_sync, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_menu_sort, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_menu_search, true);
setPreference(prefs, editor, r, R.string.p_show_menu_sync, true);
setPreference(prefs, editor, r, R.string.p_show_menu_sort, true);
setPreference(prefs, editor, r, R.string.p_calendar_reminders, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_calendar_reminders, true);
setPreference(prefs, editor, r, R.string.p_use_filters, false, ifUnset);
setPreference(prefs, editor, r, R.string.p_use_filters, false);
setPreference(prefs, editor, r, R.string.p_use_dark_theme, false, ifUnset);
setPreference(prefs, editor, r, R.string.p_use_dark_theme, false);
setPreference(prefs, editor, r, R.string.p_force_phone_layout, false, ifUnset);
setPreference(prefs, editor, r, R.string.p_force_phone_layout, false);
setPreference(prefs, editor, r, R.string.p_show_quickadd_controls, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_quickadd_controls, true);
setPreference(prefs, editor, r, R.string.p_show_task_edit_comments, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_task_edit_comments, true);
setPreference(prefs, editor, r, R.string.p_taskRowStyle_v2, "1", ifUnset); //$NON-NLS-1$
setPreference(prefs, editor, r, R.string.p_taskRowStyle_v2, "1"); //$NON-NLS-1$
setPreference(prefs, editor, r, R.string.p_use_date_shortcuts, false, ifUnset);
setPreference(prefs, editor, r, R.string.p_use_date_shortcuts, false);
setPreference(prefs, editor, r, R.string.p_save_and_cancel, false, ifUnset);
setPreference(prefs, editor, r, R.string.p_save_and_cancel, false);
setPreference(prefs, editor, r, R.string.p_hide_plus_button, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_hide_plus_button, true);
extras.setExtras(context, prefs, editor, r, ifUnset);
extras.setExtras(context);
editor.commit();
}

@ -9,27 +9,15 @@ import com.todoroo.andlib.utility.Preferences;
public abstract class AstridPreferenceSpec {
public abstract void setIfUnset();
protected static void setPreference(SharedPreferences prefs, Editor editor, Resources r, int key, int value, boolean ifUnset) {
if (ifUnset) {
Preferences.setIfUnset(prefs, editor, r, key, value);
} else {
Preferences.setString(r.getString(key), Integer.toString(value));
}
protected static void setPreference(SharedPreferences prefs, Editor editor, Resources r, int key, int value) {
Preferences.setIfUnset(prefs, editor, r, key, value);
}
protected static void setPreference(SharedPreferences prefs, Editor editor, Resources r, int key, boolean value, boolean ifUnset) {
if (ifUnset) {
Preferences.setIfUnset(prefs, editor, r, key, value);
} else {
Preferences.setBoolean(r.getString(key), value);
}
protected static void setPreference(SharedPreferences prefs, Editor editor, Resources r, int key, boolean value) {
Preferences.setIfUnset(prefs, editor, r, key, value);
}
protected static void setPreference(SharedPreferences prefs, Editor editor, Resources r, int key, String value, boolean ifUnset) {
if (ifUnset) {
Preferences.setIfUnset(prefs, editor, r, key, value);
} else {
Preferences.setString(r.getString(key), value);
}
protected static void setPreference(SharedPreferences prefs, Editor editor, Resources r, int key, String value) {
Preferences.setIfUnset(prefs, editor, r, key, value);
}
}

@ -16,11 +16,6 @@ public final class Constants {
*/
public static final String PACKAGE = "org.tasks";
/**
* Whether this is an OEM installation
*/
public static final boolean OEM = false;
/**
* Market selection strategy
*/

@ -14,7 +14,7 @@ public class Flags {
* writing a background service, send a BROADCAST_EVENT_REFRESH
* instead, as this is only checked periodically and when loading task list.
*/
public static final int REFRESH = 1 << 0;
public static final int REFRESH = 1;
/**
* If set, indicates tags changed during task save

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

Loading…
Cancel
Save