...
 
Commits (10)
......@@ -219,6 +219,7 @@ VLC_MODULE_BLACKLIST="
fb
aout_file
yuv
mpg123
.dummy
"
......
......@@ -2,8 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:keepScreenOn="true" >
android:layout_height="fill_parent" >
<!--
the double FrameLayout is necessary here to do cropping on the bottom right
......@@ -26,7 +25,8 @@
<SurfaceView
android:id="@+id/player_surface"
android:layout_width="1dp"
android:layout_height="1dp" />
android:layout_height="1dp"
android:keepScreenOn="true" />
<SurfaceView
android:id="@+id/subtitles_surface"
......
......@@ -1010,8 +1010,10 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
}
private void initMediaSession() {
ComponentName mediaButtonEventReceiver = new ComponentName(this,
RemoteControlClientReceiver.class);
mSessionCallback = new MediaSessionCallback();
mMediaSession = new MediaSessionCompat(this, "VLC");
mMediaSession = new MediaSessionCompat(this, "VLC", mediaButtonEventReceiver, null);
mMediaSession.setFlags(MediaSessionCompat.FLAG_HANDLES_MEDIA_BUTTONS
| MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS);
mMediaSession.setCallback(mSessionCallback);
......@@ -1025,7 +1027,6 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
mMediaSession.setActive(false);
mMediaSession.setFlags(MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS);
mMediaSession.setActive(true);
}
}
......
......@@ -45,17 +45,16 @@ import android.widget.TextView;
import com.android.widget.SlidingPaneLayout;
import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.gui.helpers.UiTools;
import org.videolan.vlc.media.MediaLibrary;
import org.videolan.vlc.PlaybackService;
import org.videolan.vlc.R;
import org.videolan.vlc.gui.audio.AudioPlayer;
import org.videolan.vlc.gui.browser.MediaBrowserFragment;
import org.videolan.vlc.gui.helpers.UiTools;
import org.videolan.vlc.interfaces.IRefreshable;
import org.videolan.vlc.media.MediaLibrary;
import org.videolan.vlc.util.Strings;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.WeakHandler;
import org.videolan.vlc.gui.view.HackyDrawerLayout;
public class AudioPlayerContainerActivity extends AppCompatActivity implements PlaybackService.Client.Callback {
......@@ -77,7 +76,6 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
protected SlidingPaneLayout mSlidingPane;
protected View mAudioPlayerFilling;
protected SharedPreferences mSettings;
protected ViewGroup mRootContainer;
private final PlaybackServiceActivity.Helper mHelper = new PlaybackServiceActivity.Helper(this, this);
protected PlaybackService mService;
......@@ -98,8 +96,6 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
protected void initAudioPlayerContainerActivity(){
mRootContainer = (ViewGroup) ((ViewGroup) this
.findViewById(android.R.id.content)).getChildAt(0);
mToolbar = (Toolbar) findViewById(R.id.main_toolbar);
setSupportActionBar(mToolbar);
mActionBar = getSupportActionBar();
......@@ -186,10 +182,9 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
if (!mSettings.getBoolean(settingKey, false) && !BuildConfig.tv) {
removeTipViewIfDisplayed();
View v = LayoutInflater.from(this).inflate(layoutId, null);
mRootContainer.addView(v,
new HackyDrawerLayout.LayoutParams(HackyDrawerLayout.LayoutParams.MATCH_PARENT,
HackyDrawerLayout.LayoutParams.MATCH_PARENT));
ViewGroup root = (ViewGroup) findViewById(R.id.pane).getParent();
root.addView(v, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
......@@ -214,10 +209,11 @@ public class AudioPlayerContainerActivity extends AppCompatActivity implements P
* Remove the current tip view if there is one displayed.
*/
public void removeTipViewIfDisplayed() {
if (mRootContainer.getChildCount() > 2){
for (int i = 0 ; i< mRootContainer.getChildCount() ; ++i){
if (mRootContainer.getChildAt(i).getId() == R.id.audio_tips)
mRootContainer.removeViewAt(i);
ViewGroup root = (ViewGroup) findViewById(R.id.pane).getParent();
if (root.getChildCount() > 2){
for (int i = 0 ; i< root.getChildCount() ; ++i){
if (root.getChildAt(i).getId() == R.id.audio_tips)
root.removeViewAt(i);
}
}
}
......
......@@ -322,6 +322,8 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
@Override
public void onItemClick(AdapterView<?> av, View v, int p, long id) {
ArrayList<MediaWrapper> mediaList = mArtistsAdapter.getMedias(p);
if (mediaList.isEmpty())
return;
MainActivity activity = (MainActivity)getActivity();
Intent i = new Intent(getActivity(), SecondaryActivity.class);
i.putExtra("fragment", "albumsSongs");
......@@ -335,6 +337,8 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
@Override
public void onItemClick(AdapterView<?> av, View v, int p, long id) {
ArrayList<MediaWrapper> mediaList = mAlbumsAdapter.getMedias(p);
if (mediaList.isEmpty())
return;
Intent i = new Intent(getActivity(), SecondaryActivity.class);
i.putExtra("fragment", SecondaryActivity.ALBUM);
i.putParcelableArrayListExtra("list", mediaList);
......@@ -347,6 +351,8 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
@Override
public void onItemClick(AdapterView<?> av, View v, int p, long id) {
ArrayList<MediaWrapper> mediaList = mGenresAdapter.getMedias(p);
if (mediaList.isEmpty())
return;
Intent i = new Intent(getActivity(), SecondaryActivity.class);
i.putExtra("fragment", SecondaryActivity.ALBUMS_SONGS);
i.putParcelableArrayListExtra("list", mediaList);
......
......@@ -81,13 +81,13 @@ public class VideoGridAnimator {
/* List not not ready yet: reschedule */
mLastNItems = mGridView.getChildCount();
Log.e(TAG, "Rescheduling animation: list not ready");
mGridView.postDelayed(this, 10);
mGridView.postDelayed(this, 200);
return;
}
isAnimating = false;
for (int i = 0; i < mGridView.getChildCount(); i++) {
for (int i = 0; i < mLastNItems; i++) {
AnimationSet animSet = new AnimationSet(true);
Animation animation = new AlphaAnimation(0.0f, 1.0f);
animation.setDuration(300);
......
......@@ -1277,7 +1277,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
* @param duration
*/
private void showInfo(String text, int duration) {
if (mPresentation == null)
if (mPresentation == null && mVerticalBar != null)
mVerticalBar.setVisibility(View.GONE);
mInfo.setVisibility(View.VISIBLE);
mInfo.setText(text);
......@@ -1286,7 +1286,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
}
private void showInfo(int textid, int duration) {
if (mPresentation == null)
if (mPresentation == null && mVerticalBar != null)
mVerticalBar.setVisibility(View.GONE);
mInfo.setVisibility(View.VISIBLE);
mInfo.setText(textid);
......@@ -1315,7 +1315,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
VideoPlayerActivity.this, android.R.anim.fade_out));
mInfo.setVisibility(View.INVISIBLE);
if (mPresentation == null) {
if (mPresentation == null && mVerticalBar != null) {
if (mVerticalBar.getVisibility() == View.VISIBLE) {
mVerticalBar.startAnimation(AnimationUtils.loadAnimation(
VideoPlayerActivity.this, android.R.anim.fade_out));
......@@ -1501,7 +1501,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (isFinishing())
return;
//We may not have the permission to access files
if (TextUtils.equals(mUri.getScheme(), "file") &&
if (AndroidUtil.isMarshMallowOrLater() && mUri != null &&
TextUtils.equals(mUri.getScheme(), "file") &&
!Permissions.canReadStorage()) {
Permissions.checkReadStoragePermission(this, true);
return;
......@@ -1536,11 +1537,20 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (mSwitchingView)
return;
Toast.makeText(this, R.string.hardware_acceleration_error, Toast.LENGTH_LONG).show();
mService.removeCallback(this);
final boolean wasPaused = !mService.isPlaying();
final long oldTime = mService.getTime();
mService.stop();
if(!isFinishing())
loadMedia();
if(!isFinishing()) {
final MediaWrapper mw = new MediaWrapper(mUri);
if (wasPaused)
mw.addFlags(MediaWrapper.MEDIA_PAUSED);
mw.addFlags(MediaWrapper.MEDIA_NO_HWACCEL);
mw.addFlags(MediaWrapper.MEDIA_VIDEO);
mService.load(mw);
if (oldTime > 0)
seek(oldTime);
}
}
private void handleVout(int voutCount) {
final IVLCVout vlcVout = mService.getVLCVout();
......
......@@ -140,7 +140,7 @@ public class VLCOptions {
private static String getResampler() {
final VLCUtil.MachineSpecs m = VLCUtil.getMachineSpecs();
return m.processors > 2 ? "soxr" : "ugly";
return (m == null || m.processors > 2) ? "soxr" : "ugly";
}
public static void setMediaOptions(Media media, Context context, int flags) {
......