Snap v8.10.4版本的 MD5 值为:3f7a8892a522fef17767953dff16af57

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


package com.marginz.camera;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.BitmapFactory;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.widget.TextView;
import c.f.a.j1;
import c.f.a.n0;
import c.f.a.r1;
import c.f.a.s1;
import c.f.a.u1;
import c.f.a.w1.p;
import c.f.a.z;
import c.f.b.c.l0;
import c.f.b.c.m;
import c.f.b.c.x;
import c.f.b.d.j;
import c.f.b.e.b1;
import c.f.b.e.i0;
import c.f.b.e.m0;
import c.f.b.e.u0;
import c.f.b.e.w0;
import c.f.b.i.d1;
import c.f.b.j.k;
import com.marginz.snap.R;
import com.marginz.snap.app.AbstractGalleryActivity;
public abstract class ActivityBase extends AbstractGalleryActivity implements c.f.a.w1.g {
    public static int H;
    public static BroadcastReceiver J;
    public c.d.a.a.a.c A;
    public AlertDialog B;
    public boolean D;
    public int k;
    public Intent l;
    public n0 m;
    public View n;
    public boolean p;
    public x q;
    public g r;
    public d1 s;
    public View t;
    public Animation v;
    public Animation w;
    public boolean x;
    public c.d.a.a.a.e z;
    public static final byte[] G = {-12, 23, 43, -122, -123, -52, 71, -62, 41, 58, -75, -85, 97, -17, 106, -13, -1, 36, -74, 99};
    public static boolean I = true;
    public boolean o = false;
    public boolean u = true;
    public long y = 50000000;
    public final Handler C = new a();
    public final BroadcastReceiver E = new d();
    public BroadcastReceiver F = new e();

    public class a extends Handler {
        public a() {
        }

        @Override
        public void handleMessage(Message message) {
            if (message.what != 0) {
                return;
            }
            ActivityBase activityBase = ActivityBase.this;
            activityBase.p(activityBase.y);
        }
    }

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

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            ActivityBase.this.finish();
        }
    }

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

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            ActivityBase.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("http://market.android.com/details?id=com.marginz.snap")));
            ActivityBase.this.finish();
        }
    }

    public class d extends BroadcastReceiver {
        public d() {
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (action.equals("android.intent.action.MEDIA_MOUNTED") || action.equals("android.intent.action.MEDIA_UNMOUNTED") || action.equals("android.intent.action.MEDIA_CHECKING") || action.equals("android.intent.action.MEDIA_SCANNER_FINISHED")) {
                ActivityBase.this.q();
            }
        }
    }

    public class e extends BroadcastReceiver {
        public e() {
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            ActivityBase.this.finish();
        }
    }

    public class f implements Animation.AnimationListener {
        public f(a aVar) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            ActivityBase.this.t.setVisibility(4);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationStart(Animation animation) {
        }
    }

    public class g extends m implements z.a {
        public d1 f1788a;
        public m.a f1789b;

        public g() {
        }

        @Override
        public d1 a(Context context) {
            if (this.f1788a == null) {
                this.f1788a = c.f.b.d.a.j ? new z(this, context) : new r1(BitmapFactory.decodeResource(ActivityBase.this.getResources(), R.drawable.placeholder_camera));
            }
            return this.f1788a;
        }

        public void b() {
            ActivityBase.this.f1952a.requestRender();
        }
    }

    public class h implements c.d.a.a.a.e {
        public h() {
        }

        public void a(int i) {
            Log.i("ActivityBase", "License is Good");
        }

        public void b(int i) {
            Log.i("ActivityBase", "License is Good");
        }

        public void c(int i) {
            Log.i("ActivityBase", "License is Good");
        }
    }

    public static class i extends BroadcastReceiver {
        public i(a aVar) {
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            ActivityBase.I = true;
        }
    }

    @Override
    public x b() {
        return this.q;
    }

    public void f(boolean z, Uri uri) {
        u0 u0Var;
        if (!this.x || uri == null) {
            return;
        }
        int parseInt = Integer.parseInt(uri.getLastPathSegment());
        m.a aVar = this.r.f1789b;
        if (aVar != null) {
            w0 w0Var = ((l0) aVar).y;
            if (w0Var == null) {
                throw null;
            }
            if (z) {
                u0Var = m0.v;
                w0Var.h = Math.min(w0Var.h, parseInt);
                w0Var.i = Math.max(w0Var.i, parseInt);
            } else {
                u0Var = i0.w;
                w0Var.f = Math.min(w0Var.f, parseInt);
                w0Var.g = Math.max(w0Var.g, parseInt);
            }
            u0 b2 = u0Var.b(parseInt);
            if (w0Var.j.contains(b2)) {
                return;
            }
            w0Var.j.add(b2);
            w0Var.k.add(Boolean.valueOf(z));
            c.f.b.e.f fVar = w0Var.o;
            if (fVar.f1024b.compareAndSet(false, true)) {
                fVar.f1023a.B();
            }
        }
    }

    public d1 g(boolean z) {
        String str;
        StringBuilder h2;
        int i2;
        this.t = findViewById(R.id.camera_app_root);
        Bundle bundle = new Bundle();
        if (z) {
            if (this.x) {
                h2 = c.b.a.a.a.h("/secure/all/");
                i2 = H;
            } else {
                h2 = c.b.a.a.a.h("/local/all/");
                i2 = k.f1730a;
            }
            h2.append(i2);
            str = h2.toString();
        } else {
            str = "/local/all/0";
        }
        bundle.putString("media-set-path", str);
        bundle.putString("media-item-path", str);
        bundle.putBoolean("show_when_locked", this.x);
        if (this.r != null) {
            this.s.f();
        }
        g gVar = new g();
        this.r = gVar;
        bundle.putParcelable("app-bridge", gVar);
        if (c().b() == 0) {
            c().f(l0.class, bundle);
        } else {
            c().h(c().c(), l0.class, bundle);
        }
        d1 d1Var = this.r.f1788a;
        this.s = d1Var;
        return d1Var;
    }

    public int getResultCode() {
        return this.k;
    }

    public Intent getResultData() {
        return this.l;
    }

    public void h() {
        IntentFilter intentFilter = new IntentFilter("android.intent.action.MEDIA_MOUNTED");
        intentFilter.addAction("android.intent.action.MEDIA_UNMOUNTED");
        intentFilter.addAction("android.intent.action.MEDIA_SCANNER_FINISHED");
        intentFilter.addAction("android.intent.action.MEDIA_CHECKING");
        intentFilter.addDataScheme("file");
        registerReceiver(this.E, intentFilter);
    }

    public boolean i() {
        ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService("connectivity");
        return (connectivityManager == null || connectivityManager.getActiveNetworkInfo() == null || !connectivityManager.getActiveNetworkInfo().isConnectedOrConnecting()) ? false : true;
    }

    @Override
    public void j(View view, int i2, int i3, int i4, int i5) {
        if (this.r == null) {
            return;
        }
        Log.i("ActivityBase", "onLayoutChange:" + i2 + "," + i4 + "," + i3 + "," + i5);
        int i6 = i4 - i2;
        int i7 = i5 - i3;
        if (c.f.b.d.a.j) {
            z zVar = (z) this.s;
            if (u1.h(this) % 180 == 0) {
                zVar.m(i3, i6, i7, u1.h(this));
            } else {
                zVar.m(i2, i7, i6, u1.h(this));
            }
            k();
        }
    }

    public void k() {
        m.a aVar = this.r.f1789b;
        if (aVar != null) {
            l0 l0Var = (l0) aVar;
            l0Var.Q.g = l0Var.P.a(l0Var.f758a);
            b1 b1Var = l0Var.R;
            b1Var.h.set(true);
            b1Var.B();
        }
    }

    public void l(boolean z) {
        if (this.u == z) {
            return;
        }
        this.u = z;
        if (this.p) {
            return;
        }
        isFinishing();
    }

    public d1 m(boolean z) {
        String str;
        StringBuilder h2;
        int i2;
        this.t = findViewById(R.id.camera_app_root);
        Bundle bundle = new Bundle();
        if (z) {
            if (this.x) {
                h2 = c.b.a.a.a.h("/secure/all/");
                i2 = H;
            } else {
                h2 = c.b.a.a.a.h("/local/all/");
                i2 = k.f1730a;
            }
            h2.append(i2);
            str = h2.toString();
        } else {
            str = "/local/all/0";
        }
        bundle.putString("media-set-path", str);
        bundle.putString("media-item-path", str);
        bundle.putBoolean("show_when_locked", this.x);
        if (this.r == null) {
            this.r = new g();
        }
        bundle.putParcelable("app-bridge", this.r);
        if (c().b() == 0) {
            c().f(l0.class, bundle);
        }
        d1 d1Var = this.r.f1788a;
        this.s = d1Var;
        return d1Var;
    }

    public void n(int i2, Intent intent) {
        this.k = i2;
        this.l = intent;
        setResult(i2, intent);
    }

    public void o(boolean z) {
        m.a aVar = this.r.f1789b;
        if (aVar != null) {
            ((l0) aVar).t.u.f = !z;
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        Log.i("ActivityBase", "onCreate E");
        String str = Build.MANUFACTURER;
        String str2 = Build.BOARD;
        String str3 = Build.MODEL;
        String str4 = Build.PRODUCT;
        if (str4 != null) {
            Log.i("CAM_Quirks", "Setting Quirks for " + str2 + "," + str3 + "," + str4);
            if ("MAKO".equals(str2)) {
                j1.p = true;
            } else if ("MSM7630_SURF".equals(str2)) {
                j1.f551a = true;
            } else {
                if ("SM-N900T".equals(str3)) {
                    j1.q = true;
                    j1.r = true;
                }
                if ("GT-P7510".equals(str3)) {
                    j1.f552b = true;
                    j1.f553c = true;
                } else if ("GT-I9100".equals(str3)) {
                    j1.f552b = true;
                } else if (str4.startsWith("jflte") || str4.startsWith("jgedlte")) {
                    j1.v = true;
                    j1.i = true;
                    j1.n = true;
                    j1.j = true;
                } else if (str4.startsWith("hlte") || str4.startsWith("klte")) {
                    j1.k = true;
                    j1.l = true;
                    j1.n = true;
                    j1.j = true;
                    j1.t = true;
                    j1.u = true;
                } else {
                    if ("htc_shooteru".equals(str4)) {
                        j1.d = true;
                    }
                    "hammerhead".equals(str4);
                    if ("Joyz".equals(str4)) {
                        j1.e = true;
                    } else {
                        if ("Galaxy Nexus".equals(str3)) {
                            j1.h = true;
                        }
                        if ("XT910".equals(str3)) {
                            j1.g = true;
                            j1.f = true;
                        }
                        if (str4.startsWith("d2")) {
                            if (Build.VERSION.SDK_INT < 17) {
                                j1.m = true;
                            }
                            j1.i = true;
                            j1.n = true;
                            j1.o = true;
                        }
                        if ("motorola".equals(str)) {
                            int height = getWindowManager().getDefaultDisplay().getHeight();
                            int width = getWindowManager().getDefaultDisplay().getWidth();
                            if (width <= height) {
                                height = width;
                            }
                            if (height == 540) {
                                j1.f = true;
                            }
                        }
                        if ("HTC One".equals(str3)) {
                            j1.s = true;
                        }
                    }
                }
            }
        }
        Thread.currentThread().getId();
        this.f = true;
        j.u(this);
        getWindow().addFlags(1024);
        requestWindowFeature(9);
        Intent intent = getIntent();
        String action = intent.getAction();
        if ("android.media.action.STILL_IMAGE_CAMERA_SECURE".equals(action)) {
            this.x = true;
            H++;
        } else if ("android.media.action.IMAGE_CAPTURE_SECURE".equals(action)) {
            this.x = true;
        } else {
            this.x = intent.getBooleanExtra("secure_camera", false);
        }
        if (this.x) {
            IntentFilter intentFilter = new IntentFilter("android.intent.action.SCREEN_OFF");
            registerReceiver(this.F, intentFilter);
            if (J == null) {
                J = new i(null);
                getApplicationContext().registerReceiver(J, intentFilter);
            }
        }
        super.onCreate(bundle);
    }

    @Override
    public Dialog onCreateDialog(int i2) {
        int i3;
        int i4;
        if (i2 == 2) {
            i3 = R.string.trial_dialog_title;
            i4 = R.string.trial_dialog_body;
        } else {
            i3 = R.string.unlicensed_dialog_title;
            i4 = R.string.unlicensed_dialog_body;
        }
        AlertDialog create = new AlertDialog.Builder(this).setTitle(i3).setMessage(i4).setPositiveButton(R.string.buy_button, new c()).setCancelable(false).setNegativeButton(R.string.quit_button, new b()).create();
        this.B = create;
        return create;
    }

    @Override
    public void onDestroy() {
        p.f729b.get(this);
        p.f729b.remove(this);
        if (this.x) {
            unregisterReceiver(this.F);
        }
        super.onDestroy();
        c.d.a.a.a.c cVar = this.A;
        if (cVar != null) {
            synchronized (cVar) {
                cVar.c();
                cVar.e.getLooper().quit();
            }
        }
    }

    @Override
    public boolean onKeyDown(int i2, KeyEvent keyEvent) {
        if ((i2 == 84 || i2 == 82) && keyEvent.isLongPress()) {
            return true;
        }
        if (i2 == 82 && this.u) {
            return true;
        }
        return super.onKeyDown(i2, keyEvent);
    }

    @Override
    public boolean onKeyUp(int i2, KeyEvent keyEvent) {
        if (i2 == 82 && this.u) {
            return true;
        }
        return super.onKeyUp(i2, keyEvent);
    }

    @Override
    public void onPause() {
        super.onPause();
        n0 n0Var = this.m;
        if (n0Var != null) {
            n0Var.g.post(n0Var.i);
            this.m = null;
        }
        unregisterReceiver(this.E);
    }

    @Override
    public void onResume() {
        super.onResume();
        h();
        c.f.a.x xVar = ((CameraActivity) this).K;
        if (xVar == null ? true : xVar.g()) {
            this.y = s1.k(this);
            this.C.sendEmptyMessageDelayed(0, 200L);
        }
    }

    @Override
    public boolean onSearchRequested() {
        return false;
    }

    public void p(long j) {
        String str;
        int i2;
        if (j == -1) {
            i2 = R.string.no_storage;
        } else if (j == -2) {
            i2 = R.string.preparing_sd;
        } else if (j == -3) {
            i2 = R.string.access_sd_fail;
        } else if (j > 50000000) {
            str = null;
            if (str != null) {
                n0 n0Var = this.m;
                if (n0Var != null) {
                    n0Var.g.post(n0Var.i);
                    this.m = null;
                    return;
                }
                return;
            }
            n0 n0Var2 = this.m;
            if (n0Var2 == null) {
                n0 n0Var3 = new n0(this);
                View inflate = ((LayoutInflater) getSystemService("layout_inflater")).inflate(R.layout.on_screen_hint, (ViewGroup) null);
                ((TextView) inflate.findViewById(R.id.message)).setText(str);
                n0Var3.d = inflate;
                this.m = n0Var3;
            } else {
                View view = n0Var2.d;
                if (view == null) {
                    throw new RuntimeException("This OnScreenHint was not created with OnScreenHint.makeText()");
                }
                TextView textView = (TextView) view.findViewById(R.id.message);
                if (textView == null) {
                    throw new RuntimeException("This OnScreenHint was not created with OnScreenHint.makeText()");
                }
                textView.setText(str);
            }
            n0 n0Var4 = this.m;
            if (n0Var4.d == null) {
                throw new RuntimeException("View is not initialized");
            }
            n0Var4.g.post(n0Var4.h);
            return;
        } else {
            i2 = R.string.spaceIsLow_content;
        }
        str = getString(i2);
        if (str != null) {
        }
    }

    public void q() {
        long k = s1.k(this);
        this.y = k;
        p(k);
    }

    @Override
    public void setContentView(int i2) {
        super.setContentView(i2);
        x xVar = new x(this);
        this.q = xVar;
        xVar.f();
    }
}