Snackbar shows when alarm is deleted
This commit is contained in:
parent
43e9c20468
commit
31385ad9b4
@ -125,7 +125,13 @@ public class AlarmsFragment extends Fragment implements LoaderCallbacks<Cursor>,
|
|||||||
|
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case REQUEST_CREATE_ALARM:
|
case REQUEST_CREATE_ALARM:
|
||||||
|
getLoaderManager().restartLoader(0, null, this);
|
||||||
case REQUEST_EDIT_ALARM:
|
case REQUEST_EDIT_ALARM:
|
||||||
|
if (data != null && data.getBooleanExtra(
|
||||||
|
EditAlarmActivity.EXTRA_ALARM_DELETED, false)) {
|
||||||
|
// TODO: Pass in the old alarm into the intent and access it here?
|
||||||
|
onListItemDeleted(null);
|
||||||
|
}
|
||||||
getLoaderManager().restartLoader(0, null, this);
|
getLoaderManager().restartLoader(0, null, this);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -141,6 +147,8 @@ public class AlarmsFragment extends Fragment implements LoaderCallbacks<Cursor>,
|
|||||||
startActivityForResult(intent, REQUEST_EDIT_ALARM);
|
startActivityForResult(intent, REQUEST_EDIT_ALARM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This doesn't need to be defined in the interface.
|
||||||
|
// TODO: Rename to showDeletedSnackbar() or something
|
||||||
@Override
|
@Override
|
||||||
public void onListItemDeleted(final Alarm item) {
|
public void onListItemDeleted(final Alarm item) {
|
||||||
Snackbar.make(getActivity().findViewById(R.id.main_content),
|
Snackbar.make(getActivity().findViewById(R.id.main_content),
|
||||||
|
|||||||
@ -58,6 +58,7 @@ public class EditAlarmActivity extends BaseActivity implements AlarmNumpad.KeyLi
|
|||||||
LoaderManager.LoaderCallbacks<Alarm> {
|
LoaderManager.LoaderCallbacks<Alarm> {
|
||||||
private static final String TAG = "EditAlarmActivity";
|
private static final String TAG = "EditAlarmActivity";
|
||||||
public static final String EXTRA_ALARM_ID = "com.philliphsu.clock2.editalarm.extra.ALARM_ID";
|
public static final String EXTRA_ALARM_ID = "com.philliphsu.clock2.editalarm.extra.ALARM_ID";
|
||||||
|
public static final String EXTRA_ALARM_DELETED = "com.philliphsu.clock2.editalarm.extra.ALARM_DELETED";
|
||||||
private static final RelativeSizeSpan AMPM_SIZE_SPAN = new RelativeSizeSpan(0.5f);
|
private static final RelativeSizeSpan AMPM_SIZE_SPAN = new RelativeSizeSpan(0.5f);
|
||||||
|
|
||||||
private static final int REQUEST_PICK_RINGTONE = 0;
|
private static final int REQUEST_PICK_RINGTONE = 0;
|
||||||
@ -262,7 +263,10 @@ public class EditAlarmActivity extends BaseActivity implements AlarmNumpad.KeyLi
|
|||||||
}
|
}
|
||||||
mDatabaseManager.deleteAlarm(mOldAlarm);
|
mDatabaseManager.deleteAlarm(mOldAlarm);
|
||||||
}
|
}
|
||||||
setResult(RESULT_OK);
|
Intent intent = new Intent();
|
||||||
|
// TODO: Pass in the old alarm into the intent?
|
||||||
|
intent.putExtra(EXTRA_ALARM_DELETED, true);
|
||||||
|
setResult(RESULT_OK, intent);
|
||||||
showEditorClosed();
|
showEditorClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user