Commit 21f32a34 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Modernize the code for Android 4.x

parent 84001236
......@@ -18,13 +18,14 @@
<application
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/Theme.Sherlock"
android:hardwareAccelerated="true" >
<activity
android:name=".gui.MainActivity"
android:configChanges="orientation|screenSize"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
android:theme="@style/Theme.Sherlock" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
......
......@@ -8,6 +8,7 @@
android:layout_width="fill_parent"
android:layout_height="48dip"
android:orientation="horizontal"
android:visibility="gone"
android:background="@drawable/header">
<ImageView
android:src="@drawable/header_logo"
......@@ -42,26 +43,10 @@
android:padding="10dip"
android:onClick="searchClick" />
</LinearLayout>
<TabHost
android:id="@android:id/tabhost"
<FrameLayout android:id="@+id/fragment_placeholder"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
</TabHost>
android:layout_height="wrap_content" />
<RelativeLayout
android:id="@+id/info_layout"
android:layout_width="fill_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/ml_menu_search"
android:icon="@drawable/ic_search"
android:title="@string/searchable_hint"
android:showAsAction="ifRoom" />
<item
android:id="@+id/ml_menu_open_mrl"
android:icon="@android:drawable/ic_btn_speak_now"
......
......@@ -58,7 +58,7 @@ public class ThumbnailerManager extends Thread {
}
DisplayMetrics metrics = new DisplayMetrics();
mVideoListActivity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
mVideoListActivity.getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
mDensity = metrics.density;
start();
}
......@@ -102,8 +102,8 @@ public class ThumbnailerManager extends Thread {
while (mItems.size() == 0) {
try {
Log.i(TAG, "hide ProgressBar!");
MainActivity.hideProgressBar(mVideoListActivity);
MainActivity.clearTextInfo(mVideoListActivity);
MainActivity.hideProgressBar(mVideoListActivity.getActivity());
MainActivity.clearTextInfo(mVideoListActivity.getActivity());
notEmpty.await();
} catch (InterruptedException e) {
killed = true;
......@@ -116,10 +116,10 @@ public class ThumbnailerManager extends Thread {
lock.unlock();
Media item = mItems.poll();
MainActivity.showProgressBar(mVideoListActivity);
MainActivity.showProgressBar(mVideoListActivity.getActivity());
Log.i(TAG, "show ProgressBar!");
MainActivity.sendTextInfo(mVideoListActivity, String.format("%s %s", prefix, item.getFileName()), count, total);
MainActivity.sendTextInfo(mVideoListActivity.getActivity(), String.format("%s %s", prefix, item.getFileName()), count, total);
count++;
int width = (int) (120 * mDensity);
......@@ -138,7 +138,7 @@ public class ThumbnailerManager extends Thread {
Log.i(TAG, "Thumbnail created!");
item.setPicture(mVideoListActivity, thumbnail);
item.setPicture(mVideoListActivity.getActivity(), thumbnail);
// Post to the file browser the new item.
mVideoListActivity.setItemToUpdate(item);
......
......@@ -22,6 +22,7 @@ package org.videolan.vlc.gui;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import org.videolan.vlc.AudioServiceController;
import org.videolan.vlc.LibVLC;
......@@ -29,13 +30,22 @@ import org.videolan.vlc.MediaLibrary;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCCallbackTask;
import org.videolan.vlc.gui.audio.AudioActivityGroup;
import org.videolan.vlc.gui.audio.AudioBrowserActivity;
import org.videolan.vlc.gui.audio.AudioListActivity;
import org.videolan.vlc.gui.audio.AudioPlayerActivity;
import org.videolan.vlc.gui.video.VideoActivityGroup;
import org.videolan.vlc.gui.video.VideoListActivity;
import org.videolan.vlc.gui.video.VideoListAdapter;
import org.videolan.vlc.gui.video.VideoPlayerActivity;
import org.videolan.vlc.interfaces.ISortable;
import org.videolan.vlc.widget.AudioMiniPlayer;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.ActionBar.Tab;
import com.actionbarsherlock.app.ActionBar.TabListener;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import android.app.Activity;
import android.app.ActivityGroup;
import android.app.AlertDialog;
......@@ -53,10 +63,14 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
......@@ -66,8 +80,9 @@ import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.TabHost;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends TabActivity {
public class MainActivity extends SherlockFragmentActivity {
public final static String TAG = "VLC/MainActivity";
protected static final String ACTION_SHOW_PROGRESSBAR = "org.videolan.vlc.gui.ShowProgressBar";
......@@ -79,6 +94,7 @@ public class MainActivity extends TabActivity {
public static final String START_FROM_NOTIFICATION = "from_notification";
private static final String PREF_SHOW_INFO = "show_info";
private ActionBar mActionBar;
private ProgressBar mProgressBar;
private TabHost mTabHost;
private int mCurrentState = 0;
......@@ -108,14 +124,29 @@ public class MainActivity extends TabActivity {
mInfoLayout = (View) findViewById(R.id.info_layout);
mInfoProgress = (ProgressBar) findViewById(R.id.info_progress);
mInfoText = (TextView) findViewById(R.id.info_text);
/* Initialize the TabView */
mTabHost = getTabHost();
mTabHost.addTab(mTabHost.newTabSpec("VIDEO TAB").setIndicator("VIDEO TAB")
.setContent(new Intent(this, VideoActivityGroup.class)));
mTabHost.addTab(mTabHost.newTabSpec("AUDIO TAB").setIndicator("AUDIO TAB")
.setContent(new Intent(this, AudioActivityGroup.class)));
mTabHost = (TabHost)findViewById(android.R.id.tabhost);
/* Initialize the tabs */
mActionBar = getSupportActionBar();
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
mActionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
mActionBar.addTab(mActionBar.newTab()
.setText("Video")
.setIcon(R.drawable.header_icon_video)
.setTabListener(new TabListener<VideoListActivity>(
this, "video", VideoListActivity.class)));
mActionBar.addTab(mActionBar.newTab()
.setText("Audio")
.setIcon(R.drawable.header_icon_audio)
.setTabListener(new TabListener<AudioBrowserActivity>(
this, "audio", AudioBrowserActivity.class)));
if (savedInstanceState != null) {
mActionBar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
}
// add mini audio player
mAudioPlayer = (AudioMiniPlayer) findViewById(R.id.audio_mini_player);
......@@ -163,6 +194,7 @@ public class MainActivity extends TabActivity {
@Override
protected void onResume() {
mAudioController.addAudioPlayer(mAudioPlayer);
AudioServiceController.getInstance().bindAudioService(this);
super.onResume();
}
......@@ -182,7 +214,7 @@ public class MainActivity extends TabActivity {
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.media_library, menu);
return super.onCreateOptionsMenu(menu);
}
......@@ -199,8 +231,8 @@ public class MainActivity extends TabActivity {
*/
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
savedInstanceState.putInt("mCurrentState", mCurrentState);
super.onSaveInstanceState(savedInstanceState);
savedInstanceState.putInt("tab", mActionBar.getSelectedNavigationIndex());
}
/**
......@@ -218,14 +250,13 @@ public class MainActivity extends TabActivity {
switch (item.getItemId()) {
case R.id.ml_menu_sortby_name:
case R.id.ml_menu_sortby_length:
activity = getCurrentActivity();
if (!(activity instanceof ActivityGroup))
Fragment current = getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder);
if (current == null)
break;
activity = ((ActivityGroup) activity).getCurrentActivity();
if (activity instanceof ISortable)
((ISortable) activity).sortBy(item.getItemId() == R.id.ml_menu_sortby_name
? VideoListAdapter.SORT_BY_TITLE
: VideoListAdapter.SORT_BY_LENGTH);
if (current instanceof ISortable)
((ISortable) current).sortBy(item.getItemId() == R.id.ml_menu_sortby_name
? VideoListAdapter.SORT_BY_TITLE
: VideoListAdapter.SORT_BY_LENGTH);
break;
// About
case R.id.ml_menu_about:
......@@ -301,11 +332,14 @@ public class MainActivity extends TabActivity {
}});
b.show();
break;
case R.id.ml_menu_search:
onSearchRequested();
break;
}
return super.onOptionsItemSelected(item);
}
@Override
/*@Override
public boolean onContextItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.play_pause:
......@@ -324,7 +358,7 @@ public class MainActivity extends TabActivity {
break;
}
return super.onContextItemSelected(item);
}
}*/
public void hideAudioPlayer() {
mAudioPlayer.setVisibility(AudioMiniPlayer.GONE);
......@@ -361,7 +395,7 @@ public class MainActivity extends TabActivity {
*/
public void changeTabClick(View view) {
// Toggle audio- and video-tab
if (mCurrentState == VIDEO_TAB) {
if (mActionBar.getSelectedNavigationIndex() == VIDEO_TAB) {
showAudioTab();
} else {
showVideoTab();
......@@ -369,15 +403,11 @@ public class MainActivity extends TabActivity {
}
private void showVideoTab() {
mChangeTab.setImageResource(R.drawable.header_icon_audio);
mTabHost.setCurrentTab(VIDEO_TAB);
mCurrentState = VIDEO_TAB;
mActionBar.setSelectedNavigationItem(VIDEO_TAB);
}
private void showAudioTab() {
mChangeTab.setImageResource(R.drawable.header_icon_video);
mTabHost.setCurrentTab(AUDIO_TAB);
mCurrentState = AUDIO_TAB;
mActionBar.setSelectedNavigationItem(AUDIO_TAB);
}
/**
......@@ -436,4 +466,68 @@ public class MainActivity extends TabActivity {
intent.putExtra("max", max);
context.getApplicationContext().sendBroadcast(intent);
}
public static class TabListener<T extends Fragment> implements ActionBar.TabListener {
private final SherlockFragmentActivity mActivity;
private final String mTag;
private final Class<T> mClass;
private final Bundle mArgs;
private Fragment mFragment;
public TabListener(SherlockFragmentActivity activity, String tag, Class<T> clz) {
this(activity, tag, clz, null);
}
public TabListener(SherlockFragmentActivity activity, String tag, Class<T> clz, Bundle args) {
mActivity = activity;
mTag = tag;
mClass = clz;
mArgs = args;
// Check to see if we already have a fragment for this tab, probably
// from a previously saved state. If so, deactivate it, because our
// initial state is that a tab isn't shown.
mFragment = mActivity.getSupportFragmentManager().findFragmentByTag(mTag);
if (mFragment != null && !mFragment.isDetached()) {
FragmentTransaction ft = mActivity.getSupportFragmentManager().beginTransaction();
ft.detach(mFragment);
ft.commit();
}
}
public void onTabSelected(Tab tab, FragmentTransaction ft) {
if (mTag.equalsIgnoreCase("video"))
ft.setCustomAnimations(R.anim.anim_enter_left, R.anim.anim_leave_left);
else if (mTag.equalsIgnoreCase("audio"))
ft.setCustomAnimations(R.anim.anim_enter_right, R.anim.anim_leave_right);
if (mFragment == null) {
mFragment = Fragment.instantiate(mActivity, mClass.getName(), mArgs);
ft.add(R.id.fragment_placeholder, mFragment, mTag);
} else {
ft.attach(mFragment);
}
}
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
if (mTag.equalsIgnoreCase("video"))
ft.setCustomAnimations(R.anim.anim_enter_left, R.anim.anim_leave_left);
else if (mTag.equalsIgnoreCase("audio"))
ft.setCustomAnimations(R.anim.anim_enter_right, R.anim.anim_leave_right);
if (mFragment != null) {
ft.detach(mFragment);
}
}
public void onTabReselected(Tab tab, FragmentTransaction ft) {
}
}
}
......@@ -35,7 +35,8 @@ import org.videolan.vlc.interfaces.ISortable;
import org.videolan.vlc.widget.FlingViewGroup;
import org.videolan.vlc.widget.FlingViewGroup.ViewSwitchListener;
import android.app.Activity;
import com.actionbarsherlock.app.SherlockFragment;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
......@@ -45,9 +46,11 @@ import android.os.Handler;
import android.os.Message;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnCreateContextMenuListener;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
......@@ -61,7 +64,7 @@ import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
public class AudioBrowserActivity extends Activity implements ISortable {
public class AudioBrowserActivity extends SherlockFragment implements ISortable {
public final static String TAG = "VLC/AudioBrowserActivity";
private FlingViewGroup mFlingViewGroup;
......@@ -92,27 +95,34 @@ public class AudioBrowserActivity extends Activity implements ISortable {
public final static int MENU_DELETE = Menu.FIRST + 4;
@Override
protected void onCreate(Bundle savedInstanceState) {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.audio_browser);
mFlingViewGroup = (FlingViewGroup) findViewById(R.id.content);
mFlingViewGroup.setOnViewSwitchedListener(mViewSwitchListener);
mHeader = (HorizontalScrollView) findViewById(R.id.header);
mAudioController = AudioServiceController.getInstance();
mMediaLibrary = MediaLibrary.getInstance(this);
mMediaLibrary = MediaLibrary.getInstance(getActivity());
mMediaLibrary.addUpdateHandler(mHandler);
mSongsAdapter = new AudioSongsListAdapter(this);
mArtistsAdapter = new AudioPlaylistAdapter(this, R.plurals.albums, R.plurals.songs);
mAlbumsAdapter = new AudioPlaylistAdapter(this, R.plurals.songs, R.plurals.songs);
mGenresAdapter = new AudioPlaylistAdapter(this, R.plurals.albums, R.plurals.songs);
ListView songsList = (ListView) findViewById(R.id.songs_list);
ExpandableListView artistList = (ExpandableListView) findViewById(R.id.artists_list);
ExpandableListView albumList = (ExpandableListView) findViewById(R.id.albums_list);
ExpandableListView genreList = (ExpandableListView) findViewById(R.id.genres_list);
mSongsAdapter = new AudioSongsListAdapter(getActivity());
mArtistsAdapter = new AudioPlaylistAdapter(getActivity(), R.plurals.albums, R.plurals.songs);
mAlbumsAdapter = new AudioPlaylistAdapter(getActivity(), R.plurals.songs, R.plurals.songs);
mGenresAdapter = new AudioPlaylistAdapter(getActivity(), R.plurals.albums, R.plurals.songs);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View v = inflater.inflate(R.layout.audio_browser, container, false);
mFlingViewGroup = (FlingViewGroup)v.findViewById(R.id.content);
mFlingViewGroup.setOnViewSwitchedListener(mViewSwitchListener);
mHeader = (HorizontalScrollView)v.findViewById(R.id.header);
ListView songsList = (ListView)v.findViewById(R.id.songs_list);
ExpandableListView artistList = (ExpandableListView)v.findViewById(R.id.artists_list);
ExpandableListView albumList = (ExpandableListView)v.findViewById(R.id.albums_list);
ExpandableListView genreList = (ExpandableListView)v.findViewById(R.id.genres_list);
songsList.setAdapter(mSongsAdapter);
artistList.setAdapter(mArtistsAdapter);
albumList.setAdapter(mAlbumsAdapter);
......@@ -129,6 +139,12 @@ public class AudioBrowserActivity extends Activity implements ISortable {
albumList.setOnCreateContextMenuListener(contextMenuListener);
genreList.setOnCreateContextMenuListener(contextMenuListener);
return v;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
updateLists();
}
......@@ -136,7 +152,7 @@ public class AudioBrowserActivity extends Activity implements ISortable {
@Override
public void onItemClick(AdapterView<?> av, View v, int p, long id) {
mAudioController.load(mSongsAdapter.getLocations(), p);
Intent intent = new Intent(AudioBrowserActivity.this, AudioPlayerActivity.class);
Intent intent = new Intent(getActivity(), AudioPlayerActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
......@@ -150,7 +166,7 @@ public class AudioBrowserActivity extends Activity implements ISortable {
return false;
String name = adapter.getGroup(groupPosition);
Intent intent = new Intent(AudioBrowserActivity.this, AudioListActivity.class);
Intent intent = new Intent(getActivity(), AudioListActivity.class);
AudioListActivity.set(intent, name, null, mFlingViewGroup.getPosition());
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
......@@ -164,7 +180,7 @@ public class AudioBrowserActivity extends Activity implements ISortable {
AudioPlaylistAdapter adapter = (AudioPlaylistAdapter) elv.getExpandableListAdapter();
String name = adapter.getGroup(groupPosition);
String child = adapter.getChild(groupPosition, childPosition);
Intent intent = new Intent(AudioBrowserActivity.this, AudioListActivity.class);
Intent intent = new Intent(getActivity(), AudioListActivity.class);
AudioListActivity.set(intent, name, child, mFlingViewGroup.getPosition());
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
......@@ -212,7 +228,7 @@ public class AudioBrowserActivity extends Activity implements ISortable {
if (id == MENU_DELETE){
final int groupPositionDelete = groupPosition;
AlertDialog alertDialog = new AlertDialog.Builder(this.getParent())
AlertDialog alertDialog = new AlertDialog.Builder(getActivity())
.setTitle(R.string.confirm_delete)
.setMessage(R.string.validation)
.setIcon(android.R.drawable.ic_dialog_alert)
......@@ -266,14 +282,14 @@ public class AudioBrowserActivity extends Activity implements ISortable {
else
mAudioController.load(medias, startPosition);
Intent intent = new Intent(AudioBrowserActivity.this, AudioPlayerActivity.class);
Intent intent = new Intent(getActivity(), AudioPlayerActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
return super.onContextItemSelected(item);
}
@Override
protected void onDestroy() {
public void onDestroy() {
mMediaLibrary.removeUpdateHandler(mHandler);
mSongsAdapter.clear();
mArtistsAdapter.clear();
......@@ -288,7 +304,7 @@ public class AudioBrowserActivity extends Activity implements ISortable {
@Override
public void onSwitching(float progress) {
LinearLayout hl = (LinearLayout) findViewById(R.id.header_layout);
LinearLayout hl = (LinearLayout)getActivity().findViewById(R.id.header_layout);
int width = hl.getChildAt(0).getWidth();
int x = (int) (progress * width);
mHeader.smoothScrollTo(x, 0);
......@@ -296,7 +312,7 @@ public class AudioBrowserActivity extends Activity implements ISortable {
@Override
public void onSwitched(int position) {
LinearLayout hl = (LinearLayout) findViewById(R.id.header_layout);
LinearLayout hl = (LinearLayout)getActivity().findViewById(R.id.header_layout);
TextView oldView = (TextView) hl.getChildAt(mCurrentPosition);
oldView.setTextColor(Color.GRAY);
TextView newView = (TextView) hl.getChildAt(position);
......@@ -363,7 +379,7 @@ public class AudioBrowserActivity extends Activity implements ISortable {
};
private void updateLists() {
List<Media> audioList = MediaLibrary.getInstance(this).getAudioItems();
List<Media> audioList = MediaLibrary.getInstance(getActivity()).getAudioItems();
mSongsAdapter.clear();
mArtistsAdapter.clear();
mAlbumsAdapter.clear();
......
......@@ -29,6 +29,8 @@ import org.videolan.vlc.Media;
import org.videolan.vlc.MediaLibrary;
import org.videolan.vlc.R;
import com.actionbarsherlock.app.SherlockListActivity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
......@@ -44,7 +46,7 @@ import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.ListView;
import android.widget.TextView;
public class AudioListActivity extends ListActivity {
public class AudioListActivity extends SherlockListActivity {
public final static String TAG = "VLC/AudioListActivity";
......
......@@ -33,6 +33,9 @@ import org.videolan.vlc.gui.PreferencesActivity;
import org.videolan.vlc.gui.SearchActivity;
import org.videolan.vlc.interfaces.ISortable;
import com.actionbarsherlock.app.SherlockListActivity;
import com.actionbarsherlock.app.SherlockListFragment;
import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
......@@ -40,11 +43,13 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ListView;
public class VideoListActivity extends ListActivity implements ISortable {
public class VideoListActivity extends SherlockListFragment implements ISortable {
private LinearLayout mNoFileLayout;
private LinearLayout mLoadFileLayout;
......@@ -60,25 +65,39 @@ public class VideoListActivity extends ListActivity implements ISortable {
private MediaLibrary mMediaLibrary;
@Override
protected void onCreate(Bundle savedInstanceState) {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);