FLIX VISION v2.8.2版本的 MD5 值为:4d33b143293b36f23ce5a6a5834e6993

以下内容为反编译后的 TVCategoriesActivity2.java 源代码,内容仅作参考


package flix.com.vision.tv;

import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.app.FragmentManager;
import android.content.Intent;
import android.content.res.AssetManager;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.view.animation.AlphaAnimation;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.RecyclerView;
import ba.s;
import bc.g;
import cz.msebera.android.httpclient.HttpHost;
import flix.com.vision.App;
import flix.com.vision.R;
import flix.com.vision.helpers.CenterGridLayoutManager;
import gb.i;
import hb.k;
import ib.d;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import v9.y;
import wb.c;

public class TVCategoriesActivity2 extends x9.a implements k {
    public static final int Z = 0;
    public RelativeLayout D;
    public RelativeLayout E;
    public RelativeLayout F;
    public p2.a G;
    public Typeface H;
    public TextView I;
    public TextView J;
    public TextView K;
    public TextView L;
    public LinearLayout M;
    public RecyclerView N;
    public s O;
    public String P;
    public boolean Q;
    public Handler R;
    public c S;
    public TextView T;
    public TextView U;
    public RelativeLayout V;
    public AlphaAnimation W;
    public boolean X = false;
    public int Y;

    public class a extends AsyncTask<String, Void, String> {

        public Exception f12445a = null;

        public a() {
        }

        @Override
        public String doInBackground(String... strArr) {
            try {
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new BufferedInputStream(new FileInputStream(new File(TVCategoriesActivity2.this.P)))));
                StringBuilder sb2 = new StringBuilder();
                int i10 = 0;
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    i10++;
                    if (i10 > 1000 && readLine.trim().startsWith(HttpHost.DEFAULT_SCHEME_NAME)) {
                        App.getInstance().f11726k.addAll(i.parseChannels(sb2.toString()));
                        publishProgress(new Void[0]);
                        sb2 = new StringBuilder();
                        i10 = 0;
                    }
                    sb2.append(readLine);
                    sb2.append('\n');
                }
                App.getInstance().f11726k.addAll(i.parseChannels(sb2.toString()));
                e = null;
            } catch (Exception e10) {
                e = e10;
                e.printStackTrace();
            }
            this.f12445a = e;
            return null;
        }

        @Override
        public void onPostExecute(String str) {
            TVCategoriesActivity2 tVCategoriesActivity2 = TVCategoriesActivity2.this;
            tVCategoriesActivity2.X = true;
            if (App.getInstance().f11726k.size() > 0) {
                tVCategoriesActivity2.d();
                tVCategoriesActivity2.O.notifyDataSetChanged();
                tVCategoriesActivity2.M.setVisibility(8);
            } else {
                Exception exc = this.f12445a;
                if (exc != null) {
                    Objects.toString(exc);
                }
                tVCategoriesActivity2.M.setVisibility(8);
                Toast.makeText(tVCategoriesActivity2.getBaseContext(), "Failed to load Channels", 1).show();
            }
        }

        @Override
        public void onPreExecute() {
        }

        @Override
        public void onProgressUpdate(Void... voidArr) {
            TVCategoriesActivity2.this.U.setText(App.getInstance().f11726k.size() + " channels loaded");
        }
    }

    public class b extends AsyncTask<String, Void, String> {

        public Exception f12447a;

        public b() {
        }

        @Override
        public String doInBackground(String... strArr) {
            getUrlContents(strArr[0]);
            return "OK";
        }

        public String getUrlContents(String str) {
            BufferedReader bufferedReader;
            StringBuilder sb2 = new StringBuilder();
            try {
                HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
                httpURLConnection.getResponseCode();
                bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
            } catch (Exception e10) {
                this.f12447a = e10;
                return null;
            }
            while (true) {
                int i10 = 0;
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        bufferedReader.close();
                        return null;
                    }
                    if (!readLine.contains("EXTVLCOPT")) {
                        try {
                            sb2.append(readLine.trim() + StringUtils.LF);
                            i10++;
                            if (i10 > 1000 && readLine.trim().startsWith(HttpHost.DEFAULT_SCHEME_NAME)) {
                                break;
                            }
                        } catch (Exception e11) {
                            e11.printStackTrace();
                        }
                    }
                    this.f12447a = e10;
                    return null;
                }
                sb2 = new StringBuilder();
            }
        }

        @Override
        public void onPostExecute(String str) {
            String str2;
            int size = App.getInstance().f11726k.size();
            TVCategoriesActivity2 tVCategoriesActivity2 = TVCategoriesActivity2.this;
            if (size > 0) {
                tVCategoriesActivity2.d();
                tVCategoriesActivity2.O.notifyDataSetChanged();
                tVCategoriesActivity2.M.setVisibility(8);
            } else {
                if (this.f12447a != null) {
                    str2 = "Failed to load Channels: " + this.f12447a;
                } else {
                    str2 = "Failed to load Channels";
                }
                tVCategoriesActivity2.M.setVisibility(8);
                Toast.makeText(tVCategoriesActivity2.getBaseContext(), str2, 1).show();
                tVCategoriesActivity2.I.setText("TV Categories · Failed");
            }
            tVCategoriesActivity2.X = true;
        }

        @Override
        public void onPreExecute() {
        }

        @Override
        public void onProgressUpdate(Void... voidArr) {
            TVCategoriesActivity2.this.U.setText(App.getInstance().f11726k.size() + " channels loaded");
        }
    }

    public void ToastChannel(String str) {
        if (this.V == null) {
            return;
        }
        if (str != null && str.length() > 20) {
            str = str.substring(0, 19);
        }
        this.V.setAlpha(1.0f);
        this.R.removeCallbacks(this.S);
        this.R.postDelayed(this.S, 2000L);
        this.T.setText(str);
        this.V.setVisibility(0);
    }

    public final void d() {
        App.getInstance().f11728m.clear();
        ArrayList arrayList = new ArrayList();
        Iterator<d> it = App.getInstance().f11726k.iterator();
        int i10 = 0;
        while (it.hasNext()) {
            d next = it.next();
            i10++;
            String str = next.f13777n;
            if (str != null && !arrayList.contains(str)) {
                arrayList.add(next.f13777n);
                TVCategory tVCategory = new TVCategory();
                tVCategory.setCategoryName(next.f13777n);
                tVCategory.setCategoryId(i10);
                App.getInstance().f11728m.add(tVCategory);
            }
        }
        if (App.getInstance().f11728m.size() > 0) {
            this.I.setText("TV Categories · " + App.getInstance().f11728m.size());
            this.O.notifyDataSetChanged();
            Toast.makeText(this, App.getInstance().f11726k.size() + " Channels loaded", 1).show();
        }
    }

    public void getCategories() {
        if (App.getInstance().f11728m.size() <= 0) {
            App.getInstance().f11725j = this.P;
            if (this.Q) {
                new a().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, this.P);
                return;
            } else {
                new b().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, this.P);
                return;
            }
        }
        this.I.setText("TV Categories · " + App.getInstance().f11728m.size());
        this.M.setVisibility(8);
        this.O.notifyDataSetChanged();
        this.N.requestFocus();
        this.X = true;
    }

    @Override
    public void onBackPressed() {
        if (this.X) {
            super.onBackPressed();
            finish();
            return;
        }
        FragmentManager fragmentManager = getFragmentManager();
        la.d newInstance = la.d.newInstance(this, true);
        newInstance.setTitle("Still working");
        newInstance.setMessage("We're still loading your channels. Can you please wait a little more?");
        newInstance.setButton1("CANCEL", new g(this, 0));
        newInstance.setButton2("OK, I'LL WAIT", new y(25));
        try {
            newInstance.show(fragmentManager, "");
        } catch (Exception e10) {
            e10.printStackTrace();
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        EventBus.getDefault().register(this);
        setContentView(R.layout.activity_tv_categories2);
        AssetManager assets = getAssets();
        String str = Constant.f12431b;
        this.H = Typeface.createFromAsset(assets, "fonts/product_sans_bold.ttf");
        this.G = new p2.a();
        String stringExtra = getIntent().getStringExtra("url");
        this.P = stringExtra;
        if (stringExtra == null) {
            this.P = App.getInstance().f11732q.getString("iptv_url", "https://iptv-org.github.io/iptv/index.country.m3u");
        }
        this.Q = getIntent().getBooleanExtra("is_file", false);
        this.P = this.P.toLowerCase(Locale.ROOT);
        String str2 = App.getInstance().f11725j;
        if (App.getInstance().f11728m == null) {
            App.getInstance().f11728m = new ArrayList<>();
        }
        if (App.getInstance().f11726k == null) {
            App.getInstance().f11726k = new ArrayList<>();
        }
        if (App.getInstance().f11727l == null) {
            App.getInstance().f11727l = new ArrayList<>();
        }
        if (App.getInstance().f11728m.size() > 0 && str2 != null && !str2.equalsIgnoreCase(this.P)) {
            App.getInstance().f11728m.clear();
            App.getInstance().f11726k.clear();
            App.getInstance().f11727l.clear();
        }
        this.U = (TextView) findViewById(R.id.loader_text);
        this.N = (RecyclerView) findViewById(R.id.recyclerview_categories);
        this.M = (LinearLayout) findViewById(R.id.loader);
        this.L = (TextView) findViewById(R.id.adult_settings_text);
        this.F = (RelativeLayout) findViewById(R.id.settings_button_adult);
        this.K = (TextView) findViewById(R.id.adult_search_text);
        this.J = (TextView) findViewById(R.id.adult_favorites_text);
        this.E = (RelativeLayout) findViewById(R.id.activity_player);
        this.D = (RelativeLayout) findViewById(R.id.search_button_adult);
        this.N = (RecyclerView) findViewById(R.id.recyclerview_categories);
        TextView textView = (TextView) findViewById(R.id.adult_page_title);
        this.I = textView;
        this.G.applyFontToView(textView, this.H);
        TextView textView2 = this.U;
        if (textView2 != null) {
            this.G.applyFontToView(textView2, this.H);
        }
        TextView textView3 = this.J;
        if (textView3 != null) {
            this.G.applyFontToView(textView3, this.H);
        }
        TextView textView4 = this.L;
        if (textView4 != null) {
            this.G.applyFontToView(textView4, this.H);
        }
        TextView textView5 = this.K;
        if (textView5 != null) {
            this.G.applyFontToView(textView5, this.H);
        }
        this.D.setOnClickListener(new g(this, 1));
        this.F.setOnClickListener(new g(this, 2));
        setBackgroundColor();
        if (App.D) {
            this.V = (RelativeLayout) findViewById(R.id.toast_view);
            this.W = new AlphaAnimation(1.0f, 0.0f);
            this.T = (TextView) findViewById(R.id.customToastText);
            this.R = new Handler();
            this.S = new c(this, 4);
        }
        DisplayMetrics a5 = o.a.a(getWindowManager().getDefaultDisplay());
        this.N.setLayoutManager(new CenterGridLayoutManager(this, Math.round((a5.widthPixels / getResources().getDisplayMetrics().density) / 140)));
        this.N.addItemDecoration(new gb.d(5));
        s sVar = new s(App.getInstance().f11728m, this, this);
        this.O = sVar;
        this.N.setAdapter(sVar);
        getCategories();
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onMessageEvent(ma.b bVar) {
        ArrayList<TVCategory> arrayList = App.getInstance().f11728m;
        throw null;
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void openCategory(TVCategory tVCategory) {
        App.getInstance().f11727l.clear();
        Iterator<d> it = App.getInstance().f11726k.iterator();
        while (it.hasNext()) {
            d next = it.next();
            if (next.f13777n.equalsIgnoreCase(tVCategory.getCategoryName())) {
                App.getInstance().f11727l.add(next);
            }
        }
        Intent intent = new Intent(this, (Class<?>) ChannelsListActivityImport.class);
        intent.putExtra("cat_name", tVCategory.getCategoryName());
        startActivity(intent);
    }

    public void setBackgroundColor() {
        this.Y = 2505092;
        ValueAnimator ofObject = ValueAnimator.ofObject(new ArgbEvaluator(), Integer.valueOf(this.Y), 0);
        ofObject.setDuration(2000L);
        ofObject.addUpdateListener(new y5.a(this, 17));
        ofObject.start();
        this.Y = 0;
    }
}