spaces for tabs

pull/14/head
Tim Su 14 years ago
parent e28d868454
commit 47d0222d2e

@ -86,13 +86,13 @@ public final class LocaleEditAlerts extends ExpandableListActivity {
*/
private boolean isCancelled = false;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.locale_edit_alerts);
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.locale_edit_alerts);
/*
/*
* Locale guarantees that the breadcrumb string will be present, but checking for null anyway makes your Activity more
* robust and re-usable
*/
@ -166,7 +166,7 @@ public final class LocaleEditAlerts extends ExpandableListActivity {
adapter.headerStyle = R.style.TextAppearance_LEA_Header;
adapter.categoryStyle = R.style.TextAppearance_LEA_Category;
setListAdapter(adapter);
}
}
@Override
public boolean onChildClick(ExpandableListView parent, View v,

@ -45,54 +45,54 @@ public class LocaleReceiver extends BroadcastReceiver {
@Override
/** Called when the system is started up */
public void onReceive(Context context, Intent intent) {
try {
if (com.twofortyfouram.Intent.ACTION_FIRE_SETTING.equals(intent.getAction())) {
final String title = intent.getStringExtra(LocaleEditAlerts.KEY_FILTER_TITLE);
final String sql = intent.getStringExtra(LocaleEditAlerts.KEY_SQL);
final int interval = intent.getIntExtra(LocaleEditAlerts.KEY_INTERVAL, 24*3600);
try {
if (com.twofortyfouram.Intent.ACTION_FIRE_SETTING.equals(intent.getAction())) {
final String title = intent.getStringExtra(LocaleEditAlerts.KEY_FILTER_TITLE);
final String sql = intent.getStringExtra(LocaleEditAlerts.KEY_SQL);
final int interval = intent.getIntExtra(LocaleEditAlerts.KEY_INTERVAL, 24*3600);
if(TextUtils.isEmpty(title) || TextUtils.isEmpty(sql) ||
sql.contains("--") || sql.contains(";") || interval == 0)
return;
if(TextUtils.isEmpty(title) || TextUtils.isEmpty(sql) ||
sql.contains("--") || sql.contains(";") || interval == 0)
return;
// check if we've already made a notification recently
String preferenceKey = makePreferenceKey(title, interval);
long lastNotifyTime = Preferences.getLong(preferenceKey, 0);
if(DateUtilities.now() - lastNotifyTime < interval * 1000L) {
Log.i("astrid-locale-rx", title + ": Too soon, need " + (interval
- (DateUtilities.now() - lastNotifyTime)/1000) + " more seconds");
return;
}
// check if we've already made a notification recently
String preferenceKey = makePreferenceKey(title, interval);
long lastNotifyTime = Preferences.getLong(preferenceKey, 0);
if(DateUtilities.now() - lastNotifyTime < interval * 1000L) {
Log.i("astrid-locale-rx", title + ": Too soon, need " + (interval
- (DateUtilities.now() - lastNotifyTime)/1000) + " more seconds");
return;
}
// find out if we have active tasks with this tag
DependencyInjectionService.getInstance().inject(this);
Filter filter = new Filter(title, title, null, null);
filter.sqlQuery = sql;
TodorooCursor<Task> cursor = taskService.fetchFiltered(filter, null, Task.ID);
try {
if(cursor.getCount() == 0)
return;
Resources r = context.getResources();
String reminder = r.getString(R.string.locale_notification).
replace("$NUM", r.getQuantityString(R.plurals.Ntasks,
cursor.getCount(), cursor.getCount())).
replace("$FILTER", title);
// find out if we have active tasks with this tag
DependencyInjectionService.getInstance().inject(this);
Filter filter = new Filter(title, title, null, null);
filter.sqlQuery = sql;
TodorooCursor<Task> cursor = taskService.fetchFiltered(filter, null, Task.ID);
try {
if(cursor.getCount() == 0)
return;
Resources r = context.getResources();
String reminder = r.getString(R.string.locale_notification).
replace("$NUM", r.getQuantityString(R.plurals.Ntasks,
cursor.getCount(), cursor.getCount())).
replace("$FILTER", title);
// show a reminder
String notificationTitle = r.getString(R.string.locale_edit_alerts_title);
Intent notifyIntent = ShortcutActivity.createIntent(filter);
notifyIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Notifications.showNotification(Constants.NOTIFICATION_LOCALE,
notifyIntent, 0, notificationTitle, reminder, false);
// show a reminder
String notificationTitle = r.getString(R.string.locale_edit_alerts_title);
Intent notifyIntent = ShortcutActivity.createIntent(filter);
notifyIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Notifications.showNotification(Constants.NOTIFICATION_LOCALE,
notifyIntent, 0, notificationTitle, reminder, false);
Preferences.setLong(preferenceKey, DateUtilities.now());
} finally {
cursor.close();
}
}
} catch (Exception e) {
Log.i("astrid-locale-rx", "Error receiving intent", e);
}
Preferences.setLong(preferenceKey, DateUtilities.now());
} finally {
cursor.close();
}
}
} catch (Exception e) {
Log.i("astrid-locale-rx", "Error receiving intent", e);
}
}
}

Loading…
Cancel
Save