AdGuard v4.4.135版本的 MD5 值为:95950267eaafbda3588f0934f48b2e36
以下内容为反编译后的 YoutubeActivity.java 源代码,内容仅作参考
package com.adguard.android.ui.activity;
import android.content.BroadcastReceiver;
import android.content.ComponentCallbacks;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.Lifecycle;
import androidx.media.app.NotificationCompat;
import androidx.palette.graphics.Palette;
import b.l;
import c1.c;
import ch.qos.logback.classic.spi.CallerData;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.rolling.helper.DateTokenConverter;
import ch.qos.logback.core.rolling.helper.IntegerTokenConverter;
import com.adguard.android.ui.activity.YoutubeActivity;
import com.google.android.material.appbar.MaterialToolbar;
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView;
import ff.v;
import ff.w;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import k5.i;
import k5.o;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.internal.c0;
import kotlin.jvm.internal.n;
import kotlin.jvm.internal.p;
import yb.h;
import yb.k;
@Metadata(d1 = {"\u0000¼\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0007\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u000b\u0018\u0000 k2\u00020\u00012\u00020\u0002:\u0004l2m.B\u0007¢\u0006\u0004\bi\u0010jJ\u0010\u0010\u0006\u001a\u00020\u00052\u0006\u0010\u0004\u001a\u00020\u0003H\u0002J\b\u0010\u0007\u001a\u00020\u0005H\u0002J\b\u0010\b\u001a\u00020\u0005H\u0002J.\u0010\u0010\u001a\u00020\u00052\b\u0010\n\u001a\u0004\u0018\u00010\t2\b\u0010\u000b\u001a\u0004\u0018\u00010\t2\b\u0010\r\u001a\u0004\u0018\u00010\f2\u0006\u0010\u000f\u001a\u00020\u000eH\u0002J@\u0010\u0014\u001a\u0014\u0012\u0004\u0012\u00020\u0012\u0012\u0004\u0012\u00020\u0013\u0012\u0004\u0012\u00020\u00050\u00112\b\u0010\n\u001a\u0004\u0018\u00010\t2\b\u0010\u000b\u001a\u0004\u0018\u00010\t2\b\u0010\r\u001a\u0004\u0018\u00010\f2\u0006\u0010\u000f\u001a\u00020\u000eH\u0002J\b\u0010\u0015\u001a\u00020\u0005H\u0002J\u0014\u0010\u0017\u001a\u0004\u0018\u00010\t2\b\u0010\u0016\u001a\u0004\u0018\u00010\tH\u0002J\u0012\u0010\u0018\u001a\u0004\u0018\u00010\t2\u0006\u0010\u0004\u001a\u00020\u0003H\u0002J\u001a\u0010\u001b\u001a\u0004\u0018\u00010\t2\u0006\u0010\u0019\u001a\u00020\t2\u0006\u0010\u001a\u001a\u00020\tH\u0002J\b\u0010\u001c\u001a\u00020\u0005H\u0002J\b\u0010\u001d\u001a\u00020\u0005H\u0002J\u0012\u0010 \u001a\u00020\u00052\b\u0010\u001f\u001a\u0004\u0018\u00010\u001eH\u0014J\u0010\u0010!\u001a\u00020\u00052\u0006\u0010\u0004\u001a\u00020\u0003H\u0014J\u0010\u0010$\u001a\u00020\u00052\u0006\u0010#\u001a\u00020\"H\u0016J\b\u0010%\u001a\u00020\u0005H\u0014J\u0010\u0010(\u001a\u00020\u000e2\u0006\u0010'\u001a\u00020&H\u0016J\u0010\u0010)\u001a\u00020\u000e2\u0006\u0010'\u001a\u00020&H\u0016J\u0010\u0010,\u001a\u00020\u000e2\u0006\u0010+\u001a\u00020*H\u0016J&\u0010.\u001a\u00020\u00052\b\u0010-\u001a\u0004\u0018\u00010\t2\b\u0010\u000b\u001a\u0004\u0018\u00010\t2\b\u0010\r\u001a\u0004\u0018\u00010\fH\u0016J\u0018\u00102\u001a\u00020\u00052\u000e\u00101\u001a\n\u0018\u00010/j\u0004\u0018\u0001`0H\u0016J\u0006\u00103\u001a\u00020\u000eR\u0018\u00105\u001a\u0004\u0018\u00010\t8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b1\u00104R\u0018\u0010\n\u001a\u0004\u0018\u00010\t8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b6\u00104R\u0018\u00108\u001a\u0004\u0018\u00010\t8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b7\u00104R\u0018\u0010;\u001a\u0004\u0018\u00010\f8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b9\u0010:R\u0016\u0010?\u001a\u00020<8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b=\u0010>R\u0016\u0010C\u001a\u00020@8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\bA\u0010BR\u0018\u0010G\u001a\u0004\u0018\u00010D8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bE\u0010FR\u0014\u0010K\u001a\u00020H8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bI\u0010JR\u0016\u0010O\u001a\u00020L8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bM\u0010NR\u0018\u0010S\u001a\u0004\u0018\u00010P8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bQ\u0010RR\u0016\u0010V\u001a\u00020T8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bU\u0010\u0018R\u0016\u0010X\u001a\u00020T8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bW\u0010\u0018R\u0018\u0010\\\u001a\u0004\u0018\u00010Y8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bZ\u0010[R\u0018\u0010`\u001a\u0004\u0018\u00010]8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b^\u0010_R\u0018\u0010b\u001a\u0004\u0018\u00010]8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\ba\u0010_R\u001b\u0010h\u001a\u00020c8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bd\u0010e\u001a\u0004\bf\u0010g¨\u0006n"}, d2 = {"Lcom/adguard/android/ui/activity/YoutubeActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "Lk5/o$a;", "Landroid/content/Intent;", "intent", "", "L", "J", "P", "", "videoTitle", "channel", "Landroid/graphics/Bitmap;", "thumbnail", "", "playing", "O", "Lkotlin/Function2;", "Lt7/a;", "Landroid/content/Context;", "H", "B", "input", "D", "F", "url", "type", "C", "N", "G", "Landroid/os/Bundle;", "savedInstanceState", "onCreate", "onNewIntent", "Landroid/content/res/Configuration;", "newConfig", "onConfigurationChanged", "onDestroy", "Landroid/view/Menu;", "menu", "onCreateOptionsMenu", "onPrepareOptionsMenu", "Landroid/view/MenuItem;", "item", "onOptionsItemSelected", "title", DateTokenConverter.CONVERTER_KEY, "Ljava/lang/Exception;", "Lkotlin/Exception;", "e", "b", "K", "Ljava/lang/String;", "videoId", "g", "h", "videoChannel", IntegerTokenConverter.CONVERTER_KEY, "Landroid/graphics/Bitmap;", "videoThumbnail", "Lcom/pierfrancescosoffritti/androidyoutubeplayer/core/player/views/YouTubePlayerView;", "j", "Lcom/pierfrancescosoffritti/androidyoutubeplayer/core/player/views/YouTubePlayerView;", "youTubePlayerView", "Lcom/adguard/android/ui/activity/YoutubeActivity$c;", "k", "Lcom/adguard/android/ui/activity/YoutubeActivity$c;", "playbackReceiver", "Lka/e;", "l", "Lka/e;", "youTubePlayer", "Lk5/f;", "m", "Lk5/f;", "fullScreenHelper", "Lka/d;", "n", "Lka/d;", "currentState", "Lc1/c$b;", "o", "Lc1/c$b;", "currentNotificationId", "", "p", "currentVideoTime", "q", "videoDuration", "Landroid/widget/ImageView;", "r", "Landroid/widget/ImageView;", "errorIcon", "Landroid/widget/TextView;", "s", "Landroid/widget/TextView;", "errorSummary", "t", "errorButton", "Lc1/c;", "u", "Lyb/h;", "E", "()Lc1/c;", "notificationManager", "<init>", "()V", "v", "a", "c", "base_release"}, k = 1, mv = {1, 8, 0})
public final class YoutubeActivity extends AppCompatActivity implements o.a {
public static final a f3505v = new a(null);
public static final Pattern f3506w = Pattern.compile(i.f19351g);
public static final uh.c f3507x = uh.d.i(YoutubeActivity.class);
public String f3508e;
public String f3509g;
public String f3510h;
public Bitmap f3511i;
public YouTubePlayerView f3512j;
public c f3513k;
public ka.e f3514l;
public c.b f3517o;
public float f3518p;
public float f3519q;
public ImageView f3520r;
public TextView f3521s;
public TextView f3522t;
public final k5.f f3515m = new k5.f(this, new View[0]);
public ka.d f3516n = ka.d.UNKNOWN;
public final h f3523u = yb.i.b(k.SYNCHRONIZED, new g(this, null, null));
@Metadata(d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\f\b\u0086\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0014\u0010\u0015R\u0014\u0010\u0003\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0003\u0010\u0004R\u001c\u0010\u0007\u001a\n \u0006*\u0004\u0018\u00010\u00050\u00058\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0007\u0010\bR\u0014\u0010\t\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\t\u0010\u0004R\u001c\u0010\u000b\u001a\n \u0006*\u0004\u0018\u00010\n0\n8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u000b\u0010\fR\u0014\u0010\r\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\r\u0010\u0004R\u0014\u0010\u000e\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u000e\u0010\u0004R\u0014\u0010\u000f\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u000f\u0010\u0004R\u0014\u0010\u0010\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0010\u0010\u0004R\u0014\u0010\u0011\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0011\u0010\u0004R\u0014\u0010\u0012\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0012\u0010\u0004R\u0014\u0010\u0013\u001a\u00020\u00028\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0013\u0010\u0004¨\u0006\u0016"}, d2 = {"Lcom/adguard/android/ui/activity/YoutubeActivity$a;", "", "", "LIVE", "Ljava/lang/String;", "Luh/c;", "kotlin.jvm.PlatformType", "LOG", "Luh/c;", "SHORTS", "Ljava/util/regex/Pattern;", "WEB_URL_WITH_PROTOCOL", "Ljava/util/regex/Pattern;", "YOUTUBE_LIVE_PREFIX_WITHOUT_WWW", "YOUTUBE_LIVE_PREFIX_WITH_WWW", "YOUTUBE_PREFIX", "YOUTUBE_PREFIX_FULL_WITHOUT_WWW", "YOUTUBE_PREFIX_FULL_WITH_WWW", "YOUTUBE_SHORTS_PREFIX_WITHOUT_WWW", "YOUTUBE_SHORTS_PREFIX_WITH_WWW", "<init>", "()V", "base_release"}, k = 1, mv = {1, 8, 0})
public static final class a {
public a() {
}
public a(kotlin.jvm.internal.h hVar) {
this();
}
}
@Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\n\b\u0086\u0004\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\r\u0010\u000eJ\b\u0010\u0003\u001a\u00020\u0002H\u0016J\b\u0010\u0004\u001a\u00020\u0002H\u0016R\"\u0010\f\u001a\u00020\u00058\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b\u0006\u0010\u0007\u001a\u0004\b\b\u0010\t\"\u0004\b\n\u0010\u000b¨\u0006\u000f"}, d2 = {"Lcom/adguard/android/ui/activity/YoutubeActivity$b;", "Lla/c;", "", "p", "j", "", "e", "I", "getLastOrientation", "()I", "setLastOrientation", "(I)V", "lastOrientation", "<init>", "(Lcom/adguard/android/ui/activity/YoutubeActivity;)V", "base_release"}, k = 1, mv = {1, 8, 0})
public final class b implements la.c {
public int f3524e;
public b() {
}
@Override
public void j() {
if (YoutubeActivity.this.K()) {
YoutubeActivity.this.setRequestedOrientation(this.f3524e);
}
YoutubeActivity.this.f3515m.b();
ActionBar supportActionBar = YoutubeActivity.this.getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.show();
}
}
@Override
public void p() {
this.f3524e = YoutubeActivity.this.getRequestedOrientation();
if (YoutubeActivity.this.K()) {
YoutubeActivity.this.setRequestedOrientation(11);
}
YoutubeActivity.this.f3515m.a();
ActionBar supportActionBar = YoutubeActivity.this.getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.hide();
}
}
}
@Metadata(d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0007\u0018\u0000 \t2\u00020\u0001:\u0001\bB\u000f\u0012\u0006\u0010\u000e\u001a\u00020\n¢\u0006\u0004\b\u000f\u0010\u0010J\u001c\u0010\u0007\u001a\u00020\u00062\b\u0010\u0003\u001a\u0004\u0018\u00010\u00022\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004H\u0016J\u0006\u0010\b\u001a\u00020\u0006J\u0006\u0010\t\u001a\u00020\u0006R\u0017\u0010\u000e\u001a\u00020\n8\u0006¢\u0006\f\n\u0004\b\b\u0010\u000b\u001a\u0004\b\f\u0010\r¨\u0006\u0011"}, d2 = {"Lcom/adguard/android/ui/activity/YoutubeActivity$c;", "Landroid/content/BroadcastReceiver;", "Landroid/content/Context;", CoreConstants.CONTEXT_SCOPE_VALUE, "Landroid/content/Intent;", "intent", "", "onReceive", "a", "b", "Lcom/adguard/android/ui/activity/YoutubeActivity;", "Lcom/adguard/android/ui/activity/YoutubeActivity;", "getActivity", "()Lcom/adguard/android/ui/activity/YoutubeActivity;", "activity", "<init>", "(Lcom/adguard/android/ui/activity/YoutubeActivity;)V", "base_release"}, k = 1, mv = {1, 8, 0})
public static final class c extends BroadcastReceiver {
public static final a f3526b = new a(null);
public final YoutubeActivity f3527a;
@Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\u0006\b\u0086\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0006\u0010\u0007R\u0014\u0010\u0003\u001a\u00020\u00028\u0006X\u0086T¢\u0006\u0006\n\u0004\b\u0003\u0010\u0004R\u0014\u0010\u0005\u001a\u00020\u00028\u0006X\u0086T¢\u0006\u0006\n\u0004\b\u0005\u0010\u0004¨\u0006\b"}, d2 = {"Lcom/adguard/android/ui/activity/YoutubeActivity$c$a;", "", "", "STOP_PLAYBACK", "Ljava/lang/String;", "TOGGLE_PLAYBACK", "<init>", "()V", "base_release"}, k = 1, mv = {1, 8, 0})
public static final class a {
public a() {
}
public a(kotlin.jvm.internal.h hVar) {
this();
}
}
public c(YoutubeActivity activity) {
n.g(activity, "activity");
this.f3527a = activity;
}
public final void a() {
IntentFilter intentFilter = new IntentFilter("com.adguard.youtube.TOGGLE_PLAYBACK");
intentFilter.addAction("com.adguard.youtube.STOP_PLAYBACK");
this.f3527a.registerReceiver(this, intentFilter);
}
public final void b() {
this.f3527a.unregisterReceiver(this);
}
@Override
public void onReceive(Context context, Intent intent) {
if (n.b("com.adguard.youtube.TOGGLE_PLAYBACK", intent != null ? intent.getAction() : null)) {
this.f3527a.P();
return;
}
if (n.b("com.adguard.youtube.STOP_PLAYBACK", intent != null ? intent.getAction() : null)) {
ka.e eVar = this.f3527a.f3514l;
if (eVar != null) {
eVar.a();
}
this.f3527a.finish();
}
}
}
@Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0007\n\u0002\b\u0007\b\u0086\u0004\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0010\u0010\u0011J\u0018\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0016J\u0018\u0010\n\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\t\u001a\u00020\bH\u0016J\u0018\u0010\r\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\f\u001a\u00020\u000bH\u0016J\u0018\u0010\u000f\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u000e\u001a\u00020\u000bH\u0016¨\u0006\u0012"}, d2 = {"Lcom/adguard/android/ui/activity/YoutubeActivity$d;", "Lla/a;", "Lka/e;", "youTubePlayer", "Lka/c;", "error", "", "g", "Lka/d;", "state", "q", "", "second", "o", "duration", DateTokenConverter.CONVERTER_KEY, "<init>", "(Lcom/adguard/android/ui/activity/YoutubeActivity;)V", "base_release"}, k = 1, mv = {1, 8, 0})
public final class d extends la.a {
public d() {
}
@Override
public void d(ka.e youTubePlayer, float f10) {
n.g(youTubePlayer, "youTubePlayer");
super.d(youTubePlayer, f10);
YoutubeActivity.this.f3519q = f10;
}
@Override
public void g(ka.e youTubePlayer, ka.c error) {
n.g(youTubePlayer, "youTubePlayer");
n.g(error, "error");
uh.c cVar = YoutubeActivity.f3507x;
String str = YoutubeActivity.this.f3508e;
cVar.warn("Error playing video " + str + ": " + error);
YoutubeActivity.this.N();
}
@Override
public void o(ka.e youTubePlayer, float f10) {
n.g(youTubePlayer, "youTubePlayer");
super.o(youTubePlayer, f10);
YoutubeActivity.this.f3518p = f10;
}
@Override
public void q(ka.e youTubePlayer, ka.d state) {
n.g(youTubePlayer, "youTubePlayer");
n.g(state, "state");
YoutubeActivity.this.f3516n = state;
if (state == ka.d.ENDED) {
YoutubeActivity.this.B();
} else {
YoutubeActivity youtubeActivity = YoutubeActivity.this;
youtubeActivity.O(youtubeActivity.f3509g, YoutubeActivity.this.f3510h, YoutubeActivity.this.f3511i, state == ka.d.PLAYING);
}
YoutubeActivity.this.invalidateOptionsMenu();
}
}
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\u0010\u0004\u001a\u00020\u0003*\u00020\u00002\u0006\u0010\u0002\u001a\u00020\u0001H\n¢\u0006\u0004\b\u0004\u0010\u0005"}, d2 = {"Lt7/a;", "Landroid/content/Context;", CoreConstants.CONTEXT_SCOPE_VALUE, "", "a", "(Lt7/a;Landroid/content/Context;)V"}, k = 3, mv = {1, 8, 0})
public static final class e extends p implements mc.p<t7.a, Context, Unit> {
public final String f3529e;
public final String f3530g;
public final int f3531h;
public final Bitmap f3532i;
public final int f3533j;
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\u0010\u0004\u001a\u00020\u0003*\u00020\u00002\u0006\u0010\u0002\u001a\u00020\u0001H\n¢\u0006\u0004\b\u0004\u0010\u0005"}, d2 = {"Lu7/b;", "Landroid/content/Context;", "it", "", "a", "(Lu7/b;Landroid/content/Context;)V"}, k = 3, mv = {1, 8, 0})
public static final class a extends p implements mc.p<u7.b, Context, Unit> {
public final Context f3534e;
public a(Context context) {
super(2);
this.f3534e = context;
}
public final void a(u7.b onClick, Context it) {
n.g(onClick, "$this$onClick");
n.g(it, "it");
onClick.h(new Intent(this.f3534e, YoutubeActivity.class).setFlags(603979776));
onClick.g(134217728);
}
@Override
public Unit mo2invoke(u7.b bVar, Context context) {
a(bVar, context);
return Unit.INSTANCE;
}
}
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\u0010\u0004\u001a\u00020\u0003*\u00020\u00002\u0006\u0010\u0002\u001a\u00020\u0001H\n¢\u0006\u0004\b\u0004\u0010\u0005"}, d2 = {"Lu7/a;", "Landroid/content/Context;", "it", "", "a", "(Lu7/a;Landroid/content/Context;)V"}, k = 3, mv = {1, 8, 0})
public static final class b extends p implements mc.p<u7.a, Context, Unit> {
public final int f3535e;
public b(int i10) {
super(2);
this.f3535e = i10;
}
public final void a(u7.a button, Context it) {
n.g(button, "$this$button");
n.g(it, "it");
button.k(this.f3535e);
button.j().f(l.youtube_notification_play_pause);
button.h(new Intent("com.adguard.youtube.TOGGLE_PLAYBACK"));
button.g(BasicMeasure.EXACTLY);
}
@Override
public Unit mo2invoke(u7.a aVar, Context context) {
a(aVar, context);
return Unit.INSTANCE;
}
}
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\u0010\u0004\u001a\u00020\u0003*\u00020\u00002\u0006\u0010\u0002\u001a\u00020\u0001H\n¢\u0006\u0004\b\u0004\u0010\u0005"}, d2 = {"Lu7/a;", "Landroid/content/Context;", "it", "", "a", "(Lu7/a;Landroid/content/Context;)V"}, k = 3, mv = {1, 8, 0})
public static final class c extends p implements mc.p<u7.a, Context, Unit> {
public static final c f3536e = new c();
public c() {
super(2);
}
public final void a(u7.a button, Context it) {
n.g(button, "$this$button");
n.g(it, "it");
button.k(b.e.ic_youtube_cross);
button.j().f(l.youtube_notification_stop_player);
button.h(new Intent("com.adguard.youtube.STOP_PLAYBACK"));
button.g(BasicMeasure.EXACTLY);
}
@Override
public Unit mo2invoke(u7.a aVar, Context context) {
a(aVar, context);
return Unit.INSTANCE;
}
}
public e(String str, String str2, int i10, Bitmap bitmap, int i11) {
super(2);
this.f3529e = str;
this.f3530g = str2;
this.f3531h = i10;
this.f3532i = bitmap;
this.f3533j = i11;
}
public final void a(t7.a aVar, Context context) {
n.g(aVar, "$this$null");
n.g(context, "context");
aVar.w(b.e.ic_youtube_play);
aVar.p().a(this.f3529e);
aVar.j().a(this.f3530g);
aVar.h().a(Integer.valueOf(this.f3531h));
aVar.x(new NotificationCompat.MediaStyle());
aVar.v(true);
aVar.u(this.f3532i);
aVar.q(u7.c.Activity, new a(context));
u7.c cVar = u7.c.BroadcastReceiver;
aVar.e(cVar, new b(this.f3533j));
aVar.e(cVar, c.f3536e);
}
@Override
public Unit mo2invoke(t7.a aVar, Context context) {
a(aVar, context);
return Unit.INSTANCE;
}
}
@Metadata(d1 = {"\u0000\u0017\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0006"}, d2 = {"com/adguard/android/ui/activity/YoutubeActivity$f", "Lla/b;", "Lka/e;", "youTubePlayer", "", "a", "base_release"}, k = 1, mv = {1, 8, 0})
public static final class f implements la.b {
public f() {
}
@Override
public void a(ka.e youTubePlayer) {
n.g(youTubePlayer, "youTubePlayer");
YoutubeActivity.this.f3514l = youTubePlayer;
String str = YoutubeActivity.this.f3508e;
if (str != null) {
Lifecycle lifecycle = YoutubeActivity.this.getLifecycle();
n.f(lifecycle, "lifecycle");
na.f.a(youTubePlayer, lifecycle, str, 0.0f);
}
}
}
@Metadata(d1 = {"\u0000\b\n\u0002\u0010\u0000\n\u0002\b\u0004\u0010\u0004\u001a\u00028\u0000\"\n\b\u0000\u0010\u0001\u0018\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0002\u0010\u0003"}, d2 = {"", "T", "invoke", "()Ljava/lang/Object;", "<anonymous>"}, k = 3, mv = {1, 8, 0})
public static final class g extends p implements mc.a<c1.c> {
public final ComponentCallbacks f3538e;
public final lh.a f3539g;
public final mc.a f3540h;
public g(ComponentCallbacks componentCallbacks, lh.a aVar, mc.a aVar2) {
super(0);
this.f3538e = componentCallbacks;
this.f3539g = aVar;
this.f3540h = aVar2;
}
@Override
public final c1.c invoke() {
ComponentCallbacks componentCallbacks = this.f3538e;
return vg.a.a(componentCallbacks).g(c0.b(c1.c.class), this.f3539g, this.f3540h);
}
}
public static final void I(YoutubeActivity this$0, String str) {
n.g(this$0, "this$0");
ActionBar supportActionBar = this$0.getSupportActionBar();
if (supportActionBar == null) {
return;
}
supportActionBar.setTitle(str);
}
public static final void M(String str, YoutubeActivity this$0, View view) {
n.g(this$0, "this$0");
if (str != null) {
k8.f fVar = k8.f.f19451a;
Context applicationContext = this$0.getApplicationContext();
n.f(applicationContext, "applicationContext");
k8.f.B(fVar, applicationContext, str, null, false, 12, null);
}
}
public final void B() {
c.b bVar = this.f3517o;
if (bVar != null) {
E().f(bVar);
}
this.f3517o = null;
}
public final String C(String str, String str2) {
Pattern compile = Pattern.compile("(?<=" + str2 + "/).+?(?=\\?)");
n.f(compile, "compile(\"(?<=$type/).+?(?=\\\\?)\")");
Matcher matcher = compile.matcher(str);
n.f(matcher, "pattern.matcher(url)");
if (matcher.find()) {
return matcher.group(0);
}
return null;
}
public final String D(String str) {
Matcher matcher;
String str2 = null;
if (str != null && (matcher = f3506w.matcher(str)) != null && matcher.find()) {
str2 = matcher.group();
}
return str2;
}
public final c1.c E() {
return (c1.c) this.f3523u.getValue();
}
public final String F(Intent intent) {
return intent.getData() != null ? String.valueOf(intent.getData()) : intent.getStringExtra("android.intent.extra.TEXT") != null ? D(intent.getStringExtra("android.intent.extra.TEXT")) : null;
}
public final void G() {
YouTubePlayerView youTubePlayerView = this.f3512j;
if (youTubePlayerView == null) {
n.y("youTubePlayerView");
youTubePlayerView = null;
}
youTubePlayerView.setVisibility(0);
ImageView imageView = this.f3520r;
if (imageView != null) {
imageView.setVisibility(8);
}
TextView textView = this.f3521s;
if (textView != null) {
textView.setVisibility(8);
}
TextView textView2 = this.f3522t;
if (textView2 == null) {
return;
}
textView2.setVisibility(8);
}
public final mc.p<t7.a, Context, Unit> H(String str, String str2, Bitmap bitmap, boolean z10) {
int color = ContextCompat.getColor(this, 17170444);
if (bitmap != null) {
color = Palette.from(bitmap).generate().getDominantColor(color);
}
return new e(str, str2, color, bitmap, z10 ? b.e.ic_youtube_pause : b.e.ic_youtube_play);
}
public final void J() {
String str = this.f3508e;
YouTubePlayerView youTubePlayerView = null;
if (str != null) {
f3507x.info("Opened video: " + str);
o.f19367a.d(str, k5.h.d(k5.h.f19343a, false, 1, null), this);
} else {
N();
}
YouTubePlayerView youTubePlayerView2 = this.f3512j;
if (youTubePlayerView2 == null) {
n.y("youTubePlayerView");
youTubePlayerView2 = null;
}
youTubePlayerView2.f(new f());
YouTubePlayerView youTubePlayerView3 = this.f3512j;
if (youTubePlayerView3 == null) {
n.y("youTubePlayerView");
youTubePlayerView3 = null;
}
youTubePlayerView3.getPlayerUiController().u(false).l(true);
YouTubePlayerView youTubePlayerView4 = this.f3512j;
if (youTubePlayerView4 == null) {
n.y("youTubePlayerView");
youTubePlayerView4 = null;
}
youTubePlayerView4.e(true);
YouTubePlayerView youTubePlayerView5 = this.f3512j;
if (youTubePlayerView5 == null) {
n.y("youTubePlayerView");
youTubePlayerView5 = null;
}
youTubePlayerView5.d(new d());
YouTubePlayerView youTubePlayerView6 = this.f3512j;
if (youTubePlayerView6 == null) {
n.y("youTubePlayerView");
youTubePlayerView6 = null;
}
youTubePlayerView6.c(new b());
Lifecycle lifecycle = getLifecycle();
YouTubePlayerView youTubePlayerView7 = this.f3512j;
if (youTubePlayerView7 == null) {
n.y("youTubePlayerView");
} else {
youTubePlayerView = youTubePlayerView7;
}
lifecycle.addObserver(youTubePlayerView);
}
public final boolean K() {
return Build.VERSION.SDK_INT != 26;
}
public final void L(Intent intent) {
String I0;
String I02;
final String F = F(intent);
uh.c cVar = f3507x;
cVar.info("Video url is " + F);
if (F != null) {
int i10 = (2 << 0) & 2;
String str = null;
if (v.x(F, "https://youtube.com/watch?v=", false, 2, null)) {
I0 = F.substring(28);
n.f(I0, "this as java.lang.String).substring(startIndex)");
} else if (v.x(F, "https://www.youtube.com/watch?v=", false, 2, null)) {
I0 = F.substring(32);
n.f(I0, "this as java.lang.String).substring(startIndex)");
} else {
I0 = v.x(F, "https://youtu.be/", false, 2, null) ? w.I0(w.f0(F, "https://youtu.be/"), CallerData.NA, null, 2, null) : v.x(F, "https://youtube.com/shorts/", false, 2, null) ? C(F, "shorts") : v.x(F, "https://www.youtube.com/shorts/", false, 2, null) ? C(F, "shorts") : v.x(F, "https://youtube.com/live/", false, 2, null) ? C(F, "live") : v.x(F, "https://www.youtube.com/live/", false, 2, null) ? C(F, "live") : null;
}
if (I0 != null && (I02 = w.I0(I0, "&", null, 2, null)) != null) {
str = w.I0(I02, CallerData.NA, null, 2, null);
}
this.f3508e = str;
}
TextView textView = this.f3522t;
if (textView != null) {
textView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
YoutubeActivity.M(F, this, view);
}
});
}
}
public final void N() {
YouTubePlayerView youTubePlayerView = this.f3512j;
if (youTubePlayerView == null) {
n.y("youTubePlayerView");
youTubePlayerView = null;
}
youTubePlayerView.setVisibility(4);
ImageView imageView = this.f3520r;
if (imageView != null) {
imageView.setVisibility(0);
}
TextView textView = this.f3521s;
if (textView != null) {
textView.setVisibility(0);
}
TextView textView2 = this.f3522t;
if (textView2 != null) {
textView2.setVisibility(0);
}
}
public final void O(String str, String str2, Bitmap bitmap, boolean z10) {
if (str == null || str2 == null) {
f3507x.warn("Some meta info is null, not showing notification");
return;
}
c.b bVar = this.f3517o;
if (bVar != null) {
E().v(c1.a.Media, bVar, H(str, str2, bitmap, z10));
} else {
bVar = E().q(c1.a.Media, H(str, str2, bitmap, z10));
}
this.f3517o = bVar;
}
public final void P() {
if (this.f3516n == ka.d.PLAYING) {
ka.e eVar = this.f3514l;
if (eVar != null) {
eVar.a();
}
O(this.f3509g, this.f3510h, this.f3511i, false);
return;
}
ka.e eVar2 = this.f3514l;
if (eVar2 != null) {
eVar2.c();
}
O(this.f3509g, this.f3510h, this.f3511i, true);
}
@Override
public void b(Exception exc) {
f3507x.warn("Unable to load video meta info\n", (Throwable) exc);
}
@Override
public void d(final String str, String str2, Bitmap bitmap) {
if (str == null || str2 == null) {
f3507x.warn("Some meta info is null!!!");
return;
}
this.f3509g = str;
this.f3510h = str2;
this.f3511i = bitmap;
runOnUiThread(new Runnable() {
@Override
public final void run() {
YoutubeActivity.I(YoutubeActivity.this, str);
}
});
O(str, str2, bitmap, this.f3516n == ka.d.PLAYING);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
n.g(newConfig, "newConfig");
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == 2) {
this.f3515m.a();
} else {
this.f3515m.b();
}
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(b.g.youtube_player_layout);
Window window = getWindow();
if (window != null) {
window.addFlags(Integer.MIN_VALUE);
window.clearFlags(67108864);
window.setStatusBarColor(ContextCompat.getColor(this, 17170444));
}
setSupportActionBar((MaterialToolbar) findViewById(b.f.main_toolbar));
ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.setDisplayHomeAsUpEnabled(true);
supportActionBar.setHomeAsUpIndicator(k5.a.f19324a.b(this) ? b.e.ic_cross_color_primary : b.e.ic_cross_white);
}
View findViewById = findViewById(b.f.player_view);
n.f(findViewById, "findViewById(R.id.player_view)");
this.f3512j = (YouTubePlayerView) findViewById;
c cVar = new c(this);
cVar.a();
this.f3513k = cVar;
this.f3520r = (ImageView) findViewById(b.f.error_icon);
this.f3521s = (TextView) findViewById(b.f.error_summary);
this.f3522t = (TextView) findViewById(b.f.error_button);
Intent intent = getIntent();
n.f(intent, "intent");
L(intent);
J();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
n.g(menu, "menu");
getMenuInflater().inflate(b.h.youtube_actions, menu);
return true;
}
@Override
public void onDestroy() {
super.onDestroy();
c cVar = this.f3513k;
if (cVar == null) {
n.y("playbackReceiver");
cVar = null;
}
cVar.b();
B();
}
@Override
public void onNewIntent(Intent intent) {
n.g(intent, "intent");
super.onNewIntent(intent);
L(intent);
G();
J();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
n.g(item, "item");
int itemId = item.getItemId();
boolean z10 = true;
if (itemId == b.f.jump_back) {
ka.e eVar = this.f3514l;
if (eVar != null) {
eVar.b(Math.max(this.f3518p - 15.0f, 0.0f));
}
} else if (itemId == b.f.jump_forward) {
ka.e eVar2 = this.f3514l;
if (eVar2 != null) {
eVar2.b(Math.min(this.f3518p + 15.0f, this.f3519q));
}
} else if (itemId == b.f.play_pause) {
P();
} else if (itemId == 16908332) {
onBackPressed();
} else {
z10 = super.onOptionsItemSelected(item);
}
return z10;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
n.g(menu, "menu");
menu.findItem(b.f.play_pause).setIcon(this.f3516n == ka.d.PLAYING ? b.e.ic_youtube_pause : b.e.ic_youtube_play);
return super.onPrepareOptionsMenu(menu);
}
}