diff --git a/res/drawable-hdpi/ic_av_play.png b/res/drawable-hdpi/ic_av_play.png new file mode 100644 index 0000000000000000000000000000000000000000..df8a2ca28e1e3978a59dbe9cf415a59429357084 Binary files /dev/null and b/res/drawable-hdpi/ic_av_play.png differ diff --git a/res/drawable-hdpi/ic_av_stop.png b/res/drawable-hdpi/ic_av_stop.png new file mode 100644 index 0000000000000000000000000000000000000000..dd5d6a1c1bd14a1222647db5f2cc993e9f2c63f1 Binary files /dev/null and b/res/drawable-hdpi/ic_av_stop.png differ diff --git a/res/drawable-mdpi/ic_av_play.png b/res/drawable-mdpi/ic_av_play.png new file mode 100644 index 0000000000000000000000000000000000000000..6a40cd5f7bff6c57d8349bcba17648e2fdabedc4 Binary files /dev/null and b/res/drawable-mdpi/ic_av_play.png differ diff --git a/res/drawable-mdpi/ic_av_stop.png b/res/drawable-mdpi/ic_av_stop.png new file mode 100644 index 0000000000000000000000000000000000000000..20df415869bf4c224f577abc6fc30f107cada685 Binary files /dev/null and b/res/drawable-mdpi/ic_av_stop.png differ diff --git a/res/drawable-xhdpi/ic_av_play.png b/res/drawable-xhdpi/ic_av_play.png new file mode 100644 index 0000000000000000000000000000000000000000..51124993df109972aa504c796b17e788a3ed0efd Binary files /dev/null and b/res/drawable-xhdpi/ic_av_play.png differ diff --git a/res/drawable-xhdpi/ic_av_stop.png b/res/drawable-xhdpi/ic_av_stop.png new file mode 100644 index 0000000000000000000000000000000000000000..ee5eda25c7c059489d86e8204ab96c9dc026df9f Binary files /dev/null and b/res/drawable-xhdpi/ic_av_stop.png differ diff --git a/res/menu/fragment_i2ptunnel_detail_actions.xml b/res/menu/fragment_i2ptunnel_detail_actions.xml index 0b304fd9de2c2f95ba35dcff19db8e230a1a0a53..3c7e47bfdeb837af8448b6566b21b15d4ddca909 100644 --- a/res/menu/fragment_i2ptunnel_detail_actions.xml +++ b/res/menu/fragment_i2ptunnel_detail_actions.xml @@ -1,6 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:i2pandroid="http://schemas.android.com/apk/res-auto" > + <item android:id="@+id/action_start_tunnel" + android:title="@string/action_i2ptunnel_start" + android:icon="@drawable/ic_av_play" + i2pandroid:showAsAction="ifRoom" /> + <item android:id="@+id/action_stop_tunnel" + android:title="@string/action_i2ptunnel_stop" + android:icon="@drawable/ic_av_stop" + i2pandroid:showAsAction="ifRoom" /> <item android:id="@+id/action_edit_tunnel" android:title="@string/action_edit" android:icon="@drawable/ic_content_edit" diff --git a/res/menu/fragment_i2ptunnel_list_actions.xml b/res/menu/fragment_i2ptunnel_list_actions.xml index c17e84d2621071e29387a6c4d176c01995a27966..ce66d283409ab5b95fb03f55c746e7f16856f8c8 100644 --- a/res/menu/fragment_i2ptunnel_list_actions.xml +++ b/res/menu/fragment_i2ptunnel_list_actions.xml @@ -5,5 +5,14 @@ android:title="@string/action_add" android:icon="@drawable/ic_content_new" i2pandroid:showAsAction="ifRoom" /> + <item android:id="@+id/action_start_all_tunnels" + android:title="@string/action_i2ptunnel_start_all" + i2pandroid:showAsAction="never" /> + <item android:id="@+id/action_stop_all_tunnels" + android:title="@string/action_i2ptunnel_stop_all" + i2pandroid:showAsAction="never" /> + <item android:id="@+id/action_restart_all_tunnels" + android:title="@string/action_i2ptunnel_restart_all" + i2pandroid:showAsAction="never" /> </menu> diff --git a/res/values/strings.xml b/res/values/strings.xml index fb7e0feb2f9abf925d85abcfbaa6545436fed303..f272b749d6c275e1e7006cd6fe9a360710c833ed 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -35,6 +35,11 @@ <string name="action_delete">Delete</string> <string name="action_router_start">Start Router</string> <string name="action_router_stop">Stop Router</string> + <string name="action_i2ptunnel_start">Start tunnel</string> + <string name="action_i2ptunnel_stop">Stop tunnel</string> + <string name="action_i2ptunnel_start_all">Start all tunnels</string> + <string name="action_i2ptunnel_stop_all">Stop all tunnels</string> + <string name="action_i2ptunnel_restart_all">Restart all tunnels</string> <string name="action_reload">Reload</string> <string name="hint_search_addressbook">Search addressbook</string> diff --git a/src/net/i2p/android/i2ptunnel/fragment/TunnelDetailFragment.java b/src/net/i2p/android/i2ptunnel/fragment/TunnelDetailFragment.java index b5e1dbefc5c29688f6dae1f185d629de1d767eb3..651a0b43f2c503a02cf88b49ea7335c09f32047b 100644 --- a/src/net/i2p/android/i2ptunnel/fragment/TunnelDetailFragment.java +++ b/src/net/i2p/android/i2ptunnel/fragment/TunnelDetailFragment.java @@ -114,6 +114,19 @@ public class TunnelDetailFragment extends Fragment { inflater.inflate(R.menu.fragment_i2ptunnel_detail_actions, menu); } + @Override + public void onPrepareOptionsMenu(Menu menu) { + boolean isStopped = mTunnel.getStatus() == TunnelEntry.NOT_RUNNING; + + MenuItem start = menu.findItem(R.id.action_start_tunnel); + start.setVisible(isStopped); + start.setEnabled(isStopped); + + MenuItem stop = menu.findItem(R.id.action_stop_tunnel); + stop.setVisible(!isStopped); + stop.setEnabled(!isStopped); + } + @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items