summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Sapperstein <asapperstein@google.com>2019-02-05 13:02:36 -0800
committerAndrew Sapperstein <asapperstein@google.com>2019-02-05 13:02:36 -0800
commit1e261043f79418b20aa8a6757855ce1ea3f492c2 (patch)
tree9fdbf389a29ed72ac141718526f568cb52f17a50 /src
parent3eab36819313336018388163993b081393e6649d (diff)
downloadEmergencyInfo-1e261043f79418b20aa8a6757855ce1ea3f492c2.tar.gz
Add android_library target.
Put most of the app logic in a library so it is more easily reusable. Bug: 120115754 Test: build, verify that EmergencyInfo works Change-Id: I7b2ad172f9487df50a24f0b6c8076db37a865221
Diffstat (limited to 'src')
-rw-r--r--src/com/android/emergency/edit/EditInfoActivity.java19
-rw-r--r--src/com/android/emergency/view/ViewInfoActivity.java19
2 files changed, 18 insertions, 20 deletions
diff --git a/src/com/android/emergency/edit/EditInfoActivity.java b/src/com/android/emergency/edit/EditInfoActivity.java
index 8f19692e..7a6a01b8 100644
--- a/src/com/android/emergency/edit/EditInfoActivity.java
+++ b/src/com/android/emergency/edit/EditInfoActivity.java
@@ -92,16 +92,15 @@ public class EditInfoActivity extends Activity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // The user asked to navigate up, which, in this case, can easily be accomplished
- // by finishing the activity.
- finish();
- return true;
-
- case R.id.action_clear_all:
- showClearAllDialog();
- return true;
+ int itemId = item.getItemId();
+ if (itemId == android.R.id.home) {
+ // The user asked to navigate up, which, in this case, can easily be accomplished
+ // by finishing the activity.
+ finish();
+ return true;
+ } else if (itemId == R.id.action_clear_all) {
+ showClearAllDialog();
+ return true;
}
return super.onOptionsItemSelected(item);
}
diff --git a/src/com/android/emergency/view/ViewInfoActivity.java b/src/com/android/emergency/view/ViewInfoActivity.java
index dcf34cba..30bcae36 100644
--- a/src/com/android/emergency/view/ViewInfoActivity.java
+++ b/src/com/android/emergency/view/ViewInfoActivity.java
@@ -154,16 +154,15 @@ public class ViewInfoActivity extends FragmentActivity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- onBackPressed();
- return true;
-
- case R.id.action_edit:
- Intent intent = new Intent(this, EditInfoActivity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(intent);
- return true;
+ int itemId = item.getItemId();
+ if (itemId == android.R.id.home) {
+ onBackPressed();
+ return true;
+ } else if (itemId == R.id.action_edit) {
+ Intent intent = new Intent(this, EditInfoActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(intent);
+ return true;
}
return super.onOptionsItemSelected(item);
}