Add, update, and delete operations moved to background
This commit is contained in:
parent
1843c7222a
commit
4436d5852a
@ -105,8 +105,7 @@ public final class AsyncItemChangeHandler {
|
|||||||
.setAction(R.string.snackbar_undo_item_deleted, new View.OnClickListener() {
|
.setAction(R.string.snackbar_undo_item_deleted, new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
DatabaseManager.getInstance(mContext).insertAlarm(alarm);
|
asyncAddAlarm(alarm);
|
||||||
AlarmUtils.scheduleAlarm(mContext, alarm, true);
|
|
||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,7 +68,7 @@ public class EditAlarmActivity extends BaseActivity implements AlarmNumpad.KeyLi
|
|||||||
private long mOldAlarmId;
|
private long mOldAlarmId;
|
||||||
private Uri mSelectedRingtoneUri;
|
private Uri mSelectedRingtoneUri;
|
||||||
private Alarm mOldAlarm;
|
private Alarm mOldAlarm;
|
||||||
private DatabaseManager mDatabaseManager;
|
private DatabaseManager mDatabaseManager; // TODO: Delete this
|
||||||
|
|
||||||
@Bind(R.id.save) Button mSave;
|
@Bind(R.id.save) Button mSave;
|
||||||
@Bind(R.id.delete) Button mDelete;
|
@Bind(R.id.delete) Button mDelete;
|
||||||
@ -264,10 +264,11 @@ public class EditAlarmActivity extends BaseActivity implements AlarmNumpad.KeyLi
|
|||||||
if (mOldAlarm.isEnabled()) {
|
if (mOldAlarm.isEnabled()) {
|
||||||
cancelAlarm(mOldAlarm, false);
|
cancelAlarm(mOldAlarm, false);
|
||||||
// Re-enable in case this is restored so
|
// Re-enable in case this is restored so
|
||||||
// the alarm is scheduled again
|
// the alarm can be scheduled again. This
|
||||||
|
// change is saved to the db if the alarm
|
||||||
|
// is restored (re-inserting into to the db).
|
||||||
mOldAlarm.setEnabled(true);
|
mOldAlarm.setEnabled(true);
|
||||||
}
|
}
|
||||||
mDatabaseManager.deleteAlarm(mOldAlarm);
|
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra(EXTRA_IS_DELETING, true);
|
intent.putExtra(EXTRA_IS_DELETING, true);
|
||||||
intent.putExtra(EXTRA_MODIFIED_ALARM, mOldAlarm);
|
intent.putExtra(EXTRA_MODIFIED_ALARM, mOldAlarm);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user