From 0208e58a3bc18abe93edd615bd625795f2b6fc15 Mon Sep 17 00:00:00 2001 From: str4d <str4d@mail.i2p> Date: Thu, 5 Sep 2013 12:25:32 +0000 Subject: [PATCH] Fixed previous commit Refreshing is now disabled in PeersFragment and WebFragment, but both of them will eventually be removed. --- ..._actions.xml => activity_main_actions.xml} | 0 .../router/activity/I2PActivityBase.java | 34 +------------------ .../android/router/activity/MainActivity.java | 30 ++++++++++++++++ .../android/router/fragment/MainFragment.java | 7 ---- .../router/fragment/PeersFragment.java | 2 ++ .../android/router/fragment/WebFragment.java | 2 ++ 6 files changed, 35 insertions(+), 40 deletions(-) rename res/menu/{fragment_main_actions.xml => activity_main_actions.xml} (100%) diff --git a/res/menu/fragment_main_actions.xml b/res/menu/activity_main_actions.xml similarity index 100% rename from res/menu/fragment_main_actions.xml rename to res/menu/activity_main_actions.xml diff --git a/src/net/i2p/android/router/activity/I2PActivityBase.java b/src/net/i2p/android/router/activity/I2PActivityBase.java index 2614f59e4..9c3d606b4 100644 --- a/src/net/i2p/android/router/activity/I2PActivityBase.java +++ b/src/net/i2p/android/router/activity/I2PActivityBase.java @@ -260,39 +260,7 @@ public abstract class I2PActivityBase extends ActionBarActivity implements } // Handle action buttons and overflow - switch (item.getItemId()) { - case R.id.menu_settings: - Intent intent = new Intent(I2PActivityBase.this, SettingsActivity.class); - startActivity(intent); - return true; - - case R.id.menu_help: - Intent hi = new Intent(I2PActivityBase.this, HelpActivity.class); - hi.putExtra(HelpActivity.REFERRER, "main"); - startActivity(hi); - return true; - - case R.id.menu_start: - RouterService svc = _routerService; - if (svc != null && _isBound && svc.canManualStart()) { - setPref(PREF_AUTO_START, true); - svc.manualStart(); - } else { - startRouter(); - } - return true; - - case R.id.menu_stop: - RouterService rsvc = _routerService; - if (rsvc != null && _isBound && rsvc.canManualStop()) { - setPref(PREF_AUTO_START, false); - rsvc.manualStop(); - } - return true; - - default: - return super.onOptionsItemSelected(item); - } + return super.onOptionsItemSelected(item); } @Override diff --git a/src/net/i2p/android/router/activity/MainActivity.java b/src/net/i2p/android/router/activity/MainActivity.java index e00dfa761..649ec2315 100644 --- a/src/net/i2p/android/router/activity/MainActivity.java +++ b/src/net/i2p/android/router/activity/MainActivity.java @@ -2,7 +2,11 @@ package net.i2p.android.router.activity; import java.io.File; +import android.content.Intent; import android.os.Bundle; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import net.i2p.android.router.R; import net.i2p.android.router.fragment.MainFragment; import net.i2p.android.router.fragment.VersionDialog; @@ -34,6 +38,32 @@ public class MainActivity extends I2PActivityBase implements super.onPostCreate(savedInstanceState); } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.activity_main_actions, menu); + return super.onCreateOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.menu_settings: + Intent intent = new Intent(MainActivity.this, SettingsActivity.class); + startActivity(intent); + return true; + + case R.id.menu_help: + Intent hi = new Intent(MainActivity.this, HelpActivity.class); + hi.putExtra(HelpActivity.REFERRER, "main"); + startActivity(hi); + return true; + + default: + return super.onOptionsItemSelected(item); + } + } + // MainFragment.RouterControlListener public boolean shouldShowStart() { diff --git a/src/net/i2p/android/router/fragment/MainFragment.java b/src/net/i2p/android/router/fragment/MainFragment.java index 6aa0c7216..5ff43d499 100644 --- a/src/net/i2p/android/router/fragment/MainFragment.java +++ b/src/net/i2p/android/router/fragment/MainFragment.java @@ -4,8 +4,6 @@ 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; @@ -199,11 +197,6 @@ 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) { diff --git a/src/net/i2p/android/router/fragment/PeersFragment.java b/src/net/i2p/android/router/fragment/PeersFragment.java index 893ebfe09..58f0e07bc 100644 --- a/src/net/i2p/android/router/fragment/PeersFragment.java +++ b/src/net/i2p/android/router/fragment/PeersFragment.java @@ -86,9 +86,11 @@ public class PeersFragment extends I2PFragmentBase { public boolean onOptionsItemSelected(MenuItem item) { WebView wv = (WebView) getActivity().findViewById(R.id.peers_webview); switch (item.getItemId()) { + /* case R.id.menu_reload: update(); return true; + */ default: return super.onOptionsItemSelected(item); diff --git a/src/net/i2p/android/router/fragment/WebFragment.java b/src/net/i2p/android/router/fragment/WebFragment.java index cb31713f6..c42fb5969 100644 --- a/src/net/i2p/android/router/fragment/WebFragment.java +++ b/src/net/i2p/android/router/fragment/WebFragment.java @@ -96,6 +96,7 @@ public class WebFragment extends I2PFragmentBase { public boolean onOptionsItemSelected(MenuItem item) { WebView wv = (WebView) getActivity().findViewById(R.id.browser_webview); switch (item.getItemId()) { + /* case R.id.menu_reload: _wvClient.cancelAll(); wv.stopLoading(); @@ -110,6 +111,7 @@ public class WebFragment extends I2PFragmentBase { _wvClient.shouldOverrideUrlLoading(wv, url); } return true; + */ default: return super.onOptionsItemSelected(item); -- GitLab