From 7ddd3c69c86e03a57758debab6b7dd685dce6d26 Mon Sep 17 00:00:00 2001 From: str4d <str4d@mail.i2p> Date: Sat, 7 Sep 2013 13:49:16 +0000 Subject: [PATCH] Save and restore selected rate graph --- .../i2p/android/router/activity/GraphActivity.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/net/i2p/android/router/activity/GraphActivity.java b/src/net/i2p/android/router/activity/GraphActivity.java index f430e4113..e3e95e694 100644 --- a/src/net/i2p/android/router/activity/GraphActivity.java +++ b/src/net/i2p/android/router/activity/GraphActivity.java @@ -8,6 +8,8 @@ import android.widget.ArrayAdapter; import android.widget.SpinnerAdapter; public class GraphActivity extends I2PActivityBase { + private static final String SELECTED_RATE = "selected_rate"; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -35,5 +37,17 @@ public class GraphActivity extends I2PActivityBase { }; actionBar.setListNavigationCallbacks(mSpinnerAdapter, mNavigationListener); + + if (savedInstanceState != null) { + int selected = savedInstanceState.getInt(SELECTED_RATE); + actionBar.setSelectedNavigationItem(selected); + } + } + + @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putInt(SELECTED_RATE, + getSupportActionBar().getSelectedNavigationIndex()); } } -- GitLab