Snackbar shows when alarm is deleted

This commit is contained in:
Phillip Hsu
2016-06-30 03:22:25 -07:00
parent 43e9c20468
commit 31385ad9b4
2 changed files with 13 additions and 1 deletions
@@ -125,7 +125,13 @@ public class AlarmsFragment extends Fragment implements LoaderCallbacks<Cursor>,
switch (requestCode) {
case REQUEST_CREATE_ALARM:
getLoaderManager().restartLoader(0, null, this);
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);
break;
default:
@@ -141,6 +147,8 @@ public class AlarmsFragment extends Fragment implements LoaderCallbacks<Cursor>,
startActivityForResult(intent, REQUEST_EDIT_ALARM);
}
// TODO: This doesn't need to be defined in the interface.
// TODO: Rename to showDeletedSnackbar() or something
@Override
public void onListItemDeleted(final Alarm item) {
Snackbar.make(getActivity().findViewById(R.id.main_content),