导航菜单

页面标题

页面副标题

MX Player v1.97.8 - FileExtensionSelector.java 源代码

正在查看: MX Player v1.97.8 应用的 FileExtensionSelector.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.mxtech.videoplayer.preference;

import android.R;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.preference.PreferenceFragment;
import android.util.SparseBooleanArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import androidx.appcompat.app.d;
import com.mxtech.media.MediaExtensions;
import com.mxtech.videoplayer.L;
import defpackage.s6d;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Locale;
import java.util.Map;

@TargetApi(14)
public final class FileExtensionSelector extends yh {
    public a R;

    public static class Fragment extends PreferenceFragment {
        public a b;

        @Override
        public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
            View inflate = layoutInflater.inflate(2131560518, viewGroup, false);
            m2b activity = getActivity();
            this.b = new a(activity, activity.b, inflate);
            return inflate;
        }

        @Override
        public final void onDestroy() {
            super.onDestroy();
            a aVar = this.b;
            if (aVar == null || !aVar.k) {
                return;
            }
            z6h.c(aVar.b, 2131886297, false);
        }

        @Override
        public final void onStop() {
            super.onStop();
            a aVar = this.b;
            if (aVar == null || !aVar.j) {
                return;
            }
            kkb.n(aVar.i, false);
            aVar.j = false;
        }
    }

    public static class a extends BaseAdapter implements Comparator<Map.Entry<String, ?>>, AdapterView.OnItemClickListener, View.OnClickListener {
        public final Activity b;
        public final bn4 c;
        public final LayoutInflater d;
        public final ListView f;
        public final Button g;
        public final Button h;
        public ArrayList<Map.Entry<String, Byte>> i;
        public boolean j;
        public boolean k;
        public DialogInterfaceOnClickListenerC0029a l;
        public b m;

        public class DialogInterfaceOnClickListenerC0029a implements DialogInterface.OnClickListener {
            public DialogInterfaceOnClickListenerC0029a() {
            }

            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
                String obj = ((EditText) ((Dialog) dialogInterface).findViewById(R.id.edit)).getText().toString();
                if (obj.length() == 0) {
                    return;
                }
                AbstractMap.SimpleEntry simpleEntry = new AbstractMap.SimpleEntry(obj, (byte) 0);
                a aVar = a.this;
                int binarySearch = Collections.binarySearch(aVar.i, simpleEntry, aVar);
                if (binarySearch >= 0) {
                    aVar.f.setSelection(binarySearch);
                    return;
                }
                aVar.i.add((-binarySearch) - 1, simpleEntry);
                aVar.a();
                aVar.f.setSelection(Collections.binarySearch(aVar.i, simpleEntry, aVar));
            }
        }

        public class b implements DialogInterface.OnClickListener {
            public b() {
            }

            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                a aVar = a.this;
                int i2 = aVar.b.getResources().getIntArray(s6d.U() ? 2130903061 : 2130903062)[i];
                SparseBooleanArray checkedItemPositions = aVar.f.getCheckedItemPositions();
                for (int size = checkedItemPositions.size() - 1; size >= 0; size--) {
                    if (checkedItemPositions.valueAt(size)) {
                        aVar.i.get(checkedItemPositions.keyAt(size)).setValue(Byte.valueOf((byte) i2));
                    }
                }
                aVar.a();
                dialogInterface.dismiss();
            }
        }

        public class c implements DialogInterface.OnClickListener {
            public c() {
            }

            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                a aVar = a.this;
                MediaExtensions q = MediaExtensions.q();
                try {
                    q.getClass();
                    MediaExtensions.b0(new xab(q, false));
                    aVar.getClass();
                    ArrayList<Map.Entry<String, Byte>> k = q.k();
                    Collections.sort(k, aVar);
                    aVar.i = k;
                    q.close();
                    aVar.a();
                    aVar.j = false;
                    dialogInterface.dismiss();
                } catch (Throwable th) {
                    q.close();
                    throw th;
                }
            }
        }

        public a(Activity activity, bn4 bn4Var, View view) {
            Drawable drawable;
            this.b = activity;
            this.c = bn4Var;
            this.d = (LayoutInflater) activity.getSystemService("layout_inflater");
            ListView listView = (ListView) view.findViewById(R.id.list);
            this.f = listView;
            Button button = (Button) view.findViewById(2131365639);
            this.g = button;
            Button button2 = (Button) view.findViewById(2131362608);
            this.h = button2;
            Button button3 = (Button) view.findViewById(2131361968);
            View findViewById = view.findViewById(2131365657);
            button.setOnClickListener(this);
            button2.setOnClickListener(this);
            button3.setOnClickListener(this);
            findViewById.setOnClickListener(this);
            listView.setOnItemClickListener(this);
            MediaExtensions q = MediaExtensions.q();
            try {
                ArrayList<Map.Entry<String, Byte>> k = q.k();
                Collections.sort(k, this);
                this.i = k;
                q.close();
                if ((findViewById instanceof ImageView) && (drawable = ((ImageView) findViewById).getDrawable()) != null) {
                    drawable.mutate().setColorFilter(button3.getTextColors().getDefaultColor(), PorterDuff.Mode.SRC_IN);
                }
                b();
                listView.setAdapter((ListAdapter) this);
            } catch (Throwable th) {
                q.close();
                throw th;
            }
        }

        public final void a() {
            ListView listView = this.f;
            for (int count = listView.getCount() - 1; count >= 0; count--) {
                listView.setItemChecked(count, false);
            }
            notifyDataSetChanged();
            this.j = true;
            this.k = true;
            b();
        }

        public final void b() {
            boolean z = this.f.getCheckItemIds().length > 0;
            Button button = this.g;
            button.setEnabled(z);
            button.setFocusable(z);
            Button button2 = this.h;
            button2.setEnabled(z);
            button2.setFocusable(z);
        }

        @Override
        public final int compare(Map.Entry<String, ?> entry, Map.Entry<String, ?> entry2) {
            return entry.getKey().compareToIgnoreCase(entry2.getKey());
        }

        @Override
        public final int getCount() {
            return this.i.size();
        }

        @Override
        public final Object getItem(int i) {
            return this.i.get(i);
        }

        @Override
        public final long getItemId(int i) {
            return i;
        }

        @Override
        public final View getView(int i, View view, ViewGroup viewGroup) {
            if (view == null) {
                view = this.d.inflate(2131560520, viewGroup, false);
            }
            if (i >= this.i.size()) {
                return view;
            }
            TextView textView = (TextView) view.findViewById(2131363431);
            TextView textView2 = (TextView) view.findViewById(2131364871);
            Map.Entry<String, Byte> entry = this.i.get(i);
            textView.setText(entry.getKey().toUpperCase(Locale.US));
            byte byteValue = entry.getValue().byteValue();
            Activity activity = this.b;
            ov0 ov0Var = L.a;
            textView2.setText(activity.getString(byteValue != 1 ? byteValue != 2 ? byteValue != 4 ? 2131887209 : 2131887211 : 2131887212 : 2131887210));
            return view;
        }

        @Override
        @SuppressLint({"InflateParams"})
        public final void onClick(View view) {
            Activity activity = this.b;
            if (activity.isFinishing()) {
                return;
            }
            DialogInterface.OnDismissListener onDismissListener = this.c;
            if (onDismissListener.j() > 0) {
                return;
            }
            int id = view.getId();
            if (id == 2131361968) {
                if (this.l == null) {
                    this.l = new DialogInterfaceOnClickListenerC0029a();
                }
                d.a aVar = new d.a(activity);
                aVar.l(2131886188);
                aVar.b(2131889772);
                aVar.g(R.string.ok, this.l);
                aVar.d(R.string.cancel, (DialogInterface.OnClickListener) null);
                androidx.appcompat.app.d a = aVar.a();
                a.g(a.getLayoutInflater().inflate(2131560519, (ViewGroup) null));
                a.setCanceledOnTouchOutside(true);
                onDismissListener.h(a);
                a.setOnDismissListener(onDismissListener);
                a.show();
                ka5.r(a);
                return;
            }
            if (id == 2131365639) {
                SparseBooleanArray checkedItemPositions = this.f.getCheckedItemPositions();
                if (checkedItemPositions == null) {
                    return;
                }
                for (int size = checkedItemPositions.size() - 1; size >= 0; size--) {
                    if (checkedItemPositions.valueAt(size)) {
                        this.i.remove(checkedItemPositions.keyAt(size));
                    }
                }
                a();
                return;
            }
            if (id == 2131362608) {
                if (this.m == null) {
                    this.m = new b();
                }
                d.a aVar2 = new d.a(activity);
                aVar2.l(2131887217);
                aVar2.i(s6d.U() ? 2130903059 : 2130903060, -1, this.m);
                androidx.appcompat.app.d a2 = aVar2.a();
                a2.setCanceledOnTouchOutside(true);
                onDismissListener.h(a2);
                a2.setOnDismissListener(onDismissListener);
                a2.show();
                ka5.r(a2);
                return;
            }
            if (id == 2131365657) {
                d.a aVar3 = new d.a(activity);
                aVar3.l(2131888805);
                aVar3.b(2131888307);
                aVar3.g(R.string.yes, new c());
                aVar3.d(R.string.no, (DialogInterface.OnClickListener) null);
                androidx.appcompat.app.d a3 = aVar3.a();
                a3.setCanceledOnTouchOutside(true);
                onDismissListener.h(a3);
                a3.setOnDismissListener(onDismissListener);
                a3.show();
                ka5.r(a3);
            }
        }

        @Override
        public final void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
            b();
        }
    }

    @SuppressLint({"MissingSuperCall"})
    public final void onCreate(Bundle bundle) {
        D6(2131560518, bundle);
        if (getApplication().y(this)) {
            this.R = new a(this, ((qya) this).p, getWindow().getDecorView());
        }
    }

    public final void onDestroy() {
        super/*com.mxtech.videoplayer.e*/.onDestroy();
        a aVar = this.R;
        if (aVar == null || !aVar.k) {
            return;
        }
        z6h.c(aVar.b, 2131886297, false);
    }

    public final void onStop() {
        super/*q7h*/.onStop();
        a aVar = this.R;
        if (aVar == null || !aVar.j) {
            return;
        }
        kkb.n(aVar.i, false);
        aVar.j = false;
    }
}