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

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


package flix.com.vision.activities;

import android.annotation.SuppressLint;
import android.app.FragmentManager;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.view.ContextThemeWrapper;
import android.view.MenuItem;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.Toast;
import androidx.appcompat.app.d;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import ba.v;
import cz.msebera.android.httpclient.client.utils.URLEncodedUtils;
import flix.com.vision.App;
import flix.com.vision.R;
import flix.com.vision.activities.UserTorrentsActivity;
import flix.com.vision.activities.player.SimpleVideoPlayer;
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.Constants;
import flix.com.vision.models.Movie;
import flix.com.vision.models.torrent.UserTorrent;
import flix.com.vision.processors.english.BaseProcessor;
import gb.c;
import hb.i;
import ib.o;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import la.d;
import pc.b;
import q2.m;
import v9.e2;
import v9.f2;
import v9.n0;
import v9.w;
import v9.x;

public class UserTorrentsActivity extends x9.a implements i {
    public static final int P = 0;
    public RecyclerView E;
    public RelativeLayout F;
    public RelativeLayout G;
    public RelativeLayout H;
    public b I;
    public v J;
    public BaseProcessor.TorrentServiceType K;
    public HashMap M;
    public final ArrayList<UserTorrent> D = new ArrayList<>();
    public String L = null;
    public d N = null;
    public final ArrayList<o> O = new ArrayList<>();

    public class a extends m {

        public final String f11903h;

        public a(String str, f2 f2Var, n0 n0Var, String str2) {
            super(1, str, f2Var, n0Var);
            this.f11903h = str2;
        }

        @Override
        public String getBodyContentType() {
            return "application/x-www-form-urlencoded; charset=UTF-8";
        }

        @Override
        public Map<String, String> getHeaders() {
            return a.b.t("Content-Type", URLEncodedUtils.CONTENT_TYPE);
        }

        @Override
        public Map<String, String> getParams() {
            HashMap hashMap = new HashMap();
            hashMap.put("src", this.f11903h);
            return hashMap;
        }
    }

    public final void d(ArrayList<o> arrayList) {
        try {
            ArrayList arrayList2 = new ArrayList();
            for (int i10 = 0; i10 < arrayList.size(); i10++) {
                arrayList2.add(arrayList.get(i10).f13837t.toUpperCase(Locale.ROOT));
            }
            CharSequence[] charSequenceArr = (CharSequence[]) arrayList2.toArray(new CharSequence[arrayList2.size()]);
            d.a aVar = new d.a(new ContextThemeWrapper(this, R.style.AlertDialogNoHeader));
            aVar.setSingleChoiceItems(charSequenceArr, -1, new w(this, arrayList, 1));
            aVar.setOnDismissListener(new x(3));
            aVar.show();
        } catch (Exception unused) {
        }
    }

    @SuppressLint({"CheckResult"})
    public final void e() {
        HashMap hashMap = this.M;
        if (hashMap != null) {
            hashMap.clear();
        }
        b bVar = this.I;
        if (bVar != null) {
            bVar.dispose();
        }
        if (this.K == BaseProcessor.TorrentServiceType.REAL_DEBRID) {
            this.I = ca.a.getMagnetsRealDebridLatest(RealDebridCommon.f12032h, RealDebridCommon.f12030b, 100).subscribeOn(fd.a.newThread()).observeOn(oc.a.mainThread()).subscribe(new e2(this, 0), new n0(10));
        }
        if (this.K == BaseProcessor.TorrentServiceType.PREMIUMIZE) {
            this.I = ca.a.getUserTorrentPrem(this.L).subscribeOn(fd.a.newThread()).observeOn(oc.a.mainThread()).subscribe(new e2(this, 1), new n0(11));
        }
        if (this.K == BaseProcessor.TorrentServiceType.ALL_DEBRID) {
            ca.a.getAllMagnetAllDebrid().observeOn(oc.a.mainThread()).subscribeOn(fd.a.newThread()).subscribe(new e2(this, 2), new n0(12));
        }
    }

    public final void f(o oVar) {
        int i10 = App.getInstance().f11732q.getInt("player_index", 0);
        if (i10 <= 0 || i10 >= 4) {
            g(oVar);
            return;
        }
        try {
            LinksActivity.PlayExternal(i10, oVar, oVar.f13837t, null, this, -1);
        } catch (Exception unused) {
            Toast.makeText(getBaseContext(), "Failed to load external Player, Make sure it is installed", 1).show();
            g(oVar);
        }
    }

    @Override
    public void favoriteDeleted(int i10) {
    }

    public final void g(o oVar) {
        String str = oVar.f13837t;
        Intent intent = new Intent(this, (Class<?>) SimpleVideoPlayer.class);
        intent.putExtra("title", str);
        intent.putExtra("language", oVar.f13830m);
        intent.putExtra("streamUrl", oVar.f13838u);
        startActivity(intent);
    }

    public void getMagnetPrem(String str) {
        App.getInstance().getRequestQueue().add(new a(a.b.k("https://www.premiumize.me/api/transfer/directdl?apikey=", PremiumizeCommon.f12029g), new f2(this, str, 1), new n0(13), str));
    }

    public final void h() {
        la.d dVar = this.N;
        if (dVar != null) {
            try {
                dVar.dismiss();
            } catch (Exception unused) {
            }
        }
        FragmentManager fragmentManager = getFragmentManager();
        la.d newInstance = la.d.newInstance(this, false);
        this.N = newInstance;
        newInstance.setloading();
        try {
            this.N.show(fragmentManager, "");
        } catch (Exception e10) {
            e10.printStackTrace();
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_user_torrents);
        this.M = new HashMap();
        SharedPreferences sharedPreferences = App.getInstance().f11732q;
        String str = Constants.f12301a;
        this.L = sharedPreferences.getString("prem_apikey", null);
        BaseProcessor.TorrentServiceType torrentServiceType = BaseProcessor.TorrentServiceType.REAL_DEBRID;
        this.K = torrentServiceType;
        this.H = (RelativeLayout) findViewById(R.id.alldebrid_button);
        this.G = (RelativeLayout) findViewById(R.id.prem_button);
        this.F = (RelativeLayout) findViewById(R.id.rd_button);
        if (AllDebridCommon.f12026h) {
            this.K = BaseProcessor.TorrentServiceType.ALL_DEBRID;
        } else {
            this.H.setVisibility(8);
        }
        if (RealDebridCommon.f12034j) {
            this.K = torrentServiceType;
        } else {
            this.F.setVisibility(8);
        }
        if (PremiumizeCommon.f12028b) {
            this.K = BaseProcessor.TorrentServiceType.PREMIUMIZE;
        } else {
            this.G.setVisibility(8);
        }
        final int i10 = 0;
        this.F.setOnClickListener(new View.OnClickListener(this) {

            public final UserTorrentsActivity f18844g;

            {
                this.f18844g = this;
            }

            @Override
            public final void onClick(View view) {
                int i11 = i10;
                UserTorrentsActivity userTorrentsActivity = this.f18844g;
                switch (i11) {
                    case 0:
                        userTorrentsActivity.K = BaseProcessor.TorrentServiceType.REAL_DEBRID;
                        userTorrentsActivity.D.clear();
                        userTorrentsActivity.J.notifyDataSetChanged();
                        userTorrentsActivity.e();
                        return;
                    case 1:
                        userTorrentsActivity.K = BaseProcessor.TorrentServiceType.PREMIUMIZE;
                        userTorrentsActivity.D.clear();
                        userTorrentsActivity.J.notifyDataSetChanged();
                        userTorrentsActivity.e();
                        return;
                    default:
                        userTorrentsActivity.K = BaseProcessor.TorrentServiceType.ALL_DEBRID;
                        userTorrentsActivity.D.clear();
                        userTorrentsActivity.J.notifyDataSetChanged();
                        userTorrentsActivity.e();
                        return;
                }
            }
        });
        final int i11 = 1;
        this.G.setOnClickListener(new View.OnClickListener(this) {

            public final UserTorrentsActivity f18844g;

            {
                this.f18844g = this;
            }

            @Override
            public final void onClick(View view) {
                int i112 = i11;
                UserTorrentsActivity userTorrentsActivity = this.f18844g;
                switch (i112) {
                    case 0:
                        userTorrentsActivity.K = BaseProcessor.TorrentServiceType.REAL_DEBRID;
                        userTorrentsActivity.D.clear();
                        userTorrentsActivity.J.notifyDataSetChanged();
                        userTorrentsActivity.e();
                        return;
                    case 1:
                        userTorrentsActivity.K = BaseProcessor.TorrentServiceType.PREMIUMIZE;
                        userTorrentsActivity.D.clear();
                        userTorrentsActivity.J.notifyDataSetChanged();
                        userTorrentsActivity.e();
                        return;
                    default:
                        userTorrentsActivity.K = BaseProcessor.TorrentServiceType.ALL_DEBRID;
                        userTorrentsActivity.D.clear();
                        userTorrentsActivity.J.notifyDataSetChanged();
                        userTorrentsActivity.e();
                        return;
                }
            }
        });
        final int i12 = 2;
        this.H.setOnClickListener(new View.OnClickListener(this) {

            public final UserTorrentsActivity f18844g;

            {
                this.f18844g = this;
            }

            @Override
            public final void onClick(View view) {
                int i112 = i12;
                UserTorrentsActivity userTorrentsActivity = this.f18844g;
                switch (i112) {
                    case 0:
                        userTorrentsActivity.K = BaseProcessor.TorrentServiceType.REAL_DEBRID;
                        userTorrentsActivity.D.clear();
                        userTorrentsActivity.J.notifyDataSetChanged();
                        userTorrentsActivity.e();
                        return;
                    case 1:
                        userTorrentsActivity.K = BaseProcessor.TorrentServiceType.PREMIUMIZE;
                        userTorrentsActivity.D.clear();
                        userTorrentsActivity.J.notifyDataSetChanged();
                        userTorrentsActivity.e();
                        return;
                    default:
                        userTorrentsActivity.K = BaseProcessor.TorrentServiceType.ALL_DEBRID;
                        userTorrentsActivity.D.clear();
                        userTorrentsActivity.J.notifyDataSetChanged();
                        userTorrentsActivity.e();
                        return;
                }
            }
        });
        RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview_cast);
        this.E = recyclerView;
        recyclerView.addItemDecoration(new c(App.D ? 12 : 8));
        this.J = new v(this, this.D);
        this.E.setLayoutManager(new LinearLayoutManager(this));
        this.E.addItemDecoration(new c(8));
        this.E.setAdapter(this.J);
        this.F.requestFocus();
        e();
    }

    @Override
    public void onMediaSelected(Movie movie) {
        Intent intent = new Intent(this, (Class<?>) MovieDetailActivity.class);
        intent.putExtra("movie", movie);
        intent.setFlags(268435456);
        startActivity(intent);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() != 16908332) {
            return true;
        }
        finish();
        return true;
    }

    public void torrentClicked(UserTorrent userTorrent) {
        String str;
        String str2;
        BaseProcessor.TorrentServiceType torrentServiceType = userTorrent.source_type;
        BaseProcessor.TorrentServiceType torrentServiceType2 = BaseProcessor.TorrentServiceType.REAL_DEBRID;
        int i10 = 0;
        if (torrentServiceType == torrentServiceType2 && (str2 = userTorrent.status) != null && str2.equals("error")) {
            Toast.makeText(this, "Cannot be played!", 0).show();
            return;
        }
        BaseProcessor.TorrentServiceType torrentServiceType3 = userTorrent.source_type;
        BaseProcessor.TorrentServiceType torrentServiceType4 = BaseProcessor.TorrentServiceType.ALL_DEBRID;
        if (torrentServiceType3 == torrentServiceType4 && (str = userTorrent.status) != null && !str.equals("Ready") && !userTorrent.status.equals("Downloading")) {
            Toast.makeText(this, "Cannot be played now!", 0).show();
            return;
        }
        if (userTorrent.streamable) {
            o videoSource = userTorrent.toVideoSource();
            if (videoSource == null) {
                return;
            }
            f(videoSource);
            return;
        }
        BaseProcessor.TorrentServiceType torrentServiceType5 = userTorrent.source_type;
        if (torrentServiceType5 == BaseProcessor.TorrentServiceType.PREMIUMIZE) {
            ArrayList<o> arrayList = (ArrayList) this.M.get(userTorrent.src);
            if (arrayList == null || arrayList.size() == 0) {
                getMagnetPrem(userTorrent.src);
                return;
            } else {
                d(arrayList);
                return;
            }
        }
        ArrayList<o> arrayList2 = this.O;
        if (torrentServiceType5 == torrentServiceType4) {
            ArrayList<o> arrayList3 = (ArrayList) this.M.get(userTorrent.src);
            if (arrayList3 != null && arrayList3.size() != 0) {
                d(arrayList3);
                return;
            }
            String str3 = userTorrent.file_id;
            arrayList2.clear();
            h();
            new Handler().postDelayed(new androidx.activity.d(this, 22), 5000L);
            ca.a.getMagnetStatusAllDebrid(str3).observeOn(oc.a.mainThread()).subscribeOn(fd.a.newThread()).subscribe(new f2(this, str3, i10), new l0.c(str3, 18));
            return;
        }
        if (torrentServiceType5 == torrentServiceType2) {
            ArrayList<o> arrayList4 = (ArrayList) this.M.get(userTorrent.src);
            if (arrayList4 != null && arrayList4.size() != 0) {
                d(arrayList4);
                return;
            }
            String str4 = userTorrent.src;
            h();
            arrayList2.clear();
            ca.a.getLinkRealDebrid(str4, RealDebridCommon.f12032h, RealDebridCommon.f12030b).observeOn(oc.a.mainThread()).subscribeOn(fd.a.newThread()).subscribe(new e2(this, 3), new f2(this, str4, 2));
        }
    }

    public void unlockLinkAllRebrid(String str) {
        ca.a.unlockLinkAllDebrid(str).observeOn(oc.a.mainThread()).subscribeOn(fd.a.newThread()).subscribe(new e2(this, 4), new n0(14));
    }
}