Commit 0bbb6ff2 authored by Ludovic Fauvet's avatar Ludovic Fauvet
Browse files

AboutActivity: keep the selected tab open after a screen rotation

parent e0b9f50e
...@@ -38,6 +38,9 @@ import android.widget.TextView; ...@@ -38,6 +38,9 @@ import android.widget.TextView;
public class AboutActivity extends FragmentActivity implements OnTabChangeListener { public class AboutActivity extends FragmentActivity implements OnTabChangeListener {
public final static String TAG = "VLC/AboutActivity"; 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 class DummyContentFactory implements TabHost.TabContentFactory {
private final Context mContext; private final Context mContext;
public DummyContentFactory(Context ctx) { public DummyContentFactory(Context ctx) {
...@@ -92,6 +95,15 @@ public class AboutActivity extends FragmentActivity implements OnTabChangeListen ...@@ -92,6 +95,15 @@ public class AboutActivity extends FragmentActivity implements OnTabChangeListen
mTabHost.setOnTabChangedListener(this); mTabHost.setOnTabChangedListener(this);
this.onTabChanged("main"); 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 @Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment