mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-30 23:03:00 +00:00 
			
		
		
		
	Fix player switching
- Background to popup wasn't asking for permission - The new task flag is needed to switch from the background/popup UI to the main player
This commit is contained in:
		| @@ -4,6 +4,7 @@ import android.content.Intent; | ||||
| import android.view.MenuItem; | ||||
|  | ||||
| import org.schabi.newpipe.R; | ||||
| import org.schabi.newpipe.util.PermissionHelper; | ||||
|  | ||||
| import static org.schabi.newpipe.player.BackgroundPlayer.ACTION_CLOSE; | ||||
|  | ||||
| @@ -48,6 +49,12 @@ public final class BackgroundPlayerActivity extends ServicePlayerActivity { | ||||
|     @Override | ||||
|     public boolean onPlayerOptionSelected(MenuItem item) { | ||||
|         if (item.getItemId() == R.id.action_switch_popup) { | ||||
|  | ||||
|             if (!PermissionHelper.isPopupEnabled(this)) { | ||||
|                 PermissionHelper.showPopupEnablementToast(this); | ||||
|                 return true; | ||||
|             } | ||||
|  | ||||
|             this.player.setRecovery(); | ||||
|             getApplicationContext().sendBroadcast(getPlayerShutdownIntent()); | ||||
|             getApplicationContext().startService(getSwitchIntent(PopupVideoPlayer.class)); | ||||
|   | ||||
| @@ -25,7 +25,6 @@ import android.content.Intent; | ||||
| import android.content.SharedPreferences; | ||||
| import android.content.pm.ActivityInfo; | ||||
| import android.content.res.Configuration; | ||||
| import android.content.res.Resources; | ||||
| import android.graphics.Color; | ||||
| import android.media.AudioManager; | ||||
| import android.os.Build; | ||||
| @@ -65,8 +64,6 @@ import org.schabi.newpipe.util.PermissionHelper; | ||||
| import org.schabi.newpipe.util.PopupMenuIconHacker; | ||||
| import org.schabi.newpipe.util.ThemeHelper; | ||||
|  | ||||
| import java.lang.reflect.Field; | ||||
| import java.lang.reflect.Method; | ||||
| import java.util.List; | ||||
|  | ||||
| import static org.schabi.newpipe.util.AnimationUtils.animateView; | ||||
| @@ -400,9 +397,8 @@ public final class MainVideoPlayer extends Activity { | ||||
|             if (DEBUG) Log.d(TAG, "onFullScreenButtonClicked() called"); | ||||
|             if (simpleExoPlayer == null) return; | ||||
|  | ||||
|             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M | ||||
|                     && !PermissionHelper.checkSystemAlertWindowPermission(MainVideoPlayer.this)) { | ||||
|                 Toast.makeText(MainVideoPlayer.this, R.string.msg_popup_permission, Toast.LENGTH_LONG).show(); | ||||
|             if (!PermissionHelper.isPopupEnabled(context)) { | ||||
|                 PermissionHelper.showPopupEnablementToast(context); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|   | ||||
| @@ -183,7 +183,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity | ||||
|                 this.player.getPlaybackSpeed(), | ||||
|                 this.player.getPlaybackPitch(), | ||||
|                 null | ||||
|         ); | ||||
|         ).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||||
|     } | ||||
|     //////////////////////////////////////////////////////////////////////////// | ||||
|     // Service Connection | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Mauricio Colli
					Mauricio Colli