导航菜单

页面标题

页面副标题

Fancy Optimizer v4.6.3 - ScanJunkActivity.java 源代码

正在查看: Fancy Optimizer v4.6.3 应用的 ScanJunkActivity.java JAVA 源代码文件

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


package com.fancyclean.boost.junkclean.ui.activity;

import a9.e;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.util.Pair;
import androidx.recyclerview.widget.LinearLayoutManager;
import c7.l;
import com.fancyclean.boost.junkclean.ui.activity.ScanJunkActivity;
import com.fancyclean.boost.junkclean.ui.presenter.ScanJunkPresenter;
import com.thinkyeah.common.ui.dialog.c;
import com.thinkyeah.common.ui.view.ThinkRecyclerView;
import com.thinkyeah.common.ui.view.TitleBar;
import d9.g;
import d9.h;
import e9.f;
import gl.d;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import ml.o;

@d(ScanJunkPresenter.class)
public class ScanJunkActivity extends v7.a<g> implements h {
    public static final vj.h D = new vj.h("ScanJunkActivity");
    public int l;
    public f n;
    public f o;
    public f p;
    public f q;
    public f r;
    public c9.c s;
    public LinearLayout t;
    public ThinkRecyclerView u;
    public TextView v;
    public TextView w;

    public TextView f181x;

    public Button f182y;

    public w8.h f183z;
    public final Handler m = new Handler(Looper.getMainLooper());
    public boolean A = false;
    public boolean B = false;
    public boolean C = false;

    public static class a extends com.thinkyeah.common.ui.dialog.c<ScanJunkActivity> {
        public static final int c = 0;

        @NonNull
        public final Dialog onCreateDialog(Bundle bundle) {
            View inflate = View.inflate(getContext(), 2131558589, null);
            inflate.findViewById(2131363738).setVisibility(8);
            ((ImageView) inflate.findViewById(2131362514)).setImageResource(2131231714);
            ((ImageView) inflate.findViewById(2131362397)).setVisibility(8);
            ((TextView) inflate.findViewById(2131363556)).setText(2131886668);
            Button button = (Button) inflate.findViewById(2131362014);
            button.setText(2131887268);
            button.setOnClickListener(new t4.b(this, 13));
            Button button2 = (Button) inflate.findViewById(2131362019);
            button2.setText(2131886957);
            button2.setOnClickListener(new t4.d(this, 14));
            c.a aVar = new c.a(getContext());
            aVar.y = 8;
            aVar.x = inflate;
            return aVar.a();
        }
    }

    public static class b extends com.thinkyeah.common.ui.dialog.c<ScanJunkActivity> {
        public static final int c = 0;

        @NonNull
        public final Dialog onCreateDialog(Bundle bundle) {
            View inflate = View.inflate(getContext(), 2131558589, null);
            inflate.findViewById(2131363738).setVisibility(8);
            ((ImageView) inflate.findViewById(2131362514)).setImageResource(2131231713);
            ((ImageView) inflate.findViewById(2131362397)).setVisibility(8);
            ((TextView) inflate.findViewById(2131363556)).setText(2131887590);
            final boolean z10 = false;
            if (getArguments() != null && getArguments().getBoolean("CLOSE_TO_CLEAN", false)) {
                z10 = true;
            }
            Button button = (Button) inflate.findViewById(2131362014);
            button.setText(2131887268);
            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    int i = ScanJunkActivity.b.c;
                    ScanJunkActivity.b bVar = ScanJunkActivity.b.this;
                    ScanJunkActivity activity = bVar.getActivity();
                    if (activity != null) {
                        bVar.O(activity);
                        if (z10) {
                            vj.h hVar = ScanJunkActivity.D;
                            activity.Y2();
                        }
                    }
                }
            });
            Button button2 = (Button) inflate.findViewById(2131362019);
            button2.setText(2131886957);
            button2.setOnClickListener(new t4.a(this, 13));
            c.a aVar = new c.a(getContext());
            aVar.y = 8;
            aVar.x = inflate;
            return aVar.a();
        }
    }

    public static class c extends com.thinkyeah.common.ui.dialog.c<ScanJunkActivity> {
        public static final int c = 0;

        @NonNull
        public final Dialog onCreateDialog(Bundle bundle) {
            String[] strArr;
            ArrayList<String> stringArrayList = getArguments().getStringArrayList("paths");
            if (j4.b.G(stringArrayList)) {
                strArr = new String[]{"Empty path"};
            } else {
                String[] strArr2 = new String[stringArrayList.size()];
                stringArrayList.toArray(strArr2);
                strArr = strArr2;
            }
            c.a aVar = new c.a(getContext());
            aVar.d = "Paths";
            aVar.b(strArr, (DialogInterface.OnClickListener) null);
            return aVar.a();
        }
    }

    public static void X2(long j, f fVar, boolean z10) {
        fVar.setSizeText(o.a(1, j));
        if (z10) {
            fVar.d.setVisibility(0);
            fVar.e.setVisibility(8);
        } else {
            fVar.d.setVisibility(8);
            fVar.e.setVisibility(0);
        }
    }

    @Override
    public final void C() {
        this.C = true;
    }

    @Override
    public final void D1() {
        this.C = false;
    }

    @Override
    public final void I0(SparseArray<z8.d> sparseArray) {
        if (this.l == 3) {
            D.c("Scan already finished, avoid show scan status");
            return;
        }
        z8.d dVar = sparseArray.get(0);
        z8.d dVar2 = sparseArray.get(1);
        z8.d dVar3 = sparseArray.get(2);
        z8.d dVar4 = sparseArray.get(5);
        z8.d dVar5 = sparseArray.get(4);
        long j = 0;
        X2(dVar != null ? dVar.d.get() : 0L, this.n, dVar != null && dVar.b == 2);
        X2(dVar2 != null ? dVar2.d.get() : 0L, this.p, dVar2 != null && dVar2.b == 2);
        X2(dVar3 != null ? dVar3.d.get() : 0L, this.o, dVar3 != null && dVar3.b == 2);
        X2(dVar4 != null ? dVar4.d.get() : 0L, this.r, dVar4 != null && dVar4.b == 2);
        X2(dVar5 != null ? dVar5.d.get() : 0L, this.q, dVar5 != null && dVar5.b == 2);
        int size = sparseArray.size();
        for (int i = 0; i < size; i++) {
            j += sparseArray.valueAt(i).d.get();
        }
        b3(j);
    }

    @Override
    public final void L(List<z8.c> list, Set<e> set) {
        if (j4.b.G(list)) {
            CleanJunkActivity.e3(this);
            finish();
            return;
        }
        Iterator<z8.c> it = list.iterator();
        long j = 0;
        long j10 = 0;
        while (it.hasNext()) {
            j10 += it.next().d;
        }
        if (j10 <= 0 && Build.VERSION.SDK_INT < 30) {
            CleanJunkActivity.e3(this);
            finish();
            return;
        }
        c9.c cVar = this.s;
        if (set != null) {
            cVar.m = set;
        } else {
            cVar.getClass();
            cVar.m = new HashSet();
        }
        cVar.m(list, false);
        ((al.a) cVar).k = new al.b(((al.c) cVar).i, cVar);
        cVar.notifyDataSetChanged();
        Iterator<z8.c> it2 = list.iterator();
        while (it2.hasNext()) {
            it2.next().getClass();
        }
        b3(j10);
        Iterator<e> it3 = set.iterator();
        while (it3.hasNext()) {
            j += it3.next().e.get();
        }
        a3(j);
        this.m.postDelayed(new androidx.activity.d(this, 10), 200L);
    }

    public final void Y2() {
        SharedPreferences.Editor edit;
        boolean z10 = true;
        if (Z2()) {
            int i = Build.VERSION.SDK_INT;
            if (i >= 30) {
                if (!l.c(this)) {
                    c9.c cVar = this.s;
                    cVar.getClass();
                    z8.f fVar = new z8.f(new HashSet(cVar.m));
                    fVar.a.remove(0);
                    CleanJunkActivity.f3(this, fVar, 0L, 0L);
                    return;
                }
                if (i >= 33) {
                    com.adtiny.core.d.b().getClass();
                    com.adtiny.core.d.f();
                    startActivityForResult(new Intent("android.os.storage.action.CLEAR_APP_CACHE"), 101);
                    return;
                }
                if (i >= 30 && !ml.b.o(this)) {
                    com.adtiny.core.d.b().getClass();
                    com.adtiny.core.d.f();
                    startActivityForResult(new Intent("android.os.storage.action.CLEAR_APP_CACHE"), 101);
                    return;
                }
                c9.c cVar2 = this.s;
                cVar2.getClass();
                HashSet hashSet = new HashSet(cVar2.m);
                Iterator it = hashSet.iterator();
                while (true) {
                    if (!it.hasNext()) {
                        z10 = false;
                        break;
                    } else if (((e) it.next()).f == 0) {
                        break;
                    }
                }
                if (z10) {
                    long currentTimeMillis = System.currentTimeMillis();
                    SharedPreferences sharedPreferences = getSharedPreferences("junk_clean", 0);
                    edit = sharedPreferences != null ? sharedPreferences.edit() : null;
                    if (edit != null) {
                        edit.putLong("last_clean_cache_time", currentTimeMillis);
                        edit.apply();
                    }
                }
                CleanJunkActivity.f3(this, new z8.f(hashSet), 0L, 0L);
                finish();
                return;
            }
        }
        c9.c cVar3 = this.s;
        cVar3.getClass();
        HashSet hashSet2 = new HashSet(cVar3.m);
        Iterator it2 = hashSet2.iterator();
        while (true) {
            if (!it2.hasNext()) {
                z10 = false;
                break;
            } else if (((e) it2.next()).f == 0) {
                break;
            }
        }
        if (z10) {
            long currentTimeMillis2 = System.currentTimeMillis();
            SharedPreferences sharedPreferences2 = getSharedPreferences("junk_clean", 0);
            edit = sharedPreferences2 != null ? sharedPreferences2.edit() : null;
            if (edit != null) {
                edit.putLong("last_clean_cache_time", currentTimeMillis2);
                edit.apply();
            }
        }
        CleanJunkActivity.f3(this, new z8.f(hashSet2), 0L, 0L);
        finish();
    }

    public final boolean Z2() {
        c9.c cVar = this.s;
        cVar.getClass();
        Iterator it = new HashSet(cVar.m).iterator();
        while (it.hasNext()) {
            if (((e) it.next()).f == 0) {
                return true;
            }
        }
        return false;
    }

    public final void a3(long j) {
        if (j > 0) {
            this.f182y.setEnabled(true);
            this.f182y.setText(getString(2131886253, o.a(1, j)));
        } else {
            this.f182y.setEnabled(false);
            this.f182y.setText(2131886305);
        }
    }

    public final void b3(long j) {
        Pair<String, String> b10 = u7.a.b(j);
        this.v.setText((CharSequence) b10.first);
        this.w.setText((CharSequence) b10.second);
        this.f181x.setText(getString(2131886306));
    }

    public final void c3(int i) {
        if (this.l == i) {
            return;
        }
        this.l = i;
        if (i == 2) {
            this.t.setVisibility(0);
            this.f182y.setVisibility(4);
            this.u.setVisibility(4);
        } else {
            this.t.setVisibility(4);
            this.f182y.setVisibility(0);
            this.u.setVisibility(0);
        }
    }

    public final void onActivityResult(int i, int i10, @Nullable Intent intent) {
        Uri data;
        if (i != 101) {
            if (i != 102) {
                super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i10, intent);
                return;
            }
            if (i10 != -1 || intent == null || (data = intent.getData()) == null) {
                return;
            }
            getContentResolver().takePersistableUriPermission(data, 3);
            if (this.f183z != null) {
                c3(2);
                ((g) W2()).K(this.f183z, true);
                return;
            }
            return;
        }
        c9.c cVar = this.s;
        cVar.getClass();
        z8.f fVar = new z8.f(new HashSet(cVar.m));
        SparseArray<Set<e>> sparseArray = fVar.a;
        Set<e> set = sparseArray.get(0);
        long j = 0;
        if (set != null) {
            Iterator<e> it = set.iterator();
            while (it.hasNext()) {
                j += it.next().e.get();
            }
        }
        long j10 = j;
        sparseArray.remove(0);
        vj.h hVar = D;
        if (i10 == -1) {
            hVar.c("App Cache cleared");
            CleanJunkActivity.f3(this, fVar, j10, j10);
            long currentTimeMillis = System.currentTimeMillis();
            SharedPreferences sharedPreferences = getSharedPreferences("junk_clean", 0);
            SharedPreferences.Editor edit = sharedPreferences == null ? null : sharedPreferences.edit();
            if (edit != null) {
                edit.putLong("last_clean_cache_time", currentTimeMillis);
                edit.apply();
            }
        } else {
            hVar.c("Fail to clear App Cache");
            CleanJunkActivity.f3(this, fVar, j10, 0L);
        }
        finish();
    }

    public final void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(2131558516);
        TitleBar.a configure = findViewById(2131363196).getConfigure();
        configure.e(2131887911);
        configure.g(new com.facebook.login.d(this, 15));
        configure.a();
        this.v = (TextView) findViewById(2131363664);
        this.w = (TextView) findViewById(2131363665);
        this.f181x = (TextView) findViewById(2131363693);
        ThinkRecyclerView findViewById = findViewById(2131363011);
        this.u = findViewById;
        findViewById.setItemAnimator(new kl.f());
        this.u.setLayoutManager(new LinearLayoutManager(this));
        c9.c cVar = new c9.c();
        this.s = cVar;
        this.u.setAdapter(cVar);
        this.s.n = new com.fancyclean.boost.junkclean.ui.activity.a(this);
        new al.d((ViewGroup) findViewById(2131363838), this.u, this.s).c();
        Button button = (Button) findViewById(2131361993);
        this.f182y = button;
        button.setVisibility(0);
        this.f182y.setOnClickListener(new t4.a(this, 12));
        this.t = (LinearLayout) findViewById(2131362605);
        String string = getString(2131887029);
        f fVar = new f(this);
        this.n = fVar;
        fVar.setTitleText(string);
        this.n.setIcon(2131231450);
        this.t.addView(this.n);
        String string2 = getString(2131887028);
        f fVar2 = new f(this);
        this.p = fVar2;
        fVar2.setTitleText(string2);
        this.p.setIcon(2131231448);
        this.t.addView(this.p);
        String string3 = getString(2131887038);
        f fVar3 = new f(this);
        this.o = fVar3;
        fVar3.setTitleText(string3);
        this.o.setIcon(2131231449);
        this.t.addView(this.o);
        String string4 = getString(2131887040);
        f fVar4 = new f(this);
        this.q = fVar4;
        fVar4.setTitleText(string4);
        this.q.setIcon(2131231453);
        this.t.addView(this.q);
        String string5 = getString(2131887030);
        f fVar5 = new f(this);
        this.r = fVar5;
        fVar5.setTitleText(string5);
        this.r.setIcon(2131231452);
        this.t.addView(this.r);
        w8.h hVar = (w8.h) ml.f.b().a("junkclean://junkfinder");
        this.f183z = hVar;
        if (hVar == null) {
            finish();
        } else {
            c3(2);
            ((g) W2()).K(this.f183z, false);
        }
    }

    public final void onDestroy() {
        this.m.removeCallbacksAndMessages(null);
        super/*il.b*/.onDestroy();
    }

    public final void onStart() {
        super/*il.b*/.onStart();
        if (this.A) {
            this.A = false;
            if (this.f183z != null) {
                c3(2);
                ((g) W2()).K(this.f183z, true);
            }
        }
        if (this.B) {
            this.B = false;
            Y2();
        }
    }

    @Override
    public final Context getContext() {
        return this;
    }
}