[Android] AboutActivity: keep the selected tab open after a screen rotation
Ludovic Fauvet
git at videolan.org
Sat Sep 29 03:32:45 CEST 2012
vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Sat Sep 29 03:07:26 2012 +0200| [0bbb6ff2f7047c41575e05e53802e8613a9d2d32] | committer: Ludovic Fauvet
AboutActivity: keep the selected tab open after a screen rotation
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=0bbb6ff2f7047c41575e05e53802e8613a9d2d32
---
vlc-android/src/org/videolan/vlc/gui/AboutActivity.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/gui/AboutActivity.java b/vlc-android/src/org/videolan/vlc/gui/AboutActivity.java
index cad5a5d..5af1be3 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AboutActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AboutActivity.java
@@ -38,6 +38,9 @@ import android.widget.TextView;
public class AboutActivity extends FragmentActivity implements OnTabChangeListener {
public final static String TAG = "VLC/AboutActivity";
+ private final static String CURRENT_TAB_TAG = "tabtag";
+ private final static String CURRENT_TAB_ID = "tabid";
+
private class DummyContentFactory implements TabHost.TabContentFactory {
private final Context mContext;
public DummyContentFactory(Context ctx) {
@@ -92,6 +95,15 @@ public class AboutActivity extends FragmentActivity implements OnTabChangeListen
mTabHost.setOnTabChangedListener(this);
this.onTabChanged("main");
+ if (savedInstanceState != null) {
+ mTabHost.setCurrentTab(savedInstanceState.getInt(CURRENT_TAB_ID));
+ this.onTabChanged(savedInstanceState.getString(CURRENT_TAB_TAG));
+ }
+ }
+
+ protected void onSaveInstanceState(Bundle outState) {
+ outState.putString(CURRENT_TAB_TAG, mCurrentTabTag);
+ outState.putInt(CURRENT_TAB_ID, mTabHost.getCurrentTab());
}
@Override
More information about the Android
mailing list