SD Maid v5.6.3版本的 MD5 值为:b283f6effbd880c54f4e4da72852de99

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


package eu.thedarken.sdm.setup.modules.storage.ui;

import a5.a;
import a5.h;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.google.android.material.snackbar.Snackbar;
import eu.thedarken.sdm.App;
import eu.thedarken.sdm.R;
import eu.thedarken.sdm.setup.modules.storage.ui.StorageFragment;
import eu.thedarken.sdm.tools.storage.e;
import h9.c;
import io.reactivex.rxjava3.internal.operators.observable.h0;
import io.reactivex.rxjava3.internal.operators.observable.p;
import io.reactivex.rxjava3.internal.operators.observable.w0;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import mb.v;
import z.c;
import z9.b;
public final class StorageFragment extends c implements c.a, b.a {
    public static final String f4713f0 = App.d("Setup", "ExternalStorage", "Fragment");
    public b f4714e0;
    @BindView
    public TextView explanation;
    @BindView
    public Button grantAccess;
    @BindView
    public ImageView icon;
    @BindView
    public View permissionBox;
    @BindView
    public TextView primaryLabel;
    @BindView
    public TextView secondaryLabel;

    @Override
    public final void Q1(e eVar) {
        v vVar = eVar.h;
        if (qd.c.a(vVar.getPath(), "/")) {
            TextView textView = this.secondaryLabel;
            if (textView != null) {
                textView.setText(eVar.f4955j.h.getPath());
                return;
            } else {
                qd.c.k("secondaryLabel");
                throw null;
            }
        }
        TextView textView2 = this.secondaryLabel;
        if (textView2 != null) {
            textView2.setText(vVar.getPath());
        } else {
            qd.c.k("secondaryLabel");
            throw null;
        }
    }

    @Override
    public final void Z2(Context context) {
        qd.c.f("context", context);
        super.Z2(context);
        a.C0005a c0005a = new a.C0005a();
        c0005a.a(new b5.e(this));
        c0005a.f190b = new h(this);
        c0005a.f189a = new b5.c(this);
        c0005a.b(this);
    }

    @Override
    public final void b(boolean z4) {
        int b10 = a0.b.b(A3(), z4 ? R.color.state_p3 : R.color.state_m3);
        View view = this.permissionBox;
        if (view == null) {
            qd.c.k("permissionBox");
            throw null;
        }
        view.setBackgroundColor(b10);
        ImageView imageView = this.icon;
        if (imageView != null) {
            imageView.setImageResource(z4 ? R.drawable.ic_folder_open_white_24dp : R.drawable.ic_folder_white_24dp);
        } else {
            qd.c.k("icon");
            throw null;
        }
    }

    @Override
    public final void c(boolean z4) {
        Button button = this.grantAccess;
        if (button != null) {
            button.setVisibility(z4 ? 0 : 8);
        } else {
            qd.c.k("grantAccess");
            throw null;
        }
    }

    @Override
    public final View c3(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        qd.c.f("inflater", layoutInflater);
        View inflate = layoutInflater.inflate(R.layout.setup_permission_fragment, viewGroup, false);
        K3(ButterKnife.a(inflate, this));
        return inflate;
    }

    @Override
    public final void onRequestPermissionsResult(int i10, String[] strArr, int[] iArr) {
        qd.c.f("permissions", strArr);
        qd.c.f("grantResults", iArr);
        if (i10 == 10) {
            String str = f4713f0;
            ne.a.d(str).a("Received response for REQUEST_WRITE_EXTERNAL_STORAGE permission request.", new Object[0]);
            if (iArr.length != 1 || iArr[0] != 0) {
                ne.a.d(str).a("REQUEST_WRITE_EXTERNAL_STORAGE permission was NOT granted.", new Object[0]);
                return;
            }
            ne.a.d(str).a("REQUEST_WRITE_EXTERNAL_STORAGE permission has now been granted.", new Object[0]);
            b bVar = this.f4714e0;
            if (bVar != null) {
                new h0(new w0(new p(bVar.f11185f.c(), new x8.b(22))), new g8.c(17)).o(new g5.a(3, bVar), io.reactivex.rxjava3.internal.functions.a.f6369e, io.reactivex.rxjava3.internal.functions.a.f6368c);
            } else {
                qd.c.k("presenter");
                throw null;
            }
        }
    }

    @Override
    public final void p3(View view, Bundle bundle) {
        qd.c.f("view", view);
        View view2 = this.permissionBox;
        if (view2 == null) {
            qd.c.k("permissionBox");
            throw null;
        }
        view2.setOnClickListener(new View.OnClickListener(this) {
            public final StorageFragment f11184i;

            {
                this.f11184i = this;
            }

            @Override
            public final void onClick(View view3) {
                int i10 = r2;
                StorageFragment storageFragment = this.f11184i;
                switch (i10) {
                    case 0:
                        String str = StorageFragment.f4713f0;
                        qd.c.f("this$0", storageFragment);
                        Button button = storageFragment.grantAccess;
                        if (button != null) {
                            button.performClick();
                            return;
                        } else {
                            qd.c.k("grantAccess");
                            throw null;
                        }
                    default:
                        String str2 = StorageFragment.f4713f0;
                        qd.c.f("this$0", storageFragment);
                        String str3 = StorageFragment.f4713f0;
                        ne.a.d(str3).g("WRITE_EXTERNAL_STORAGE has NOT been granted. Requesting permission.", new Object[0]);
                        try {
                            z.c.c(10, storageFragment.y3(), new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"});
                            return;
                        } catch (ActivityNotFoundException e10) {
                            ne.a.d(str3).d(e10);
                            try {
                                String str4 = "https://www.google.de/search?ie=UTF-8&q=" + URLEncoder.encode(e10.toString(), "utf-8");
                                storageFragment.N.getClass();
                                View view4 = storageFragment.N;
                                qd.c.c(view4);
                                Snackbar h = Snackbar.h(view4, storageFragment.R2(R.string.context_details), -2);
                                h.i(R.string.button_more, new x5.a(15, storageFragment, str4));
                                h.j();
                                return;
                            } catch (UnsupportedEncodingException e11) {
                                ne.a.d(str3).d(e11);
                                return;
                            }
                        }
                }
            }
        });
        Button button = this.grantAccess;
        if (button == null) {
            qd.c.k("grantAccess");
            throw null;
        }
        button.setOnClickListener(new View.OnClickListener(this) {
            public final StorageFragment f11184i;

            {
                this.f11184i = this;
            }

            @Override
            public final void onClick(View view3) {
                int i10 = r2;
                StorageFragment storageFragment = this.f11184i;
                switch (i10) {
                    case 0:
                        String str = StorageFragment.f4713f0;
                        qd.c.f("this$0", storageFragment);
                        Button button2 = storageFragment.grantAccess;
                        if (button2 != null) {
                            button2.performClick();
                            return;
                        } else {
                            qd.c.k("grantAccess");
                            throw null;
                        }
                    default:
                        String str2 = StorageFragment.f4713f0;
                        qd.c.f("this$0", storageFragment);
                        String str3 = StorageFragment.f4713f0;
                        ne.a.d(str3).g("WRITE_EXTERNAL_STORAGE has NOT been granted. Requesting permission.", new Object[0]);
                        try {
                            z.c.c(10, storageFragment.y3(), new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"});
                            return;
                        } catch (ActivityNotFoundException e10) {
                            ne.a.d(str3).d(e10);
                            try {
                                String str4 = "https://www.google.de/search?ie=UTF-8&q=" + URLEncoder.encode(e10.toString(), "utf-8");
                                storageFragment.N.getClass();
                                View view4 = storageFragment.N;
                                qd.c.c(view4);
                                Snackbar h = Snackbar.h(view4, storageFragment.R2(R.string.context_details), -2);
                                h.i(R.string.button_more, new x5.a(15, storageFragment, str4));
                                h.j();
                                return;
                            } catch (UnsupportedEncodingException e11) {
                                ne.a.d(str3).d(e11);
                                return;
                            }
                        }
                }
            }
        });
        super.p3(view, bundle);
    }
}