From 85fc5e7ebfbde91aaaff94e7ba89ca15c3c2a81c Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Thu, 17 Aug 2017 06:06:35 -0500 Subject: [PATCH] ConfigListFragment: Restore the non-FAB add menu Signed-off-by: Jason A. Donenfeld --- .../java/com/wireguard/android/ConfigActivity.java | 3 +++ .../com/wireguard/android/ConfigListFragment.java | 12 ++++++++++++ app/src/main/res/menu/config_list.xml | 9 +++++++++ app/src/main/res/values/strings.xml | 1 + 4 files changed, 25 insertions(+) create mode 100644 app/src/main/res/menu/config_list.xml diff --git a/app/src/main/java/com/wireguard/android/ConfigActivity.java b/app/src/main/java/com/wireguard/android/ConfigActivity.java index fb565e96..bd455be8 100644 --- a/app/src/main/java/com/wireguard/android/ConfigActivity.java +++ b/app/src/main/java/com/wireguard/android/ConfigActivity.java @@ -95,6 +95,9 @@ public class ConfigActivity extends BaseConfigActivity { case android.R.id.home: onBackPressed(); return true; + case R.id.menu_action_add: + startActivity(new Intent(this, ConfigAddActivity.class)); + return true; case R.id.menu_action_edit: isEditing = true; switchToFragment(mainContainer, TAG_EDIT, true); diff --git a/app/src/main/java/com/wireguard/android/ConfigListFragment.java b/app/src/main/java/com/wireguard/android/ConfigListFragment.java index ed21ac00..ab87571b 100644 --- a/app/src/main/java/com/wireguard/android/ConfigListFragment.java +++ b/app/src/main/java/com/wireguard/android/ConfigListFragment.java @@ -7,6 +7,7 @@ import android.util.Log; import android.view.ActionMode; import android.view.LayoutInflater; import android.view.Menu; +import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; @@ -27,6 +28,17 @@ import java.util.List; public class ConfigListFragment extends BaseConfigFragment { private ListView listView; + @Override + public void onCreate(final Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setHasOptionsMenu(true); + } + + @Override + public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { + inflater.inflate(R.menu.config_list, menu); + } + @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup parent, final Bundle savedInstanceState) { diff --git a/app/src/main/res/menu/config_list.xml b/app/src/main/res/menu/config_list.xml new file mode 100644 index 00000000..ef1651f6 --- /dev/null +++ b/app/src/main/res/menu/config_list.xml @@ -0,0 +1,9 @@ + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4c781c21..9397dcf3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4,6 +4,7 @@ %d configuration selected %d configurations selected + Add WireGuard Configuration name Delete