APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Music Player
版本号:1.0
包名称:music.downloader.mp3player.downloadmusic

MD5 校验值:61e58c10a11e4adec8760ee3854e996a

反编译源代码说明

MusicPlayerService.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package music.downloader.mp3player.downloadmusic.service;

import A.r;
import I1.AbstractC0007f;
import I1.AbstractC0013l;
import I1.C0009h;
import I1.C0011j;
import I1.F;
import I1.J;
import I1.RunnableC0002a;
import I1.u;
import I1.v;
import I2.C0042n;
import K1.C0068b;
import L2.N;
import N5.d;
import N5.g;
import Q4.p;
import Q4.y;
import T4.j;
import T4.k;
import T4.n;
import U4.a;
import V4.c;
import X4.h;
import Y4.l;
import a0.AbstractServiceC0218i;
import a1.C0225d;
import a5.BinderC0237f;
import a5.C0233b;
import a5.C0236e;
import a5.CountDownTimerC0235d;
import a5.RunnableC0234c;
import android.app.Activity;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.AudioManager;
import android.media.MediaMetadata;
import android.media.RemoteControlClient;
import android.media.audiofx.AudioEffect;
import android.media.audiofx.BassBoost;
import android.media.audiofx.Equalizer;
import android.media.audiofx.Virtualizer;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcel;
import android.support.v4.media.MediaMetadataCompat;
import android.support.v4.media.session.MediaSessionCompat$Token;
import android.support.v4.media.session.m;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.view.Surface;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.widget.AppCompatSeekBar;
import androidx.core.graphics.drawable.IconCompat;
import androidx.fragment.app.X;
import androidx.recyclerview.widget.RecyclerView;
import b0.C0266a;
import com.google.android.exoplayer2.source.dash.DashMediaSource$Factory;
import com.google.android.exoplayer2.source.hls.HlsMediaSource$Factory;
import com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource$Factory;
import com.google.android.gms.internal.ads.C0398Kc;
import com.google.android.gms.internal.ads.C0847h1;
import com.google.android.gms.internal.ads.Ix;
import com.wang.avi.AVLoadingIndicatorView;
import d2.AbstractC1726a;
import d2.C1733h;
import f0.AbstractC1761a;
import g1.C1797c;
import h2.C1812d;
import i2.C1846b;
import i2.C1853i;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
import j3.AbstractC1888a;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Objects;
import java.util.Random;
import java.util.concurrent.CopyOnWriteArrayList;
import k2.C1955c;
import l3.AbstractC2026e;
import music.downloader.mp3player.downloadmusic.MainActivityX;
import music.downloader.mp3player.downloadmusic.MusicApp;
import music.downloader.mp3player.downloadmusic.R;
import music.downloader.mp3player.downloadmusic.receiver.BroadcastControl;
import music.downloader.mp3player.downloadmusic.ui.activity.PlayerActivity;
import music.downloader.mp3player.downloadmusic.widget.PlayerView;
import n3.e;
import n4.AbstractC2098a;
import o4.AbstractC2119b;
import org.apache.http.protocol.HTTP;
import org.greenrobot.eventbus.ThreadMode;
import org.mozilla.javascript.ES6Iterator;
import org.schabi.newpipe.extractor.utils.ManifestCreatorCache;
import q.C2156b;
import q3.C2222s;
import v0.AbstractC2363a;
import v2.f;
import v2.i;
import x2.InterfaceC2406c;
import z2.b;
import z2.q;

public class MusicPlayerService extends AbstractServiceC0218i implements AudioManager.OnAudioFocusChangeListener, c {

    public static boolean f17269p0 = false;

    public static J f17270q0;

    public m f17271A;

    public ImageView f17272B;

    public e f17273C;

    public ArrayList f17277H;

    public ArrayList f17279J;

    public r f17281L;

    public X4.c f17282M;

    public m f17284O;

    public final RunnableC0234c f17286Q;

    public PlayerView f17287R;

    public ComponentName f17288S;

    public AbstractC1726a f17289T;

    public NotificationManager f17290U;

    public boolean f17291V;

    public l f17292W;

    public RemoteControlClient f17293X;

    public RecyclerView f17294Y;

    public RecyclerView f17295Z;

    public PlayerView f17296a0;

    public AppCompatSeekBar f17297b0;
    public C0398Kc c0;

    public int f17298d0;

    public int f17299e0;

    public i f17300f0;

    public f f17301g0;

    public TextView f17302h0;

    public TextView f17303i0;

    public TextView f17304j0;

    public TextView f17305k0;

    public TextView f17306l0;

    public String f17308m0;

    public p f17309n;

    public LinearLayout f17310n0;

    public y f17311o;

    public Virtualizer f17312o0;

    public AudioManager f17313p;

    public BassBoost f17314q;

    public Bitmap f17315r;

    public BroadcastControl f17316s;

    public ImageView f17317t;

    public ImageButton f17318u;

    public AVLoadingIndicatorView f17319v;

    public CountDownTimerC0235d f17320w;

    public C2222s f17321x;

    public Equalizer f17323z;

    public boolean f17307m = false;

    public boolean f17322y = false;

    public boolean f17274D = false;

    public final I0.c f17275E = new I0.c(this, 3);

    public final ArrayList f17276F = new ArrayList();
    public final ArrayList G = new ArrayList();

    public final ArrayList f17278I = new ArrayList();

    public final BinderC0237f f17280K = new BinderC0237f(this);

    public final long f17283N = 1000;

    public final C0233b f17285P = new C0233b(this);

    public MusicPlayerService() {
        new RunnableC0234c(this, 0);
        this.f17286Q = new RunnableC0234c(this, 1);
        this.f17293X = null;
        this.f17298d0 = 0;
        this.f17308m0 = "";
    }

    public final void A() {
        if (f17269p0) {
            J j5 = f17270q0;
            if (j5 != null) {
                Object obj = new Object();
                j5.G();
                for (AbstractC0007f abstractC0007f : j5.f913f) {
                    if (abstractC0007f.f955b == 1) {
                        F w6 = j5.f914j.w(abstractC0007f);
                        b.f(!w6.f899f);
                        w6.f898c = 5;
                        b.f(!w6.f899f);
                        w6.d = obj;
                        w6.b();
                    }
                }
            }
            Virtualizer virtualizer = this.f17312o0;
            if (virtualizer != null) {
                virtualizer.release();
                this.f17312o0 = null;
            }
            BassBoost bassBoost = this.f17314q;
            if (bassBoost != null) {
                bassBoost.release();
                this.f17314q = null;
            }
            Equalizer equalizer = this.f17323z;
            if (equalizer != null) {
                equalizer.release();
                this.f17323z = null;
            }
            C();
            z();
            CountDownTimerC0235d countDownTimerC0235d = this.f17320w;
            if (countDownTimerC0235d != null) {
                countDownTimerC0235d.cancel();
            }
            TextView textView = this.f17306l0;
            if (textView != null) {
                textView.setText("");
            }
            SharedPreferences.Editor edit = ((SharedPreferences) this.f17292W.e).edit();
            edit.putInt("com.eskaylation.downloadmusic.TIMER", 0);
            edit.apply();
            SharedPreferences.Editor edit2 = ((SharedPreferences) this.f17292W.e).edit();
            edit2.putBoolean("com.eskaylation.downloadmusic.PREF_TIMEOFF", false);
            edit2.apply();
            SharedPreferences.Editor edit3 = ((SharedPreferences) this.f17292W.e).edit();
            edit3.putBoolean("PREF_SHOWADS_INTRO", true);
            edit3.apply();
            f17269p0 = false;
            if (Build.VERSION.SDK_INT >= 26) {
                try {
                    this.f17290U.deleteNotificationChannel("com.eskaylation.downloadmusic");
                } catch (SecurityException e) {
                    e.printStackTrace();
                }
            } else {
                stopForeground(true);
            }
            this.f17290U.cancel(888888);
            d.b().h(new n(true));
        }
        this.G.clear();
        this.f17276F.clear();
        this.f17278I.clear();
        this.f17308m0 = "";
        AbstractC2119b.a("Stop service", new Object[0]);
    }

    public final void B() {
        try {
            r();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public final void C() {
        RemoteControlClient remoteControlClient = this.f17293X;
        if (remoteControlClient != null) {
            remoteControlClient.setPlaybackState(1);
            RemoteControlClient.MetadataEditor editMetadata = this.f17293X.editMetadata(true);
            editMetadata.clear();
            editMetadata.apply();
            this.f17313p.unregisterRemoteControlClient(this.f17293X);
            this.f17293X = null;
        }
    }

    @N5.i(sticky = true, threadMode = ThreadMode.MAIN)
    public void ConTrolBroadcast(T4.c cVar) {
        char c7;
        String str = cVar.f3492a;
        switch (str.hashCode()) {
            case -399999368:
                if (str.equals("com.eskaylation.downloadmusic.action.playpause")) {
                    c7 = 1;
                    break;
                }
            case -376054275:
                if (str.equals("com.eskaylation.downloadmusic.action.next")) {
                    c7 = 0;
                    break;
                }
            case 1229439436:
                if (str.equals("com.eskaylation.downloadmusic.action.prive")) {
                    c7 = 2;
                    break;
                }
            case 1371943730:
                if (str.equals("com.eskaylation.downloadmusic.action.stop_music")) {
                    c7 = 3;
                    break;
                }
            default:
                c7 = 65535;
                break;
        }
        if (c7 != 0) {
            if (c7 != 1) {
                if (c7 != 2) {
                    if (c7 == 3) {
                        Intent intent = new Intent(this, (Class<?>) MusicPlayerService.class);
                        intent.setAction("com.eskaylation.downloadmusic.action.stop_music");
                        startService(intent);
                        return;
                    }
                    return;
                }
                if (f17269p0) {
                    p();
                    return;
                }
                return;
            }
            if (f17269p0) {
                o();
                return;
            }
            return;
        }
        if (f17269p0) {
            n();
        }
    }

    public final void D(int i5) {
        RemoteControlClient remoteControlClient = this.f17293X;
        if (remoteControlClient != null) {
            boolean z6 = this.f17307m;
            remoteControlClient.setPlaybackState(i5);
            this.f17293X.setTransportControlFlags(137);
            RemoteControlClient.MetadataEditor editMetadata = this.f17293X.editMetadata(true);
            if (z6) {
                editMetadata.putString(2, "").putString(7, this.f17282M.f4277k).apply();
            } else {
                editMetadata.putString(2, h().f4294f).putString(1, h().f4293b).putString(7, h().f4302q).apply();
            }
        }
    }

    @N5.i(sticky = true, threadMode = ThreadMode.MAIN)
    public void OnMusicPlayServiceUrl(T4.i iVar) {
        u uVar;
        String str = iVar.f3494b;
        this.f17308m0 = str;
        this.f17322y = false;
        z();
        this.f17321x = b();
        this.f17301g0 = new f(ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, true, true, ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, true, ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, true, true, new SparseArray(), new SparseBooleanArray());
        g2.f fVar = new g2.f(17);
        C0011j c0011j = new C0011j(this, 0);
        i iVar2 = new i(fVar);
        this.f17300f0 = iVar2;
        f fVar2 = this.f17301g0;
        fVar2.getClass();
        if (!((f) iVar2.d.getAndSet(fVar2)).equals(fVar2) && (uVar = iVar2.f18969a) != null) {
            uVar.f1051m.n(11);
        }
        J a6 = AbstractC0013l.a(getApplicationContext(), c0011j, this.f17300f0, new C0009h());
        f17270q0 = a6;
        a6.D(new C0068b(2, 1));
        f17270q0.y(new g(this, 14));
        try {
            this.f17289T = c(Uri.parse(str));
            this.f17308m0 = str;
            if (this.f17313p.requestAudioFocus(this.f17285P, 3, 1) == 1) {
                f17270q0.E(true);
            }
            f17270q0.B(this.f17289T);
        } catch (Exception e) {
            e.printStackTrace();
        }
        ArrayList arrayList = iVar.f3493a;
        if (!arrayList.isEmpty()) {
            ArrayList arrayList2 = this.f17276F;
            arrayList2.clear();
            arrayList2.addAll(arrayList);
            p pVar = this.f17309n;
            if (pVar != null) {
                pVar.f2641f.clear();
                ArrayList arrayList3 = pVar.e;
                arrayList3.clear();
                arrayList3.addAll(arrayList2);
                pVar.d();
                this.f17294Y.e0(0);
                this.f17294Y.setVisibility(0);
                this.f17310n0.setVisibility(8);
            }
        }
    }

    @N5.i(sticky = true, threadMode = ThreadMode.MAIN)
    public void OnMusicPlayServiceUrlFailed(j jVar) {
        this.f17308m0 = "";
        AbstractC2363a.F(this, getString(R.string.txt_error_again));
        A();
    }

    public final void a(h hVar) {
        if (f17269p0) {
            ArrayList arrayList = this.f17278I;
            if (!arrayList.isEmpty()) {
                arrayList.add(this.f17298d0 + 1, hVar);
            }
        }
    }

    public final C2222s b() {
        y2.i iVar;
        MusicApp musicApp = (MusicApp) getApplication();
        d3.j jVar = new d3.j(musicApp, new C0847h1(musicApp.f17257k));
        synchronized (musicApp) {
            try {
                if (musicApp.f17254b == null) {
                    if (musicApp.e == null) {
                        File externalFilesDir = musicApp.getExternalFilesDir(null);
                        musicApp.e = externalFilesDir;
                        if (externalFilesDir == null) {
                            musicApp.e = musicApp.getFilesDir();
                        }
                    }
                    musicApp.f17254b = new y2.i(new File(musicApp.e, "downloads"), new Object());
                }
                iVar = musicApp.f17254b;
            } catch (Throwable th) {
                throw th;
            }
        }
        return new C2222s(iVar, jVar, new m1.l(), 9);
    }

    public final AbstractC1726a c(Uri uri) {
        int q6;
        int i5 = q.f19694a;
        if (TextUtils.isEmpty(null)) {
            String path = uri.getPath();
            if (path == null) {
                q6 = 3;
            } else {
                q6 = q.q(path);
            }
        } else {
            q6 = q.q(".null");
        }
        if (q6 == 0) {
            DashMediaSource$Factory dashMediaSource$Factory = new DashMediaSource$Factory(this.f17321x);
            if (dashMediaSource$Factory.d == null) {
                dashMediaSource$Factory.d = new C1812d();
            }
            uri.getClass();
            return new g2.g(uri, dashMediaSource$Factory.f5913b, dashMediaSource$Factory.d, dashMediaSource$Factory.f5912a, dashMediaSource$Factory.e, dashMediaSource$Factory.f5914c, dashMediaSource$Factory.f5915f, dashMediaSource$Factory.f5916g);
        }
        if (q6 == 1) {
            SsMediaSource$Factory ssMediaSource$Factory = new SsMediaSource$Factory(this.f17321x);
            if (ssMediaSource$Factory.f5925c == null) {
                ssMediaSource$Factory.f5925c = new m(25);
            }
            uri.getClass();
            return new C1955c(uri, ssMediaSource$Factory.f5924b, ssMediaSource$Factory.f5925c, ssMediaSource$Factory.f5923a, ssMediaSource$Factory.d, ssMediaSource$Factory.e, ssMediaSource$Factory.f5926f, ssMediaSource$Factory.f5927g);
        }
        if (q6 == 2) {
            HlsMediaSource$Factory hlsMediaSource$Factory = new HlsMediaSource$Factory(this.f17321x);
            C1846b c1846b = hlsMediaSource$Factory.f5918b;
            M1.e eVar = hlsMediaSource$Factory.f5920f;
            C1797c c1797c = hlsMediaSource$Factory.f5919c;
            hlsMediaSource$Factory.d.getClass();
            C1797c c1797c2 = hlsMediaSource$Factory.f5921g;
            g2.i iVar = hlsMediaSource$Factory.f5917a;
            return new C1853i(uri, iVar, c1846b, hlsMediaSource$Factory.e, eVar, c1797c2, new j2.c(iVar, c1797c2, c1797c), hlsMediaSource$Factory.f5922h);
        }
        if (q6 == 3) {
            return new C1733h(uri, this.f17321x, new Object(), new C1797c(19));
        }
        throw new IllegalStateException(AbstractC1761a.e(q6, "Unsupported type: "));
    }

    public final void d(boolean z6) {
        String string;
        String string2;
        String str;
        String str2;
        Intent intent = new Intent("com.eskaylation.downloadmusic.action.next");
        Intent intent2 = new Intent("com.eskaylation.downloadmusic.action.prive");
        Intent intent3 = new Intent("com.eskaylation.downloadmusic.action.stop_music");
        PendingIntent broadcast = PendingIntent.getBroadcast(this, 0, new Intent("com.eskaylation.downloadmusic.action.playpause"), 67108864);
        PendingIntent broadcast2 = PendingIntent.getBroadcast(this, 0, intent, 67108864);
        PendingIntent broadcast3 = PendingIntent.getBroadcast(this, 0, intent2, 67108864);
        PendingIntent broadcast4 = PendingIntent.getBroadcast(this, 0, intent3, 67108864);
        Intent intent4 = new Intent(getApplicationContext(), (Class<?>) PlayerActivity.class);
        intent4.setAction("ACTION_MAIN_OPEN");
        intent4.putExtra("notify", "OPEN_FROM_NOTIFICATION");
        intent4.setFlags(603979776);
        PendingIntent activity = PendingIntent.getActivity(this, 0, intent4, 67108864);
        if (this.f17307m) {
            X4.c cVar = this.f17282M;
            if (cVar != null) {
                str2 = cVar.f4277k;
            } else {
                str2 = getString(R.string.txt_songs);
            }
            str = getString(R.string.unknow);
        } else {
            ArrayList arrayList = this.f17278I;
            if (!arrayList.isEmpty()) {
                string = ((h) arrayList.get(this.f17298d0)).f4302q;
            } else {
                string = getString(R.string.txt_songs);
            }
            if (!arrayList.isEmpty()) {
                string2 = ((h) arrayList.get(this.f17298d0)).f4294f;
            } else {
                string2 = getString(R.string.tit_artist);
            }
            String str3 = string;
            str = string2;
            str2 = str3;
        }
        if (z6) {
            r rVar = new r(getApplicationContext(), "com.eskaylation.downloadmusic");
            this.f17281L = rVar;
            rVar.f35r.icon = R.drawable.ic_notisong;
            rVar.f27j = false;
            rVar.f32o = 1;
            rVar.e = r.c(str2);
            rVar.f23f = r.c(str);
            rVar.d(2, true);
            rVar.f29l = r.c(getString(R.string.txt_now_playing));
            rVar.f26i = -1;
            rVar.f24g = activity;
            rVar.a(R.drawable.noti_prive, "Prive", broadcast3);
            rVar.a(R.drawable.noti_pause, "Pause", broadcast);
            rVar.a(R.drawable.noti_next, ES6Iterator.NEXT_METHOD, broadcast2);
            rVar.a(R.drawable.noti_close, HTTP.CONN_CLOSE, broadcast4);
            C0266a c0266a = new C0266a();
            c0266a.f5469f = new int[]{0, 1, 2};
            c0266a.f5470j = ((android.support.v4.media.session.i) this.f17284O.f4650b).f4645b;
            rVar.f(c0266a);
            return;
        }
        r rVar2 = new r(getApplicationContext(), "com.eskaylation.downloadmusic");
        this.f17281L = rVar2;
        rVar2.f35r.icon = R.drawable.ic_notisong;
        rVar2.f27j = false;
        rVar2.d(2, false);
        rVar2.f32o = 1;
        rVar2.e = r.c(str2);
        rVar2.f23f = r.c(str);
        rVar2.f29l = r.c(getString(R.string.txt_now_playing));
        rVar2.f26i = -1;
        rVar2.f24g = activity;
        rVar2.a(R.drawable.noti_prive, "Prive", broadcast3);
        rVar2.a(R.drawable.noti_play, "Pause", broadcast);
        rVar2.a(R.drawable.noti_next, ES6Iterator.NEXT_METHOD, broadcast2);
        rVar2.a(R.drawable.noti_close, HTTP.CONN_CLOSE, broadcast4);
        C0266a c0266a2 = new C0266a();
        c0266a2.f5469f = new int[]{0, 1, 2};
        c0266a2.f5470j = ((android.support.v4.media.session.i) this.f17284O.f4650b).f4645b;
        rVar2.f(c0266a2);
    }

    public final void e() {
        if (this.f17292W.D("com.eskaylation.downloadmusic.PREF_ENABLE_BASSBOSSTER")) {
            BassBoost bassBoost = this.f17314q;
            if (bassBoost != null) {
                bassBoost.release();
                this.f17314q = null;
            }
            try {
                BassBoost bassBoost2 = new BassBoost(1, f17270q0.f907A);
                this.f17314q = bassBoost2;
                bassBoost2.setEnabled(true);
                this.f17314q.setStrength((short) ((SharedPreferences) this.f17292W.e).getInt("com.eskaylation.downloadmusic.BBSLIDER", 0));
            } catch (Exception unused) {
            }
        } else {
            BassBoost bassBoost3 = this.f17314q;
            if (bassBoost3 != null) {
                bassBoost3.release();
            }
        }
    }

    public final void f(int i5) {
        if (this.f17292W.D("com.eskaylation.downloadmusic.PREF_ENABLE_EQUALIZER")) {
            Equalizer equalizer = this.f17323z;
            if (equalizer != null) {
                equalizer.release();
                this.f17323z = null;
            }
            try {
                Equalizer equalizer2 = new Equalizer(1, f17270q0.f907A);
                this.f17323z = equalizer2;
                equalizer2.setProperties(new Equalizer.Settings("Equalizer;curPreset=-1;numBands=5;band1Level=0;band2Level=0;band3Level=0;band4Level=0;band5Level=0;"));
                w(i5);
                this.f17323z.setEnabled(true);
            } catch (Exception unused) {
            }
        } else {
            Equalizer equalizer3 = this.f17323z;
            if (equalizer3 != null) {
                equalizer3.release();
            }
        }
    }

    public final void g() {
        if (this.f17292W.D("com.eskaylation.downloadmusic.PREF_ENABLE_BASSBOSSTER")) {
            Virtualizer virtualizer = this.f17312o0;
            if (virtualizer != null) {
                virtualizer.release();
                this.f17312o0 = null;
            }
            try {
                Virtualizer virtualizer2 = new Virtualizer(1, f17270q0.f907A);
                this.f17312o0 = virtualizer2;
                virtualizer2.setEnabled(true);
                this.f17312o0.setStrength((short) ((SharedPreferences) this.f17292W.e).getInt("com.eskaylation.downloadmusic.VIRSLIDER", 0));
            } catch (Exception unused) {
            }
        } else {
            Virtualizer virtualizer3 = this.f17312o0;
            if (virtualizer3 != null) {
                virtualizer3.release();
                this.f17312o0 = null;
            }
        }
    }

    public final h h() {
        ArrayList arrayList = this.f17278I;
        if (!arrayList.isEmpty()) {
            return (h) arrayList.get(this.f17298d0);
        }
        return null;
    }

    public final h i() {
        if (!this.f17307m) {
            ArrayList arrayList = this.f17278I;
            if (!arrayList.isEmpty() && this.f17298d0 <= arrayList.size() - 1) {
                return (h) arrayList.get(this.f17298d0);
            }
            return null;
        }
        return null;
    }

    public final void j() {
        y yVar = this.f17311o;
        if (yVar != null && !this.f17307m) {
            if (f17269p0) {
                yVar.d = i();
                yVar.d();
                this.f17295Z.e0(this.f17298d0);
            } else {
                yVar.d = new h();
                yVar.d();
            }
        }
    }

    public final void k() {
        PlayerView playerView;
        String string;
        int i5;
        String str;
        J j5;
        boolean z6;
        boolean z7;
        String str2;
        if (f17270q0 != null && (playerView = this.f17287R) != null) {
            boolean z8 = this.f17307m;
            ArrayList arrayList = this.f17278I;
            if (z8) {
                string = this.f17282M.f4277k;
            } else if (arrayList.size() > 0) {
                string = ((h) arrayList.get(this.f17298d0)).f4302q;
            } else {
                string = getString(R.string.txt_song);
            }
            playerView.setTitle(string);
            PlayerView playerView2 = this.f17287R;
            if (this.f17307m) {
                i5 = R.string.txt_songs;
            } else {
                if (arrayList.size() > 0) {
                    str = ((h) arrayList.get(this.f17298d0)).f4294f;
                    playerView2.setArtist(str);
                    PlayerView playerView3 = this.f17287R;
                    j5 = f17270q0;
                    if (j5 == null && j5.m()) {
                        z6 = true;
                    } else {
                        z6 = false;
                    }
                    playerView3.setStatePlayer(z6);
                    PlayerView playerView4 = this.f17287R;
                    Context applicationContext = getApplicationContext();
                    z7 = this.f17307m;
                    if (!z7) {
                        str2 = "x";
                    } else {
                        ArrayList arrayList2 = this.f17278I;
                        if (!arrayList2.isEmpty()) {
                            str2 = String.valueOf(((h) arrayList2.get(this.f17298d0)).e);
                        } else {
                            str2 = "0";
                        }
                    }
                    playerView4.a(applicationContext, str2, z7);
                    if (!f17269p0) {
                        this.f17287R.setVisibility(0);
                        return;
                    } else {
                        this.f17287R.setVisibility(8);
                        return;
                    }
                }
                i5 = R.string.txt_artist;
            }
            str = getString(i5);
            playerView2.setArtist(str);
            PlayerView playerView32 = this.f17287R;
            j5 = f17270q0;
            if (j5 == null) {
            }
            z6 = false;
            playerView32.setStatePlayer(z6);
            PlayerView playerView42 = this.f17287R;
            Context applicationContext2 = getApplicationContext();
            z7 = this.f17307m;
            if (!z7) {
            }
            playerView42.a(applicationContext2, str2, z7);
            if (!f17269p0) {
            }
        }
    }

    public final void l() {
        View view;
        p pVar = this.f17309n;
        if (pVar != null) {
            if (f17269p0) {
                if (this.f17307m) {
                    ArrayList arrayList = this.f17276F;
                    pVar.f2641f.clear();
                    ArrayList arrayList2 = pVar.e;
                    arrayList2.clear();
                    arrayList2.addAll(arrayList);
                    pVar.d();
                    boolean isEmpty = arrayList.isEmpty();
                    int i5 = 8;
                    if (isEmpty) {
                        view = this.f17310n0;
                    } else {
                        this.f17310n0.setVisibility(8);
                        view = this.f17294Y;
                        i5 = 0;
                    }
                    view.setVisibility(i5);
                } else {
                    ArrayList arrayList3 = this.f17278I;
                    pVar.e.clear();
                    ArrayList arrayList4 = pVar.f2641f;
                    arrayList4.clear();
                    arrayList4.addAll(arrayList3);
                    pVar.d();
                    p pVar2 = this.f17309n;
                    pVar2.d = i();
                    pVar2.d();
                }
                this.f17294Y.e0(this.f17298d0);
                return;
            }
            pVar.d = new h();
            pVar.d();
        }
    }

    public final void m() {
        String string;
        int i5;
        String str;
        J j5;
        ImageButton imageButton;
        int i6;
        J j6;
        ImageView imageView;
        int i7;
        AVLoadingIndicatorView aVLoadingIndicatorView;
        AppCompatSeekBar appCompatSeekBar;
        int parseInt;
        TextView textView = this.f17304j0;
        if (textView != null) {
            boolean z6 = this.f17307m;
            ArrayList arrayList = this.f17278I;
            if (z6) {
                string = this.f17282M.f4277k;
            } else if (arrayList.size() > 0) {
                string = ((h) arrayList.get(this.f17298d0)).f4302q;
            } else {
                string = getString(R.string.txt_song);
            }
            textView.setText(string);
            TextView textView2 = this.f17302h0;
            if (this.f17307m) {
                i5 = R.string.txt_songs;
            } else {
                if (arrayList.size() > 0) {
                    str = ((h) arrayList.get(this.f17298d0)).f4294f;
                    textView2.setText(str);
                    this.f17304j0.setSelected(true);
                    j5 = f17270q0;
                    int i8 = 0;
                    if (j5 == null) {
                        if (j5.n() == 2) {
                            aVLoadingIndicatorView = this.f17319v;
                        } else {
                            aVLoadingIndicatorView = this.f17319v;
                            i8 = 4;
                        }
                        aVLoadingIndicatorView.setVisibility(i8);
                        TextView textView3 = this.f17303i0;
                        long A6 = f17270q0.A();
                        long j7 = 0;
                        long j8 = this.f17283N;
                        RunnableC0234c runnableC0234c = this.f17286Q;
                        String str2 = "00:00";
                        if (A6 > 0) {
                            j7 = f17270q0.A();
                        } else if (!this.f17307m) {
                            j7 = Long.parseLong(h().f4296k);
                        } else {
                            textView3.setText("00:00");
                            TextView textView4 = this.f17305k0;
                            if (f17270q0.i() > 0) {
                                str2 = AbstractC1888a.b(f17270q0.i());
                            }
                            textView4.setText(str2);
                            if (!this.f17307m || f17270q0.A() >= 0) {
                                appCompatSeekBar = this.f17297b0;
                                parseInt = (int) f17270q0.A();
                            } else {
                                appCompatSeekBar = this.f17297b0;
                                parseInt = Integer.parseInt(h().f4296k);
                            }
                            appCompatSeekBar.setMax(parseInt);
                            this.f17297b0.setProgress((int) f17270q0.i());
                            this.f17297b0.postDelayed(runnableC0234c, j8);
                            runnableC0234c.run();
                        }
                        textView3.setText(AbstractC1888a.b(j7));
                        TextView textView5 = this.f17305k0;
                        f17270q0.i();
                        textView5.setText(str2);
                        this.f17297b0.setProgress((int) f17270q0.i());
                        this.f17297b0.postDelayed(runnableC0234c, j8);
                        runnableC0234c.run();
                    } else {
                        this.f17319v.setVisibility(0);
                        this.f17317t.setVisibility(8);
                    }
                    if (!this.f17277H.contains(h())) {
                        imageButton = this.f17318u;
                        i6 = R.drawable.favorite_on;
                    } else {
                        imageButton = this.f17318u;
                        i6 = R.drawable.favorite_off;
                    }
                    imageButton.setImageResource(i6);
                    j6 = f17270q0;
                    if (j6 == null && j6.m()) {
                        imageView = this.f17317t;
                        i7 = R.drawable.ic_pause;
                    } else {
                        imageView = this.f17317t;
                        i7 = R.drawable.ic_play;
                    }
                    imageView.setImageResource(i7);
                    this.f17277H = this.c0.e();
                }
                i5 = R.string.txt_artist;
            }
            str = getString(i5);
            textView2.setText(str);
            this.f17304j0.setSelected(true);
            j5 = f17270q0;
            int i82 = 0;
            if (j5 == null) {
            }
            if (!this.f17277H.contains(h())) {
            }
            imageButton.setImageResource(i6);
            j6 = f17270q0;
            if (j6 == null) {
            }
            imageView = this.f17317t;
            i7 = R.drawable.ic_play;
            imageView.setImageResource(i7);
            this.f17277H = this.c0.e();
        }
    }

    public final void n() {
        this.f17308m0 = "";
        int i5 = 0;
        this.f17322y = false;
        if (!this.f17307m) {
            ArrayList arrayList = this.f17278I;
            if (!arrayList.isEmpty()) {
                z();
                d.b().h(new T4.b(true));
                if (this.f17292W.D("com.eskaylation.downloadmusic.SHUFFLE_MUSIC")) {
                    if (arrayList.size() > 0) {
                        i5 = new Random().nextInt(arrayList.size());
                        this.f17298d0 = i5;
                    }
                    u();
                    return;
                }
                if (this.f17292W.F() != 1) {
                    if (this.f17292W.F() == 999) {
                        if (this.f17298d0 != arrayList.size() - 1) {
                            i5 = this.f17298d0 + 1;
                        }
                    } else if (this.f17298d0 < arrayList.size() - 1) {
                        i5 = this.f17298d0 + 1;
                    } else {
                        PlayerView playerView = this.f17287R;
                        if (playerView != null) {
                            playerView.setStatePlayer(false);
                            this.f17287R.setVisibility(8);
                        }
                        PlayerView playerView2 = this.f17296a0;
                        if (playerView2 != null) {
                            playerView2.setStatePlayer(false);
                            this.f17296a0.setVisibility(8);
                        }
                        if (this.f17305k0 != null) {
                            this.f17297b0.setProgress(0);
                            this.f17297b0.setSecondaryProgress(0);
                            this.f17305k0.setText("00:00");
                            this.f17317t.setImageResource(R.drawable.ic_play);
                        }
                        C();
                        d(false);
                        Intent intent = new Intent(this, (Class<?>) MusicPlayerService.class);
                        intent.setAction("com.eskaylation.downloadmusic.action.stop_music");
                        startService(intent);
                        return;
                    }
                    this.f17298d0 = i5;
                }
                u();
                return;
            }
            return;
        }
        ArrayList arrayList2 = this.f17276F;
        if (!arrayList2.isEmpty()) {
            if (this.f17292W.F() == 1) {
                J j5 = f17270q0;
                if (j5 != null) {
                    j5.C(0L, j5.l());
                    return;
                }
                return;
            }
            if (!this.f17291V) {
                if (this.f17282M != null) {
                    ArrayList arrayList3 = this.G;
                    if (!arrayList3.isEmpty() && !((X4.c) X.s(1, arrayList3)).f4278l.equals(this.f17282M.f4278l)) {
                        arrayList3.add(this.f17282M);
                    }
                }
                this.f17282M = (X4.c) arrayList2.get(0);
                LinearLayout linearLayout = this.f17310n0;
                if (linearLayout != null) {
                    linearLayout.setVisibility(0);
                    this.f17294Y.setVisibility(8);
                }
                m();
                this.f17319v.setVisibility(0);
                this.f17317t.setVisibility(8);
                this.f17273C.h(this.f17282M);
                this.f17291V = true;
                return;
            }
            AbstractC2363a.F(this, getString(R.string.waiting_txt));
        }
    }

    public final void o() {
        AppCompatSeekBar appCompatSeekBar;
        int parseInt;
        J j5 = f17270q0;
        if (j5 != null) {
            if (j5.m()) {
                ImageView imageView = this.f17317t;
                if (imageView != null) {
                    imageView.setImageResource(R.drawable.ic_play);
                }
                PlayerView playerView = this.f17296a0;
                if (playerView != null) {
                    playerView.setStatePlayer(false);
                }
                PlayerView playerView2 = this.f17287R;
                if (playerView2 != null) {
                    playerView2.setStatePlayer(false);
                }
                D(2);
                f17270q0.E(false);
                SharedPreferences.Editor edit = ((SharedPreferences) this.f17292W.e).edit();
                edit.putBoolean("PREF_SHOWADS_INTRO", true);
                edit.apply();
            } else if (this.f17313p.requestAudioFocus(this.f17285P, 3, 1) == 1) {
                f17270q0.E(true);
                SharedPreferences.Editor edit2 = ((SharedPreferences) this.f17292W.e).edit();
                edit2.putBoolean("PREF_SHOWADS_INTRO", false);
                edit2.apply();
                D(3);
                ImageView imageView2 = this.f17317t;
                if (imageView2 != null) {
                    imageView2.setImageResource(R.drawable.ic_pause);
                }
                PlayerView playerView3 = this.f17296a0;
                if (playerView3 != null) {
                    playerView3.setStatePlayer(true);
                }
                PlayerView playerView4 = this.f17287R;
                if (playerView4 != null) {
                    playerView4.setStatePlayer(true);
                }
                if (this.f17297b0 != null) {
                    RunnableC0234c runnableC0234c = this.f17286Q;
                    runnableC0234c.run();
                    if (this.f17307m || f17270q0.A() >= 0) {
                        appCompatSeekBar = this.f17297b0;
                        parseInt = (int) f17270q0.A();
                    } else {
                        appCompatSeekBar = this.f17297b0;
                        parseInt = Integer.parseInt(h().f4296k);
                    }
                    appCompatSeekBar.setMax(parseInt);
                    this.f17297b0.postDelayed(runnableC0234c, this.f17283N);
                }
            }
            x();
            return;
        }
        AbstractC2363a.F(this, getString(R.string.waiting_txt));
        AbstractC2119b.a("Exo null", new Object[0]);
    }

    @Override
    public final void onAudioFocusChange(int i5) {
    }

    @Override
    public final IBinder onBind(Intent intent) {
        return this.f17280K;
    }

    @Override
    public final void onCreate() {
        super.onCreate();
        this.f17271A = new m(new a(this, 1));
        this.f17292W = l.E(this);
        d.b().j(this);
        Context applicationContext = getApplicationContext();
        e eVar = new e(8);
        new CompositeDisposable();
        eVar.e = applicationContext;
        eVar.f17544f = this;
        this.f17273C = eVar;
        this.f17313p = (AudioManager) getApplicationContext().getSystemService("audio");
        ComponentName componentName = new ComponentName(getPackageName(), MediaControlButtonReceiver.class.getName());
        this.f17288S = componentName;
        this.f17313p.registerMediaButtonEventReceiver(componentName);
        m mVar = new m(getApplicationContext(), 0);
        this.f17284O = mVar;
        Bundle bundle = new Bundle();
        C2156b c2156b = MediaMetadataCompat.f4597f;
        if (c2156b.containsKey("android.media.metadata.DURATION") && ((Integer) c2156b.getOrDefault("android.media.metadata.DURATION", null)).intValue() != 0) {
            throw new IllegalArgumentException("The android.media.metadata.DURATION key cannot be used to put a long");
        }
        bundle.putLong("android.media.metadata.DURATION", -1L);
        MediaMetadataCompat mediaMetadataCompat = new MediaMetadataCompat(bundle);
        android.support.v4.media.session.i iVar = (android.support.v4.media.session.i) mVar.f4650b;
        iVar.getClass();
        if (mediaMetadataCompat.e == null) {
            Parcel obtain = Parcel.obtain();
            mediaMetadataCompat.writeToParcel(obtain, 0);
            obtain.setDataPosition(0);
            mediaMetadataCompat.e = (MediaMetadata) MediaMetadata.CREATOR.createFromParcel(obtain);
            obtain.recycle();
        }
        iVar.f4644a.setMetadata(mediaMetadataCompat.e);
        MediaSessionCompat$Token mediaSessionCompat$Token = ((android.support.v4.media.session.i) this.f17284O.f4650b).f4645b;
        if (mediaSessionCompat$Token != null) {
            if (this.f4527l == null) {
                this.f4527l = mediaSessionCompat$Token;
                C0042n c0042n = this.f4523b;
                ((AbstractServiceC0218i) c0042n.f1239k).f4526k.a(new Ix(c0042n, mediaSessionCompat$Token, 26, false));
                this.f17316s = new BroadcastControl();
                IntentFilter intentFilter = new IntentFilter();
                intentFilter.addAction("com.eskaylation.downloadmusic.action.next");
                intentFilter.addAction("com.eskaylation.downloadmusic.action.prive");
                intentFilter.addAction("com.eskaylation.downloadmusic.action.playpause");
                intentFilter.addAction("com.eskaylation.downloadmusic.ACTION.STARTSERVICE");
                intentFilter.addAction("com.eskaylation.downloadmusic.action.stop_music");
                int i5 = Build.VERSION.SDK_INT;
                BroadcastControl broadcastControl = this.f17316s;
                if (i5 >= 33) {
                    registerReceiver(broadcastControl, intentFilter, 4);
                } else {
                    registerReceiver(broadcastControl, intentFilter);
                }
                this.f17279J = this.f17271A.I();
                I0.c cVar = this.f17275E;
                if (cVar != null) {
                    if (i5 >= 33) {
                        registerReceiver(cVar, new IntentFilter("android.intent.action.HEADSET_PLUG"), 4);
                    } else {
                        registerReceiver(cVar, new IntentFilter("android.intent.action.HEADSET_PLUG"));
                    }
                }
                C0398Kc c0398Kc = new C0398Kc(new U4.b(getApplicationContext(), "DEFAULT_FAVORITEDOWNLOAD"));
                this.c0 = c0398Kc;
                this.f17277H = c0398Kc.e();
                return;
            }
            throw new IllegalStateException("The session token has already been set");
        }
        throw new IllegalArgumentException("Session token may not be null");
    }

    @N5.i(sticky = true, threadMode = ThreadMode.MAIN)
    public void onDeleteSong(k kVar) {
        ArrayList arrayList = this.f17278I;
        if (!arrayList.isEmpty()) {
            h hVar = (h) arrayList.get(this.f17298d0);
            h hVar2 = kVar.f3495a;
            for (int i5 = 0; i5 < arrayList.size(); i5++) {
                if (((h) arrayList.get(i5)).f4301p.equals(hVar2.f4301p)) {
                    arrayList.remove(i5);
                    this.f17298d0 = arrayList.indexOf(hVar);
                }
            }
        }
    }

    @Override
    public final void onDestroy() {
        d.b().l(this);
        f17269p0 = false;
        unregisterReceiver(this.f17316s);
        unregisterReceiver(this.f17275E);
        super.onDestroy();
    }

    @Override
    public final int onStartCommand(Intent intent, int i5, int i6) {
        char c7;
        int i7;
        AudioEffect audioEffect;
        Virtualizer virtualizer;
        l lVar;
        J j5;
        Equalizer equalizer;
        Equalizer equalizer2;
        Equalizer equalizer3;
        Equalizer equalizer4;
        Equalizer equalizer5;
        int i8;
        if (intent == null || intent.getAction() == null) {
            return 2;
        }
        int intExtra = intent.getIntExtra("com.eskaylation.downloadmusic.STRENGTH_BASSBOOSTER", 0);
        int intExtra2 = intent.getIntExtra("com.eskaylation.downloadmusic.STRENGTH_VTUARLIZER", 0);
        int intExtra3 = intent.getIntExtra("com.eskaylation.downloadmusic.STRENGTH_EQUALIZER", 0);
        boolean booleanExtra = intent.getBooleanExtra("com.eskaylation.downloadmusic.PREF_ENABLE_EQUALIZER", false);
        boolean booleanExtra2 = intent.getBooleanExtra("com.eskaylation.downloadmusic.PREF_ENABLE_BASSBOSSTER", false);
        boolean booleanExtra3 = intent.getBooleanExtra("com.eskaylation.downloadmusic.PREF_ENABLE_VITUARLIZER", false);
        String action = intent.getAction();
        int hashCode = action.hashCode();
        if (MainActivityX.f17236I % 3 == 0) {
            C0225d c0225d = MainActivityX.f17237J;
            N2.a aVar = (N2.a) c0225d.e;
            if (aVar != null) {
                aVar.b((Activity) c0225d.f4540f);
            } else {
                System.out.println("interstitialAd = null");
            }
        }
        int i9 = MainActivityX.f17236I + 1;
        MainActivityX.f17236I = i9;
        Log.i("btnclick", String.valueOf(i9));
        switch (hashCode) {
            case -1781377049:
                if (action.equals("com.eskaylation.downloadmusic.PREF_ENABLE_BASSBOSSTER")) {
                    c7 = '\b';
                    break;
                }
            case -1633022058:
                if (action.equals("com.eskaylation.downloadmusic.ACTION.SETDATAONLINEPLAYER")) {
                    c7 = 1;
                    break;
                }
            case -1183531785:
                if (action.equals("com.eskaylation.downloadmusic.action.next_nolimited")) {
                    c7 = 19;
                    break;
                }
            case -1151144769:
                if (action.equals("set_timmer")) {
                    c7 = 18;
                    break;
                }
            case -610370046:
                if (action.equals("com.eskaylation.downloadmusic.ACTION.SETDATAOFFLINEPLAYER")) {
                    c7 = 0;
                    break;
                }
            case -399999368:
                if (action.equals("com.eskaylation.downloadmusic.action.playpause")) {
                    c7 = 4;
                    break;
                }
            case -376054275:
                if (action.equals("com.eskaylation.downloadmusic.action.next")) {
                    c7 = 2;
                    break;
                }
            case 87061860:
                if (action.equals("com.eskaylation.downloadmusic.PREF_ENABLE_EQUALIZER")) {
                    c7 = 7;
                    break;
                }
            case 231986583:
                if (action.equals("com.eskaylation.downloadmusic.PREF_ENABLE_VITUARLIZER")) {
                    c7 = '\t';
                    break;
                }
            case 299798425:
                if (action.equals("com.eskaylation.downloadmusic.ACTION.CHANGEPRESET")) {
                    c7 = 6;
                    break;
                }
            case 1229439436:
                if (action.equals("com.eskaylation.downloadmusic.action.prive")) {
                    c7 = 3;
                    break;
                }
            case 1371943730:
                if (action.equals("com.eskaylation.downloadmusic.action.stop_music")) {
                    c7 = 5;
                    break;
                }
            case 1554179155:
                if (action.equals("com.eskaylation.downloadmusic.ACTION.STRENGTH_BASS")) {
                    c7 = '\n';
                    break;
                }
            case 1778017137:
                if (action.equals("com.eskaylation.downloadmusic.ACTION.STRENGTH_VITUARLIZER")) {
                    c7 = 11;
                    break;
                }
            case 2063435946:
                if (action.equals("com.eskaylation.downloadmusic.reverb_profile")) {
                    c7 = 17;
                    break;
                }
            default:
                switch (hashCode) {
                    case 620133418:
                        action.equals("com.eskaylation.downloadmusic.ACTION.SLIDER5");
                        break;
                }
                c7 = 65535;
                break;
        }
        ArrayList arrayList = this.f17276F;
        ArrayList arrayList2 = this.G;
        try {
            switch (c7) {
                case 0:
                    arrayList.clear();
                    this.f17322y = false;
                    this.f17307m = false;
                    u();
                    y();
                    q();
                    return 2;
                case 1:
                    if (this.f17291V) {
                        AbstractC2363a.F(this, getString(R.string.waiting_txt));
                        return 2;
                    }
                    z();
                    this.f17322y = false;
                    X4.c cVar = (X4.c) intent.getParcelableExtra("com.eskaylation.downloadmusic.ACTION.SETDATAONLINEPLAYER");
                    this.f17282M = cVar;
                    arrayList2.add(cVar);
                    this.f17307m = true;
                    this.f17278I.clear();
                    LinearLayout linearLayout = this.f17310n0;
                    if (linearLayout != null) {
                        linearLayout.setVisibility(0);
                        this.f17294Y.setVisibility(8);
                    }
                    this.f17273C.h(this.f17282M);
                    this.f17291V = true;
                    m();
                    y();
                    q();
                    return 2;
                case 2:
                    if (!f17269p0) {
                        return 2;
                    }
                    n();
                    return 2;
                case 3:
                    if (!f17269p0) {
                        return 2;
                    }
                    p();
                    return 2;
                case 4:
                    if (!f17269p0) {
                        return 2;
                    }
                    o();
                    return 2;
                case 5:
                    A();
                    return 2;
                case 6:
                    this.f17279J = this.f17271A.I();
                    if (!this.f17292W.D("com.eskaylation.downloadmusic.PREF_ENABLE_EQUALIZER")) {
                        return 2;
                    }
                    if (this.f17323z == null) {
                        f(((SharedPreferences) this.f17292W.e).getInt("com.eskaylation.downloadmusic.SPINER_POSITION", 0));
                        return 2;
                    }
                    i7 = ((SharedPreferences) this.f17292W.e).getInt("com.eskaylation.downloadmusic.SPINER_POSITION", 0);
                    w(i7);
                    return 2;
                case 7:
                    if (!booleanExtra) {
                        audioEffect = this.f17323z;
                        if (audioEffect == null) {
                            return 2;
                        }
                        audioEffect.release();
                        return 2;
                    }
                    e();
                    g();
                    Equalizer equalizer6 = new Equalizer(1, f17270q0.f907A);
                    this.f17323z = equalizer6;
                    equalizer6.setProperties(new Equalizer.Settings("Equalizer;curPreset=-1;numBands=5;band1Level=0;band2Level=0;band3Level=0;band4Level=0;band5Level=0;"));
                    this.f17323z.setEnabled(true);
                    i7 = ((SharedPreferences) this.f17292W.e).getInt("com.eskaylation.downloadmusic.SPINER_POSITION", 0);
                    w(i7);
                    return 2;
                case '\b':
                    if (!booleanExtra2) {
                        BassBoost bassBoost = this.f17314q;
                        if (bassBoost != null) {
                            bassBoost.release();
                        }
                        audioEffect = this.f17312o0;
                        if (audioEffect == null) {
                            return 2;
                        }
                        audioEffect.release();
                        return 2;
                    }
                    BassBoost bassBoost2 = new BassBoost(1, f17270q0.f907A);
                    this.f17314q = bassBoost2;
                    bassBoost2.setEnabled(true);
                    this.f17314q.setStrength((short) ((SharedPreferences) this.f17292W.e).getInt("com.eskaylation.downloadmusic.BBSLIDER", 0));
                    Virtualizer virtualizer2 = new Virtualizer(1, f17270q0.f907A);
                    this.f17312o0 = virtualizer2;
                    virtualizer2.setEnabled(true);
                    virtualizer = this.f17312o0;
                    lVar = this.f17292W;
                    virtualizer.setStrength((short) ((SharedPreferences) lVar.e).getInt("com.eskaylation.downloadmusic.VIRSLIDER", 0));
                    return 2;
                case '\t':
                    if (!booleanExtra3) {
                        audioEffect = this.f17312o0;
                        if (audioEffect == null) {
                            return 2;
                        }
                        audioEffect.release();
                        return 2;
                    }
                    Virtualizer virtualizer3 = new Virtualizer(1, f17270q0.f907A);
                    this.f17312o0 = virtualizer3;
                    virtualizer3.setEnabled(true);
                    virtualizer = this.f17312o0;
                    lVar = this.f17292W;
                    virtualizer.setStrength((short) ((SharedPreferences) lVar.e).getInt("com.eskaylation.downloadmusic.VIRSLIDER", 0));
                    return 2;
                case '\n':
                    short s3 = (short) intExtra;
                    if (!this.f17292W.D("com.eskaylation.downloadmusic.PREF_ENABLE_BASSBOSSTER")) {
                        return 2;
                    }
                    BassBoost bassBoost3 = this.f17314q;
                    if (bassBoost3 != null) {
                        bassBoost3.setStrength(s3);
                        return 2;
                    }
                    BassBoost bassBoost4 = new BassBoost(1, f17270q0.f907A);
                    this.f17314q = bassBoost4;
                    bassBoost4.setEnabled(true);
                    this.f17314q.setStrength(s3);
                    return 2;
                case 11:
                    short s4 = (short) intExtra2;
                    if (!this.f17292W.D("com.eskaylation.downloadmusic.PREF_ENABLE_BASSBOSSTER") || (j5 = f17270q0) == null) {
                        return 2;
                    }
                    Virtualizer virtualizer4 = this.f17312o0;
                    if (virtualizer4 != null) {
                        virtualizer4.setStrength(s4);
                        return 2;
                    }
                    Virtualizer virtualizer5 = new Virtualizer(1, j5.f907A);
                    this.f17312o0 = virtualizer5;
                    virtualizer5.setEnabled(true);
                    this.f17312o0.setStrength(s4);
                    return 2;
                case '\f':
                    if (!this.f17292W.D("com.eskaylation.downloadmusic.PREF_ENABLE_EQUALIZER") || (equalizer = this.f17323z) == null) {
                        return 2;
                    }
                    equalizer.setBandLevel((short) 0, (short) intExtra3);
                    ((X4.e) X.s(1, this.f17279J)).f4283f = intExtra3;
                    return 2;
                case '\r':
                    if (!this.f17292W.D("com.eskaylation.downloadmusic.PREF_ENABLE_EQUALIZER") || (equalizer2 = this.f17323z) == null) {
                        return 2;
                    }
                    equalizer2.setBandLevel((short) 1, (short) intExtra3);
                    ((X4.e) X.s(1, this.f17279J)).f4284j = intExtra3;
                    return 2;
                case 14:
                    if (!this.f17292W.D("com.eskaylation.downloadmusic.PREF_ENABLE_EQUALIZER") || (equalizer3 = this.f17323z) == null) {
                        return 2;
                    }
                    equalizer3.setBandLevel((short) 2, (short) intExtra3);
                    ((X4.e) X.s(1, this.f17279J)).f4285k = intExtra3;
                    return 2;
                case 15:
                    if (!this.f17292W.D("com.eskaylation.downloadmusic.PREF_ENABLE_EQUALIZER") || (equalizer4 = this.f17323z) == null) {
                        return 2;
                    }
                    equalizer4.setBandLevel((short) 3, (short) intExtra3);
                    ((X4.e) X.s(1, this.f17279J)).f4286l = intExtra3;
                    return 2;
                case 16:
                    if (!this.f17292W.D("com.eskaylation.downloadmusic.PREF_ENABLE_EQUALIZER") || (equalizer5 = this.f17323z) == null) {
                        return 2;
                    }
                    equalizer5.setBandLevel((short) 4, (short) intExtra3);
                    ArrayList arrayList3 = this.f17279J;
                    ((X4.e) arrayList3.get(arrayList3.size() - 1)).f4287m = intExtra3;
                    return 2;
                case 17:
                    intent.getIntExtra("com.eskaylation.downloadmusic.reverb_profile", 0);
                    return 2;
                case 18:
                    long longExtra = intent.getLongExtra("set_timmer", 0L);
                    CountDownTimerC0235d countDownTimerC0235d = this.f17320w;
                    if (countDownTimerC0235d != null) {
                        countDownTimerC0235d.cancel();
                    }
                    TextView textView = this.f17306l0;
                    if (textView != null) {
                        textView.setText("");
                    }
                    CountDownTimerC0235d countDownTimerC0235d2 = new CountDownTimerC0235d(this, longExtra);
                    this.f17320w = countDownTimerC0235d2;
                    countDownTimerC0235d2.start();
                    return 2;
                case 19:
                    if (!this.f17291V) {
                        if (this.f17282M != null && !arrayList2.isEmpty() && !((X4.c) X.s(1, arrayList2)).f4278l.equals(this.f17282M.f4278l)) {
                            arrayList2.add(this.f17282M);
                        }
                        this.f17282M = (X4.c) arrayList.get(0);
                        LinearLayout linearLayout2 = this.f17310n0;
                        if (linearLayout2 != null) {
                            linearLayout2.setVisibility(0);
                            i8 = 8;
                            this.f17294Y.setVisibility(8);
                        } else {
                            i8 = 8;
                        }
                        m();
                        this.f17319v.setVisibility(0);
                        this.f17317t.setVisibility(i8);
                        this.f17273C.h(this.f17282M);
                        this.f17291V = true;
                        return 2;
                    }
                    AbstractC2363a.F(this, getString(R.string.waiting_txt));
                    return 2;
                default:
                    return 2;
            }
        } catch (Exception unused) {
            return 2;
        }
    }

    public final void p() {
        int i5;
        this.f17308m0 = "";
        d.b().h(new T4.b(true));
        if (!this.f17307m) {
            z();
            this.f17322y = false;
            boolean D5 = this.f17292W.D("com.eskaylation.downloadmusic.SHUFFLE_MUSIC");
            ArrayList arrayList = this.f17278I;
            if (D5) {
                if (arrayList.size() > 0) {
                    i5 = new Random().nextInt(arrayList.size());
                    this.f17298d0 = i5;
                }
                u();
                return;
            }
            if (this.f17292W.F() != 1) {
                if (this.f17292W.F() == 999) {
                    int i6 = this.f17298d0;
                    if (i6 == 0) {
                        i6 = arrayList.size();
                    }
                    i5 = i6 - 1;
                    this.f17298d0 = i5;
                } else if (!arrayList.isEmpty()) {
                    int i7 = this.f17298d0;
                    if (i7 != 0) {
                        this.f17298d0 = i7 - 1;
                        u();
                        return;
                    }
                    this.f17298d0 = 0;
                } else {
                    return;
                }
            }
            u();
            return;
        }
        if (this.f17292W.F() == 1) {
            J j5 = f17270q0;
            if (j5 != null) {
                j5.C(0L, j5.l());
                if (!f17270q0.m()) {
                    o();
                    return;
                }
                return;
            }
            return;
        }
        z();
        this.f17322y = false;
        ArrayList arrayList2 = this.G;
        if (!arrayList2.isEmpty()) {
            if (!this.f17291V) {
                if (arrayList2.size() != 1) {
                    this.f17282M = (X4.c) X.s(1, arrayList2);
                    arrayList2.remove(arrayList2.size() - 1);
                } else {
                    this.f17282M = (X4.c) X.s(1, arrayList2);
                    Toast.makeText(this, getString(R.string.txt_first_song), 0).show();
                }
                LinearLayout linearLayout = this.f17310n0;
                if (linearLayout != null) {
                    linearLayout.setVisibility(0);
                    this.f17294Y.setVisibility(8);
                }
                LinearLayout linearLayout2 = this.f17310n0;
                if (linearLayout2 != null) {
                    linearLayout2.setVisibility(0);
                    this.f17294Y.setVisibility(8);
                }
                m();
                this.f17319v.setVisibility(0);
                this.f17317t.setVisibility(8);
                this.f17273C.h(this.f17282M);
                this.f17291V = true;
                return;
            }
            AbstractC2363a.F(this, getString(R.string.waiting_txt));
        }
    }

    public final void q() {
        if (this.f17293X == null) {
            try {
                Intent intent = new Intent("android.intent.action.MEDIA_BUTTON");
                intent.setComponent(this.f17288S);
                RemoteControlClient remoteControlClient = new RemoteControlClient(PendingIntent.getBroadcast(getApplicationContext(), 0, intent, 67108864));
                this.f17293X = remoteControlClient;
                remoteControlClient.setTransportControlFlags(137);
                this.f17313p.registerRemoteControlClient(this.f17293X);
            } catch (Exception unused) {
            }
        }
    }

    public final void r() {
        String str;
        J j5 = f17270q0;
        if (j5 != null) {
            j5.G();
            com.bumptech.glide.manager.p pVar = j5.f924t;
            RunnableC0002a runnableC0002a = (RunnableC0002a) pVar.f5878j;
            Context context = (Context) pVar.f5877f;
            if (pVar.e) {
                context.unregisterReceiver(runnableC0002a);
                pVar.e = false;
            }
            j5.f925u.a(true);
            j5.f926v.getClass();
            I1.q qVar = j5.f914j;
            qVar.getClass();
            StringBuilder sb = new StringBuilder("Release ");
            sb.append(Integer.toHexString(System.identityHashCode(qVar)));
            sb.append(" [ExoPlayerLib/2.11.1] [");
            sb.append(q.e);
            sb.append("] [");
            HashSet hashSet = v.f1065a;
            synchronized (v.class) {
                str = v.f1066b;
            }
            sb.append(str);
            sb.append("]");
            Log.i("ExoPlayerImpl", sb.toString());
            u uVar = qVar.f1010l;
            synchronized (uVar) {
                if (!uVar.f1035C && uVar.f1052n.isAlive()) {
                    uVar.f1051m.n(7);
                    boolean z6 = false;
                    while (!uVar.f1035C) {
                        try {
                            uVar.wait();
                        } catch (InterruptedException unused) {
                            z6 = true;
                        }
                    }
                    if (z6) {
                        Thread.currentThread().interrupt();
                    }
                }
            }
            qVar.f1009k.removeCallbacksAndMessages(null);
            qVar.f1022x = qVar.y(false, false, false, 1);
            Surface surface = j5.f927w;
            if (surface != null) {
                if (j5.f928x) {
                    surface.release();
                }
                j5.f927w = null;
            }
            AbstractC1726a abstractC1726a = j5.f910D;
            if (abstractC1726a != null) {
                abstractC1726a.o(j5.f923s);
                j5.f910D = null;
            }
            InterfaceC2406c interfaceC2406c = j5.f922r;
            J1.c cVar = j5.f923s;
            CopyOnWriteArrayList copyOnWriteArrayList = (CopyOnWriteArrayList) ((x2.m) interfaceC2406c).f19427c.f17984b;
            Iterator it = copyOnWriteArrayList.iterator();
            while (it.hasNext()) {
                z2.e eVar = (z2.e) it.next();
                if (eVar.f19659b == cVar) {
                    eVar.f19660c = true;
                    copyOnWriteArrayList.remove(eVar);
                }
            }
            Collections.emptyList();
            j5.f912F = true;
            f17270q0 = null;
            this.f17289T = null;
            this.f17300f0 = null;
        }
        this.f17322y = false;
    }

    public final void s() {
        this.f17299e0 = R.drawable.ic_player_default;
        Bitmap decodeResource = BitmapFactory.decodeResource(getResources(), R.drawable.ic_songx);
        this.f17315r = decodeResource;
        if (this.f17272B != null) {
            if (this.f17307m) {
                AbstractC2098a.h(decodeResource);
                d.b().h(new Object());
                this.f17281L.e(this.f17315r);
                NotificationManager notificationManager = this.f17290U;
                if (notificationManager != null) {
                    notificationManager.notify(888888, this.f17281L.b());
                    return;
                }
                return;
            }
            if (h() != null) {
                com.bumptech.glide.n b7 = com.bumptech.glide.b.a(this).f5788k.b(this);
                b7.getClass();
                com.bumptech.glide.l a6 = new com.bumptech.glide.l(b7.f5884b, b7, Bitmap.class, b7.e).a(com.bumptech.glide.n.f5883q);
                Uri y6 = AbstractC2026e.y(h().e);
                com.bumptech.glide.l B6 = a6.B(y6);
                com.bumptech.glide.l lVar = B6;
                if (y6 != null) {
                    lVar = B6;
                    if ("android.resource".equals(y6.getScheme())) {
                        lVar = a6.w(B6);
                    }
                }
                lVar.z(new C0236e(this), lVar);
            }
        }
    }

    public final void t() {
        boolean z6;
        String string;
        String string2;
        String str;
        PlayerView playerView = this.f17296a0;
        if (playerView != null) {
            J j5 = f17270q0;
            if (j5 != null && j5.m()) {
                z6 = true;
            } else {
                z6 = false;
            }
            playerView.setStatePlayer(z6);
            PlayerView playerView2 = this.f17296a0;
            boolean z7 = this.f17307m;
            ArrayList arrayList = this.f17278I;
            if (z7) {
                string = this.f17282M.f4277k;
            } else if (!arrayList.isEmpty()) {
                string = ((h) arrayList.get(this.f17298d0)).f4302q;
            } else {
                string = getString(R.string.txt_title);
            }
            playerView2.setTitle(string);
            PlayerView playerView3 = this.f17296a0;
            if (this.f17307m) {
                string2 = AbstractC1888a.b(this.f17282M.e);
            } else if (!arrayList.isEmpty()) {
                string2 = ((h) arrayList.get(this.f17298d0)).f4294f;
            } else {
                string2 = getString(R.string.tit_artist);
            }
            playerView3.setArtist(string2);
            PlayerView playerView4 = this.f17296a0;
            Context applicationContext = getApplicationContext();
            boolean z8 = this.f17307m;
            if (z8) {
                str = "x";
            } else {
                ArrayList arrayList2 = this.f17278I;
                if (!arrayList2.isEmpty()) {
                    str = String.valueOf(((h) arrayList2.get(this.f17298d0)).e);
                } else {
                    str = "0";
                }
            }
            playerView4.a(applicationContext, str, z8);
            if (f17270q0 == null || !f17269p0) {
                this.f17296a0.setVisibility(8);
            } else {
                this.f17296a0.setVisibility(0);
            }
        }
    }

    public final void u() {
        u uVar;
        this.f17308m0 = "";
        if (h() != null) {
            String str = ((h) this.f17278I.get(this.f17298d0)).f4301p;
            z();
            this.f17321x = b();
            this.f17301g0 = new f(ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, true, true, ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, true, ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, ManifestCreatorCache.DEFAULT_MAXIMUM_SIZE, true, true, new SparseArray(), new SparseBooleanArray());
            g2.f fVar = new g2.f(17);
            C0011j c0011j = new C0011j(this, 0);
            i iVar = new i(fVar);
            this.f17300f0 = iVar;
            f fVar2 = this.f17301g0;
            fVar2.getClass();
            if (!((f) iVar.d.getAndSet(fVar2)).equals(fVar2) && (uVar = iVar.f18969a) != null) {
                uVar.f1051m.n(11);
            }
            J a6 = AbstractC0013l.a(getApplicationContext(), c0011j, this.f17300f0, new C0009h());
            f17270q0 = a6;
            a6.y(new g(this, 14));
            f17270q0.D(new C0068b(2, 1));
            try {
                if (new File(str).exists()) {
                    this.f17289T = c(Uri.parse(str));
                    if (this.f17313p.requestAudioFocus(this.f17285P, 3, 1) == 1) {
                        f17270q0.E(true);
                    }
                    f17270q0.B(this.f17289T);
                    return;
                }
                n();
                return;
            } catch (Exception e) {
                e.printStackTrace();
                return;
            }
        }
        n();
    }

    public final void v(int i5, ArrayList arrayList) {
        ArrayList arrayList2 = this.f17278I;
        arrayList2.clear();
        arrayList2.addAll(arrayList);
        this.f17298d0 = i5;
    }

    public final void w(int i5) {
        try {
            if (i5 < 10) {
                this.f17323z.usePreset((short) i5);
            } else {
                Equalizer equalizer = this.f17323z;
                if (equalizer != null) {
                    equalizer.release();
                }
                this.f17323z = new Equalizer(1, f17270q0.f907A);
                X4.e eVar = (X4.e) this.f17279J.get(i5);
                this.f17323z.setBandLevel((short) 0, (short) eVar.f4283f);
                this.f17323z.setBandLevel((short) 1, (short) eVar.f4284j);
                this.f17323z.setBandLevel((short) 2, (short) eVar.f4285k);
                this.f17323z.setBandLevel((short) 3, (short) eVar.f4286l);
                this.f17323z.setBandLevel((short) 4, (short) eVar.f4287m);
                this.f17323z.setEnabled(true);
            }
        } catch (Exception unused) {
        }
    }

    public final void x() {
        String string;
        String string2;
        String str;
        String str2;
        if (this.f17307m) {
            X4.c cVar = this.f17282M;
            if (cVar != null) {
                str2 = cVar.f4277k;
            } else {
                str2 = getString(R.string.txt_songs);
            }
            str = getString(R.string.unknow);
        } else {
            ArrayList arrayList = this.f17278I;
            if (!arrayList.isEmpty()) {
                string = ((h) arrayList.get(this.f17298d0)).f4302q;
            } else {
                string = getString(R.string.txt_songs);
            }
            if (!arrayList.isEmpty()) {
                string2 = ((h) arrayList.get(this.f17298d0)).f4294f;
            } else {
                string2 = getString(R.string.tit_artist);
            }
            String str3 = string;
            str = string2;
            str2 = str3;
        }
        r rVar = this.f17281L;
        rVar.getClass();
        rVar.e = r.c(str2);
        r rVar2 = this.f17281L;
        rVar2.getClass();
        rVar2.f23f = r.c(str);
        this.f17290U = (NotificationManager) getSystemService("notification");
        J j5 = f17270q0;
        if (j5 != null) {
            if (j5.m()) {
                if (this.f17290U != null) {
                    this.f17281L.d(2, true);
                    IconCompat a6 = ((A.l) this.f17281L.f21b.get(1)).a();
                    Objects.requireNonNull(a6);
                    a6.e = R.drawable.noti_pause;
                    startForeground(888888, this.f17281L.b());
                    return;
                }
                return;
            }
            if (this.f17290U != null) {
                this.f17281L.d(2, false);
                IconCompat a7 = ((A.l) this.f17281L.f21b.get(1)).a();
                Objects.requireNonNull(a7);
                a7.e = R.drawable.noti_play;
                stopForeground(false);
                this.f17290U.notify(888888, this.f17281L.b());
            }
        }
    }

    public final void y() {
        if (!f17269p0) {
            f17269p0 = true;
            this.f17290U = (NotificationManager) getSystemService("notification");
            int i5 = Build.VERSION.SDK_INT;
            if (i5 >= 26) {
                NotificationChannel d = N.d();
                d.enableVibration(false);
                d.enableLights(true);
                this.f17290U.createNotificationChannel(d);
            }
            d(true);
            if (i5 >= 33) {
                startForeground(888888, this.f17281L.b(), 2);
            } else {
                startForeground(888888, this.f17281L.b());
            }
        }
    }

    public final void z() {
        this.f17308m0 = "";
        r();
        PlayerView playerView = this.f17296a0;
        if (playerView != null) {
            playerView.setStatePlayer(false);
            this.f17296a0.setVisibility(8);
        }
        ImageView imageView = this.f17317t;
        if (imageView != null) {
            imageView.setImageResource(R.drawable.ic_play);
        }
        AppCompatSeekBar appCompatSeekBar = this.f17297b0;
        RunnableC0234c runnableC0234c = this.f17286Q;
        if (appCompatSeekBar != null) {
            appCompatSeekBar.setProgress(0);
            this.f17297b0.setSecondaryProgress(0);
            this.f17297b0.removeCallbacks(runnableC0234c);
        }
        TextView textView = this.f17305k0;
        if (textView != null) {
            textView.setText("00:00");
            this.f17305k0.removeCallbacks(runnableC0234c);
        }
        PlayerView playerView2 = this.f17287R;
        if (playerView2 != null) {
            playerView2.setStatePlayer(false);
            this.f17287R.setVisibility(8);
        }
        y yVar = this.f17311o;
        if (yVar != null) {
            yVar.d = new h();
            yVar.d();
        }
        p pVar = this.f17309n;
        if (pVar != null) {
            pVar.d = new h();
            pVar.d();
        }
    }
}