FLIX VISION v2.8.2版本的 MD5 值为:4d33b143293b36f23ce5a6a5834e6993
以下内容为反编译后的 MainActivity.java 源代码,内容仅作参考
package flix.com.vision.activities;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.FragmentManager;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.content.res.ColorStateList;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.Toast;
import androidx.appcompat.app.d;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.FileProvider;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.mediarouter.app.MediaRouteButton;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import ba.p;
import ba.q;
import ba.x;
import com.google.android.gms.cast.framework.CastButtonFactory;
import com.google.android.gms.cast.framework.CastContext;
import com.google.android.material.tabs.TabLayout;
import com.malinskiy.superrecyclerview.SuperRecyclerView;
import flix.com.vision.App;
import flix.com.vision.R;
import flix.com.vision.activities.MainActivity;
import flix.com.vision.activities.adult.AdultPINSetupActivity;
import flix.com.vision.activities.adult.AdultZonePINEntryActivity;
import flix.com.vision.api.alldebrid.AllDebridCommon;
import flix.com.vision.api.premiumize.PremiumizeCommon;
import flix.com.vision.api.realdebrid.RealDebridCommon;
import flix.com.vision.helpers.CenterGridLayoutManager;
import flix.com.vision.helpers.CenterLayoutManager;
import flix.com.vision.helpers.Constants;
import flix.com.vision.materialsearchview.MaterialSearchView;
import flix.com.vision.models.Movie;
import flix.com.vision.tv.Constant;
import flix.com.vision.tv.MyImportActivity;
import flix.com.vision.tv.TVCategoriesActivity2;
import flix.com.vision.utils.JsonUtils;
import hb.i;
import ib.h;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Locale;
import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import rc.f;
import v9.a0;
import v9.b0;
import v9.c0;
import v9.d0;
import v9.f0;
import v9.g0;
import v9.h0;
import v9.i0;
import v9.k0;
import v9.l0;
import v9.m0;
import v9.y;
import y5.c;
public class MainActivity extends x9.a implements c.InterfaceC0297c, i, SwipeRefreshLayout.f, n8.a {
public static final int f11782p0 = 0;
public x F;
public q G;
public RecyclerView H;
public RecyclerView I;
public MediaRouteButton J;
public TabLayout K;
public pc.b L;
public RelativeLayout N;
public MenuItem P;
public c Q;
public Toolbar S;
public MaterialSearchView T;
public ArrayList<Movie> U;
public p V;
public SuperRecyclerView W;
public CenterGridLayoutManager X;
public DrawerLayout Z;
public k0 f11783a0;
public p2.a f11784b0;
public Typeface f11785c0;
public Typeface f11786d0;
public Menu f11789g0;
public gb.b f11791i0;
public ProgressDialog f11792j0;
public pc.b f11793k0;
public int f11794l0;
public final ArrayList<Movie> D = new ArrayList<>();
public final ArrayList<mb.a> E = new ArrayList<>();
public boolean M = true;
public boolean O = false;
public final int R = 200;
public int Y = 1;
public String f11787e0 = "IN THEATER";
public int f11788f0 = 1;
public boolean f11790h0 = false;
public boolean f11795m0 = false;
public int f11796n0 = 0;
public boolean f11797o0 = false;
public class a extends AnimatorListenerAdapter {
public a() {
}
@Override
public void onAnimationEnd(Animator animator) {
super.onAnimationEnd(animator);
MainActivity.this.f11795m0 = false;
}
}
public class b extends AsyncTask<String, Integer, String> {
public static final int f11799e = 0;
public String f11800a = "";
public String f11801b = "";
public String f11802c = "";
public class a implements DialogInterface.OnClickListener {
public a() {
}
@Override
public void onClick(DialogInterface dialogInterface, int i10) {
dialogInterface.dismiss();
b.this.cancel(true);
}
}
public class DialogInterfaceOnClickListenerC0140b implements DialogInterface.OnClickListener {
@Override
public void onClick(DialogInterface dialogInterface, int i10) {
dialogInterface.dismiss();
}
}
public b() {
}
@Override
public String doInBackground(String... strArr) {
MainActivity mainActivity = MainActivity.this;
String str = "";
try {
URL url = new URL(strArr[0]);
URLConnection openConnection = url.openConnection();
openConnection.connect();
this.f11801b = Environment.getExternalStorageDirectory().getPath();
String str2 = this.f11801b + "/FlixVision.Update" + this.f11800a.replace(StringUtils.SPACE, "").replace(".", "") + ".apk";
this.f11802c = str2;
try {
int contentLength = openConnection.getContentLength();
BufferedInputStream bufferedInputStream = new BufferedInputStream(url.openStream());
try {
this.f11800a = "." + mainActivity.getPackageManager().getPackageInfo(mainActivity.getPackageName(), 0).versionName;
} catch (PackageManager.NameNotFoundException e10) {
e10.printStackTrace();
this.f11800a = "";
}
FileOutputStream fileOutputStream = new FileOutputStream(this.f11802c);
byte[] bArr = new byte[1024];
long j10 = 0;
while (true) {
int read = bufferedInputStream.read(bArr);
if (read == -1) {
fileOutputStream.flush();
fileOutputStream.close();
bufferedInputStream.close();
return str2;
}
j10 += read;
publishProgress(Integer.valueOf((int) ((100 * j10) / contentLength)));
fileOutputStream.write(bArr, 0, read);
}
} catch (Exception e11) {
e = e11;
str = str2;
e.printStackTrace();
try {
File file = new File(this.f11802c);
if (file.exists()) {
file.delete();
}
} catch (Exception e12) {
e12.printStackTrace();
}
return str;
}
} catch (Exception e13) {
e = e13;
}
}
@Override
public void onCancelled() {
try {
File file = new File(this.f11802c);
if (file.exists()) {
file.delete();
}
} catch (Exception e10) {
e10.printStackTrace();
}
super.onCancelled();
}
@Override
public void onPostExecute(String str) {
MainActivity mainActivity = MainActivity.this;
super.onPostExecute((b) str);
try {
mainActivity.f11792j0.dismiss();
} catch (Exception e10) {
e10.printStackTrace();
}
File file = new File(str);
if (!file.exists()) {
d create = new d.a(mainActivity).create();
create.setTitle("OOPPSS!!");
create.setIcon(R.drawable.ic_action_error_outline);
create.setMessage(mainActivity.getString(R.string.error_downloading_apk_mess));
create.setButton(-1, "GOT IT", new DialogInterfaceOnClickListenerC0140b());
try {
create.show();
return;
} catch (Exception e11) {
e11.printStackTrace();
return;
}
}
try {
if (Build.VERSION.SDK_INT >= 24) {
Uri uriForFile = FileProvider.getUriForFile(mainActivity.getBaseContext(), mainActivity.getBaseContext().getApplicationContext().getPackageName() + ".provider", file);
Intent intent = new Intent("android.intent.action.VIEW");
intent.setDataAndType(uriForFile, "application/vnd.android.package-archive");
intent.setFlags(1);
mainActivity.startActivity(intent);
} else {
Uri fromFile = Uri.fromFile(file);
Intent intent2 = new Intent("android.intent.action.VIEW");
intent2.setDataAndType(fromFile, "application/vnd.android.package-archive");
intent2.setFlags(268435456);
mainActivity.startActivity(intent2);
}
} catch (Exception e12) {
e12.printStackTrace();
d create2 = new d.a(mainActivity).create();
create2.setTitle("OOPPSS!!");
create2.setIcon(R.drawable.ic_action_error_outline);
create2.setMessage(mainActivity.getString(R.string.apk_downloaded_but_could_not) + this.f11802c + "\n\nAnd Install the Apk manually");
create2.setButton(-1, "GOT IT", new b0(3));
try {
create2.show();
} catch (Exception e13) {
e13.printStackTrace();
}
}
}
@Override
public void onPreExecute() {
super.onPreExecute();
MainActivity mainActivity = MainActivity.this;
mainActivity.f11792j0 = new ProgressDialog(mainActivity);
ProgressDialog progressDialog = mainActivity.f11792j0;
StringBuilder sb2 = new StringBuilder();
sb2.append(mainActivity.getString(R.string.downloading_update_wait));
sb2.append(StringUtils.SPACE);
SharedPreferences sharedPreferences = App.getInstance().f11732q;
String str = Constant.f12431b;
sb2.append(sharedPreferences.getString("update_version_name", ""));
progressDialog.setTitle(sb2.toString());
mainActivity.f11792j0.setIndeterminate(false);
mainActivity.f11792j0.setMax(100);
mainActivity.f11792j0.setCancelable(false);
mainActivity.f11792j0.setButton(-1, mainActivity.getString(R.string.cancel_label), new a());
mainActivity.f11792j0.setProgressStyle(1);
mainActivity.f11792j0.show();
}
@Override
public void onProgressUpdate(Integer... numArr) {
super.onProgressUpdate((Object[]) numArr);
MainActivity.this.f11792j0.setProgress(numArr[0].intValue());
}
}
public static void d(MainActivity mainActivity, TabLayout.f fVar) {
if (mainActivity.f11788f0 > 1) {
mainActivity.recreate();
return;
}
App.getInstance().f11732q.edit().putString("genre", "").apply();
App.getInstance().f11732q.edit().putString("year", "").apply();
mainActivity.U.clear();
mainActivity.V.notifyDataSetChanged();
mainActivity.f11796n0 = fVar.getPosition();
mainActivity.Y = 1;
mainActivity.k();
mainActivity.f(mainActivity.Y);
}
public static void resetFilter() {
SharedPreferences.Editor edit = App.getInstance().f11732q.edit();
edit.remove("year");
edit.remove("year_index");
edit.remove("genre_index_genre");
edit.remove("network_index");
edit.remove("content_type");
edit.remove("sort_by_index");
edit.apply();
}
public void applyFilter() {
recreate();
}
public final void askToUpdateIfAny(boolean z10, Movie movie) {
try {
SharedPreferences sharedPreferences = App.getInstance().f11732q;
String str = Constant.f12431b;
int i10 = 0;
int i11 = 1;
if (sharedPreferences.getBoolean("update_available", false) && App.getInstance().f11732q.getString("update_url", "").length() > 5) {
la.d newInstance = la.d.newInstance(this, false);
newInstance.setButton1(getString(R.string.later_label).toUpperCase(), new d0(this, newInstance, movie, i10));
newInstance.setButton2(getString(R.string.download_update_label), new d0(this, newInstance, movie, i11));
newInstance.setMessage(getString(R.string.new_update_message) + App.getInstance().f11732q.getString("update_message", "") + getString(R.string.make_sure_you_get_it_mess));
newInstance.setTitle(getString(R.string.update_available_label) + StringUtils.SPACE + App.getInstance().f11732q.getString("update_version_name", ""));
newInstance.show(getFragmentManager(), "");
} else if (z10) {
Toast.makeText(getBaseContext(), "You're running the latest version", 1).show();
}
} catch (Exception unused) {
}
}
public final void e() {
if (this.Z.isDrawerOpen(8388611)) {
this.Z.closeDrawer(8388611, true);
return;
}
if (this.T.isOpen()) {
this.T.closeSearch();
return;
}
if (!this.f11790h0) {
if (this.U.size() < 200) {
this.W.getRecyclerView().smoothScrollToPosition(0);
} else {
this.W.getRecyclerView().scrollToPosition(0);
}
this.f11790h0 = true;
this.S.requestFocus();
this.W.clearFocus();
new Handler().postDelayed(new f0(this, 5), 2000L);
return;
}
this.f11790h0 = false;
FragmentManager fragmentManager = getFragmentManager();
la.d newInstance = la.d.newInstance(this, true);
newInstance.setTitle("Exit");
newInstance.setMessage("Do you really want to close the App ?");
newInstance.setButton1("CANCEL", new y(2));
newInstance.setButton2("YES", new g0(this, 3));
try {
newInstance.show(fragmentManager, "");
} catch (Exception e10) {
e10.printStackTrace();
}
}
public void extractDominantColor(int i10) {
if (this.f11795m0) {
return;
}
ValueAnimator ofObject = ValueAnimator.ofObject(new ArgbEvaluator(), Integer.valueOf(this.f11794l0), Integer.valueOf(i10));
ofObject.setDuration(2000L);
ofObject.addUpdateListener(new y5.a(this, 7));
ofObject.addListener(new a());
ofObject.start();
this.f11794l0 = i10;
this.f11795m0 = true;
}
public final void f(int i10) {
this.W.setupMoreListener(this, 20);
pc.b bVar = this.L;
if (bVar != null) {
bVar.dispose();
}
final int i11 = 0;
final int i12 = App.getInstance().f11732q.getInt("content_type", 0);
final int i13 = 1;
if ((App.getInstance().f11732q.getInt("year_index", 0) == 0 || !App.getInstance().f11732q.contains("year_index")) && (App.getInstance().f11732q.getInt("genre_index_genre", 0) == 0 || !App.getInstance().f11732q.contains("genre_index_genre")) && ((App.getInstance().f11732q.getInt("network_index", 0) == 0 || !App.getInstance().f11732q.contains("network_index")) && ((App.getInstance().f11732q.getInt("content_type", 0) == 0 || !App.getInstance().f11732q.contains("content_type")) && (App.getInstance().f11732q.getInt("sort_by_index", 0) == 0 || !App.getInstance().f11732q.contains("sort_by_index"))))) {
this.L = ca.a.gettabbedList(this, i10, i12 == 0 ? "movie" : "tv", this.f11796n0).observeOn(oc.a.mainThread()).subscribeOn(fd.a.newThread()).subscribe(new f(this) {
public final MainActivity f18848g;
{
this.f18848g = this;
}
@Override
public final void accept(Object obj) {
int i14 = i11;
int i15 = i12;
MainActivity mainActivity = this.f18848g;
switch (i14) {
case 0:
int i16 = MainActivity.f11782p0;
mainActivity.getClass();
ArrayList<Movie> parseListMovie = JsonUtils.parseListMovie((com.google.gson.o) obj, i15);
mainActivity.U.addAll(App.getInstance().filterList(parseListMovie));
mainActivity.V.notifyItemRangeChanged(mainActivity.U.size() - 1, parseListMovie.size());
if (parseListMovie.size() <= 0 || mainActivity.U.size() != 0) {
return;
}
int i17 = mainActivity.Y + 1;
mainActivity.Y = i17;
mainActivity.f(i17);
return;
default:
int i18 = MainActivity.f11782p0;
mainActivity.getClass();
ArrayList<Movie> parseListMovie2 = JsonUtils.parseListMovie((com.google.gson.o) obj, i15);
mainActivity.U.addAll(App.getInstance().filterList(parseListMovie2));
mainActivity.V.notifyItemRangeChanged(mainActivity.U.size() - 1, parseListMovie2.size());
if (parseListMovie2.size() <= 0 || mainActivity.U.size() != 0) {
return;
}
int i19 = mainActivity.Y + 1;
mainActivity.Y = i19;
mainActivity.f(i19);
return;
}
}
}, new b3.b(22));
return;
}
String string = App.getInstance().f11732q.getString("year", "");
int i14 = App.getInstance().f11732q.getInt("genre_id", 0);
int i15 = App.getInstance().f11732q.getInt("pref_network_id", -1);
this.L = ca.a.getItemsByGenres(this, String.valueOf(i14), i10, i12, string, App.getInstance().f11732q.getInt("sort_by_index", 0) != 0 ? "primary_release_date.desc" : "popularity.desc", i15).observeOn(oc.a.mainThread()).subscribeOn(fd.a.newThread()).subscribe(new f(this) {
public final MainActivity f18848g;
{
this.f18848g = this;
}
@Override
public final void accept(Object obj) {
int i142 = i13;
int i152 = i12;
MainActivity mainActivity = this.f18848g;
switch (i142) {
case 0:
int i16 = MainActivity.f11782p0;
mainActivity.getClass();
ArrayList<Movie> parseListMovie = JsonUtils.parseListMovie((com.google.gson.o) obj, i152);
mainActivity.U.addAll(App.getInstance().filterList(parseListMovie));
mainActivity.V.notifyItemRangeChanged(mainActivity.U.size() - 1, parseListMovie.size());
if (parseListMovie.size() <= 0 || mainActivity.U.size() != 0) {
return;
}
int i17 = mainActivity.Y + 1;
mainActivity.Y = i17;
mainActivity.f(i17);
return;
default:
int i18 = MainActivity.f11782p0;
mainActivity.getClass();
ArrayList<Movie> parseListMovie2 = JsonUtils.parseListMovie((com.google.gson.o) obj, i152);
mainActivity.U.addAll(App.getInstance().filterList(parseListMovie2));
mainActivity.V.notifyItemRangeChanged(mainActivity.U.size() - 1, parseListMovie2.size());
if (parseListMovie2.size() <= 0 || mainActivity.U.size() != 0) {
return;
}
int i19 = mainActivity.Y + 1;
mainActivity.Y = i19;
mainActivity.f(i19);
return;
}
}
}, new b3.b(23));
}
@Override
public void favoriteDeleted(int i10) {
try {
this.U.remove(i10);
} catch (Exception unused) {
}
if (this.U.isEmpty()) {
recreate();
} else {
this.V.notifyItemRemoved(i10);
}
}
public final void g() {
if (App.getInstance().f11732q.getBoolean("pref_hide_continue", false)) {
this.H.setVisibility(8);
return;
}
ArrayList<Movie> watchingMoviesFromDb = App.getInstance().f11731p.getWatchingMoviesFromDb();
if (watchingMoviesFromDb.size() <= 0) {
this.H.setVisibility(8);
return;
}
ArrayList<Movie> arrayList = this.D;
arrayList.clear();
arrayList.addAll(watchingMoviesFromDb);
watchingMoviesFromDb.clear();
this.F.notifyDataSetChanged();
this.H.setVisibility(0);
this.H.scrollToPosition(0);
}
public final void h() {
FragmentManager fragmentManager = getFragmentManager();
la.d newInstance = la.d.newInstance(this, true);
newInstance.setTitle("Discord");
newInstance.setMessage("Join the Flix Vision community at https://discord.gg/tKjc4PTvxu");
newInstance.setButton1("OK", new h0(newInstance, 3));
boolean z10 = false;
try {
getPackageManager().getPackageInfo("com.discord", 0);
z10 = true;
} catch (PackageManager.NameNotFoundException unused) {
}
if (z10) {
newInstance.setButton2("OPEN APP", new i0(this, newInstance, 2));
}
try {
newInstance.show(fragmentManager, "");
} catch (Exception e10) {
e10.printStackTrace();
}
SharedPreferences.Editor edit = App.getInstance().f11732q.edit();
String str = Constant.f12431b;
edit.putBoolean("discord_check", true).apply();
}
public final void i() {
d create = new d.a(this).create();
create.setTitle(getString(R.string.out_of_mem));
create.setIcon(R.drawable.ic_action_live_help);
create.setMessage(getString(R.string.out_of_memory_mess));
create.setButton(-1, getString(R.string.got_it), new b0(2));
create.setButton(-2, getString(R.string.reload_label), new c0(this, 1));
try {
create.show();
} catch (Exception e10) {
e10.printStackTrace();
}
}
public final void j() {
boolean z10;
FragmentManager fragmentManager = getFragmentManager();
la.d newInstance = la.d.newInstance(this, true);
newInstance.setTitle("Twitter");
newInstance.setMessage("Find us on twitter at @FlixVisionApp");
int i10 = 0;
newInstance.setButton1("OK", new h0(newInstance, i10));
try {
getPackageManager().getPackageInfo("com.twitter.android", 0);
z10 = true;
} catch (PackageManager.NameNotFoundException unused) {
z10 = false;
}
if (z10) {
newInstance.setButton2("OPEN APP", new i0(this, newInstance, i10));
}
try {
newInstance.show(fragmentManager, "");
} catch (Exception e10) {
e10.printStackTrace();
}
SharedPreferences.Editor edit = App.getInstance().f11732q.edit();
String str = Constant.f12431b;
edit.putBoolean("twitter_check", true).apply();
}
public final void k() {
boolean z10 = false;
int i10 = App.getInstance().f11732q.getInt("content_type", 0);
String string = App.getInstance().f11732q.getString("genre", "");
String string2 = App.getInstance().f11732q.getString("year", "");
if (string.length() > 0 || (!string.equalsIgnoreCase("all") && !string2.isEmpty())) {
z10 = true;
}
String str = "MOVIES";
if (i10 == 0) {
if (z10) {
String concat = ": ".concat(string);
if (string2.length() > 0) {
concat = o.a.d(concat, ": ", string2);
}
getSupportActionBar().setTitle((getString(R.string.movies_label) + concat).toUpperCase(Locale.ROOT));
return;
}
int i11 = this.f11796n0;
if (i11 == 0) {
str = getString(R.string.movies_label).toUpperCase() + ": TRENDING";
} else if (i11 == 1) {
str = getString(R.string.movies_label).toUpperCase() + ": IN THEATER";
} else if (i11 == 2) {
str = getString(R.string.movies_label).toUpperCase() + ": POPULAR";
}
getSupportActionBar().setTitle(str.toUpperCase(Locale.ROOT));
return;
}
if (z10) {
String concat2 = ": ".concat(string);
if (string2.length() > 0) {
concat2 = o.a.d(concat2, ": ", string2);
}
getSupportActionBar().setTitle((getString(R.string.tv_series_label) + concat2).toUpperCase(Locale.ROOT));
return;
}
int i12 = this.f11796n0;
if (i12 == 0) {
str = getString(R.string.tv_series_label).toUpperCase() + ": TRENDING";
} else if (i12 == 1) {
str = getString(R.string.tv_series_label).toUpperCase() + ": NOW STREAMING";
} else if (i12 == 2) {
str = getString(R.string.tv_series_label).toUpperCase() + ": POPULAR";
}
getSupportActionBar().setTitle(str.toUpperCase(Locale.ROOT));
}
@Override
public void onActivityResult(int i10, int i11, Intent intent) {
if (i10 == 42 && i11 == -1) {
ArrayList<String> stringArrayListExtra = intent.getStringArrayListExtra("android.speech.extra.RESULTS");
if (stringArrayListExtra == null || stringArrayListExtra.size() <= 0) {
Toast.makeText(getBaseContext(), getString(R.string.did_not_catch_any_mic_voice_mess), 0).show();
return;
}
String str = stringArrayListExtra.get(0);
if (TextUtils.isEmpty(str)) {
Toast.makeText(getBaseContext(), getString(R.string.did_not_catch_any_mic_voice_mess), 0).show();
return;
}
if (str == null || str.length() < 3) {
return;
}
Intent intent2 = new Intent(this, (Class<?>) SearchResultsActivity.class);
intent2.putExtra("query", str);
intent2.putExtra("tv_shows_only", App.getInstance().f11732q.getInt("content_type", 0) == 1);
startActivity(intent2);
return;
}
if (intent != null && intent.getIntExtra("result", -1) == 8888) {
recreate();
} else if (i10 == 1000) {
recreate();
} else if (i10 == 10001) {
App.getInstance().fetch_anime();
} else if (i10 == 2000) {
askToUpdateIfAny(false, null);
} else if (i10 == 12345 && i11 == -1) {
String stringExtra = intent.getStringExtra("fileExtraPath");
h hVar = new h();
try {
hVar.f13799g = stringExtra.split("/")[r4.length - 1];
} catch (Exception unused) {
hVar.f13799g = stringExtra;
}
hVar.f13798b = stringExtra;
hVar.f13800h = "3";
App.getInstance().f11731p.addHistoryIPTV(hVar);
Intent intent3 = new Intent(this, (Class<?>) TVCategoriesActivity2.class);
intent3.putExtra("is_file", true);
intent3.putExtra("url", stringExtra);
startActivity(intent3);
} else if (i10 == 1100 && App.getInstance().f11732q.getBoolean("clear_history_pending", false)) {
try {
MaterialSearchView materialSearchView = this.T;
if (materialSearchView != null) {
materialSearchView.clearHistory();
}
} catch (Exception e10) {
e10.printStackTrace();
}
a.b.y(App.getInstance().f11732q, "clear_history_pending", false);
}
super.onActivityResult(i10, i11, intent);
}
@Override
@SuppressLint({"MissingSuperCall"})
public void onBackPressed() {
e();
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
final int i10 = 1;
App.getInstance().f11732q.getBoolean("pref_hide_unreleased", true);
final int i11 = 0;
if (bundle == null) {
this.O = false;
if (App.getInstance().f11732q.getBoolean("IS_RD_LOGGED_IN", false)) {
App.getInstance().refreshTokenRD();
RealDebridCommon.f12034j = true;
}
if (App.getInstance().f11732q.getBoolean("PREM_LOGGED_IN", false)) {
PremiumizeCommon.f12028b = true;
SharedPreferences sharedPreferences = App.getInstance().f11732q;
String str = Constants.f12301a;
PremiumizeCommon.f12029g = sharedPreferences.getString("prem_apikey", null);
}
if (App.getInstance().f11732q.getBoolean("ALL_DEBRID_LOGGED_IN", false)) {
AllDebridCommon.f12026h = true;
SharedPreferences sharedPreferences2 = App.getInstance().f11732q;
String str2 = Constants.f12301a;
AllDebridCommon.f12027i = sharedPreferences2.getString("all_debrid_apikey", null);
}
}
try {
setContentView(R.layout.activity_main);
} catch (Exception e10) {
e10.printStackTrace();
i();
} catch (OutOfMemoryError unused) {
i();
return;
}
int round = Math.round((o.a.a(getWindowManager().getDefaultDisplay()).widthPixels / getResources().getDisplayMetrics().density) / 140);
try {
EventBus.getDefault().register(this);
} catch (Exception unused2) {
}
this.f11791i0 = new gb.b();
this.U = new ArrayList<>();
this.H = (RecyclerView) findViewById(R.id.recyclerview_continue);
this.I = (RecyclerView) findViewById(R.id.recyclerview_network);
this.N = (RelativeLayout) findViewById(R.id.activity_main);
this.K = (TabLayout) findViewById(R.id.tabs);
this.S = (Toolbar) findViewById(R.id.toolbar);
this.Z = (DrawerLayout) findViewById(R.id.drawer_layout);
this.Q = (c) findViewById(R.id.nav_view);
if (App.getInstance().f11732q.getBoolean("pref_show_adult_zone", true)) {
this.Q.inflateMenu(R.menu.nav_drawer_menu);
} else {
this.Q.inflateMenu(R.menu.nav_drawer_menu_no_adult);
}
new ColorStateList(new int[][]{new int[]{android.R.attr.state_focused}, new int[]{-16842908}, new int[]{-16842913}, new int[]{android.R.attr.state_selected}}, new int[]{-16777216, -1, -1, -16777216});
this.W = (SuperRecyclerView) findViewById(R.id.recyclerview);
this.T = (MaterialSearchView) findViewById(R.id.search_view);
this.f11794l0 = getResources().getColor(R.color.colorPrimary);
AssetManager assets = getAssets();
String str3 = Constant.f12431b;
this.f11785c0 = Typeface.createFromAsset(assets, "fonts/pproduct_sans_rregular.ttf");
this.f11786d0 = Typeface.createFromAsset(getAssets(), "fonts/product_sans_bold.ttf");
this.f11784b0 = new p2.a();
try {
EventBus.getDefault().register(this);
} catch (Exception unused3) {
}
this.f11784b0.applyFontToNavigationView(this.Q, this.f11786d0);
setSupportActionBar(this.S);
this.Q.setNavigationItemSelectedListener(this);
k0 k0Var = new k0(this, this, this.Z, this.S);
this.f11783a0 = k0Var;
this.Z.setDrawerListener(k0Var);
this.f11783a0.syncState();
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_baseline_subject_24);
this.V = new p(getBaseContext(), this.U, this, this.R, this, this);
this.F = new x(getBaseContext(), this.D, this, this);
this.H.setLayoutManager(new CenterLayoutManager(this, 0, false));
this.H.setAdapter(this.F);
this.H.addItemDecoration(new gb.c(5));
Context baseContext = getBaseContext();
ArrayList<mb.a> arrayList = this.E;
this.G = new q(baseContext, arrayList, this);
this.I.setLayoutManager(new CenterLayoutManager(this, 0, false));
this.I.setAdapter(this.G);
int i12 = 10;
this.I.addItemDecoration(new gb.c(10));
this.W.setRefreshListener(this);
CenterGridLayoutManager centerGridLayoutManager = new CenterGridLayoutManager(this, round);
this.X = centerGridLayoutManager;
this.W.setLayoutManager(centerGridLayoutManager);
this.W.addItemDecoration(new gb.c(12));
this.W.setAdapter(this.V);
this.W.setupMoreListener(this, 20);
this.S.setOnFocusChangeListener(new View.OnFocusChangeListener(this) {
public final MainActivity f18886g;
{
this.f18886g = this;
}
@Override
public final void onFocusChange(View view, boolean z10) {
int i13 = i11;
MainActivity mainActivity = this.f18886g;
switch (i13) {
case 0:
int i14 = MainActivity.f11782p0;
mainActivity.getClass();
if (z10) {
try {
View actionView = mainActivity.P.getActionView();
if (actionView != null) {
mainActivity.S.clearFocus();
actionView.requestFocus();
return;
}
return;
} catch (Exception unused4) {
return;
}
}
return;
default:
if (z10) {
mainActivity.N.clearFocus();
mainActivity.W.requestFocus();
return;
} else {
int i15 = MainActivity.f11782p0;
mainActivity.getClass();
return;
}
}
}
});
this.T.setHint("Movies, TV Shows, People...");
this.T.adjustTintAlpha(0.0f);
this.T.setCloseOnTintClick(true);
this.T.setOnQueryTextListener(new l0(this));
this.T.setOnItemClickListener(new v9.f(this, i10));
RelativeLayout relativeLayout = this.N;
if (relativeLayout != null) {
relativeLayout.setOnFocusChangeListener(new View.OnFocusChangeListener(this) {
public final MainActivity f18886g;
{
this.f18886g = this;
}
@Override
public final void onFocusChange(View view, boolean z10) {
int i13 = i10;
MainActivity mainActivity = this.f18886g;
switch (i13) {
case 0:
int i14 = MainActivity.f11782p0;
mainActivity.getClass();
if (z10) {
try {
View actionView = mainActivity.P.getActionView();
if (actionView != null) {
mainActivity.S.clearFocus();
actionView.requestFocus();
return;
}
return;
} catch (Exception unused4) {
return;
}
}
return;
default:
if (z10) {
mainActivity.N.clearFocus();
mainActivity.W.requestFocus();
return;
} else {
int i15 = MainActivity.f11782p0;
mainActivity.getClass();
return;
}
}
}
});
}
this.K.setOnTabSelectedListener((TabLayout.d) new m0(this));
if (bundle == null) {
try {
new Handler().postDelayed(new f0(this, 7), 5000L);
} catch (Exception unused4) {
}
}
if (App.getInstance().f11732q.getString("guid", "null").equals("null")) {
App.getInstance().f11732q.edit().putString("guid", UUID.randomUUID().toString()).apply();
}
k();
new Handler().postDelayed(new f0(this, 9), 1000L);
new Handler().postDelayed(new f0(this, i12), 1000L);
new Handler().postDelayed(new f0(this, 11), 500L);
this.f11784b0.applyFontToToolbar(this.S, this.f11786d0);
f(this.Y);
if (App.getInstance().f11732q.getInt("content_type", 0) == 0) {
this.f11787e0 = "IN THEATER";
} else {
this.f11787e0 = "NOW STREAMING";
}
try {
this.K.getTabAt(1).setText(this.f11787e0);
} catch (Exception unused5) {
}
new Handler().postDelayed(new f0(this, 8), 2000L);
new Handler().postDelayed(new f0(this, 6), 3000L);
App.getInstance().loadRemoteConfig();
try {
File file = new File(Environment.getExternalStorageDirectory().getPath() + "/FlixVision.Update" + "".replace(StringUtils.SPACE, "").replace(".", "") + ".apk");
if (file.exists()) {
file.delete();
}
} catch (Exception unused6) {
}
if (!App.D) {
try {
this.J = (MediaRouteButton) findViewById(R.id.media_route_button);
CastButtonFactory.setUpMediaRouteButton(getApplicationContext(), this.J);
CastContext.getSharedInstance(this);
} catch (Exception unused7) {
}
}
ArrayList<mb.a> networks = Constants.getNetworks();
if (networks.size() > 0) {
arrayList.clear();
arrayList.addAll(networks);
networks.clear();
this.G.notifyDataSetChanged();
this.I.setVisibility(0);
} else {
this.I.setVisibility(8);
}
g();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (App.D) {
getMenuInflater().inflate(R.menu.main_menu, menu);
} else {
getMenuInflater().inflate(R.menu.main_menu_smartphones, menu);
CastButtonFactory.setUpMediaRouteButton(getApplicationContext(), menu, R.id.media_route_menu_item);
}
this.f11789g0 = menu;
this.P = menu.findItem(R.id.action_filter);
this.f11784b0.applyFontToMenu(this.f11789g0, this.f11785c0);
if (App.getInstance().f11732q.getInt("content_type", 0) == 0) {
App.getInstance().f11732q.edit().putInt("actual_menu_index", 0).apply();
} else {
App.getInstance().f11732q.edit().putInt("actual_menu_index", 1).apply();
}
return true;
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public boolean onKeyDown(int i10, KeyEvent keyEvent) {
int directionPressed = this.f11791i0.getDirectionPressed(keyEvent);
if (directionPressed != 0 && directionPressed != 1 && directionPressed != 2 && directionPressed != 3 && directionPressed != 4) {
switch (directionPressed) {
case 10:
e();
break;
case 11:
if (this.Z.isDrawerOpen(8388611)) {
this.Z.closeDrawer(8388611);
} else {
this.Z.openDrawer(8388611);
}
return true;
case 12:
this.T.openSearch();
return true;
default:
return super.onKeyDown(i10, keyEvent);
}
}
return false;
}
@Override
public void onMediaSelected(Movie movie) {
SharedPreferences sharedPreferences = App.getInstance().f11732q;
String str = Constant.f12431b;
if (sharedPreferences.getBoolean("update_available", false)) {
if (!App.getInstance().f11732q.getBoolean("mandatory_update", false)) {
askToUpdateIfAny(false, movie);
return;
}
askToUpdateIfAny(false, null);
}
openMovieintent(movie);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(Constants.TRAKT_TV_EVENT trakt_tv_event) {
if (trakt_tv_event != Constants.TRAKT_TV_EVENT.USER_LOGGED_IN || this.f11797o0) {
return;
}
this.f11797o0 = true;
d create = new d.a(this).create();
create.setTitle("Trakt TV");
create.setIcon(R.drawable.trakt_logo_3);
create.setMessage("Hello " + App.getInstance().f11732q.getString("trakt_user_name", "") + getString(R.string.trakt_welcome_mess));
create.setButton(-1, getString(R.string.yes_sync_now), new b0(0));
create.setButton(-2, getString(R.string.no_thanks_label), new b0(1));
create.setButton(-3, getString(R.string.go_to_trk_settings), new c0(this, 0));
try {
create.show();
} catch (Exception e10) {
e10.printStackTrace();
}
}
@Override
public void onMoreAsked(int i10, int i11, int i12) {
if (this.M) {
this.Y++;
new Handler().postDelayed(new f0(this, 2), 200L);
}
}
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
onNavigationItemSelected1(menuItem.getItemId());
return false;
}
public boolean onNavigationItemSelected1(int i10) {
this.Z.closeDrawer(8388611);
int i11 = 2;
int i12 = 1;
int i13 = 0;
if (i10 == R.id.setting_follow_discord) {
h();
} else if (i10 == R.id.setting_contact) {
FragmentManager fragmentManager = getFragmentManager();
la.d newInstance = la.d.newInstance(this, true);
newInstance.setTitle("Get in touch");
newInstance.setMessage("Report issue and suggestions at info@flixvision.tv");
newInstance.setButton1("OK", new h0(newInstance, i11));
newInstance.setButton2("OPEN MAIL APP", new a0(this, newInstance, fragmentManager, i13));
try {
newInstance.show(fragmentManager, "");
} catch (Exception e10) {
e10.printStackTrace();
}
} else if (i10 == R.id.action_user_torrent) {
if (AllDebridCommon.f12026h || RealDebridCommon.f12034j || PremiumizeCommon.f12028b) {
startActivity(new Intent(this, (Class<?>) UserTorrentsActivity.class));
} else {
Toast.makeText(this, "Please connect a Premium account first to see your Torrents (RealDebrid, Premiumize or AllDebrid", 1).show();
}
}
if (i10 == R.id.action_donation) {
startActivity(new Intent(this, (Class<?>) DonationActvity.class));
} else if (i10 == R.id.action_adult) {
if (App.getInstance().f11732q.getBoolean("pref_adult_zone_pin_set", false)) {
startActivity(new Intent(this, (Class<?>) AdultZonePINEntryActivity.class));
} else {
startActivity(new Intent(this, (Class<?>) AdultPINSetupActivity.class));
}
} else if (i10 == R.id.setting_follow_twitter) {
j();
} else if (i10 == R.id.action_exit) {
finish();
} else if (i10 == R.id.action_anime) {
startActivity(new Intent(this, (Class<?>) AnimesListActivity.class));
} else if (i10 == R.id.action_tvseries) {
App.getInstance().f11732q.edit().putInt("actual_menu_index", 1).apply();
App.getInstance().f11732q.edit().putInt("content_type", 1).apply();
try {
new Handler().postDelayed(new f0(this, 3), 200L);
} catch (Exception e11) {
e11.printStackTrace();
recreate();
}
} else {
int i14 = 4;
if (i10 == R.id.action_movies) {
App.getInstance().f11732q.edit().putInt("actual_menu_index", 0).apply();
App.getInstance().f11732q.edit().putInt("content_type", 0).apply();
try {
new Handler().postDelayed(new f0(this, i14), 200L);
} catch (Exception e12) {
e12.printStackTrace();
recreate();
}
} else if (i10 == R.id.action_settings) {
startActivityForResult(new Intent(this, (Class<?>) SettingsActivity.class), 1100);
} else if (i10 == R.id.action_my_tv_imports) {
startActivity(new Intent(this, (Class<?>) MyImportActivity.class));
} else if (i10 == R.id.action_my_favorites) {
if (App.getInstance().f11731p.getFavoritesMoviesFromDb().size() > 0) {
startActivity(new Intent(this, (Class<?>) FavoritesAcvivity.class));
} else {
cc.d.makeToast(this, "No Item in your Favorites", false);
}
} else if (i10 == R.id.action_import_tv) {
FragmentManager fragmentManager2 = getFragmentManager();
la.d newInstance2 = la.d.newInstance(this, true);
newInstance2.setTitle("M3U Import");
newInstance2.setMessage("How do you want to import your M3U Playlist?");
newInstance2.setButton2("From File", new g0(this, i13));
newInstance2.setButton1("From URL", new g0(this, i12));
try {
newInstance2.show(fragmentManager2, "");
} catch (Exception e13) {
e13.printStackTrace();
}
} else if (i10 == R.id.action_live_tv_extra) {
startActivity(new Intent(this, (Class<?>) TVCategoriesActivity2.class));
} else if (i10 == R.id.action_trakt) {
if (App.getInstance().f11732q.getBoolean("trakt_user_logged_in", false)) {
startActivity(new Intent(this, (Class<?>) TraktActivity.class));
} else {
FragmentManager fragmentManager3 = getFragmentManager();
la.d newInstance3 = la.d.newInstance(this, false);
newInstance3.setTitle(getString(R.string.trakt_tv_label));
newInstance3.setCancelable(false);
newInstance3.setMessage(getString(R.string.connect_with_trakt_tv_enjoy_benefits_mess));
newInstance3.setButton1("CANCEL", new y(i12));
newInstance3.setButton2(getString(R.string.action_sign_in), new g0(this, i11));
try {
newInstance3.show(fragmentManager3, "");
} catch (Exception e14) {
e14.printStackTrace();
}
}
} else if (i10 == R.id.action_watched_history) {
if (App.getInstance().f11731p.getWatchedMoviesFromDb().size() == 0) {
cc.d.makeToast(this, "No Item Marked As Watched Yet", false);
} else {
startActivity(new Intent(this, (Class<?>) WatchedAcvivity.class));
}
} else if (i10 == R.id.action_watching) {
ArrayList<Movie> watchingMoviesFromDb = App.getInstance().f11731p.getWatchingMoviesFromDb();
if (watchingMoviesFromDb.size() > 0) {
this.W.setupMoreListener(null, 20);
this.f11789g0.findItem(R.id.action_sort_fav).setVisible(true);
this.M = false;
MenuItem findItem = this.f11789g0.findItem(R.id.action_clear);
findItem.setTitle("Clear watching list");
findItem.setVisible(true);
this.U.clear();
this.f11788f0 = 4;
this.U.addAll(watchingMoviesFromDb);
this.W.getAdapter().notifyDataSetChanged();
this.X.scrollToPositionWithOffset(0, 0);
getSupportActionBar().setTitle("WATCHING");
this.W.invalidate();
} else {
Toast.makeText(getBaseContext(), "No Movie or Show in Progress", 0).show();
}
} else if (i10 != R.id.action_watched_history && i10 != R.id.action_my_favorites) {
this.f11789g0.findItem(R.id.action_sort_fav).setVisible(false);
}
}
return false;
}
public void onNetworkClicked(mb.a aVar) {
Intent intent = new Intent(this, (Class<?>) FilterActivity.class);
intent.putExtra("network", aVar.f16524b);
intent.setFlags(268435456);
startActivity(intent);
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
int itemId = menuItem.getItemId();
if (itemId == R.id.action_filter) {
try {
fb.b.newInstance(this).show(getFragmentManager(), "");
} catch (Exception e10) {
e10.printStackTrace();
}
} else if (itemId == R.id.action_refresh) {
try {
resetFilter();
finish();
App.getInstance().restartApp();
} catch (Exception e11) {
e11.printStackTrace();
}
} else if (itemId == R.id.action_exit_app) {
try {
finish();
} catch (Exception e12) {
e12.printStackTrace();
}
} else {
int i10 = 1;
if (itemId == R.id.action_sort_fav) {
if (!this.O) {
Collections.sort(this.U);
this.O = true;
}
Collections.reverse(this.U);
this.V.notifyDataSetChanged();
} else {
int i11 = 0;
if (itemId == R.id.action_search) {
if (!App.D) {
this.T.openSearch();
} else if (App.getInstance().f11732q.getBoolean("pref_classic_search", false)) {
this.T.openSearch();
} else {
startActivity(new Intent(this, (Class<?>) SearchActivityTV.class));
}
} else if (itemId == R.id.action_tvseries) {
App.getInstance().f11732q.edit().putInt("content_type", 1).apply();
try {
new Handler().postDelayed(new f0(this, i11), 300L);
} catch (Exception e13) {
e13.printStackTrace();
recreate();
}
} else if (itemId == R.id.action_movies) {
App.getInstance().f11732q.edit().putInt("content_type", 0).apply();
try {
new Handler().postDelayed(new f0(this, i10), 300L);
} catch (Exception e14) {
e14.printStackTrace();
recreate();
}
} else if (itemId == R.id.action_settings) {
startActivityForResult(new Intent(this, (Class<?>) SettingsActivity.class), 1100);
} else if (itemId == R.id.action_check_update) {
FragmentManager fragmentManager = getFragmentManager();
la.d newInstance = la.d.newInstance(this, false);
newInstance.setloading();
try {
newInstance.show(fragmentManager, "");
} catch (Exception e15) {
e15.printStackTrace();
}
App.getInstance().loadRemoteConfig();
new Handler().postDelayed(new d.y(13, this, newInstance), 5000L);
} else if (itemId == R.id.action_favorites) {
if (App.getInstance().f11731p.getFavoritesMoviesFromDb().size() > 0) {
startActivity(new Intent(this, (Class<?>) FavoritesAcvivity.class));
} else {
cc.d.makeToast(this, "No Item in your Favorites", false);
}
} else if (itemId == R.id.action_clear) {
if (this.f11788f0 == 2) {
la.d newInstance2 = la.d.newInstance(this, true);
newInstance2.setButton1("YES CLEAR", new i0(this, newInstance2, i10));
newInstance2.setButton2(getString(R.string.cancel_label), new h0(newInstance2, i10));
newInstance2.setMessage("This will clear all your Favorites\nDo You really want to clear them?");
newInstance2.setTitle("Clear Favorites");
newInstance2.show(getFragmentManager(), "");
}
int i12 = 4;
int i13 = 3;
if (this.f11788f0 == 3) {
la.d newInstance3 = la.d.newInstance(this, true);
newInstance3.setButton1("YES CLEAR", new i0(this, newInstance3, i13));
newInstance3.setButton2(getString(R.string.cancel_label), new h0(newInstance3, i12));
newInstance3.setMessage("This will clear all your Watched Movies and Shows and You will loose their Progress. \nDo You really want to clear your History?");
newInstance3.setTitle("Clear Watch List");
newInstance3.show(getFragmentManager(), "");
}
if (this.f11788f0 == 4) {
cc.d.makeToast(this, "Cannot clear Watching list", false);
}
}
}
}
return super.onOptionsItemSelected(menuItem);
}
@Override
public void onPause() {
MaterialSearchView materialSearchView = this.T;
if (materialSearchView != null) {
materialSearchView.clearSuggestions();
}
super.onPause();
}
@Override
public void onRefresh() {
k();
this.Y = 1;
this.U.clear();
f(this.Y);
}
@Override
public void onResume() {
super.onResume();
MaterialSearchView materialSearchView = this.T;
if (materialSearchView != null) {
materialSearchView.activityResumed();
this.T.closeSearch();
}
if (App.getInstance().f11723h) {
g();
App.getInstance().f11723h = false;
}
}
public void openMovieintent(Movie movie) {
App.getInstance().f11723h = false;
Intent intent = new Intent(this, (Class<?>) MovieDetailActivity.class);
intent.putExtra("movie", movie);
intent.setFlags(268435456);
startActivity(intent);
}
}