Commit 0fbca9d9 by Kunj Gupta

UOFLMA-96: Added Alert dialogue when we click on BACK in dynamic forms.

parent 8a3bd7a0
......@@ -368,7 +368,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
@OnClick(R.id.variable_screen_back_text_view)
void backOnClicked() {
finish();
showNavigationBackDialog();
}
private void saveFormData() {
......@@ -626,7 +626,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == android.R.id.home) {
finish();
showNavigationBackDialog();
}
return super.onOptionsItemSelected(menuItem);
}
......@@ -841,4 +841,28 @@ public class CatalogueVariableScreen extends AppCompatActivity {
AlertDialog alert = builder.create();
alert.show();
}
@Override
public void onBackPressed() {
showNavigationBackDialog();
}
private void showNavigationBackDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.variable_form_back_navigation_string)
.setCancelable(false)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
})
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
}
}
\ No newline at end of file
......@@ -56,6 +56,8 @@
<string name="variable_form_ui_page_button_label_string">Add Attachment</string>
<string name="variable_form_ui_page_no_selected_attachment_string">Not Selected</string>
<string name="custom_setting_storage_permission_dialog_msg_string">To use this feature, please go to Settings -> Apps -> %s -> Permissions and enable \'Storage\' permission</string>
<string name="variable_form_back_navigation_string">Are you sure you want to navigate away?</string>
<!--Catalogue Item Screen-->
<string name="no_catalogue_item_string">No Catalogue Items&#8230;</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment