正在查看: Top浏览器 v4.6.16 应用的 DLNACastActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Top浏览器 v4.6.16 应用的 DLNACastActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.pocket.topbrowser.browser.av;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.lifecycle.ViewModel;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import c.c.a.a.b.j;
import c.c.a.a.b.l.i;
import c.c.a.a.b.l.k;
import c.c.a.a.b.l.m;
import c.c.a.a.b.l.n;
import c.c.a.a.b.l.q;
import c.t.a.w.r0;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.pocket.common.base.BaseViewModelActivity;
import com.pocket.topbrowser.browser.R$attr;
import com.pocket.topbrowser.browser.R$color;
import com.pocket.topbrowser.browser.R$id;
import com.pocket.topbrowser.browser.R$layout;
import com.pocket.topbrowser.browser.R$mipmap;
import com.pocket.topbrowser.browser.av.DLNACastActivity;
import h.b0.d.l;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import org.adblockplus.libadblockplus.android.settings.Utils;
import org.fourthline.cling.model.meta.Device;
import org.fourthline.cling.model.types.DeviceType;
import org.fourthline.cling.support.model.DIDLContent;
import org.fourthline.cling.support.model.MediaInfo;
import org.fourthline.cling.support.model.PositionInfo;
import org.fourthline.cling.support.model.TransportInfo;
import org.fourthline.cling.support.model.TransportState;
public final class DLNACastActivity extends BaseViewModelActivity {
public static final Companion a = new Companion(null);
public boolean f795c;
public long f797e;
public long f798f;
public Thread f800h;
public CastDeviceAdapter f801i;
public ImageView f802j;
public String f803k;
public String f804l;
public boolean f805m;
public final List<Device<?, ?, ?>> b = Collections.synchronizedList(new ArrayList());
public boolean f796d = true;
public int f799g = 30;
public static final class Companion {
private Companion() {
}
public Companion(h.b0.d.g gVar) {
this();
}
public final void start(Activity activity, String str, String str2) {
l.f(activity, "activity");
l.f(str, Utils.SUBSCRIPTION_FIELD_URL);
l.f(str2, Utils.SUBSCRIPTION_FIELD_TITLE);
Intent intent = new Intent(activity, (Class<?>) DLNACastActivity.class);
intent.putExtra("video_url", str);
intent.putExtra("video_title", str2);
activity.startActivity(intent);
}
}
public static final class a implements j {
public a() {
}
public void a(Device<?, ?, ?> device) {
if (device != null) {
int indexOf = DLNACastActivity.this.b.indexOf(device);
DLNACastActivity.this.b.set(indexOf, device);
CastDeviceAdapter castDeviceAdapter = DLNACastActivity.this.f801i;
if (castDeviceAdapter == null) {
l.u("castDeviceAdapter");
castDeviceAdapter = null;
}
castDeviceAdapter.g0(indexOf, device);
}
}
public void b(Device<?, ?, ?> device) {
if (device != null) {
List list = DLNACastActivity.this.b;
l.e(list, "devices");
int i2 = 0;
Iterator it2 = list.iterator();
while (true) {
if (!it2.hasNext()) {
i2 = -1;
break;
} else if (l.b(((Device) it2.next()).getIdentity().getUdn().getIdentifierString(), device.getIdentity().getUdn().getIdentifierString())) {
break;
} else {
i2++;
}
}
if (i2 >= 0) {
DLNACastActivity.this.b.remove(i2);
CastDeviceAdapter castDeviceAdapter = DLNACastActivity.this.f801i;
if (castDeviceAdapter == null) {
l.u("castDeviceAdapter");
castDeviceAdapter = null;
}
castDeviceAdapter.f0(i2);
}
}
}
public void c(Device<?, ?, ?> device) {
CastDeviceAdapter castDeviceAdapter;
Object obj;
if (device != null) {
List list = DLNACastActivity.this.b;
l.e(list, "devices");
Iterator it2 = list.iterator();
while (true) {
castDeviceAdapter = null;
if (!it2.hasNext()) {
obj = null;
break;
} else {
obj = it2.next();
if (l.b(((Device) obj).getIdentity().getUdn().getIdentifierString(), device.getIdentity().getUdn().getIdentifierString())) {
break;
}
}
}
if (((Device) obj) == null) {
DLNACastActivity.this.b.add(device);
CastDeviceAdapter castDeviceAdapter2 = DLNACastActivity.this.f801i;
if (castDeviceAdapter2 == null) {
l.u("castDeviceAdapter");
} else {
castDeviceAdapter = castDeviceAdapter2;
}
castDeviceAdapter.g(device);
}
}
}
}
public static final class b implements c.c.a.a.b.l.h {
public b() {
}
public void a(String str) {
if (str == null) {
return;
}
Log.e("==CastEvent==", str);
}
public void onSuccess(String str) {
if (str != null) {
Log.e("==CastEvent==", str);
}
DLNACastActivity.this.b0();
}
}
public static final class c implements c.c.a.a.b.l.l {
public void a(String str) {
if (str == null) {
return;
}
Log.e("==PlayEvent==", str);
}
public void onSuccess(Void r2) {
Log.e("==PlayEvent==", "onSuccess");
}
}
public static final class d implements k {
public void a(String str) {
if (str == null) {
return;
}
Log.e("==PauseEvent==", str);
}
public void onSuccess(Void r2) {
Log.e("==PauseEvent==", "onSuccess");
}
}
public static final class e implements n {
public void a(String str) {
if (str == null) {
return;
}
Log.e("==StopEvent==", str);
}
public void onSuccess(Void r2) {
Log.e("== ==", "onSuccess");
}
}
public static final class f implements m {
public void a(String str) {
if (str == null) {
return;
}
Log.e("==SeekToEvent==", str);
}
public void onSuccess(Long l2) {
if (l2 == null) {
return;
}
Log.e("==SeekToEvent==", String.valueOf(l2.longValue()));
}
}
public static final class g implements c.c.a.a.a.b {
public g() {
}
public String getId() {
String a = c.t.a.s.l.d.a();
l.e(a, "genUUID()");
return a;
}
public String getName() {
String str = DLNACastActivity.this.f804l;
if (str != null) {
return str;
}
l.u("videoTitle");
return null;
}
public String getUri() {
String str = DLNACastActivity.this.f803k;
if (str != null) {
return str;
}
l.u("videoUrl");
return null;
}
}
public static final class h implements SeekBar.OnSeekBarChangeListener {
public h() {
}
@Override
public void onProgressChanged(SeekBar seekBar, int i2, boolean z) {
l.f(seekBar, "seekBar");
if (DLNACastActivity.this.f805m) {
c.c.a.a.b.h.o().A((DLNACastActivity.this.f797e * i2) / 100);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
l.f(seekBar, "seekBar");
DLNACastActivity.this.f805m = true;
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
l.f(seekBar, "seekBar");
DLNACastActivity.this.f805m = false;
}
}
public static final void A(TransportState transportState) {
Log.e("====rsl", transportState.name());
}
public static final void C(DLNACastActivity dLNACastActivity, View view) {
l.f(dLNACastActivity, "this$0");
dLNACastActivity.finish();
}
public static final void D(DLNACastActivity dLNACastActivity, View view) {
l.f(dLNACastActivity, "this$0");
if (!dLNACastActivity.f795c) {
c.c.a.a.b.h.o().z((DeviceType) null, 60);
return;
}
Thread thread = dLNACastActivity.f800h;
if (thread != null) {
thread.interrupt();
}
c.c.a.a.b.h.o().C();
dLNACastActivity.finish();
}
public static final void E(DLNACastActivity dLNACastActivity, View view) {
l.f(dLNACastActivity, "this$0");
int i2 = dLNACastActivity.f799g;
if (i2 <= 100) {
int i3 = i2 + 3;
dLNACastActivity.f799g = i3;
if (i3 > 100) {
dLNACastActivity.f799g = 100;
}
c.c.a.a.b.h.o().B(dLNACastActivity.f799g);
}
}
public static final void F(DLNACastActivity dLNACastActivity, View view) {
l.f(dLNACastActivity, "this$0");
int i2 = dLNACastActivity.f799g;
if (i2 >= 0) {
int i3 = i2 - 3;
dLNACastActivity.f799g = i3;
if (i3 < 0) {
dLNACastActivity.f799g = 0;
}
c.c.a.a.b.h.o().B(dLNACastActivity.f799g);
}
}
public static final void G(DLNACastActivity dLNACastActivity, View view) {
l.f(dLNACastActivity, "this$0");
c.c.a.a.b.h.o().A(dLNACastActivity.f798f - 4000);
}
public static final void H(DLNACastActivity dLNACastActivity, View view) {
l.f(dLNACastActivity, "this$0");
c.c.a.a.b.h.o().A(dLNACastActivity.f798f + 6000);
}
public static final void I(DLNACastActivity dLNACastActivity, View view) {
l.f(dLNACastActivity, "this$0");
if (dLNACastActivity.f796d) {
c.c.a.a.b.h.o().v();
((ImageView) dLNACastActivity.findViewById(R$id.iv_video_play_pause)).setImageResource(R$mipmap.browser_ic_video_play);
} else {
c.c.a.a.b.h.o().w();
((ImageView) dLNACastActivity.findViewById(R$id.iv_video_play_pause)).setImageResource(R$mipmap.browser_ic_video_pause);
}
dLNACastActivity.f796d = !dLNACastActivity.f796d;
}
public static final void Z(DLNACastActivity dLNACastActivity, BaseQuickAdapter baseQuickAdapter, View view, int i2) {
l.f(dLNACastActivity, "this$0");
l.f(baseQuickAdapter, "$noName_0");
l.f(view, "$noName_1");
dLNACastActivity.findViewById(R$id.recycler_view).setVisibility(8);
ImageView imageView = dLNACastActivity.f802j;
CastDeviceAdapter castDeviceAdapter = null;
if (imageView == null) {
l.u("rightImg");
imageView = null;
}
imageView.setImageResource(R$mipmap.browser_ic_menu_shutdown);
dLNACastActivity.f795c = true;
c.c.a.a.b.h o = c.c.a.a.b.h.o();
CastDeviceAdapter castDeviceAdapter2 = dLNACastActivity.f801i;
if (castDeviceAdapter2 == null) {
l.u("castDeviceAdapter");
} else {
castDeviceAdapter = castDeviceAdapter2;
}
o.k((Device) castDeviceAdapter.getItem(i2), dLNACastActivity.new g());
}
public static final void c0(final DLNACastActivity dLNACastActivity) {
l.f(dLNACastActivity, "this$0");
while (true) {
l.e(dLNACastActivity.b, "devices");
if (!(!r0.isEmpty()) || !c.c.a.a.b.h.o().t(dLNACastActivity.b.get(0)) || Thread.currentThread().isInterrupted()) {
return;
}
try {
c.c.a.a.b.h.o().p(dLNACastActivity.b.get(0), new i() {
public final void a(Object obj, String str) {
DLNACastActivity.d0((MediaInfo) obj, str);
}
});
c.c.a.a.b.h.o().q(dLNACastActivity.b.get(0), new i() {
public final void a(Object obj, String str) {
DLNACastActivity.e0(DLNACastActivity.this, (PositionInfo) obj, str);
}
});
c.c.a.a.b.h.o().r(dLNACastActivity.b.get(0), new i() {
public final void a(Object obj, String str) {
DLNACastActivity.f0((TransportInfo) obj, str);
}
});
c.c.a.a.b.h.o().s(dLNACastActivity.b.get(0), new i() {
public final void a(Object obj, String str) {
DLNACastActivity.g0((Integer) obj, str);
}
});
c.c.a.a.b.h.o().n(dLNACastActivity.b.get(0), c.c.a.a.a.a.d, new i() {
public final void a(Object obj, String str) {
DLNACastActivity.h0((DIDLContent) obj, str);
}
});
} catch (Exception e2) {
e2.printStackTrace();
}
try {
Thread.sleep(1000L);
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
}
}
}
public static final void d0(MediaInfo mediaInfo, String str) {
if (mediaInfo != null) {
Log.e("=getMediaInfo=", mediaInfo.toString());
}
if (str == null) {
return;
}
Log.e("=getMediaInfo=", str);
}
public static final void e0(DLNACastActivity dLNACastActivity, PositionInfo positionInfo, String str) {
l.f(dLNACastActivity, "this$0");
if (positionInfo != null) {
((TextView) dLNACastActivity.findViewById(R$id.tv_play_time)).setText(positionInfo.getRelTime());
String trackDuration = positionInfo.getTrackDuration();
if (!(trackDuration == null || trackDuration.length() == 0)) {
((TextView) dLNACastActivity.findViewById(R$id.tv_video_time)).setText(positionInfo.getTrackDuration());
}
try {
((SeekBar) dLNACastActivity.findViewById(R$id.sb_schedule)).setProgress(positionInfo.getElapsedPercent());
} catch (IllegalArgumentException e2) {
e2.printStackTrace();
}
long b2 = c.c.a.a.a.c.b(positionInfo.getTrackDuration());
dLNACastActivity.f797e = b2;
Log.e("=getPositionInfo=", String.valueOf(b2));
}
if (str == null) {
return;
}
Log.e("=getPositionInfo=", str);
}
public static final void f0(TransportInfo transportInfo, String str) {
if (transportInfo != null) {
Log.e("=getTransportInfo=", transportInfo.toString());
}
if (str == null) {
return;
}
Log.e("=getTransportInfo=", str);
}
public static final void g0(Integer num, String str) {
if (num != null) {
Log.e("=getVolumeInfo=", String.valueOf(num));
}
if (str == null) {
return;
}
Log.e("=getVolumeInfo=", str);
}
public static final void h0(DIDLContent dIDLContent, String str) {
if (dIDLContent != null) {
Log.e("=getContent=", dIDLContent.toString());
}
if (str == null) {
return;
}
Log.e("=getContent=", str);
}
public final void B() {
int i2 = R$id.toolbar;
findViewById(i2).setNavImgListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
DLNACastActivity.C(DLNACastActivity.this, view);
}
});
ImageView g2 = findViewById(i2).g(R$mipmap.common_ic_refresh, View.generateViewId(), new View.OnClickListener() {
@Override
public final void onClick(View view) {
DLNACastActivity.D(DLNACastActivity.this, view);
}
});
this.f802j = g2;
if (g2 == null) {
l.u("rightImg");
g2 = null;
}
int a2 = c.t.a.k.f.a(8);
g2.setPadding(a2, a2, a2, a2);
((ImageView) findViewById(R$id.iv_volume_plus)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
DLNACastActivity.E(DLNACastActivity.this, view);
}
});
((ImageView) findViewById(R$id.iv_volume_minus)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
DLNACastActivity.F(DLNACastActivity.this, view);
}
});
((ImageView) findViewById(R$id.iv_video_back)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
DLNACastActivity.G(DLNACastActivity.this, view);
}
});
((ImageView) findViewById(R$id.iv_video_forward)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
DLNACastActivity.H(DLNACastActivity.this, view);
}
});
((ImageView) findViewById(R$id.iv_video_play_pause)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
DLNACastActivity.I(DLNACastActivity.this, view);
}
});
}
public final void Y() {
CastDeviceAdapter castDeviceAdapter;
int i2 = R$id.recycler_view;
findViewById(i2).setLayoutManager(new LinearLayoutManager(this, 1, false));
CastDeviceAdapter castDeviceAdapter2 = new CastDeviceAdapter();
this.f801i = castDeviceAdapter2;
CastDeviceAdapter castDeviceAdapter3 = null;
if (castDeviceAdapter2 == null) {
l.u("castDeviceAdapter");
castDeviceAdapter2 = null;
}
castDeviceAdapter2.setOnItemClickListener(new c.f.a.a.a.g.d() {
public final void a(BaseQuickAdapter baseQuickAdapter, View view, int i3) {
DLNACastActivity.Z(DLNACastActivity.this, baseQuickAdapter, view, i3);
}
});
RecyclerView findViewById = findViewById(i2);
RecyclerView.Adapter adapter = this.f801i;
if (adapter == null) {
l.u("castDeviceAdapter");
adapter = null;
}
findViewById.setAdapter(adapter);
TextView textView = new TextView(this);
textView.setBackgroundColor(Color.parseColor("#FEEDED"));
textView.setTextSize(14.0f);
textView.setTextColor(r0.a.b(R$color.c_666));
textView.setText("m3u8类视频,需要在电视端安装乐播、kodi 之类投屏APP");
textView.setLayoutParams(new RecyclerView.LayoutParams(-1, -2));
textView.setPadding(c.t.a.k.f.a(30), c.t.a.k.f.a(8), c.t.a.k.f.a(30), c.t.a.k.f.a(8));
textView.setGravity(17);
CastDeviceAdapter castDeviceAdapter4 = this.f801i;
if (castDeviceAdapter4 == null) {
l.u("castDeviceAdapter");
castDeviceAdapter = null;
} else {
castDeviceAdapter = castDeviceAdapter4;
}
BaseQuickAdapter.m(castDeviceAdapter, textView, 0, 0, 6, (Object) null);
CastDeviceAdapter castDeviceAdapter5 = this.f801i;
if (castDeviceAdapter5 == null) {
l.u("castDeviceAdapter");
} else {
castDeviceAdapter3 = castDeviceAdapter5;
}
castDeviceAdapter3.j0(R$layout.browser_dlna_cast_search);
}
public final void a0() {
Drawable drawable;
r0 r0Var = r0.a;
int b2 = r0Var.b(c.t.a.u.a.a.a().b(this, R$attr.yaIconPrimary));
int i2 = R$id.sb_schedule;
Drawable progressDrawable = ((SeekBar) findViewById(i2)).getProgressDrawable();
if (progressDrawable instanceof LayerDrawable) {
Drawable progressDrawable2 = ((SeekBar) findViewById(i2)).getProgressDrawable();
Objects.requireNonNull(progressDrawable2, "null cannot be cast to non-null type android.graphics.drawable.LayerDrawable");
drawable = ((LayerDrawable) progressDrawable2).getDrawable(2);
} else if (progressDrawable instanceof StateListDrawable) {
Drawable progressDrawable3 = ((SeekBar) findViewById(i2)).getProgressDrawable();
Objects.requireNonNull(progressDrawable3, "null cannot be cast to non-null type android.graphics.drawable.StateListDrawable");
drawable = (StateListDrawable) progressDrawable3;
} else {
Drawable progressDrawable4 = ((SeekBar) findViewById(i2)).getProgressDrawable();
Objects.requireNonNull(progressDrawable4, "null cannot be cast to non-null type android.graphics.drawable.LayerDrawable");
drawable = ((LayerDrawable) progressDrawable4).getDrawable(2);
}
drawable.setColorFilter(r0Var.b(R$color.c_333), PorterDuff.Mode.SRC);
((SeekBar) findViewById(i2)).getThumb().setColorFilter(new PorterDuffColorFilter(b2, PorterDuff.Mode.SRC_ATOP));
((SeekBar) findViewById(i2)).invalidate();
((SeekBar) findViewById(i2)).setMax(100);
((SeekBar) findViewById(i2)).setOnSeekBarChangeListener(new h());
((SeekBar) findViewById(i2)).getProgressDrawable().setColorFilter(new PorterDuffColorFilter(b2, PorterDuff.Mode.SRC_ATOP));
((SeekBar) findViewById(i2)).setProgress(0);
}
public final void b0() {
Thread thread = new Thread(new Runnable() {
@Override
public final void run() {
DLNACastActivity.c0(DLNACastActivity.this);
}
});
this.f800h = thread;
if (thread == null) {
return;
}
thread.start();
}
public c.t.a.d.n getDataBindingConfig() {
return new c.t.a.d.n(R$layout.browser_dlna_cast_activity, 0, (ViewModel) null);
}
public void initViewModel() {
}
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
c.t.a.u.a.a.c(this);
c.c.a.a.b.h.o().j(this);
String stringExtra = getIntent().getStringExtra("video_url");
String stringExtra2 = getIntent().getStringExtra("video_title");
if (stringExtra == null || stringExtra.length() == 0) {
finish();
} else {
this.f803k = stringExtra;
if (stringExtra2 == null) {
stringExtra2 = "";
}
this.f804l = stringExtra2;
}
a0();
B();
Y();
z();
}
public void onDestroy() {
super/*com.pocket.common.base.BaseActivity*/.onDestroy();
c.c.a.a.b.h.o().D(this);
}
public final void z() {
c.c.a.a.b.h.o().registerDeviceListener(new a());
c.c.a.a.b.h.o().x(new q[]{new b(), new c(), new d(), new e(), new f()});
c.c.a.a.b.h.o().y(new c.c.a.a.b.l.j() {
public final void a(TransportState transportState) {
DLNACastActivity.A(transportState);
}
});
}
}