Up button navigation now doing same as back button.

This commit is contained in:
GaidamakUA 2015-11-03 19:49:48 +02:00
parent e4f786cbaa
commit 41ea53257e

View file

@ -135,7 +135,7 @@ public class EditPoiDialogFragment extends DialogFragment {
toolbar.setNavigationOnClickListener(new View.OnClickListener() { toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
dismiss(); dismissCheckForChanges();
} }
}); });
@ -337,12 +337,7 @@ public class EditPoiDialogFragment extends DialogFragment {
LOG.debug("onKey hasChangesBeenMade" + editPoiData.hasChangesBeenMade()); LOG.debug("onKey hasChangesBeenMade" + editPoiData.hasChangesBeenMade());
return true; return true;
} else { } else {
if (editPoiData.hasChangesBeenMade()) { dismissCheckForChanges();
new AreYouSureDialogFragment().show(getChildFragmentManager(),
"AreYouSureDialogFragment");
} else {
dismiss();
}
return true; return true;
} }
} }
@ -351,6 +346,15 @@ public class EditPoiDialogFragment extends DialogFragment {
}); });
} }
private void dismissCheckForChanges() {
if (editPoiData.hasChangesBeenMade()) {
new AreYouSureDialogFragment().show(getChildFragmentManager(),
"AreYouSureDialogFragment");
} else {
dismiss();
}
}
@Override @Override
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState) {
outState.putSerializable(TAGS_LIST, (Serializable) editPoiData.getTagValues()); outState.putSerializable(TAGS_LIST, (Serializable) editPoiData.getTagValues());