diff --git a/res/menu/activity_main_actions.xml b/res/menu/activity_main_actions.xml deleted file mode 100755 index 60e47760ac9fe29be300eb65ea83ba16da00c5e7..0000000000000000000000000000000000000000 --- a/res/menu/activity_main_actions.xml +++ /dev/null @@ -1,27 +0,0 @@ -<menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:i2pandroid="http://schemas.android.com/apk/res-auto"> - <item android:title="@string/action_router_start" - android:id="@+id/menu_start" - android:icon="@drawable/ic_av_play" - i2pandroid:showAsAction="ifRoom" > - </item> - <item android:title="@string/action_router_stop" - android:id="@+id/menu_stop" - android:icon="@drawable/ic_av_stop" - i2pandroid:showAsAction="ifRoom" > - </item> - <item android:title="@string/action_reload" - android:id="@+id/menu_reload" - android:icon="@drawable/ic_navigation_refresh" - i2pandroid:showAsAction="ifRoom" > - </item> - <item android:title="@string/menu_settings" - android:id="@+id/menu_settings" - android:icon="@android:drawable/ic_menu_preferences" - i2pandroid:showAsAction="never" > - </item> - <item android:title="@string/menu_help" - android:id="@+id/menu_help" - i2pandroid:showAsAction="never" > - </item> -</menu> diff --git a/res/menu/fragment_main_actions.xml b/res/menu/fragment_main_actions.xml new file mode 100755 index 0000000000000000000000000000000000000000..ab07512ef3e0bea97b7f33623e237f853c8ca98a --- /dev/null +++ b/res/menu/fragment_main_actions.xml @@ -0,0 +1,12 @@ +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:i2pandroid="http://schemas.android.com/apk/res-auto"> + <item android:title="@string/menu_settings" + android:id="@+id/menu_settings" + android:icon="@android:drawable/ic_menu_preferences" + i2pandroid:showAsAction="never" > + </item> + <item android:title="@string/menu_help" + android:id="@+id/menu_help" + i2pandroid:showAsAction="never" > + </item> +</menu> diff --git a/src/net/i2p/android/router/activity/I2PActivityBase.java b/src/net/i2p/android/router/activity/I2PActivityBase.java index d5b9747bd23fef4dc26175cdb8137bf609bdb45f..2614f59e4e21720b7ebe47df34458199718141ba 100644 --- a/src/net/i2p/android/router/activity/I2PActivityBase.java +++ b/src/net/i2p/android/router/activity/I2PActivityBase.java @@ -16,7 +16,6 @@ import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar.Tab; import android.view.Menu; -import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; @@ -232,31 +231,11 @@ public abstract class I2PActivityBase extends ActionBarActivity implements super.onDestroy(); } - @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.activity_main_actions, menu); - return true; - } - /** * Called whenever we call invalidateOptionsMenu() */ @Override public boolean onPrepareOptionsMenu(Menu menu) { - // add/hide items here - RouterService svc = _routerService; - boolean showStart = ((svc == null) || (!_isBound) || svc.canManualStart()) && - Util.isConnected(this); - MenuItem start = menu.findItem(R.id.menu_start); - start.setVisible(showStart); - start.setEnabled(showStart); - - boolean showStop = svc != null && _isBound && svc.canManualStop(); - MenuItem stop = menu.findItem(R.id.menu_stop); - stop.setVisible(showStop); - stop.setEnabled(showStop); - // If the nav drawer is open, hide action items related to the content view boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList); onDrawerChange(drawerOpen); diff --git a/src/net/i2p/android/router/fragment/MainFragment.java b/src/net/i2p/android/router/fragment/MainFragment.java index 5ff43d499dde06be6d98b5caf4b9c8244da51c4a..6aa0c7216f839112071c96b3f6fbcea40f2d9a18 100644 --- a/src/net/i2p/android/router/fragment/MainFragment.java +++ b/src/net/i2p/android/router/fragment/MainFragment.java @@ -4,6 +4,8 @@ import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; @@ -197,6 +199,11 @@ public class MainFragment extends I2PFragmentBase { updateOneShot(); } + @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + inflater.inflate(R.menu.fragment_main_actions, menu); + } + @Override public void onSaveInstanceState(Bundle outState) { if(_savedStatus != null) {