-Fixed popup player not in foreground when opened by external intent.
-Fixed popup overlay permission causing exception when opened externally.
This commit is contained in:
parent
77678b8f31
commit
979bd09b29
|
@ -185,7 +185,7 @@
|
||||||
android:name=".RouterPopupActivity"
|
android:name=".RouterPopupActivity"
|
||||||
android:label="@string/popup_mode_share_menu_title"
|
android:label="@string/popup_mode_share_menu_title"
|
||||||
android:taskAffinity=""
|
android:taskAffinity=""
|
||||||
android:theme="@android:style/Theme.NoDisplay">
|
android:theme="@style/PopupPermissionsTheme">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH"/>
|
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH"/>
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class RouterPopupActivity extends RouterActivity {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
||||||
&& !PermissionHelper.checkSystemAlertWindowPermission(this)) {
|
&& !PermissionHelper.checkSystemAlertWindowPermission(this)) {
|
||||||
Toast.makeText(this, R.string.msg_popup_permission, Toast.LENGTH_LONG).show();
|
Toast.makeText(this, R.string.msg_popup_permission, Toast.LENGTH_LONG).show();
|
||||||
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
StreamingService service;
|
StreamingService service;
|
||||||
|
|
|
@ -842,6 +842,8 @@ public final class PopupVideoPlayer extends Service {
|
||||||
}
|
}
|
||||||
savePositionAndSize();
|
savePositionAndSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
v.performClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -880,23 +882,25 @@ public final class PopupVideoPlayer extends Service {
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final Handler mainHandler;
|
private final Handler mainHandler;
|
||||||
|
|
||||||
FetcherHandler(Context context, int serviceId, String url) {
|
private FetcherHandler(Context context, int serviceId, String url) {
|
||||||
this.mainHandler = new Handler(PopupVideoPlayer.this.getMainLooper());
|
this.mainHandler = new Handler(PopupVideoPlayer.this.getMainLooper());
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.serviceId = serviceId;
|
this.serviceId = serviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*package-private*/ void onReceive(final StreamInfo info) {
|
private void onReceive(final StreamInfo info) {
|
||||||
mainHandler.post(new Runnable() {
|
mainHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
playerImpl.initPlayback(new SinglePlayQueue(info));
|
final Intent intent = NavigationHelper.getPlayerIntent(getApplicationContext(),
|
||||||
|
PopupVideoPlayer.class, new SinglePlayQueue(info));
|
||||||
|
playerImpl.handleIntent(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onError(final Throwable exception) {
|
private void onError(final Throwable exception) {
|
||||||
if (DEBUG) Log.d(TAG, "onError() called with: exception = [" + exception + "]");
|
if (DEBUG) Log.d(TAG, "onError() called with: exception = [" + exception + "]");
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
mainHandler.post(new Runnable() {
|
mainHandler.post(new Runnable() {
|
||||||
|
@ -922,7 +926,7 @@ public final class PopupVideoPlayer extends Service {
|
||||||
stopSelf();
|
stopSelf();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*package-private*/ void onReCaptchaException() {
|
private void onReCaptchaException() {
|
||||||
Toast.makeText(context, R.string.recaptcha_request_toast, Toast.LENGTH_LONG).show();
|
Toast.makeText(context, R.string.recaptcha_request_toast, Toast.LENGTH_LONG).show();
|
||||||
// Starting ReCaptcha Challenge Activity
|
// Starting ReCaptcha Challenge Activity
|
||||||
Intent intent = new Intent(context, ReCaptchaActivity.class);
|
Intent intent = new Intent(context, ReCaptchaActivity.class);
|
||||||
|
|
|
@ -160,4 +160,12 @@
|
||||||
<item name="android:background">@color/dark_youtube_primary_color</item>
|
<item name="android:background">@color/dark_youtube_primary_color</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="PopupPermissionsTheme" parent="Theme.AppCompat.NoActionBar">
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
<item name="android:windowAnimationStyle">@android:style/Animation</item>
|
||||||
|
<item name="android:windowNoDisplay">true</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue