导航菜单

页面标题

页面副标题

Cleaner for WhatsApp v2.9.6 - GalleryActivity.java 源代码

正在查看: Cleaner for WhatsApp v2.9.6 应用的 GalleryActivity.java JAVA 源代码文件

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


package com.lookandfeel.cleanerforwhatsapp;

import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.UriPermission;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Parcelable;
import android.provider.DocumentsContract;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.c;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.FileProvider;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import c4.C0218f;
import com.google.android.material.tabs.TabLayout;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.lookandfeel.cleanerforwhatsapp.GalleryActivity;
import com.lookandfeel.cleanerforwhatsapp.database.AppDatabase;
import com.lookandfeel.cleanerforwhatsapp.shared.AbstractC0295l;
import com.lookandfeel.cleanerforwhatsapp.shared.C0286c;
import com.lookandfeel.cleanerforwhatsapp.shared.C0292i;
import com.lookandfeel.cleanerforwhatsapp.shared.C0293j;
import d4.C0309a;
import e4.C0322c;
import e4.InterfaceC0320a;
import java.io.File;
import java.io.FileFilter;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;

public class GalleryActivity extends androidx.appcompat.app.d {
    c S;
    ViewPager T;
    public Toolbar U;
    public Toolbar V;
    public CheckBox W;
    public Intent X;
    private FirebaseAnalytics Y;
    public boolean Z = true;
    public boolean a0 = true;
    public boolean b0 = true;
    public String c0;
    private LinearLayout d0;
    public int e0;
    ViewPager.j f0;

    class a implements ViewPager.j {
        a() {
        }

        public void a(int i, float f, int i2) {
        }

        public void b(int i) {
            ((b) GalleryActivity.this.V().h0("android:switcher:2131296424:" + GalleryActivity.this.T.getCurrentItem() + "")).O(false);
        }

        public void c(int i) {
            if ((i != 0 || GalleryActivity.this.Z) && ((i != 1 || GalleryActivity.this.a0) && (i != 2 || GalleryActivity.this.b0))) {
                return;
            }
            GalleryActivity galleryActivity = GalleryActivity.this;
            b bVar = (b) galleryActivity.S.h(galleryActivity.T, i);
            androidx.appcompat.app.d applicationContext = GalleryActivity.this.getApplicationContext();
            if (applicationContext == null) {
                applicationContext = GalleryActivity.this;
            }
            bVar.M(i, applicationContext);
        }
    }

    public static class b extends androidx.fragment.app.f {
        static int A;
        public C0218f r;
        ArrayList s;
        TextView t;
        ProgressBar u;
        RecyclerView v;
        AsyncTask w;
        Context x;
        AppDatabase y;
        e.c z;

        class a implements e.b {
            a() {
            }

            public void a(Uri uri) {
                if (uri != null) {
                    Log.v("kml_move", "uri:" + uri.toString());
                    if (Build.VERSION.SDK_INT >= 30) {
                        b.this.K(uri);
                    }
                }
            }
        }

        class RunnableC0060b implements Runnable {
            final Uri r;
            final ProgressDialog s;

            class a implements Runnable {
                a() {
                }

                @Override
                public void run() {
                    Log.v("kml_move", "salina");
                    ProgressDialog progressDialog = RunnableC0060b.this.s;
                    if (progressDialog != null && progressDialog.isShowing()) {
                        RunnableC0060b.this.s.dismiss();
                    }
                    try {
                        b.this.O(false);
                    } catch (NullPointerException unused) {
                        b.this.r.o();
                    }
                    if (b.this.getActivity().c0.equals("false")) {
                        C0286c.u(b.this.getActivity()).K();
                    }
                    int i = b.this.getArguments().getInt("section_number");
                    Log.v("kml_move", "section:" + i);
                    b.this.getActivity().Z = i == 1;
                    b.this.getActivity().a0 = i == 2;
                    b.this.getActivity().b0 = i == 3;
                    Toast.makeText(b.this.getContext(), 2131886298, 1).show();
                    b.this.getActivity().getWindow().clearFlags(128);
                }
            }

            RunnableC0060b(Uri uri, ProgressDialog progressDialog) {
                this.r = uri;
                this.s = progressDialog;
            }

            @Override
            public void run() {
                b.this.L(this.r, this.s);
                new Handler(Looper.getMainLooper()).post(new a());
            }
        }

        class c extends Handler {
            final ProgressDialog a;

            c(Looper looper, ProgressDialog progressDialog) {
                super(looper);
                this.a = progressDialog;
            }

            @Override
            public void handleMessage(Message message) {
                if (message.what == 1) {
                    try {
                        this.a.setMessage(b.this.getString(2131886196, new Object[]{Long.valueOf(message.getData().getLong("progress")), Long.valueOf(message.getData().getLong("count"))}));
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        }

        class d implements FileFilter {
            private final List a = Arrays.asList("aac", "m4a", "amr", "mp3", "opus", "3gp");

            d() {
            }

            @Override
            public boolean accept(File file) {
                String path = file.getPath();
                return this.a.contains(path.substring(path.lastIndexOf(".") + 1));
            }
        }

        class e implements FileFilter {
            private final List a = Collections.singletonList("webp");

            e() {
            }

            @Override
            public boolean accept(File file) {
                String path = file.getPath();
                return this.a.contains(path.substring(path.lastIndexOf(".") + 1));
            }
        }

        class f implements FileFilter {
            private final List a = Arrays.asList("jpg", "jpeg", "mp4");

            f() {
            }

            @Override
            public boolean accept(File file) {
                String path = file.getPath();
                return this.a.contains(path.substring(path.lastIndexOf(".") + 1));
            }
        }

        class g implements View.OnClickListener {
            final CheckBox r;
            final ArrayList s;
            final Dialog t;

            g(CheckBox checkBox, ArrayList arrayList, Dialog dialog) {
                this.r = checkBox;
                this.s = arrayList;
                this.t = dialog;
            }

            @Override
            public void onClick(View view) {
                if (this.r.getVisibility() == 0) {
                    b bVar = b.this;
                    new i(bVar, bVar.getActivity(), this.r.isChecked(), b.this.getArguments().getInt("section_number"), null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, this.s);
                } else {
                    b bVar2 = b.this;
                    new i(bVar2, bVar2.getActivity(), false, b.this.getArguments().getInt("section_number"), null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, this.s);
                }
                this.t.dismiss();
            }
        }

        class h implements View.OnClickListener {
            final Dialog r;

            h(Dialog dialog) {
                this.r = dialog;
            }

            @Override
            public void onClick(View view) {
                this.r.dismiss();
            }
        }

        class i extends AsyncTask {
            ProgressDialog a;
            long b;
            boolean c;
            int d;
            Activity e;

            class a implements DialogInterface.OnCancelListener {
                a() {
                }

                @Override
                public void onCancel(DialogInterface dialogInterface) {
                    i.this.cancel(true);
                    b.this.O(false);
                    Toast.makeText(b.this.getContext(), 2131886190, 1).show();
                }
            }

            i(b bVar, Activity activity, boolean z, int i, a aVar) {
                this(activity, z, i);
            }

            private void c(ArrayList arrayList) {
                for (int i = 0; i < arrayList.size(); i++) {
                    try {
                        File file = new File(((C0309a) arrayList.get(i)).f());
                        publishProgress(Long.valueOf(i + 1));
                        if (this.d == 3) {
                            Iterator it = ((C0309a) arrayList.get(i)).d().iterator();
                            while (it.hasNext()) {
                                if (com.lookandfeel.cleanerforwhatsapp.shared.N.c(new File((String) it.next()), b.this.getContext())) {
                                    b.this.r.c.remove(arrayList.get(i));
                                }
                            }
                            if (!this.c) {
                                com.lookandfeel.cleanerforwhatsapp.shared.N.c(file, b.this.getContext());
                            }
                        } else if (com.lookandfeel.cleanerforwhatsapp.shared.N.c(file, b.this.getContext())) {
                            b.this.r.c.remove(arrayList.get(i));
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    if (isCancelled()) {
                        return;
                    }
                }
            }

            private void d(ArrayList arrayList) {
                Log.v("kml_saf_delete", "fileItems: " + arrayList.size());
                for (int i = 0; i < arrayList.size(); i++) {
                    try {
                        Uri parse = Uri.parse(((C0309a) arrayList.get(i)).f());
                        publishProgress(Long.valueOf(i + 1));
                        Log.v("kml_saf_delete", "section: " + this.d);
                        if (this.d == 3) {
                            Log.v("kml_saf_delete", "getListFichierDoublon size: " + ((C0309a) arrayList.get(i)).d().size());
                            Iterator it = ((C0309a) arrayList.get(i)).d().iterator();
                            while (it.hasNext()) {
                                String str = (String) it.next();
                                Log.v("kml_saf_delete", "path: " + str);
                                Uri parse2 = Uri.parse(str);
                                if (b.this.getActivity() != null) {
                                    Log.v("kml_saf_delete", "fileDbl: " + parse2);
                                    if (DocumentsContract.deleteDocument(b.this.getActivity().getContentResolver(), parse2)) {
                                        Log.v("kml_saf_delete", "deleted: " + i);
                                        b.this.r.c.remove(arrayList.get(i));
                                        b.this.y.B().g(parse2.getLastPathSegment());
                                    } else {
                                        Log.v("kml_saf_delete", "delete failed ");
                                    }
                                }
                            }
                            if (!this.c) {
                                Log.v("kml_saf_delete", "supprimer aussi : " + parse);
                                if (b.this.getActivity() != null && DocumentsContract.deleteDocument(b.this.getActivity().getContentResolver(), parse)) {
                                    b.this.y.B().g(parse.getLastPathSegment());
                                }
                            }
                        } else if (b.this.getActivity() != null && DocumentsContract.deleteDocument(b.this.getActivity().getContentResolver(), parse)) {
                            b.this.r.c.remove(arrayList.get(i));
                            b.this.y.B().g(parse.getLastPathSegment());
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        Log.v("kml_saf_delete", "error: " + e.getMessage());
                    }
                    if (isCancelled()) {
                        return;
                    }
                }
            }

            public void f(x2.l lVar) {
                if (((GalleryActivity) this.e).c0.equals("false")) {
                    C0286c.u(this.e).K();
                }
            }

            public void g(U2.c cVar, x2.l lVar) {
                if (lVar.o()) {
                    cVar.a(this.e, (U2.b) lVar.k()).c(new x2.f() {
                        public final void a(x2.l lVar2) {
                            GalleryActivity.b.i.this.f(lVar2);
                        }
                    });
                } else if (((GalleryActivity) this.e).c0.equals("false")) {
                    C0286c.u(this.e).K();
                }
            }

            @Override
            public Long doInBackground(ArrayList... arrayListArr) {
                ArrayList arrayList = arrayListArr[0];
                this.b = arrayList.size();
                if (Build.VERSION.SDK_INT >= 30) {
                    Log.v("kml_saf_delete", "selectedfiles:" + this.b);
                    d(arrayList);
                } else {
                    c(arrayList);
                }
                return 0L;
            }

            @Override
            public void onPostExecute(Long l) {
                try {
                    ProgressDialog progressDialog = this.a;
                    if (progressDialog != null && progressDialog.isShowing()) {
                        this.a.dismiss();
                    }
                } catch (Exception unused) {
                } catch (Throwable th) {
                    this.a = null;
                    throw th;
                }
                this.a = null;
                try {
                    b.this.O(false);
                } catch (NullPointerException unused2) {
                    b.this.r.o();
                }
                final U2.c a2 = U2.d.a(this.e);
                a2.b().c(new x2.f() {
                    public final void a(x2.l lVar) {
                        GalleryActivity.b.i.this.g(a2, lVar);
                    }
                });
                Activity activity = this.e;
                GalleryActivity galleryActivity = (GalleryActivity) activity;
                int i = this.d;
                galleryActivity.Z = i == 1;
                ((GalleryActivity) activity).a0 = i == 2;
                ((GalleryActivity) activity).b0 = i == 3;
                Toast.makeText(activity, 2131886191, 1).show();
                this.e.getWindow().clearFlags(128);
            }

            @Override
            public void onProgressUpdate(Long... lArr) {
                try {
                    this.a.setMessage(b.this.getString(2131886195, new Object[]{lArr[0], Long.valueOf(this.b)}));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Override
            protected void onPreExecute() {
                super.onPreExecute();
                this.e.getWindow().addFlags(128);
                this.a.setMessage(b.this.getString(2131886194));
                this.a.show();
                this.a.setOnCancelListener(new a());
            }

            private i(Activity activity, boolean z, int i) {
                this.a = new ProgressDialog(b.this.getContext());
                this.b = 0L;
                this.e = activity;
                this.c = z;
                this.d = i;
            }
        }

        class j extends AsyncTask {
            Context a;

            class a implements FileFilter {
                private final List a = Arrays.asList("jpeg", "jpg", "png", "bmp", "gif", "3gp", "mp4", "mkv", "aac", "m4a", "amr", "mp3", "opus", "3gp", "doc", "docx", "txt", "ppt", "xls", "xlsx", "pdf", "pptx");

                a() {
                }

                @Override
                public boolean accept(File file) {
                    String path = file.getPath();
                    return this.a.contains(path.substring(path.lastIndexOf(".") + 1));
                }
            }

            class C0061b implements FileFilter {
                private final List a = Arrays.asList("jpeg", "jpg", "png", "bmp", "gif", "3gp", "mp4", "mkv", "aac", "m4a", "amr", "mp3", "opus", "3gp", "doc", "docx", "txt", "ppt", "xls", "xlsx", "pdf", "pptx");

                C0061b() {
                }

                @Override
                public boolean accept(File file) {
                    String path = file.getPath();
                    return this.a.contains(path.substring(path.lastIndexOf(".") + 1)) || file.isDirectory();
                }
            }

            protected j(Context context) {
                this.a = context;
            }

            private java.util.ArrayList f(int r23, java.lang.String r24) {
                throw new UnsupportedOperationException("Method not decompiled: com.lookandfeel.cleanerforwhatsapp.GalleryActivity.b.j.f(int, java.lang.String):java.util.ArrayList");
            }

            private ArrayList g(int i, Context context) {
                String str;
                File[] listFiles;
                SharedPreferences b = androidx.preference.k.b(context);
                String string = b.getString("wp_folder", com.lookandfeel.cleanerforwhatsapp.shared.N.a());
                String string2 = b.getString("wp_folder_name", com.lookandfeel.cleanerforwhatsapp.shared.N.b());
                ArrayList arrayList = new ArrayList();
                if (b.this.getActivity() == null || b.this.getActivity().X == null) {
                    return arrayList;
                }
                if (b.this.getActivity().e0 == 4) {
                    return b.this.F(string + "/Media/" + string2 + " Voice Notes", false);
                }
                if (b.this.getActivity().e0 == 10) {
                    return b.this.E(string + "/Media/" + string2 + " Stickers");
                }
                if (b.this.getActivity().e0 == 11) {
                    return b.this.D(string + "/Media/.Statuses");
                }
                if (i == 1) {
                    if (b.this.getActivity().X.getIntExtra("type", 0) == 1) {
                        str = string + "/Media/" + string2 + " Images";
                    } else if (b.this.getActivity().X.getIntExtra("type", 0) == 2) {
                        str = string + "/Media/" + string2 + " Video";
                    } else if (b.this.getActivity().X.getIntExtra("type", 0) == 3) {
                        str = string + "/Media/" + string2 + " Audio";
                    } else if (b.this.getActivity().X.getIntExtra("type", 0) == 5) {
                        str = string + "/Media/" + string2 + " Documents";
                    } else if (b.this.getActivity().X.getIntExtra("type", 0) == 6) {
                        str = string + "/Media/" + string2 + " Animated Gifs";
                    } else if (b.this.getActivity().X.getIntExtra("type", 0) == 7) {
                        str = string + "/Media/WallPaper";
                    } else {
                        str = string + "/Media/" + string2 + " Profile Photos";
                    }
                } else if (i == 3) {
                    if (b.this.getActivity().X.getIntExtra("type", 0) == 1) {
                        str = string + "/Media/" + string2 + " Images";
                    } else if (b.this.getActivity().X.getIntExtra("type", 0) == 2) {
                        str = string + "/Media/" + string2 + " Video";
                    } else if (b.this.getActivity().X.getIntExtra("type", 0) == 3) {
                        str = string + "/Media/" + string2 + " Audio";
                    } else if (b.this.getActivity().X.getIntExtra("type", 0) == 5) {
                        str = string + "/Media/" + string2 + " Documents";
                    } else if (b.this.getActivity().X.getIntExtra("type", 0) == 6) {
                        str = string + "/Media/" + string2 + " Animated Gifs";
                    } else {
                        str = "";
                    }
                } else if (b.this.getActivity().X.getIntExtra("type", 0) == 1) {
                    str = string + "/Media/" + string2 + " Images/Sent";
                } else if (b.this.getActivity().X.getIntExtra("type", 0) == 2) {
                    str = string + "/Media/" + string2 + " Video/Sent";
                } else if (b.this.getActivity().X.getIntExtra("type", 0) == 3) {
                    str = string + "/Media/" + string2 + " Audio/Sent";
                } else if (b.this.getActivity().X.getIntExtra("type", 0) == 5) {
                    str = string + "/Media/" + string2 + " Documents/Sent";
                } else {
                    str = string + "/Media/" + string2 + " Animated Gifs/Sent";
                }
                if (i == 3) {
                    List<C0293j> n = n(str);
                    if (n.size() <= 0) {
                        return arrayList;
                    }
                    for (C0293j c0293j : n) {
                        if (!c0293j.a().isHidden() && c0293j.a().length() > 0) {
                            C0309a c0309a = new C0309a();
                            c0309a.l(c0293j.a().getName());
                            c0309a.m(c0293j.a().getAbsolutePath());
                            c0309a.o(c0293j.a().length());
                            c0309a.j(c0293j.a().lastModified());
                            c0309a.n(false);
                            c0309a.p(com.lookandfeel.cleanerforwhatsapp.shared.N.g(c0293j.a().getAbsolutePath()));
                            try {
                                c0309a.k(c0293j.b());
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                            if (arrayList.size() <= 0 || !c0309a.c().equals(((C0309a) arrayList.get(arrayList.size() - 1)).c())) {
                                arrayList.add(c0309a);
                            } else {
                                ((C0309a) arrayList.get(arrayList.size() - 1)).a(c0293j.a().getAbsolutePath());
                            }
                        }
                    }
                    return arrayList;
                }
                File file = new File(str);
                a aVar = new a();
                File[] listFiles2 = file.listFiles(aVar);
                if (listFiles2 != null && listFiles2.length > 0) {
                    for (File file2 : listFiles2) {
                        if (!file2.isHidden() && file2.length() > 0) {
                            C0309a c0309a2 = new C0309a();
                            c0309a2.l(file2.getName());
                            c0309a2.m(file2.getAbsolutePath());
                            c0309a2.o(file2.length());
                            c0309a2.j(file2.lastModified());
                            c0309a2.n(false);
                            c0309a2.p(com.lookandfeel.cleanerforwhatsapp.shared.N.g(file2.getAbsolutePath()));
                            arrayList.add(c0309a2);
                        }
                    }
                }
                File file3 = new File(str + "/Private");
                if (!file3.exists() || (listFiles = file3.listFiles(aVar)) == null || listFiles.length <= 0) {
                    return arrayList;
                }
                for (File file4 : listFiles) {
                    if (!file4.isHidden() && file4.length() > 0) {
                        C0309a c0309a3 = new C0309a();
                        c0309a3.l(file4.getName());
                        c0309a3.m(file4.getAbsolutePath());
                        c0309a3.o(file4.length());
                        c0309a3.j(file4.lastModified());
                        c0309a3.n(false);
                        c0309a3.p(com.lookandfeel.cleanerforwhatsapp.shared.N.g(file4.getAbsolutePath()));
                        arrayList.add(c0309a3);
                    }
                }
                return arrayList;
            }

            private void h(Map map, String str) {
                File[] listFiles;
                if (b.this.w.isCancelled() || (listFiles = new File(str).listFiles(new C0061b())) == null || listFiles.length <= 0) {
                    return;
                }
                for (File file : listFiles) {
                    if (b.this.w.isCancelled()) {
                        return;
                    }
                    if (file.isDirectory() && !file.isHidden()) {
                        h(map, file.getPath());
                    } else if (!file.isHidden() && file.length() > 0) {
                        map.put(file.getAbsolutePath(), Long.valueOf(file.length()));
                    }
                }
            }

            private void i(Map map, String[] strArr, String str) {
                if (b.this.w.isCancelled()) {
                    return;
                }
                InterfaceC0320a B = b.this.y.B();
                ArrayList<C0322c> arrayList = new ArrayList();
                for (String str2 : strArr) {
                    arrayList.addAll(B.e(str2, str));
                }
                if (arrayList.size() > 0) {
                    for (C0322c c0322c : arrayList) {
                        if (!c0322c.c.startsWith(".") && c0322c.g > 0) {
                            if (b.this.w.isCancelled()) {
                                return;
                            } else {
                                map.put(DocumentsContract.buildDocumentUriUsingTree(Uri.parse(c0322c.f), c0322c.e).toString(), Long.valueOf(c0322c.g));
                            }
                        }
                    }
                }
            }

            public static int j(C0309a c0309a, C0309a c0309a2) {
                return Long.compare(c0309a2.h(), c0309a.h());
            }

            public static int k(C0309a c0309a, C0309a c0309a2) {
                return Long.compare(c0309a.h(), c0309a2.h());
            }

            public static int l(C0309a c0309a, C0309a c0309a2) {
                return Long.compare(c0309a.b(), c0309a2.b());
            }

            public static int m(C0309a c0309a, C0309a c0309a2) {
                return Long.compare(c0309a2.b(), c0309a.b());
            }

            private List n(String str) {
                String str2;
                ArrayList arrayList = new ArrayList();
                HashMap hashMap = new HashMap();
                h(hashMap, str);
                HashMap hashMap2 = new HashMap();
                for (Map.Entry entry : hashMap.entrySet()) {
                    if (b.this.w.isCancelled()) {
                        break;
                    }
                    if (!hashMap2.containsKey(entry.getValue())) {
                        hashMap2.put((Long) entry.getValue(), new ArrayList());
                    }
                    ArrayList arrayList2 = (ArrayList) hashMap2.get(entry.getValue());
                    arrayList2.add((String) entry.getKey());
                    hashMap2.put((Long) entry.getValue(), arrayList2);
                }
                HashMap hashMap3 = new HashMap();
                for (Long l : hashMap2.keySet()) {
                    if (b.this.w.isCancelled()) {
                        break;
                    }
                    if (((ArrayList) hashMap2.get(l)).size() > 1) {
                        Iterator it = ((ArrayList) hashMap2.get(l)).iterator();
                        while (it.hasNext()) {
                            String str3 = (String) it.next();
                            if (b.this.w.isCancelled()) {
                                break;
                            }
                            try {
                                str2 = AbstractC0295l.c(str3);
                            } catch (Exception e) {
                                e.printStackTrace();
                                str2 = "0";
                            }
                            hashMap3.put(str3, str2);
                        }
                    }
                }
                HashMap hashMap4 = new HashMap();
                for (Map.Entry entry2 : hashMap3.entrySet()) {
                    if (b.this.w.isCancelled()) {
                        break;
                    }
                    if (!hashMap4.containsKey(entry2.getValue())) {
                        hashMap4.put((String) entry2.getValue(), new ArrayList());
                    }
                    ArrayList arrayList3 = (ArrayList) hashMap4.get(entry2.getValue());
                    arrayList3.add((String) entry2.getKey());
                    hashMap4.put((String) entry2.getValue(), arrayList3);
                }
                for (String str4 : hashMap4.keySet()) {
                    if (b.this.w.isCancelled()) {
                        break;
                    }
                    if (((ArrayList) hashMap4.get(str4)).size() > 1) {
                        Iterator it2 = ((ArrayList) hashMap4.get(str4)).iterator();
                        while (it2.hasNext()) {
                            String str5 = (String) it2.next();
                            C0293j c0293j = new C0293j();
                            c0293j.c(new File(str5));
                            c0293j.d(str4);
                            arrayList.add(c0293j);
                        }
                    }
                }
                return arrayList;
            }

            private List o(String[] strArr, String str) {
                String str2;
                ArrayList arrayList = new ArrayList();
                HashMap hashMap = new HashMap();
                i(hashMap, strArr, str);
                HashMap hashMap2 = new HashMap();
                for (Map.Entry entry : hashMap.entrySet()) {
                    if (b.this.w.isCancelled()) {
                        break;
                    }
                    if (!hashMap2.containsKey(entry.getValue())) {
                        hashMap2.put((Long) entry.getValue(), new ArrayList());
                    }
                    ArrayList arrayList2 = (ArrayList) hashMap2.get(entry.getValue());
                    arrayList2.add((String) entry.getKey());
                    hashMap2.put((Long) entry.getValue(), arrayList2);
                }
                HashMap hashMap3 = new HashMap();
                for (Long l : hashMap2.keySet()) {
                    if (b.this.w.isCancelled()) {
                        break;
                    }
                    if (((ArrayList) hashMap2.get(l)).size() > 1) {
                        Iterator it = ((ArrayList) hashMap2.get(l)).iterator();
                        while (it.hasNext()) {
                            String str3 = (String) it.next();
                            if (b.this.w.isCancelled()) {
                                break;
                            }
                            try {
                                str2 = AbstractC0295l.d(str3, b.this.getActivity());
                            } catch (Exception e) {
                                e.printStackTrace();
                                str2 = "0";
                            }
                            hashMap3.put(str3, str2);
                        }
                    }
                }
                HashMap hashMap4 = new HashMap();
                for (Map.Entry entry2 : hashMap3.entrySet()) {
                    if (b.this.w.isCancelled()) {
                        break;
                    }
                    if (!hashMap4.containsKey(entry2.getValue())) {
                        hashMap4.put((String) entry2.getValue(), new ArrayList());
                    }
                    ArrayList arrayList3 = (ArrayList) hashMap4.get(entry2.getValue());
                    arrayList3.add((String) entry2.getKey());
                    hashMap4.put((String) entry2.getValue(), arrayList3);
                }
                for (String str4 : hashMap4.keySet()) {
                    if (b.this.w.isCancelled()) {
                        break;
                    }
                    if (((ArrayList) hashMap4.get(str4)).size() > 1) {
                        Iterator it2 = ((ArrayList) hashMap4.get(str4)).iterator();
                        while (it2.hasNext()) {
                            String str5 = (String) it2.next();
                            C0292i c0292i = new C0292i();
                            c0292i.c(new C0322c(str5, b.this.getContext()));
                            c0292i.d(str4);
                            arrayList.add(c0292i);
                        }
                    }
                }
                return arrayList;
            }

            @Override
            public Void doInBackground(Void... voidArr) {
                if (Build.VERSION.SDK_INT >= 30) {
                    List<UriPermission> arrayList = new ArrayList<>();
                    if (b.this.getActivity() != null) {
                        arrayList = b.this.getActivity().getContentResolver().getPersistedUriPermissions();
                    }
                    if (arrayList.size() > 0) {
                        Iterator<UriPermission> it = arrayList.iterator();
                        Uri uri = null;
                        while (it.hasNext()) {
                            uri = it.next().getUri();
                        }
                        String str = uri.getPathSegments().get(1);
                        if (b.this.getArguments() != null) {
                            b bVar = b.this;
                            bVar.s = f(bVar.getArguments().getInt("section_number"), str);
                        }
                    }
                } else if (b.this.getArguments() != null) {
                    b bVar2 = b.this;
                    bVar2.s = g(bVar2.getArguments().getInt("section_number"), this.a);
                }
                return null;
            }

            @Override
            protected void onCancelled() {
                super.onCancelled();
                b.this.A();
            }

            @Override
            protected void onPreExecute() {
                super.onPreExecute();
                if (Build.VERSION.SDK_INT < 30 || b.this.getActivity() == null) {
                    return;
                }
                b.this.getActivity().getWindow().addFlags(128);
            }

            @Override
            public void onPostExecute(java.lang.Void r5) {
                throw new UnsupportedOperationException("Method not decompiled: com.lookandfeel.cleanerforwhatsapp.GalleryActivity.b.j.onPostExecute(java.lang.Void):void");
            }
        }

        class k extends AsyncTask {
            ProgressDialog a;
            long b;
            int c;
            Activity d;

            k(b bVar, Activity activity, int i, a aVar) {
                this(activity, i);
            }

            public void c(DialogInterface dialogInterface) {
                cancel(true);
                b.this.O(false);
                Toast.makeText(b.this.getContext(), 2131886296, 1).show();
            }

            @Override
            public Long doInBackground(ArrayList... arrayListArr) {
                File externalStoragePublicDirectory;
                Uri parse;
                Uri moveDocument;
                ArrayList arrayList = arrayListArr[0];
                this.b = arrayList.size();
                for (int i = 0; i < arrayList.size(); i++) {
                    if (Build.VERSION.SDK_INT >= 30) {
                        String f = ((C0309a) arrayList.get(i)).f();
                        Uri parse2 = Uri.parse(f);
                        Uri parse3 = Uri.parse(f.substring(0, f.lastIndexOf(Uri.encode(((C0309a) arrayList.get(i)).e()))));
                        String substring = f.substring(0, f.lastIndexOf("/primary") + 8);
                        if (((C0309a) arrayList.get(i)).i().contains("video")) {
                            parse = Uri.parse("content://com.android.externalstorage.documents/tree/primary%3AMovies/document/primary:Movies");
                        } else if (((C0309a) arrayList.get(i)).i().contains("audio")) {
                            parse = Uri.parse(substring + ":" + Environment.DIRECTORY_MUSIC);
                        } else if (((C0309a) arrayList.get(i)).f().contains("Documents")) {
                            parse = Uri.parse(substring + ":" + Environment.DIRECTORY_DOWNLOADS);
                        } else {
                            parse = Uri.parse(substring + ":" + Environment.DIRECTORY_PICTURES);
                        }
                        try {
                            String e = ((C0309a) arrayList.get(i)).e();
                            if (e.lastIndexOf(".") > -1) {
                                e.substring(e.lastIndexOf("."));
                                e.substring(0, e.lastIndexOf("."));
                            }
                            System.currentTimeMillis();
                            moveDocument = DocumentsContract.moveDocument(this.d.getContentResolver(), parse2, parse3, parse);
                            if (moveDocument != null) {
                                b.this.r.c.remove(arrayList.get(i));
                                b.this.y.B().g(parse2.getLastPathSegment());
                            }
                        } catch (FileNotFoundException e2) {
                            e2.printStackTrace();
                        } catch (Exception e5) {
                            e5.printStackTrace();
                        }
                        publishProgress(Long.valueOf(i + 1));
                    } else {
                        try {
                            File file = new File(((C0309a) arrayList.get(i)).f());
                            if (((C0309a) arrayList.get(i)).f().contains("Video")) {
                                externalStoragePublicDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);
                            } else {
                                if (!((C0309a) arrayList.get(i)).f().contains("Audio") && !((C0309a) arrayList.get(i)).f().contains("Voice")) {
                                    externalStoragePublicDirectory = ((C0309a) arrayList.get(i)).f().contains("Document") ? Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) : Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
                                }
                                externalStoragePublicDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC);
                            }
                            publishProgress(Long.valueOf(i + 1));
                            if (com.lookandfeel.cleanerforwhatsapp.shared.N.o(file, externalStoragePublicDirectory, b.this.getContext())) {
                                b.this.r.c.remove(arrayList.get(i));
                            }
                        } catch (Exception e6) {
                            e6.printStackTrace();
                        }
                    }
                    if (isCancelled()) {
                        break;
                    }
                }
                return 0L;
            }

            @Override
            public void onPostExecute(Long l) {
                ProgressDialog progressDialog = this.a;
                if (progressDialog != null && progressDialog.isShowing()) {
                    this.a.dismiss();
                }
                try {
                    b.this.O(false);
                } catch (NullPointerException unused) {
                    b.this.r.o();
                }
                if (((GalleryActivity) this.d).c0.equals("false")) {
                    C0286c.u(this.d).K();
                }
                Object obj = this.d;
                GalleryActivity galleryActivity = (GalleryActivity) obj;
                int i = this.c;
                galleryActivity.Z = i == 1;
                ((GalleryActivity) obj).a0 = i == 2;
                ((GalleryActivity) obj).b0 = i == 3;
                Toast.makeText(b.this.getContext(), 2131886298, 1).show();
            }

            @Override
            public void onProgressUpdate(Long... lArr) {
                try {
                    this.a.setMessage(b.this.getString(2131886196, new Object[]{lArr[0], Long.valueOf(this.b)}));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Override
            protected void onPreExecute() {
                super.onPreExecute();
                this.a.setMessage(b.this.getString(2131886194));
                this.a.show();
                this.a.setOnCancelListener(new DialogInterface.OnCancelListener() {
                    @Override
                    public final void onCancel(DialogInterface dialogInterface) {
                        GalleryActivity.b.k.this.c(dialogInterface);
                    }
                });
            }

            private k(Activity activity, int i) {
                this.a = new ProgressDialog(b.this.getContext());
                this.b = 0L;
                this.d = activity;
                this.c = i;
            }
        }

        public void G(SharedPreferences sharedPreferences, DialogInterface dialogInterface, int i2) {
            SharedPreferences.Editor edit = sharedPreferences.edit();
            edit.putString("sort", (i2 + 1) + "");
            edit.apply();
            M(getArguments().getInt("section_number"), getContext());
            dialogInterface.dismiss();
        }

        public void H(ArrayList arrayList, Dialog dialog, View view) {
            if (Build.VERSION.SDK_INT >= 30) {
                Uri f2 = com.lookandfeel.cleanerforwhatsapp.shared.N.f(Environment.DIRECTORY_PICTURES, getActivity());
                if (getActivity().e0 == 3 || getActivity().e0 == 4) {
                    f2 = com.lookandfeel.cleanerforwhatsapp.shared.N.f(Environment.DIRECTORY_MUSIC, getActivity());
                } else if (getActivity().e0 == 2) {
                    f2 = com.lookandfeel.cleanerforwhatsapp.shared.N.f(Environment.DIRECTORY_MOVIES, getActivity());
                } else if (getActivity().e0 == 5) {
                    f2 = com.lookandfeel.cleanerforwhatsapp.shared.N.f(Environment.DIRECTORY_DOCUMENTS, getActivity());
                }
                this.z.a(f2);
            } else {
                new k(this, getActivity(), getArguments().getInt("section_number"), null).execute(arrayList);
            }
            dialog.dismiss();
        }

        public static b J(int i2, int i5) {
            b bVar = new b();
            Bundle bundle = new Bundle();
            bundle.putInt("section_number", i2);
            bVar.setArguments(bundle);
            A = i5;
            return bVar;
        }

        public void K(Uri uri) {
            Log.v("kml_move", "bdina");
            ProgressDialog progressDialog = new ProgressDialog(getContext());
            progressDialog.setMessage(getString(2131886300));
            progressDialog.show();
            progressDialog.setCancelable(false);
            getActivity().getWindow().addFlags(128);
            Executors.newSingleThreadExecutor().execute(new RunnableC0060b(uri, progressDialog));
        }

        public void L(Uri uri, ProgressDialog progressDialog) {
            Uri moveDocument;
            ArrayList I = this.r.I();
            Q.a d2 = Q.a.d(getActivity(), uri);
            String treeDocumentId = DocumentsContract.getTreeDocumentId(d2.f());
            for (int i2 = 0; i2 < I.size(); i2++) {
                String f2 = ((C0309a) I.get(i2)).f();
                Log.v("kml_move", "sourcePath:" + f2);
                Uri parse = Uri.parse(f2);
                Uri parse2 = Uri.parse(f2.substring(0, f2.lastIndexOf(Uri.encode(((C0309a) I.get(i2)).e()))));
                try {
                    String e2 = ((C0309a) I.get(i2)).e();
                    if (Q.a.c(getActivity(), DocumentsContract.buildDocumentUriUsingTree(uri, treeDocumentId + "/" + e2)).a()) {
                        Log.v("kml_move", "rename and move");
                        String str = "";
                        if (e2.lastIndexOf(".") > -1) {
                            str = e2.substring(e2.lastIndexOf("."));
                            e2 = e2.substring(0, e2.lastIndexOf("."));
                        }
                        Uri renameDocument = DocumentsContract.renameDocument(getActivity().getContentResolver(), parse, e2 + "-" + System.currentTimeMillis() + str);
                        moveDocument = renameDocument != null ? DocumentsContract.moveDocument(getActivity().getContentResolver(), renameDocument, parse2, d2.f()) : null;
                    } else {
                        Log.v("kml_move", "move");
                        moveDocument = DocumentsContract.moveDocument(getActivity().getContentResolver(), parse, parse2, d2.f());
                    }
                    if (moveDocument != null) {
                        this.r.c.remove(I.get(i2));
                        this.y.B().g(parse.getLastPathSegment());
                        Bundle bundle = new Bundle();
                        bundle.putLong("progress", i2);
                        bundle.putLong("count", I.size());
                        Message obtain = Message.obtain();
                        obtain.what = 1;
                        obtain.setData(bundle);
                        z(obtain, progressDialog);
                    }
                } catch (FileNotFoundException e5) {
                    e5.printStackTrace();
                } catch (Exception e6) {
                    e6.printStackTrace();
                }
            }
        }

        private void z(Message message, ProgressDialog progressDialog) {
            new c(Looper.getMainLooper(), progressDialog).sendMessage(message);
        }

        public void A() {
            this.w = null;
        }

        public ArrayList D(String str) {
            ArrayList arrayList = new ArrayList();
            File[] listFiles = new File(str).listFiles(new f());
            if (listFiles != null && listFiles.length > 0) {
                for (File file : listFiles) {
                    if (!file.isHidden() && file.length() > 0) {
                        C0309a c0309a = new C0309a();
                        c0309a.l(file.getName());
                        c0309a.m(file.getAbsolutePath());
                        c0309a.o(file.length());
                        c0309a.j(file.lastModified());
                        c0309a.n(false);
                        c0309a.p(com.lookandfeel.cleanerforwhatsapp.shared.N.g(file.getAbsolutePath()));
                        arrayList.add(c0309a);
                    }
                }
            }
            return arrayList;
        }

        public ArrayList E(String str) {
            ArrayList arrayList = new ArrayList();
            File[] listFiles = new File(str).listFiles(new e());
            if (listFiles != null && listFiles.length > 0) {
                for (File file : listFiles) {
                    if (!file.isHidden() && file.length() > 0) {
                        C0309a c0309a = new C0309a();
                        c0309a.l(file.getName());
                        c0309a.m(file.getAbsolutePath());
                        c0309a.o(file.length());
                        c0309a.j(file.lastModified());
                        c0309a.n(false);
                        c0309a.p(com.lookandfeel.cleanerforwhatsapp.shared.N.g(file.getAbsolutePath()));
                        arrayList.add(c0309a);
                    }
                }
            }
            return arrayList;
        }

        public ArrayList F(String str, boolean z) {
            ArrayList arrayList = new ArrayList();
            File file = new File(str);
            File[] listFiles = z ? file.listFiles(new d()) : file.listFiles();
            if (listFiles != null && listFiles.length > 0) {
                for (File file2 : listFiles) {
                    if (file2.isDirectory() && !file2.isHidden()) {
                        arrayList.addAll(F(file2.getPath(), true));
                    } else if (!file2.isHidden() && file2.length() > 0) {
                        C0309a c0309a = new C0309a();
                        c0309a.l(file2.getName());
                        c0309a.m(file2.getAbsolutePath());
                        c0309a.o(file2.length());
                        c0309a.j(file2.lastModified());
                        c0309a.n(false);
                        c0309a.p(com.lookandfeel.cleanerforwhatsapp.shared.N.g(file2.getAbsolutePath()));
                        arrayList.add(c0309a);
                    }
                }
            }
            return arrayList;
        }

        public void M(int i2, Context context) {
            if (this.w == null) {
                this.w = new j(context).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
                C0218f c0218f = this.r;
                if (c0218f != null) {
                    c0218f.o();
                }
            }
            if (getActivity() != null) {
                if (i2 == 0) {
                    getActivity().Z = true;
                } else if (i2 == 1) {
                    getActivity().a0 = true;
                } else if (i2 == 2) {
                    getActivity().b0 = true;
                }
            }
        }

        public void N(boolean z) {
            this.r.M(z);
        }

        public void O(boolean z) {
            C0218f c0218f = this.r;
            if (c0218f != null) {
                c0218f.g = z;
                if (z) {
                    getActivity().U.setVisibility(8);
                    getActivity().V.setVisibility(0);
                    getActivity().V.setTitle("");
                    getActivity().W.setChecked(false);
                    getActivity().W.setText(String.format(getActivity().getResources().getString(2131886369), 0));
                    getActivity().q0(getActivity().V);
                } else {
                    getActivity().V.setVisibility(8);
                    getActivity().U.setVisibility(0);
                    getActivity().q0(getActivity().U);
                    getActivity().g0().r(true);
                }
                this.r.o();
            }
        }

        public void onAttach(Context context) {
            super.onAttach(context);
            this.x = context;
        }

        public void onCreate(Bundle bundle) {
            super.onCreate(bundle);
            this.z = registerForActivityResult(new f.b(), new a());
        }

        public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) {
            if (getActivity().U.getVisibility() == 0) {
                menuInflater.inflate(2131623938, menu);
            } else {
                menuInflater.inflate(2131623939, menu);
                if (getArguments().getInt("section_number") == 3) {
                    menu.findItem(2131296326).setVisible(false);
                    menu.findItem(2131296332).setVisible(false);
                }
            }
            super.onCreateOptionsMenu(menu, menuInflater);
        }

        public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
            LinearLayoutManager gridLayoutManager;
            this.y = (AppDatabase) k0.p.a(this.x, AppDatabase.class, "wpcleaner-db").e().f().d();
            View inflate = layoutInflater.inflate(2131492927, viewGroup, false);
            this.t = (TextView) inflate.findViewById(2131296671);
            this.u = (ProgressBar) inflate.findViewById(2131296573);
            if (this.s == null) {
                this.s = new ArrayList();
            }
            this.v = inflate.findViewById(2131296511);
            if (((GalleryActivity) this.x).X.getIntExtra("type", 0) == 5) {
                gridLayoutManager = new LinearLayoutManager(getContext());
            } else {
                gridLayoutManager = new GridLayoutManager(getContext(), getResources().getBoolean(2131034118) ? 5 : 3);
            }
            if (this.s.size() == 0) {
                this.t.setVisibility(8);
                this.v.setVisibility(8);
                this.u.setVisibility(0);
            } else {
                this.t.setVisibility(8);
                this.v.setVisibility(0);
                this.u.setVisibility(8);
            }
            this.v.setHasFixedSize(true);
            this.v.setNestedScrollingEnabled(false);
            this.v.setLayoutManager(gridLayoutManager);
            C0218f c0218f = new C0218f(this.s, getActivity(), getArguments().getInt("section_number"), A);
            this.r = c0218f;
            this.v.setAdapter(c0218f);
            if (this.w == null) {
                this.w = new j(getContext()).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
            }
            setHasOptionsMenu(true);
            return inflate;
        }

        public boolean onOptionsItemSelected(MenuItem menuItem) {
            int itemId = menuItem.getItemId();
            if (itemId == 2131296329) {
                if (this.r != null) {
                    O(true);
                } else {
                    Toast.makeText((Context) getActivity(), 2131886374, 1).show();
                }
                return true;
            }
            if (itemId == 2131296330) {
                if (this.r != null) {
                    O(true);
                    N(true);
                    getActivity().W.setChecked(true);
                } else {
                    Toast.makeText((Context) getActivity(), 2131886374, 1).show();
                }
            } else if (itemId == 2131296334) {
                String[] stringArray = getResources().getStringArray(2130903047);
                c.a aVar = new c.a(getActivity());
                aVar.m(2131886449);
                final SharedPreferences b = androidx.preference.k.b(getActivity());
                aVar.l(stringArray, Integer.parseInt(b.getString("sort", "1")) - 1, new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i2) {
                        GalleryActivity.b.this.G(b, dialogInterface, i2);
                    }
                });
                aVar.a().show();
            } else {
                if (itemId == 2131296326) {
                    final ArrayList I = this.r.I();
                    if (I.size() > 0) {
                        final Dialog dialog = new Dialog(getActivity());
                        int i2 = Build.VERSION.SDK_INT;
                        if (i2 < 30) {
                            dialog.requestWindowFeature(1);
                        }
                        dialog.setContentView(2131492957);
                        Button button = (Button) dialog.findViewById(2131296622);
                        Button button2 = (Button) dialog.findViewById(2131296446);
                        CheckBox checkBox = (CheckBox) dialog.findViewById(2131296396);
                        Button button3 = (Button) dialog.findViewById(2131296621);
                        TextView textView = (TextView) dialog.findViewById(2131296623);
                        ((TextView) dialog.findViewById(2131296879)).setText(2131886111);
                        if (i2 >= 30) {
                            dialog.setTitle(2131886111);
                            button.setText(2131886157);
                            button3.setText(2131886149);
                            textView.setText(2131886466);
                        } else if (getActivity().e0 == 3 || getActivity().e0 == 4) {
                            textView.setText(2131886464);
                        } else if (getActivity().e0 == 5) {
                            textView.setText(2131886465);
                        } else {
                            textView.setText(2131886463);
                        }
                        button2.setVisibility(8);
                        button.setVisibility(0);
                        checkBox.setVisibility(8);
                        button.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public final void onClick(View view) {
                                GalleryActivity.b.this.H(I, dialog, view);
                            }
                        });
                        button3.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public final void onClick(View view) {
                                dialog.dismiss();
                            }
                        });
                        dialog.show();
                    } else {
                        Toast.makeText((Context) getActivity(), 2131886371, 1).show();
                    }
                    return true;
                }
                if (itemId == 2131296318) {
                    ArrayList I5 = this.r.I();
                    if (I5.size() > 0) {
                        Dialog dialog2 = new Dialog(getActivity());
                        dialog2.requestWindowFeature(1);
                        dialog2.setContentView(2131492957);
                        Button button4 = (Button) dialog2.findViewById(2131296622);
                        Button button5 = (Button) dialog2.findViewById(2131296446);
                        TextView textView2 = (TextView) dialog2.findViewById(2131296623);
                        ((TextView) dialog2.findViewById(2131296879)).setText(2131886180);
                        CheckBox checkBox2 = (CheckBox) dialog2.findViewById(2131296396);
                        if (getArguments().getInt("section_number") == 3) {
                            textView2.setText(2131886200);
                            checkBox2.setVisibility(0);
                        } else {
                            textView2.setText(2131886460);
                            checkBox2.setVisibility(8);
                        }
                        button5.setVisibility(0);
                        button4.setVisibility(8);
                        button5.setOnClickListener(new g(checkBox2, I5, dialog2));
                        ((Button) dialog2.findViewById(2131296621)).setOnClickListener(new h(dialog2));
                        dialog2.show();
                    } else {
                        Toast.makeText((Context) getActivity(), 2131886371, 1).show();
                    }
                    return true;
                }
                if (itemId == 2131296332) {
                    ArrayList I6 = this.r.I();
                    if (I6.size() > 0) {
                        try {
                            ArrayList<? extends Parcelable> arrayList = new ArrayList<>();
                            Iterator it = I6.iterator();
                            while (it.hasNext()) {
                                C0309a c0309a = (C0309a) it.next();
                                arrayList.add(Build.VERSION.SDK_INT >= 30 ? Uri.parse(c0309a.f()) : FileProvider.h(this.x, "com.lookandfeel.cleanerforwhatsapp.provider", new File(c0309a.f().replace("%20", " "))));
                            }
                            Log.v("kml_share", I6.size() + " <<<");
                            Intent intent = new Intent();
                            intent.setFlags(0);
                            intent.setAction("android.intent.action.SEND_MULTIPLE");
                            intent.putParcelableArrayListExtra("android.intent.extra.STREAM", arrayList);
                            intent.setType("*/*");
                            startActivity(Intent.createChooser(intent, getString(2131886444) + "..."));
                        } catch (Exception e2) {
                            e2.printStackTrace();
                        }
                    } else {
                        Toast.makeText((Context) getActivity(), 2131886371, 1).show();
                    }
                    return true;
                }
                if (itemId == 16908332) {
                    if (getActivity() != null) {
                        getActivity().onBackPressed();
                    }
                    return true;
                }
            }
            return super.onOptionsItemSelected(menuItem);
        }

        public void y() {
            AsyncTask asyncTask = this.w;
            if (asyncTask != null) {
                asyncTask.cancel(true);
            }
        }
    }

    private class c extends androidx.fragment.app.C {
        int h;

        c(GalleryActivity galleryActivity, androidx.fragment.app.x xVar, int i, a aVar) {
            this(xVar, i);
        }

        public int d() {
            int i = this.h;
            return (i == 4 || i == 7 || i == 8 || i == 10 || i == 11) ? 1 : 3;
        }

        public CharSequence f(int i) {
            int i2 = this.h;
            if (i2 == 4 || i2 == 7 || i2 == 8 || i2 == 10 || i2 == 11) {
                return null;
            }
            if (i == 0) {
                return GalleryActivity.this.getString(2131886418);
            }
            if (i == 1) {
                return GalleryActivity.this.getString(2131886443);
            }
            if (i != 2) {
                return null;
            }
            return GalleryActivity.this.getString(2131886199);
        }

        public androidx.fragment.app.f t(int i) {
            return b.J(i + 1, GalleryActivity.this.e0);
        }

        private c(androidx.fragment.app.x xVar, int i) {
            super(xVar);
            this.h = i;
        }
    }

    public void A0(View view) {
        startActivity(new Intent((Context) this, (Class<?>) PremiumActivity.class));
    }

    public void B0(View view) {
        startActivity(new Intent((Context) this, (Class<?>) PremiumActivity.class));
    }

    public void C0(int i) {
        this.f0.c(i);
    }

    public void y0(CompoundButton compoundButton, boolean z) {
        try {
            ((b) V().h0("android:switcher:2131296424:" + this.T.getCurrentItem() + "")).N(z);
        } catch (NullPointerException e) {
            e.printStackTrace();
        }
    }

    public void z0(View view) {
        startActivity(new Intent((Context) this, (Class<?>) PremiumActivity.class));
    }

    public void D0() {
        if (this.c0.equals("false")) {
            C0286c.u(this).G((LinearLayout) findViewById(2131296338), this.d0, (ViewGroup) findViewById(2131296424));
        }
        final int currentItem = this.T.getCurrentItem();
        if (currentItem == 0) {
            this.Z = false;
        } else if (currentItem == 1) {
            this.a0 = false;
        } else if (currentItem == 2) {
            this.b0 = false;
        }
        this.T.post(new Runnable() {
            @Override
            public final void run() {
                GalleryActivity.this.C0(currentItem);
            }
        });
    }

    public void onBackPressed() {
        if (this.V.getVisibility() != 0) {
            super/*androidx.activity.h*/.onBackPressed();
            return;
        }
        this.V.setVisibility(8);
        this.U.setVisibility(0);
        ((b) V().h0("android:switcher:2131296424:" + this.T.getCurrentItem() + "")).O(false);
    }

    protected void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.k*/.onCreate(bundle);
        if (getResources().getBoolean(2131034118)) {
            setRequestedOrientation(0);
        } else {
            setRequestedOrientation(1);
        }
        setContentView(2131492892);
        this.c0 = androidx.preference.k.b(this).getString("Premuim", "false");
        Intent intent = getIntent();
        this.X = intent;
        this.e0 = intent.getIntExtra("type", 0);
        this.W = (CheckBox) findViewById(2131296771);
        Toolbar findViewById = findViewById(2131296882);
        this.U = findViewById;
        findViewById.setTitle(this.X.getStringExtra("name"));
        q0(this.U);
        g0().r(true);
        this.V = findViewById(2131296883);
        this.S = new c(this, V(), this.e0, null);
        ViewPager findViewById2 = findViewById(2131296424);
        this.T = findViewById2;
        findViewById2.setAdapter(this.S);
        a aVar = new a();
        this.f0 = aVar;
        this.T.c(aVar);
        TabLayout tabLayout = (TabLayout) findViewById(2131296829);
        int i = this.e0;
        if (i == 4 || i == 7 || i == 8 || i == 10 || i == 11) {
            tabLayout.setVisibility(8);
        } else {
            tabLayout.setVisibility(0);
            tabLayout.setupWithViewPager(this.T);
        }
        this.W.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                GalleryActivity.this.y0(compoundButton, z);
            }
        });
        this.Y = FirebaseAnalytics.getInstance(this);
        Bundle bundle2 = new Bundle();
        bundle2.putString("item_name", this.X.getStringExtra("name"));
        this.Y.a("select_content", bundle2);
        LinearLayout linearLayout = (LinearLayout) findViewById(2131296724);
        this.d0 = linearLayout;
        linearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                GalleryActivity.this.z0(view);
            }
        });
        if (this.c0.equals("false")) {
            this.d0.setVisibility(0);
        } else {
            this.d0.setVisibility(8);
        }
        ((TextView) findViewById(2131296726)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                GalleryActivity.this.A0(view);
            }
        });
        ((ImageView) findViewById(2131296725)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                GalleryActivity.this.B0(view);
            }
        });
        if (this.c0.equals("false")) {
            C0286c.u(this).G((LinearLayout) findViewById(2131296338), this.d0, (ViewGroup) findViewById(2131296424));
        }
    }

    protected void onResume() {
        super/*androidx.fragment.app.k*/.onResume();
        if (C0286c.u(this).v() == null) {
            C0286c.u(this).C();
        }
    }

    public void onStop() {
        super.onStop();
        for (int i = 0; i < 3; i++) {
            b bVar = (b) V().h0("android:switcher:2131296424:" + i + "");
            if (bVar != null) {
                bVar.y();
            }
        }
    }
}