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 { ...@@ -368,7 +368,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
@OnClick(R.id.variable_screen_back_text_view) @OnClick(R.id.variable_screen_back_text_view)
void backOnClicked() { void backOnClicked() {
finish(); showNavigationBackDialog();
} }
private void saveFormData() { private void saveFormData() {
...@@ -626,7 +626,7 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -626,7 +626,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
@Override @Override
public boolean onOptionsItemSelected(MenuItem menuItem) { public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == android.R.id.home) { if (menuItem.getItemId() == android.R.id.home) {
finish(); showNavigationBackDialog();
} }
return super.onOptionsItemSelected(menuItem); return super.onOptionsItemSelected(menuItem);
} }
...@@ -841,4 +841,28 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -841,4 +841,28 @@ public class CatalogueVariableScreen extends AppCompatActivity {
AlertDialog alert = builder.create(); AlertDialog alert = builder.create();
alert.show(); 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 @@ ...@@ -56,6 +56,8 @@
<string name="variable_form_ui_page_button_label_string">Add Attachment</string> <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="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="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--> <!--Catalogue Item Screen-->
<string name="no_catalogue_item_string">No Catalogue Items&#8230;</string> <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