Commit 46f9d396 authored by Adrien Maglo's avatar Adrien Maglo

Support: replace the ActionBarSherlock library by android-support-v7-appcompat

This change is confirmed to work on Android 2.2.
parent caadf959
......@@ -9,6 +9,6 @@
# Project target.
target=android-19
android.library.reference.1=../java-libs/ActionBarSherlock
android.library.reference.1=../java-libs/appcompat
android.library.reference.2=../java-libs/SlidingMenu
android.library.reference.3=../java-libs/WheelView
......@@ -15,7 +15,7 @@
<item name="android:actionOverflowButtonStyle">@style/ActionBar.OverflowButton</item>
</style>
<style name="ActionBar" parent="Widget.Sherlock.Light.ActionBar">
<style name="ActionBar" parent="Widget.AppCompat.Light.ActionBar">
<item name="android:background">@drawable/actionbar_background</item>
<item name="android:titleTextStyle">@style/ActionBar.Text</item>
</style>
......
......@@ -15,7 +15,7 @@
<item name="actionOverflowButtonStyle">@style/ActionBar.OverflowButton</item>
</style>
<style name="Theme.VLC.Apearance" parent="Theme.Sherlock.Light">
<style name="Theme.VLC.Apearance" parent="Theme.AppCompat.Light">
<item name="marginTopContent">50dp</item>
<item name="android:listViewStyle">@style/Theme.VLC.List</item>
......@@ -76,7 +76,7 @@
<item name="actionOverflowButtonStyle">@style/ActionBar.OverflowButton</item>
</style>
<style name="Theme.VLC.Apearance.Black" parent="Theme.Sherlock">
<style name="Theme.VLC.Apearance.Black" parent="Theme.AppCompat">
<item name="marginTopContent">50dp</item>
<item name="android:listViewStyle">@style/Theme.VLC.List</item>
......@@ -134,7 +134,8 @@
<item name="android:listSelector">@drawable/background_item</item>
</style>
<style name="Theme.VLC.NoTitleBar" parent="Theme.Sherlock.Light.NoActionBar">
<style name="Theme.VLC.NoTitleBar" parent="Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item>
<item name="item_common_pressed">@color/item_common_pressed</item>
<item name="item_common_selected">@color/item_common_selected</item>
<item name="item_footer">@color/item_footer</item>
......@@ -153,12 +154,12 @@
<item name="advanced_options_style">@style/Theme.VLC.AdvancedOptionsBlack</item>
</style>
<style name="ActionBar" parent="Widget.Sherlock.Light.ActionBar">
<style name="ActionBar" parent="Widget.AppCompat.Light.ActionBar">
<item name="background">@drawable/actionbar_background</item>
<item name="titleTextStyle">@style/ActionBar.Text</item>
</style>
<style name="ActionBar.Text" parent="TextAppearance.Sherlock.Widget.ActionBar.Title">
<style name="ActionBar.Text" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/action_bar_title</item>
</style>
......@@ -176,7 +177,7 @@
</style>
<style name="Theme.VLC.AdvancedOptionsLight" parent="Theme.VLC.AdvancedOptions">
<item name="android:windowBackground">@drawable/abs__menu_dropdown_panel_holo_light</item>
<item name="android:windowBackground">@drawable/abc_menu_dropdown_panel_holo_light</item>
<item name="android:textColor">@color/grey1</item>
<item name="advanced_options_divider">@color/darkgrey</item>
<item name="ic_speed_normal_style">@drawable/ic_speed_normal</item>
......@@ -189,7 +190,7 @@
<style name="Theme.VLC.AdvancedOptionsBlack" parent="Theme.VLC.AdvancedOptions">
<item name="android:windowBackground">@drawable/abs__menu_dropdown_panel_holo_dark</item>
<item name="android:windowBackground">@drawable/abc_menu_dropdown_panel_holo_dark</item>
<item name="android:textColor">@color/white</item>
<item name="advanced_options_divider">@color/grey1</item>
<item name="ic_speed_normal_style">@drawable/ic_speed_normal_w</item>
......
......@@ -17,31 +17,24 @@
package org.videolan.android.ui;
import android.app.Activity;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.internal.view.menu.MenuItemWrapper;
import com.actionbarsherlock.internal.view.menu.MenuWrapper;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
public class SherlockGridFragment extends GridFragment {
private FragmentActivity mActivity;
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnCreateOptionsMenuListener;
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnOptionsItemSelectedListener;
import static com.actionbarsherlock.app.SherlockFragmentActivity.OnPrepareOptionsMenuListener;
public class SherlockGridFragment extends GridFragment implements OnCreateOptionsMenuListener, OnPrepareOptionsMenuListener, OnOptionsItemSelectedListener {
private SherlockFragmentActivity mActivity;
public SherlockFragmentActivity getSherlockActivity() {
public FragmentActivity getSherlockActivity() {
return mActivity;
}
@Override
public void onAttach(Activity activity) {
if (!(activity instanceof SherlockFragmentActivity)) {
if (!(activity instanceof FragmentActivity)) {
throw new IllegalStateException(getClass().getSimpleName() + " must be attached to a SherlockFragmentActivity.");
}
mActivity = (SherlockFragmentActivity)activity;
mActivity = (FragmentActivity)activity;
super.onAttach(activity);
}
......@@ -52,31 +45,16 @@ public class SherlockGridFragment extends GridFragment implements OnCreateOption
super.onDetach();
}
@Override
public final void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater) {
onCreateOptionsMenu(new MenuWrapper(menu), mActivity.getSupportMenuInflater());
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
//Nothing to see here.
}
@Override
public final void onPrepareOptionsMenu(android.view.Menu menu) {
onPrepareOptionsMenu(new MenuWrapper(menu));
}
@Override
public void onPrepareOptionsMenu(Menu menu) {
//Nothing to see here.
}
@Override
public final boolean onOptionsItemSelected(android.view.MenuItem item) {
return onOptionsItemSelected(new MenuItemWrapper(item));
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
//Nothing to see here.
......
......@@ -24,12 +24,12 @@ import org.videolan.vlc.R;
import org.videolan.vlc.Util;
import org.videolan.vlc.widget.FlingViewGroup;
import com.actionbarsherlock.app.SherlockFragment;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
......@@ -45,7 +45,7 @@ import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import android.widget.TextView;
public class AboutFragment extends SherlockFragment {
public class AboutFragment extends Fragment {
public final static String TAG = "VLC/AboutActivity";
private TabHost mTabHost;
......@@ -55,7 +55,7 @@ public class AboutFragment extends SherlockFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
getSherlockActivity().getSupportActionBar().setTitle("VLC " + getVersion(getActivity()));
((ActionBarActivity) getActivity()).getSupportActionBar().setTitle("VLC " + getVersion(getActivity()));
View v = inflater.inflate(R.layout.about, container, false);
......
......@@ -37,6 +37,8 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.support.v7.app.ActionBarActivity;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
......@@ -49,9 +51,7 @@ import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ListView;
import com.actionbarsherlock.app.SherlockListFragment;
public class DirectoryViewFragment extends SherlockListFragment implements ISortable {
public class DirectoryViewFragment extends ListFragment implements ISortable {
public final static String TAG = "VLC/DirectoryViewFragment";
private DirectoryAdapter mDirectoryAdapter;
......@@ -81,7 +81,7 @@ public class DirectoryViewFragment extends SherlockListFragment implements ISort
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
getSherlockActivity().getSupportActionBar().setTitle(R.string.directories);
((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(R.string.directories);
View v = inflater.inflate(R.layout.directory_view, container, false);
setListAdapter(mDirectoryAdapter);
......
......@@ -24,6 +24,8 @@ import org.videolan.libvlc.LibVLC;
import org.videolan.vlc.AudioServiceController;
import org.videolan.vlc.R;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
......@@ -35,9 +37,7 @@ import android.view.ViewGroup;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.ListView;
import com.actionbarsherlock.app.SherlockListFragment;
public class HistoryFragment extends SherlockListFragment {
public class HistoryFragment extends ListFragment {
public final static String TAG = "VLC/HistoryFragment";
private HistoryAdapter mHistoryAdapter;
......@@ -56,7 +56,7 @@ public class HistoryFragment extends SherlockListFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
getSherlockActivity().getSupportActionBar().setTitle(R.string.history);
((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(R.string.history);
View v = inflater.inflate(R.layout.history_list, container, false);
setListAdapter(mHistoryAdapter);
......
......@@ -66,12 +66,18 @@ 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.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.text.InputType;
import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
......@@ -83,15 +89,9 @@ import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.actionbarsherlock.view.Window;
import com.slidingmenu.lib.SlidingMenu;
public class MainActivity extends SherlockFragmentActivity {
public class MainActivity extends ActionBarActivity {
public final static String TAG = "VLC/MainActivity";
protected static final String ACTION_SHOW_PROGRESSBAR = "org.videolan.vlc.gui.ShowProgressBar";
......@@ -558,7 +558,7 @@ public class MainActivity extends SherlockFragmentActivity {
* is called while the view is created. This can happen
* any time after onCreate.
*/
MenuInflater inflater = getSupportMenuInflater();
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.media_library, menu);
return super.onCreateOptionsMenu(menu);
}
......
......@@ -31,10 +31,10 @@ import org.videolan.vlc.MediaLibrary;
import org.videolan.vlc.R;
import org.videolan.vlc.gui.video.VideoPlayerActivity;
import com.actionbarsherlock.app.SherlockListFragment;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.support.v7.app.ActionBarActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
......@@ -48,7 +48,7 @@ import android.widget.ListView;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
public class SearchFragment extends SherlockListFragment {
public class SearchFragment extends ListFragment {
public final static String TAG = "VLC/SearchActivity";
......@@ -59,7 +59,7 @@ public class SearchFragment extends SherlockListFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
getSherlockActivity().getSupportActionBar().setTitle(R.string.search);
((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(R.string.search);
View v = inflater.inflate(R.layout.search, container, false);
......
......@@ -40,6 +40,8 @@ import android.app.AlertDialog;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
......@@ -60,9 +62,7 @@ import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import android.widget.TextView;
import com.actionbarsherlock.app.SherlockFragment;
public class AudioAlbumsSongsFragment extends SherlockFragment {
public class AudioAlbumsSongsFragment extends Fragment {
public final static String TAG = "VLC/AudioAlbumsSongsFragment";
......@@ -112,7 +112,7 @@ public class AudioAlbumsSongsFragment extends SherlockFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
getSherlockActivity().getSupportActionBar().setTitle(mTitle);
((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(mTitle);
View v = inflater.inflate(R.layout.audio_albums_songs, container, false);
......
......@@ -44,6 +44,8 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
......@@ -63,9 +65,7 @@ import android.widget.ListView;
import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
import com.actionbarsherlock.app.SherlockFragment;
public class AudioBrowserFragment extends SherlockFragment {
public class AudioBrowserFragment extends Fragment {
public final static String TAG = "VLC/AudioBrowserFragment";
private FlingViewGroup mFlingViewGroup;
......@@ -113,7 +113,7 @@ public class AudioBrowserFragment extends SherlockFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
getSherlockActivity().getSupportActionBar().setTitle(R.string.audio);
((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(R.string.audio);
View v = inflater.inflate(R.layout.audio_browser, container, false);
......
......@@ -27,13 +27,13 @@ import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.interfaces.OnEqualizerBarChangeListener;
import org.videolan.vlc.widget.EqualizerBar;
import com.actionbarsherlock.app.SherlockFragment;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -49,7 +49,7 @@ import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.Spinner;
import android.widget.ToggleButton;
public class EqualizerFragment extends SherlockFragment {
public class EqualizerFragment extends Fragment {
public final static String TAG = "VLC/EqualizerFragment";
private ToggleButton button;
......@@ -66,7 +66,7 @@ public class EqualizerFragment extends SherlockFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
getSherlockActivity().getSupportActionBar().setTitle(getResources().getString(R.string.equalizer));
((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(getResources().getString(R.string.equalizer));
super.onCreateView(inflater, container, savedInstanceState);
View v = inflater.inflate(R.layout.equalizer, container, false);
......
......@@ -31,13 +31,13 @@ import org.videolan.vlc.R;
import org.videolan.vlc.Util;
import org.videolan.vlc.WeakHandler;
import com.actionbarsherlock.app.SherlockListFragment;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.ListFragment;
import android.support.v7.app.ActionBarActivity;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
......@@ -47,7 +47,7 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
public class MediaInfoFragment extends SherlockListFragment {
public class MediaInfoFragment extends ListFragment {
public final static String TAG = "VLC/MediaInfoFragment";
private Media mItem;
......@@ -97,7 +97,7 @@ public class MediaInfoFragment extends SherlockListFragment {
}
mTitleView.setText(mItem.getTitle());
getSherlockActivity().getSupportActionBar().setTitle(mItem.getTitle());
((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(mItem.getTitle());
mLengthView.setText(Util.millisToString(mItem.getLength()));
new Thread(mLoadImage).start();
......
......@@ -54,6 +54,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.ActionBarActivity;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.ContextMenu;
......@@ -128,7 +129,7 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
getSherlockActivity().getSupportActionBar().setTitle(R.string.video);
((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(R.string.video);
View v = inflater.inflate(R.layout.video_grid, container, false);
......
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