Commit ec197537 authored by Geoffrey Métais's avatar Geoffrey Métais

Remove pre-17 SDK specific code

parent 693b71d4
......@@ -31,8 +31,6 @@ import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.TextureView;
import org.videolan.libvlc.util.AndroidUtil;
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger;
......@@ -204,8 +202,7 @@ public class AWindow implements IVLCVout {
private int mMouseAction = -1, mMouseButton = -1, mMouseX = -1, mMouseY = -1;
private int mWindowWidth = -1, mWindowHeight = -1;
private SurfaceTextureThread mSurfaceTextureThread = AndroidUtil.isJellyBeanOrLater ?
new SurfaceTextureThread() : null;
private SurfaceTextureThread mSurfaceTextureThread = new SurfaceTextureThread();
/**
* Create an AWindow
......@@ -358,8 +355,7 @@ public class AWindow implements IVLCVout {
cb.onSurfacesDestroyed(this);
if (mSurfaceCallback != null)
mSurfaceCallback.onSurfacesDestroyed(this);
if (AndroidUtil.isJellyBeanOrLater)
mSurfaceTextureThread.release();
mSurfaceTextureThread.release();
}
@Override
......@@ -707,7 +703,7 @@ public class AWindow implements IVLCVout {
*/
@SuppressWarnings("unused") /* used by JNI */
boolean SurfaceTexture_attachToGLContext(int texName) {
return AndroidUtil.isJellyBeanOrLater && mSurfaceTextureThread.attachToGLContext(texName);
return mSurfaceTextureThread.attachToGLContext(texName);
}
/**
......
......@@ -33,8 +33,6 @@ public class AndroidUtil {
public static final boolean isLolliPopOrLater = isMarshMallowOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
public static final boolean isKitKatOrLater = isLolliPopOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
public static final boolean isJellyBeanMR2OrLater = isKitKatOrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2;
public static final boolean isJellyBeanMR1OrLater = isJellyBeanMR2OrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
public static final boolean isJellyBeanOrLater = isJellyBeanMR1OrLater || android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
public static File UriToFile(Uri uri) {
return new File(uri.getPath().replaceFirst("file://", ""));
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+id/player_overlay_title"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:layout_gravity="top"
android:background="@color/transparent"
android:textColor="@color/white"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:textSize="15sp"
android:shadowColor="@color/black"
android:shadowDx="3"
android:shadowDy="3"
android:shadowRadius="1.5" />
<ImageView
android:id="@+id/video_renderer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_renderer_circle"
android:focusable="true"
android:visibility="gone"/>
<ImageView
android:id="@+id/playlist_toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_playlist_circle"
android:focusable="true"
android:visibility="gone"/>
<ImageView
android:id="@+id/player_overlay_navmenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_gravity="center_vertical"
android:clickable="true"
android:src="@drawable/ic_navmenu_circle"
android:scaleType="center"
android:focusable="true"
android:visibility="gone" />
<!-- Useless views to fix Chrome OS build -->
<Space
android:id="@+id/player_overlay_systime"
android:layout_width="0dp"
android:layout_height="0dp" />
<Space
android:id="@+id/player_overlay_battery"
android:layout_width="0dp"
android:layout_height="0dp" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:background="@color/transparent"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
android:layout_height="fill_parent" >
<TextView
android:id="@+id/player_overlay_title"
......@@ -14,32 +10,30 @@
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:layout_gravity="top"
android:background="@color/transparent"
android:textColor="@color/white"
android:textSize="15sp" />
<TextView
android:id="@+id/player_overlay_battery"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="5dp"
android:textColor="@color/white"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:textSize="15sp"
android:gravity="center"
tools:ignore="true" />
android:shadowColor="@color/black"
android:shadowDx="3"
android:shadowDy="3"
android:shadowRadius="1.5" />
<TextView
android:id="@+id/player_overlay_systime"
<ImageView
android:id="@+id/video_renderer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="15sp"
tools:ignore="true" />
android:layout_gravity="center_vertical"
android:src="@drawable/ic_renderer_circle"
android:focusable="true"
android:visibility="gone"/>
<ImageView
android:id="@+id/playlist_toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_playlist_circle"
android:focusable="true"
......@@ -49,10 +43,20 @@
android:id="@+id/player_overlay_navmenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_gravity="center_vertical"
android:clickable="true"
android:src="@drawable/ic_navmenu_circle"
android:scaleType="center"
android:focusable="true"
android:visibility="gone" />
<!-- Useless views to fix Chrome OS build -->
<Space
android:id="@+id/player_overlay_systime"
android:layout_width="0dp"
android:layout_height="0dp" />
<Space
android:id="@+id/player_overlay_battery"
android:layout_width="0dp"
android:layout_height="0dp" />
</LinearLayout>
......@@ -124,8 +124,8 @@ public class StartActivity extends FragmentActivity implements StoragePermission
}
private boolean showTvUi() {
return AndroidUtil.isJellyBeanMR1OrLater && (AndroidDevices.isAndroidTv || (!AndroidDevices.isChromeBook && !AndroidDevices.hasTsp) ||
PreferenceManager.getDefaultSharedPreferences(this).getBoolean("tv_ui", false));
return AndroidDevices.isAndroidTv || (!AndroidDevices.isChromeBook && !AndroidDevices.hasTsp) ||
PreferenceManager.getDefaultSharedPreferences(this).getBoolean("tv_ui", false);
}
@Override
......
......@@ -54,7 +54,6 @@ import kotlinx.coroutines.experimental.channels.Channel
import kotlinx.coroutines.experimental.channels.actor
import kotlinx.coroutines.experimental.launch
import kotlinx.coroutines.experimental.withContext
import org.videolan.libvlc.util.AndroidUtil
import org.videolan.medialibrary.Tools
import org.videolan.medialibrary.media.MediaWrapper
import org.videolan.vlc.PlaybackService
......@@ -122,10 +121,8 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, PlaybackSe
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (AndroidUtil.isJellyBeanMR1OrLater) {
DEFAULT_BACKGROUND_DARKER_ID = UiTools.getResourceFromAttribute(view.context, R.attr.background_default_darker)
DEFAULT_BACKGROUND_ID = UiTools.getResourceFromAttribute(view.context, R.attr.background_default)
}
DEFAULT_BACKGROUND_DARKER_ID = UiTools.getResourceFromAttribute(view.context, R.attr.background_default_darker)
DEFAULT_BACKGROUND_ID = UiTools.getResourceFromAttribute(view.context, R.attr.background_default)
binding.songsList.layoutManager = LinearLayoutManager(view.context)
binding.songsList.adapter = playlistAdapter
binding.audioMediaSwitcher.setAudioMediaSwitcherListener(headerMediaSwitcherListener)
......@@ -270,7 +267,7 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, PlaybackSe
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private fun updateBackground() {
if (AndroidUtil.isJellyBeanMR1OrLater && settings.getBoolean("blurred_cover_background", true)) {
if (settings.getBoolean("blurred_cover_background", true)) {
launch(UI, CoroutineStart.UNDISPATCHED) {
val mw = service?.currentMediaWrapper
if (mw === null || TextUtils.equals(currentCoverArt, mw.artworkMrl)) return@launch
......
......@@ -23,23 +23,17 @@
package org.videolan.vlc.gui.preferences;
import android.Manifest;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.preference.EditTextPreference;
import android.support.v7.preference.Preference;
import android.text.TextUtils;
import android.widget.Toast;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.medialibrary.Medialibrary;
import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.DebugLogActivity;
......@@ -64,18 +58,6 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
return R.string.advanced_prefs_category;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (TextUtils.equals(BuildConfig.FLAVOR_target, "chrome")) {
findPreference("quit_app").setEnabled(false);
}
findPreference("debug_logs").setVisible(AndroidUtil.isJellyBeanOrLater ||
(BuildConfig.DEBUG && getActivity().checkCallingOrSelfPermission(Manifest.permission.READ_LOGS) == PackageManager.PERMISSION_GRANTED));
}
@Override
public void onStart() {
super.onStart();
......
......@@ -30,7 +30,6 @@ import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.SwitchPreferenceCompat;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.R;
import org.videolan.vlc.gui.helpers.UiTools;
import org.videolan.vlc.util.LocalePair;
......@@ -65,8 +64,6 @@ public class PreferencesUi extends BasePreferenceFragment implements SharedPrefe
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
findPreference("tv_ui").setVisible(AndroidUtil.isJellyBeanMR1OrLater);
findPreference("blurred_cover_background").setVisible(AndroidUtil.isJellyBeanMR1OrLater);
prepareLocaleList();
}
......
......@@ -23,23 +23,17 @@
package org.videolan.vlc.gui.tv.preferences;
import android.Manifest;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.preference.EditTextPreference;
import android.support.v7.preference.Preference;
import android.text.TextUtils;
import android.widget.Toast;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.DebugLogActivity;
......@@ -58,16 +52,6 @@ public class PreferencesAdvanced extends BasePreferenceFragment implements Share
return R.string.advanced_prefs_category;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (TextUtils.equals(BuildConfig.FLAVOR_target, "chrome")) {
findPreference("quit_app").setEnabled(false);
}
findPreference("debug_logs").setVisible(AndroidUtil.isJellyBeanOrLater ||
(BuildConfig.DEBUG && getActivity().checkCallingOrSelfPermission(Manifest.permission.READ_LOGS) == PackageManager.PERMISSION_GRANTED));
}
@Override
public void onStart() {
super.onStart();
......
......@@ -16,7 +16,6 @@ import android.view.SurfaceView
import android.view.WindowManager
import android.widget.FrameLayout
import org.videolan.libvlc.RendererItem
import org.videolan.libvlc.util.AndroidUtil
import org.videolan.vlc.BuildConfig
import org.videolan.vlc.R
import org.videolan.vlc.RendererDelegate
......@@ -29,7 +28,7 @@ class DisplayManager(private val activity: Activity, cloneMode: Boolean, benchma
val displayType: DisplayType
// Presentation
private val mediaRouter: MediaRouter? by lazy { if (AndroidUtil.isJellyBeanMR1OrLater) activity.applicationContext.getSystemService(Context.MEDIA_ROUTER_SERVICE) as MediaRouter else null }
private val mediaRouter: MediaRouter? by lazy { activity.applicationContext.getSystemService(Context.MEDIA_ROUTER_SERVICE) as MediaRouter }
private var mediaRouterCallback: MediaRouter.SimpleCallback? = null
var presentation: SecondaryDisplay? = null
private var presentationDisplayId = -1
......@@ -57,7 +56,7 @@ class DisplayManager(private val activity: Activity, cloneMode: Boolean, benchma
}}
init {
presentation = if (AndroidUtil.isJellyBeanMR1OrLater && !(cloneMode || benchmark)) createPresentation() else null
presentation = if (!(cloneMode || benchmark)) createPresentation() else null
displayType = if (benchmark) DisplayType.PRIMARY else getCurrentType()
if (!AndroidDevices.isChromeBook) RendererDelegate.selectedRenderer.observeForever(rendererObs)
}
......@@ -115,9 +114,7 @@ class DisplayManager(private val activity: Activity, cloneMode: Boolean, benchma
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
fun mediaRouterAddCallback(add: Boolean) {
if (!AndroidUtil.isJellyBeanMR1OrLater || mediaRouter === null
|| add == (mediaRouterCallback !== null))
return
if (mediaRouter === null || add == (mediaRouterCallback !== null)) return
if (add) {
mediaRouterCallback = object : MediaRouter.SimpleCallback() {
override fun onRoutePresentationDisplayChanged(
......
......@@ -340,12 +340,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mActionBarView = (ViewGroup) mActionBar.getCustomView();
mTitle = mActionBarView.findViewById(R.id.player_overlay_title);
if (!AndroidUtil.isJellyBeanOrLater) {
View v = findViewById(R.id.player_overlay_systime);
if (v instanceof TextView) mSysTime = (TextView) v;
v = findViewById(R.id.player_overlay_battery);
if (v instanceof TextView) mBattery = (TextView) v;
}
mPlaylistToggle = findViewById(R.id.playlist_toggle);
mPlaylist = findViewById(R.id.video_playlist);
......@@ -433,7 +427,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
} else touch = 0;
mCurrentScreenOrientation = getResources().getConfiguration().orientation;
if (touch != 0) {
boolean isRtl = AndroidUtil.isJellyBeanMR1OrLater && TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL;
boolean isRtl = TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL;
final DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int yRange = Math.min(dm.widthPixels, dm.heightPixels);
......@@ -582,15 +576,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
final int orientation = getScreenOrientation(100);
final boolean portrait = orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ||
orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
final int endOf = AndroidUtil.isJellyBeanMR1OrLater ? RelativeLayout.END_OF : RelativeLayout.RIGHT_OF;
final int startOf = AndroidUtil.isJellyBeanMR1OrLater ? RelativeLayout.START_OF : RelativeLayout.LEFT_OF;
final int endAlign = AndroidUtil.isJellyBeanMR1OrLater ? RelativeLayout.ALIGN_PARENT_END : RelativeLayout.ALIGN_PARENT_RIGHT;
final int startAlign = AndroidUtil.isJellyBeanMR1OrLater ? RelativeLayout.ALIGN_PARENT_START : RelativeLayout.ALIGN_PARENT_LEFT;
layoutParams.addRule(startAlign, portrait ? 1 : 0);
layoutParams.addRule(endAlign, portrait ? 1 : 0);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_START, portrait ? 1 : 0);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_END, portrait ? 1 : 0);
layoutParams.addRule(RelativeLayout.BELOW, portrait ? R.id.player_overlay_length : R.id.player_overlay_seekbar);
layoutParams.addRule(endOf, portrait ? 0 : R.id.player_overlay_time);
layoutParams.addRule(startOf, portrait ? 0 : R.id.player_overlay_length);
layoutParams.addRule(RelativeLayout.END_OF, portrait ? 0 : R.id.player_overlay_time);
layoutParams.addRule(RelativeLayout.START_OF, portrait ? 0 : R.id.player_overlay_length);
mHudBinding.playerOverlayButtons.setLayoutParams(layoutParams);
}
......@@ -2503,7 +2493,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mHudBinding.progressOverlay.setLayoutParams(layoutParams);
mOverlayBackground = findViewById(R.id.player_overlay_background);
mNavMenu = findViewById(R.id.player_overlay_navmenu);
if (!AndroidDevices.isChromeBook && AndroidUtil.isJellyBeanMR1OrLater && !VLCApplication.showTvUi()) {
if (!AndroidDevices.isChromeBook && !VLCApplication.showTvUi()) {
mRendererBtn = findViewById(R.id.video_renderer);
RendererDelegate.INSTANCE.getSelectedRenderer().observe(this, new Observer<RendererItem>() {
@Override
......@@ -2570,23 +2560,14 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (mIsNavMenu) return;
if (dim || mIsLocked) mActionBar.hide();
else mActionBar.show();
int visibility = 0;
int navbar = 0;
if (AndroidUtil.isJellyBeanOrLater) {
visibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
navbar = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
}
int visibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
int navbar = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
if (dim || mIsLocked) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
navbar |= View.SYSTEM_UI_FLAG_LOW_PROFILE;
if (!AndroidDevices.hasCombBar) {
navbar |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
if (AndroidUtil.isKitKatOrLater)
visibility |= View.SYSTEM_UI_FLAG_IMMERSIVE;
if (AndroidUtil.isJellyBeanOrLater)
visibility |= View.SYSTEM_UI_FLAG_FULLSCREEN;
}
navbar |= View.SYSTEM_UI_FLAG_LOW_PROFILE|View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
if (AndroidUtil.isKitKatOrLater) visibility |= View.SYSTEM_UI_FLAG_IMMERSIVE;
visibility |= View.SYSTEM_UI_FLAG_FULLSCREEN;
} else {
mActionBar.show();
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
......@@ -2601,14 +2582,10 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void showTitle() {
if (mIsNavMenu) return;
int visibility = 0;
int navbar = 0;
mActionBar.show();
if (AndroidUtil.isJellyBeanOrLater) {
visibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
navbar = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
}
int visibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
int navbar = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
navbar |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
if (AndroidDevices.hasNavBar) visibility |= navbar;
......
......@@ -30,7 +30,6 @@ import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.R;
import org.videolan.vlc.interfaces.OnEqualizerBarChangeListener;
......@@ -58,19 +57,17 @@ public class EqualizerBar extends LinearLayout {
private void init(Context context, float band) {
LayoutInflater.from(context).inflate(R.layout.equalizer_bar, this, true);
mSeek = (VerticalSeekBar) findViewById(R.id.equalizer_seek);
mSeek = findViewById(R.id.equalizer_seek);
//Force LTR to fix VerticalSeekBar background problem with RTL layout
if (AndroidUtil.isJellyBeanMR1OrLater){
mSeek.setLayoutDirection(LAYOUT_DIRECTION_LTR);
}
mSeek.setLayoutDirection(LAYOUT_DIRECTION_LTR);
mSeek.setMax(2 * RANGE);
mSeek.setProgress(RANGE);
mSeek.setOnSeekBarChangeListener(mSeekListener);
mBand = (TextView) findViewById(R.id.equalizer_band);
mBand = findViewById(R.id.equalizer_band);
mBand.setText(band < 999.5f
? (int) (band + 0.5f) + " Hz"
: (int) (band / 1000.0f + 0.5f) + " kHz");
mValue = (TextView) findViewById(R.id.equalizer_value);
mValue = findViewById(R.id.equalizer_value);
}
private final OnSeekBarChangeListener mSeekListener = new OnSeekBarChangeListener() {
......
......@@ -54,7 +54,6 @@ public class AndroidDevices {
public final static String TAG = "VLC/UiTools/AndroidDevices";
public final static String EXTERNAL_PUBLIC_DIRECTORY = Environment.getExternalStorageDirectory().getPath();
public final static boolean isPhone;
public final static boolean hasCombBar;
public final static boolean hasNavBar;
public final static boolean hasTsp;
public final static boolean isAndroidTv;
......@@ -106,7 +105,6 @@ public class AndroidDevices {
final TelephonyManager tm = ctx != null ? ((TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE)) : null;
isPhone = tm == null || tm.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE;
// hasCombBar test if device has Combined Bar : only for tablet with Honeycomb or ICS
hasCombBar = !AndroidDevices.isPhone && !AndroidUtil.isJellyBeanMR1OrLater;
}
public static boolean hasExternalStorage() {
......
......@@ -34,7 +34,6 @@ import android.text.TextUtils;
import android.view.View;
import android.widget.RemoteViews;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.R;
import org.videolan.vlc.StartActivity;
......@@ -101,7 +100,7 @@ abstract public class VLCAppWidgetProvider extends AppWidgetProvider {
views.setOnClickPendingIntent(R.id.stop, piStop);
views.setOnClickPendingIntent(R.id.forward, piForward);
views.setOnClickPendingIntent(R.id.cover, piVlc);
if (AndroidUtil.isJellyBeanMR1OrLater && TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL) {
if (TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL) {
final boolean black = this instanceof VLCAppWidgetProviderBlack;
views.setImageViewResource(R.id.forward, black ? R.drawable.ic_widget_previous_w : R.drawable.ic_widget_previous);
views.setImageViewResource(R.id.backward, black ? R.drawable.ic_widget_next_w : R.drawable.ic_widget_next);
......
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