导航菜单

页面标题

页面副标题

Tasker v6.5.11 - SceneEdit.java 源代码

正在查看: Tasker v6.5.11 应用的 SceneEdit.java JAVA 源代码文件

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


package net.dinglisch.android.taskerm;

import android.R;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.joaomgcd.taskerm.spawn.RFactory;
import com.joaomgcd.taskerservercommon.ConstantsCommonTaskerServer;
import cyanogenmod.alarmclock.ClockContract;
import cyanogenmod.app.ProfileManager;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.dinglisch.android.taskerm.HTMLView;
import net.dinglisch.android.taskerm.MyMapView;
import net.dinglisch.android.taskerm.MyRelativeLayout;
import net.dinglisch.android.taskerm.SceneEdit;
import net.dinglisch.android.taskerm.SceneEditElement;
import net.dinglisch.android.taskerm.br;
import net.dinglisch.android.taskerm.fn;
import net.dinglisch.android.taskerm.g6;
import net.dinglisch.android.taskerm.hk;
import net.dinglisch.android.taskerm.mh;
import net.dinglisch.android.taskerm.yd;

public class SceneEdit extends MyActivity implements View.OnClickListener, View.OnTouchListener {
    private static final int[] n0 = {2131296407, 2131296408, 2131296413, 2131296414, 2131296409, 2131296410, 2131296411, 2131296412};
    private static hk o0 = null;
    private ImageView A;
    private ImageView B;
    private ImageView C;
    private ImageView D;
    private ImageView E;
    private ImageView F;
    private ImageView G;
    private ViewGroup H;
    private MyRelativeLayout I;
    private ViewGroup J;
    private TextView K;
    private TextView L;
    private Handler[] M;
    private ImageView N;
    private ImageView O;
    private ImageView P;
    private ImageView Q;
    private ImageView R;
    private ImageView S;
    private ImageView T;
    private ImageView U;
    private int V;
    private long W;
    private long X;
    private int Y;
    private int Z;
    private int a0;
    private int b0;
    private int c0;
    private int d0;
    private int e0;
    private int f0;
    private int g0;
    private int h0;
    private int i0;
    private dk j0;
    private List<dk> k0;
    private boolean l0;
    private boolean m0;
    private o v;
    private o w;
    int[] x;
    private boolean y;
    private ImageView z;

    class a implements View.OnClickListener {
        a() {
        }

        @Override
        public void onClick(View view) {
            SceneEdit.this.v1();
        }
    }

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

        public void c(ViewGroup viewGroup) {
            SceneEdit.this.y1("onLayout");
            viewGroup.invalidate();
        }

        @Override
        public void a(int i, int i2) {
            final ViewGroup viewGroup;
            if (SceneEdit.this.X < 0) {
                if (i > 1 && i2 > 1 && (((dq.Q1(SceneEdit.this) && i >= i2) || (!dq.Q1(SceneEdit.this) && i2 >= i)) && (viewGroup = SceneEdit.this.H) != null)) {
                    viewGroup.post(new Runnable() {
                        @Override
                        public final void run() {
                            SceneEdit.b.this.c(viewGroup);
                        }
                    });
                }
                SceneEdit.this.U1();
                Intent intent = SceneEdit.this.getIntent();
                if (intent == null || !intent.hasExtra("el")) {
                    return;
                }
                String stringExtra = intent.getStringExtra("el");
                intent.removeExtra("el");
                if (stringExtra.equals(hk.d1(SceneEdit.this.getResources(), hk.k.PROPERTIES))) {
                    SceneEdit.this.k2();
                    return;
                }
                int c1 = SceneEdit.this.j0.c1(stringExtra);
                if (c1 >= 0) {
                    SceneEdit sceneEdit = SceneEdit.this;
                    sceneEdit.j2(c1, sceneEdit.j0.a1(c1));
                } else {
                    r7.G("SceneEdit", "bad launch element name " + stringExtra);
                }
            }
        }
    }

    class c implements Runnable {
        c() {
        }

        @Override
        public void run() {
            SceneEdit sceneEdit = SceneEdit.this;
            sceneEdit.k1(sceneEdit.g0);
        }
    }

    class d extends Handler {
        final int a;
        final int b;
        final Intent c;

        d(int i, int i2, Intent intent) {
            this.a = i;
            this.b = i2;
            this.c = intent;
        }

        @Override
        public void handleMessage(Message message) {
            if (SceneEdit.this.I == null || SceneEdit.this.H == null) {
                return;
            }
            if (SceneEdit.this.w1()) {
                SceneEdit.this.onActivityResult(this.a, this.b, this.c);
                return;
            }
            int i = message.what;
            if (i < 15) {
                sendEmptyMessageDelayed(i + 1, 50L);
            }
        }
    }

    class e implements mh.f {
        e() {
        }

        @Override
        public void a(mh mhVar) {
            if (mhVar.v()) {
                return;
            }
            String B = mhVar.B();
            hk b1 = SceneEdit.this.j0.b1(B);
            SceneEdit sceneEdit = SceneEdit.this;
            sceneEdit.Y = sceneEdit.j0.c1(B);
            int ordinal = SceneEdit.this.v.ordinal();
            if (ordinal == 0 || ordinal == 1) {
                if (mhVar.M()) {
                    SceneEdit sceneEdit2 = SceneEdit.this;
                    sceneEdit2.t1(sceneEdit2.Y);
                    return;
                } else {
                    SceneEdit sceneEdit3 = SceneEdit.this;
                    sceneEdit3.j2(sceneEdit3.Y, b1);
                    return;
                }
            }
            if (ordinal == 2 || ordinal == 3) {
                SceneEdit sceneEdit4 = SceneEdit.this;
                sceneEdit4.Q1(sceneEdit4.j0.a1(SceneEdit.this.Y));
                SceneEdit.this.m1();
            }
        }
    }

    class f implements mh.f {
        final int a;
        final int b;

        f(int i, int i2) {
            this.a = i;
            this.b = i2;
        }

        @Override
        public void a(mh mhVar) {
            if (mhVar.v()) {
                return;
            }
            SceneEdit.this.c1();
            SceneEdit.this.U1();
            int A = mhVar.A();
            if (A == 5834324) {
                hk L = SceneEdit.o0.L(true);
                L.u3(SceneEdit.this.j0.s1(L.getName()));
                SceneEdit.this.W1(L, this.a, L.F1());
                SceneEdit.this.X1(L, this.b, L.R0());
                L.w(to.h2(SceneEdit.this));
                SceneEdit.this.j2(-1, L);
            } else {
                hk.k kVar = hk.k.values()[A];
                if (kVar == hk.k.MAP && MyMapView.k(SceneEdit.this)) {
                    dq.i0(SceneEdit.this, "Map elements unavailable on this device due to ROM bug", new Object[0]);
                } else {
                    hk W0 = hk.W0(SceneEdit.this, kVar);
                    W0.u3(SceneEdit.this.j0.r1(SceneEdit.this.getResources(), W0.C1()));
                    SceneEdit.this.j2(-1, W0);
                }
            }
            SceneEdit.this.N1();
        }
    }

    class g implements mh.f {
        final int a;
        final hk b;

        g(int i, hk hkVar) {
            this.a = i;
            this.b = hkVar;
        }

        @Override
        public void a(mh mhVar) {
            if (mhVar.v()) {
                return;
            }
            hk a1 = SceneEdit.this.j0.a1(this.a);
            switch (n.values()[mhVar.A()].ordinal()) {
                case 0:
                    SceneEdit.this.a2();
                    break;
                case 1:
                    SceneEdit sceneEdit = SceneEdit.this;
                    sceneEdit.e2(0, 0, sceneEdit.B);
                    break;
                case 2:
                    SceneEdit.this.j2(this.a, a1);
                    break;
                case 3:
                    SceneEdit.o0 = a1.L(true);
                    break;
                case 4:
                    a1.I3(SceneEdit.this.r1() / 2);
                    a1.q3(SceneEdit.this.q1() / 2);
                    a1.m(SceneEdit.this.r1(), SceneEdit.this.q1());
                    a1.V3();
                    SceneEdit.this.k1(this.a);
                    break;
                case 5:
                    a1.L2(SceneEdit.this.r1(), SceneEdit.this.q1());
                    a1.V3();
                    a1.D3(false);
                    SceneEdit.this.L1(0);
                    break;
                case ClockContract.InstancesColumns.MISSED_STATE:
                    SceneEdit.this.f2();
                    break;
                case 7:
                    if (a1.i4()) {
                        a1.H3(false);
                    } else {
                        SceneEdit.this.j0.w3(a1.getName());
                    }
                    dk dkVar = SceneEdit.this.j0;
                    SceneEdit sceneEdit2 = SceneEdit.this;
                    dkVar.X3(sceneEdit2, to.h2(sceneEdit2), 2);
                    break;
                case 8:
                case 9:
                    this.b.G3(!r5.I2());
                    hk hkVar = this.b;
                    SceneEdit sceneEdit3 = SceneEdit.this;
                    hkVar.Y3(sceneEdit3, to.h2(sceneEdit3), 2, null);
                    SceneEdit.this.k1(this.a);
                    break;
                case 10:
                case 11:
                    SceneEdit.this.j0.a1(this.a).W3();
                    SceneEdit.this.k1(this.a);
                    break;
            }
        }
    }

    class h implements fn.b {
        h() {
        }

        @Override
        public void a(int i) {
            SceneEdit sceneEdit = SceneEdit.this;
            sceneEdit.L1(i - (!sceneEdit.j0.g2() ? 1 : 0));
        }

        @Override
        public void b(int i) {
        }
    }

    class i implements fn.b {
        i() {
        }

        @Override
        public void a(int i) {
            SceneEdit.this.j0.K3(i);
            SceneEdit.this.Y1();
        }

        @Override
        public void b(int i) {
        }
    }

    class j implements mh.f {

        class a implements Runnable {
            a() {
            }

            @Override
            public void run() {
                if (SceneEdit.this.I != null) {
                    SceneEdit.this.I.invalidate();
                }
            }
        }

        j() {
        }

        @Override
        public void a(mh mhVar) {
            if (!mhVar.v()) {
                o oVar = o.values()[mhVar.A()];
                if (SceneEdit.this.s2()) {
                    if (oVar != SceneEdit.this.v) {
                        SceneEdit.this.v = oVar;
                        SceneEdit sceneEdit = SceneEdit.this;
                        sceneEdit.p2("selZoom", sceneEdit.v);
                        SceneEdit.this.m1();
                        if (SceneEdit.this.v == o.MOVE) {
                            lp.d(SceneEdit.this, 2131890939);
                        } else if (SceneEdit.this.v == o.RESIZE) {
                            lp.d(SceneEdit.this, 2131890940);
                        }
                    }
                } else if (oVar != SceneEdit.this.w) {
                    SceneEdit.this.w = oVar;
                    SceneEdit.this.p2("selPrev", oVar);
                }
            }
            SceneEdit.this.I.post(new a());
        }
    }

    class k extends Handler {
        k() {
        }

        @Override
        public void handleMessage(Message message) {
            if (message.what == 0) {
                SceneEdit.this.V = -1;
                SceneEdit.this.j0.C0(false);
                SceneEdit.this.I.removeAllViews();
                SceneEdit.this.j0.Z2();
                SceneEdit.this.Y = -1;
                SceneEdit.this.m1();
                SceneEdit.this.O1();
            }
        }
    }

    class l extends Handler {
        l() {
        }

        @Override
        public void handleMessage(Message message) {
            if (message.what == 0) {
                SceneEdit.this.V = -1;
                SceneEdit sceneEdit = SceneEdit.this;
                sceneEdit.g1(sceneEdit.Y);
                SceneEdit.this.Y = -1;
                SceneEdit.this.m1();
                SceneEdit.this.O1();
                SceneEdit.this.H.invalidate();
            }
        }
    }

    class m extends Handler {
        final int a;

        m(int i) {
            this.a = i;
        }

        @Override
        public void handleMessage(Message message) {
            SceneEdit.this.M[this.a] = null;
            if (SceneEdit.this.H != null) {
                SceneEdit.this.H.performHapticFeedback(0, 2);
                SceneEdit.this.V1();
                SceneEdit sceneEdit = SceneEdit.this;
                int x1 = sceneEdit.x1(sceneEdit.d0, SceneEdit.this.e0);
                if (SceneEdit.this.Y == -1) {
                    SceneEdit sceneEdit2 = SceneEdit.this;
                    sceneEdit2.e2(sceneEdit2.b0, SceneEdit.this.c0, SceneEdit.this.B);
                } else if (x1 == SceneEdit.this.Y) {
                    SceneEdit sceneEdit3 = SceneEdit.this;
                    sceneEdit3.t1(sceneEdit3.Y);
                }
                SceneEdit.this.V = -1;
                SceneEdit sceneEdit4 = SceneEdit.this;
                sceneEdit4.k1(sceneEdit4.Y);
            }
        }
    }

    private enum n {
        Delete,
        Add,
        Edit,
        Copy,
        SetForeground,
        SetBackground,
        SetDepth,
        Focus,
        SetVisible,
        SetInvisible,
        Pin,
        Unpin
    }

    private enum o {
        NORMAL,
        EDIT,
        MOVE,
        RESIZE
    }

    public SceneEdit() {
        o oVar = o.NORMAL;
        this.v = oVar;
        this.w = oVar;
        this.x = new int[]{2131888979, 2131886874, 2131888978, 2131888980};
        this.y = false;
        this.M = new Handler[2];
        this.V = -1;
        this.X = -1L;
        this.Y = -1;
        this.g0 = -1;
        this.k0 = new ArrayList();
        this.l0 = false;
        this.m0 = false;
    }

    private void A1(hk hkVar) {
        int gridSize = this.I.getGridSize();
        this.I.setGridCellSize(0);
        double y3 = hkVar.y3(1.0d);
        z1(this.j0, hkVar, this.b0, this.c0);
        Rect D0 = hkVar.D0();
        hkVar.K3(this.I.f(D0.left));
        hkVar.M3(this.I.g(D0.top));
        hkVar.I3(Math.max(1, this.I.f(D0.right) - hkVar.H1()));
        hkVar.q3(Math.max(1, this.I.g(D0.bottom) - hkVar.J1()));
        hkVar.e0(this.j0.S1(), this.j0.Q1());
        hkVar.y3(y3);
        this.I.setGridCellSize(gridSize);
    }

    private boolean B1() {
        o oVar = this.v;
        return oVar == o.RESIZE || oVar == o.MOVE;
    }

    private boolean C1(int i2, int i3, Intent intent) {
        if (w1()) {
            return true;
        }
        r7.f("SceneEdit", "delay oar, no layout yet");
        new d(i2, i3, intent).sendEmptyMessageDelayed(0, 50L);
        return false;
    }

    private boolean D1(int i2, int i3) {
        this.X = System.currentTimeMillis();
        this.f0 = 0;
        c1();
        f1();
        if (s2()) {
            int x1 = x1(i2, i3);
            if (x1 != -1) {
                this.Y = x1;
                hk a1 = this.j0.a1(x1);
                this.Z = i2 - a1.H1();
                this.a0 = i3 - a1.J1();
                this.V = this.Y;
                o oVar = this.v;
                if (oVar != o.MOVE) {
                    o oVar2 = o.RESIZE;
                    int F1 = oVar == oVar2 ? a1.F1() / 2 : Math.max((a1.F1() * 30) / 100, 40);
                    int R0 = this.v == oVar2 ? a1.R0() / 2 : Math.max((a1.R0() * 30) / 100, 40);
                    if (this.Z < F1) {
                        this.f0 |= 8;
                    }
                    if (i2 > a1.m1() - F1) {
                        this.f0 |= 2;
                    }
                    if (this.a0 < R0) {
                        this.f0 |= 1;
                    }
                    if (i3 > a1.B0() - R0) {
                        this.f0 |= 4;
                    }
                }
            } else if (!B1()) {
                this.Y = x1;
                this.V = x1;
            }
            m1();
            O1();
            if (this.v == o.NORMAL) {
                l2(0, 1000L);
            }
        } else if (this.w == o.NORMAL) {
            int V1 = (this.j0.V1() * 30) / 100;
            int l1 = (this.j0.l1() * 30) / 100;
            if (i2 <= V1) {
                this.f0 |= 8;
            }
            if (i2 >= this.j0.V1() - V1) {
                this.f0 |= 2;
            }
            if (i3 <= l1) {
                this.f0 |= 1;
            }
            if (i3 >= this.j0.l1() - l1) {
                this.f0 |= 4;
            }
            if (this.f0 != 0) {
                K1(RFactory.raw.joda_america_thule);
                this.I.invalidate();
            }
        }
        this.b0 = i2;
        this.c0 = i3;
        this.d0 = i2;
        this.e0 = i3;
        return true;
    }

    private boolean E1(int i2, int i3) {
        int i4;
        int i5;
        this.d0 = i2;
        this.e0 = i3;
        if (s2()) {
            if (i1(i2, i3) > 20 && this.V != -1) {
                m2(0);
                hk a1 = this.j0.a1(this.Y);
                if (!a1.E2() && !a1.s2()) {
                    Rect D0 = a1.D0();
                    if (this.f0 == 0) {
                        W1(a1, this.I.f(i2 - this.Z), a1.F1());
                        X1(a1, this.I.g(i3 - this.a0), a1.R0());
                    } else {
                        int f2 = this.I.f(i2);
                        int g2 = this.I.g(i3);
                        int F1 = a1.F1() / 2;
                        int R0 = a1.R0() / 2;
                        if (f2 < a1.H1() + F1 && (this.f0 & 8) != 0 && f2 >= 0) {
                            int F12 = a1.F1() + (a1.H1() - f2);
                            if (F12 >= 40) {
                                a1.K3(f2);
                                a1.I3(this.I.f(F12));
                            }
                            this.f0 &= -3;
                        }
                        if (f2 >= a1.H1() + F1 && f2 < this.j0.V1() && (this.f0 & 2) != 0) {
                            int F13 = (a1.F1() + f2) - a1.m1();
                            if (F13 >= 40 && a1.H1() + F13 < this.j0.V1()) {
                                a1.I3(F13);
                            }
                            this.f0 &= -9;
                        }
                        if (g2 < a1.J1() + R0 && g2 >= 0 && (this.f0 & 1) != 0) {
                            int R02 = a1.R0() + (a1.J1() - g2);
                            if (R02 >= 40) {
                                a1.M3(g2);
                                a1.q3(this.I.g(R02));
                            }
                            this.f0 &= -5;
                        }
                        if (g2 > a1.J1() + R0 && (this.f0 & 4) != 0 && g2 < this.j0.l1()) {
                            int R03 = (a1.R0() + g2) - a1.B0();
                            if (R03 >= 40) {
                                a1.q3(R03);
                            }
                            this.f0 &= -2;
                            V1();
                        }
                    }
                    if (!a1.D0().equals(D0)) {
                        k1(this.Y);
                        O1();
                        V1();
                    }
                }
            }
        } else if (this.w == o.NORMAL) {
            d2(false);
            int I2 = dq.I2(this.j0.D1() / 2);
            int i6 = this.f0;
            if ((i6 & 8) > 0) {
                i4 = i2 <= 0 ? I2 : i2 > I2 ? 0 - I2 : 0;
                this.f0 = i6 & (-3);
            } else {
                i4 = 0;
            }
            if ((this.f0 & 2) > 0) {
                if (i2 > this.I.getWidth()) {
                    i4 = I2;
                } else if (i2 < this.I.getWidth() - I2) {
                    i4 = 0 - I2;
                }
                this.f0 &= -9;
            }
            int i7 = this.f0;
            if ((i7 & 1) > 0) {
                i5 = i3 < 0 ? I2 : i3 > I2 ? 0 - I2 : 0;
                this.f0 = i7 & (-5);
            } else {
                i5 = 0;
            }
            if ((this.f0 & 4) > 0) {
                if (i3 <= this.I.getHeight()) {
                    I2 = i3 < this.I.getHeight() - I2 ? 0 - I2 : i5;
                }
                this.f0 &= -2;
                i5 = I2;
            }
            u1(i4, i5);
        }
        return false;
    }

    private boolean F1(int i2, int i3) {
        int i4;
        if (!s2() && this.w == o.RESIZE) {
            return true;
        }
        if (s2()) {
            m2(0);
            if (B1()) {
                O1();
            } else if (System.currentTimeMillis() - this.X < 1000 && (i4 = this.Y) != -1) {
                hk a1 = this.j0.a1(i4);
                if (!a1.E2() && !a1.s2() && i1(i2, i3) < 20) {
                    V1();
                    int i5 = this.Y;
                    j2(i5, this.j0.a1(i5));
                }
            }
            this.V = -1;
            m1();
        } else if (this.f0 != 0) {
            j1();
            d2(true);
        }
        if (this.l0) {
            U1();
        } else {
            H1();
        }
        f1();
        this.X = -1L;
        return false;
    }

    private void G1() {
        setContentView(2131494213);
        this.K = (TextView) findViewById(2131297602);
        this.J = (ViewGroup) findViewById(2131296437);
        ImageView imageView = (ImageView) findViewById(2131296575);
        this.A = imageView;
        imageView.setOnClickListener(this);
        dq.T2(this.A, 2131887543, true);
        ImageView imageView2 = (ImageView) findViewById(2131296413);
        this.P = imageView2;
        dq.T2(imageView2, 2131891275, true);
        ImageView imageView3 = (ImageView) findViewById(2131296407);
        this.Q = imageView3;
        dq.T2(imageView3, 2131891154, true);
        ImageView imageView4 = (ImageView) findViewById(2131296409);
        this.N = imageView4;
        dq.T2(imageView4, 2131891190, true);
        ImageView imageView5 = (ImageView) findViewById(2131296411);
        this.O = imageView5;
        dq.T2(imageView5, 2131891234, true);
        ImageView imageView6 = (ImageView) findViewById(2131296414);
        this.T = imageView6;
        dq.T2(imageView6, 2131891275, true);
        ImageView imageView7 = (ImageView) findViewById(2131296408);
        this.U = imageView7;
        dq.T2(imageView7, 2131891154, true);
        ImageView imageView8 = (ImageView) findViewById(2131296410);
        this.R = imageView8;
        dq.T2(imageView8, 2131891190, true);
        ImageView imageView9 = (ImageView) findViewById(2131296412);
        this.S = imageView9;
        dq.T2(imageView9, 2131891234, true);
        for (int i2 : n0) {
            findViewById(i2).setOnClickListener(this);
        }
        a aVar = new a();
        ImageView imageView10 = (ImageView) findViewById(2131296585);
        this.E = imageView10;
        imageView10.setOnClickListener(aVar);
        dq.T2(this.E, 2131890088, true);
        ImageView imageView11 = (ImageView) findViewById(2131296586);
        this.F = imageView11;
        imageView11.setOnClickListener(aVar);
        dq.T2(this.F, 2131890088, true);
        this.L = (TextView) findViewById(2131296963);
        ImageView imageView12 = (ImageView) findViewById(2131296577);
        this.z = imageView12;
        imageView12.setOnClickListener(this);
        dq.T2(this.z, 2131886819, true);
        ImageView imageView13 = (ImageView) findViewById(2131296452);
        this.B = imageView13;
        imageView13.setOnClickListener(this);
        dq.T2(this.B, 2131889800, true);
        ImageView imageView14 = (ImageView) findViewById(2131296488);
        this.D = imageView14;
        imageView14.setOnClickListener(this);
        dq.T2(this.D, 2131887536, true);
        ImageView imageView15 = (ImageView) findViewById(2131296487);
        this.C = imageView15;
        imageView15.setOnClickListener(this);
        dq.T2(this.C, 2131887536, true);
        ImageView imageView16 = (ImageView) findViewById(2131296574);
        this.G = imageView16;
        imageView16.setOnClickListener(this);
        dq.T2(this.G, 2131887543, true);
        this.H = (ViewGroup) findViewById(2131296763);
        MyRelativeLayout myRelativeLayout = (MyRelativeLayout) findViewById(2131296865);
        this.I = myRelativeLayout;
        myRelativeLayout.setOnTouchListener(this);
        this.I.setFrameWidth(8);
        this.I.setOnLayoutCallback(new b());
        K1(2131100595);
    }

    private void H1() {
        if (this.k0.size() > 0) {
            this.k0.remove(r0.size() - 1);
        }
    }

    private boolean I1() {
        this.v = o.NORMAL;
        this.j0.I3(1.0d, false);
        Intent intent = new Intent();
        if (r2()) {
            intent.putExtra("sc", this.j0.U(0).c0());
        } else {
            to.h2(this).y0(this.j0, -1);
            intent.putExtra("sc", this.j0.getName());
        }
        MyActivity.X(this, -1, intent);
        finish();
        return true;
    }

    private void J1() {
        int R0 = this.j0.R0(this);
        this.I.setBackgroundColor(R0);
        if (this.j0.o2()) {
            this.j0.z1().setBackgroundColor(R0);
        }
    }

    private void K1(int i2) {
        this.I.setFrameColour(yd.k0.c(getResources(), i2, null));
    }

    public void L1(int i2) {
        int i3 = this.Y;
        if (i3 == i2) {
            k1(i3);
            return;
        }
        this.j0.q3(i3, i2);
        this.Y = i2;
        this.j0.Z2();
        m1();
    }

    private void M1() {
        int width = (this.H.getWidth() - this.j0.V1()) / 2;
        int height = (this.H.getHeight() - this.j0.l1()) / 2;
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.I.getLayoutParams();
        if (layoutParams == null) {
            layoutParams = new RelativeLayout.LayoutParams(this.j0.V1(), this.j0.l1());
        } else {
            layoutParams.width = this.j0.V1();
            layoutParams.height = this.j0.l1();
        }
        layoutParams.leftMargin = width;
        layoutParams.topMargin = height;
        this.I.setLayoutParams(layoutParams);
    }

    public void N1() {
        this.C.setVisibility((!s2() || this.j0.t1() <= 0) ? 4 : 0);
    }

    public void O1() {
        boolean z = false;
        if (s2()) {
            if (this.j0.t1() == 0 && this.v == o.NORMAL) {
                this.L.setText(vh.g(this, 2131888235, new Object[0]));
                z = true;
            }
            int i2 = this.Y;
            if (i2 >= 0) {
                Q1(this.j0.a1(i2));
            } else {
                R1();
            }
        } else {
            R1();
        }
        dq.Y2(this.L, z);
    }

    private void P1() {
        dk dkVar = this.j0;
        if (dkVar != null) {
            com.joaomgcd.taskerm.util.x2.Y4(this, cl.h5(dkVar.W0()), "SceneEdit:setRequestedOrientation");
        }
    }

    public void Q1(hk hkVar) {
        String str = hkVar.getName() + ConstantsCommonTaskerServer.ID_SEPARATOR + dq.u0(hkVar.D1());
        ActionBar S = net.dinglisch.android.taskerm.a.S(this, "SceneEdit/ssfe");
        if (S != null) {
            S.setSubtitle(str);
        }
        this.K.setText(str);
    }

    private void R1() {
        ActionBar S = net.dinglisch.android.taskerm.a.S(this, "SceneEdit/ssfs");
        if (S != null) {
            S.setSubtitle(this.j0.getName() + ": " + dq.i1(this.j0.S1(), this.j0.Q1()));
        }
    }

    private void S1() {
        this.G.setVisibility(0);
    }

    private void T1(boolean z) {
        int J = tp.J(this, z ? 2130969312 : 2130969311);
        this.E.setImageResource(J);
        this.F.setImageResource(J);
        this.y = z;
    }

    public void U1() {
        this.z.setVisibility(this.k0.size() > 0 ? 0 : 4);
    }

    public void V1() {
        this.l0 = true;
    }

    public void W1(hk hkVar, int i2, int i3) {
        int r1 = r1();
        if (i2 + i3 > r1) {
            hkVar.K3(r1 - i3);
        } else if (i2 < 0) {
            hkVar.K3(0);
        } else {
            hkVar.K3(i2);
        }
    }

    public void X1(hk hkVar, int i2, int i3) {
        int q1 = q1();
        if (i2 + i3 > q1) {
            hkVar.M3(q1 - i3);
        } else if (i2 < 0) {
            hkVar.M3(0);
        } else {
            hkVar.M3(i2);
        }
    }

    public void Y1() {
        int D1 = this.j0.D1();
        MyRelativeLayout myRelativeLayout = this.I;
        if (!s2()) {
            D1 = 0;
        }
        myRelativeLayout.setGridCellSize(D1);
        this.I.setFrame(false);
        this.I.invalidate();
    }

    private void Z1() {
        Drawable b2 = br.b(this, br.a.Launcher);
        if (b2 != null) {
            yd.x0.c(this.H, b2);
            return;
        }
        int B = tp.B(this);
        if (B == -1) {
            B = -16777216;
        }
        this.H.setBackgroundColor(B);
    }

    public void a2() {
        TextBoxDialogFragment.Z(this, new l(), -1, dq.r0(this, 2131887318, this.j0.a1(this.Y).getName()));
    }

    public static void b2(Activity activity, View view, dk dkVar, mh.f fVar, boolean z) {
        SceneEditElement.m l3 = SceneEditElement.l3(dkVar.getName());
        mh mhVar = new mh(activity, view);
        Iterator<String> it = dkVar.F1().iterator();
        int i2 = -1;
        int i3 = 0;
        while (it.hasNext()) {
            String[] split = it.next().split("::dvd::");
            hk.k valueOf = hk.k.valueOf(split[1]);
            if (l3 != null && l3.a.equals(split[0])) {
                i2 = i3;
            }
            mhVar.n(i3, split[0], hk.U0(valueOf));
            i3++;
        }
        if (i2 >= 0) {
            mhVar.E(i2, true, true);
        }
        mhVar.F(fVar).I();
        if (z) {
            mhVar.x();
        }
        mhVar.show();
    }

    public void c1() {
        List<dk> list = this.k0;
        if (list != null) {
            list.add(this.j0.B0());
            if (this.k0.size() > 10) {
                this.k0.remove(0);
            }
        }
    }

    private void c2(View view) {
        b2(this, view, this.j0, new e(), true);
    }

    private double d1(boolean z) {
        if (z) {
            return Math.min(this.H.getWidth() / this.j0.V1(), this.H.getHeight() / this.j0.l1());
        }
        return 1.0d;
    }

    private void d2(boolean z) {
        ActionBar S = net.dinglisch.android.taskerm.a.S(this, "SceneEdit/showHideHeaderFooter");
        if (S != null) {
            if (!z) {
                z = (this.H.getHeight() - this.I.getHeight()) / 2 >= S.getHeight() + 10;
            }
            boolean isShowing = getActionBar().isShowing();
            if (z) {
                if (isShowing) {
                    return;
                }
                S.show();
                this.J.setVisibility(0);
                return;
            }
            if (isShowing) {
                S.hide();
                this.J.setVisibility(4);
            }
        }
    }

    private void e1() {
        r7.f("SceneEdit", "check init map");
        if (this.m0 || !this.j0.k2(hk.k.MAP)) {
            return;
        }
        r7.f("SceneEdit", "play services initialized OK");
        w9.d.a(this);
        this.m0 = true;
    }

    public void e2(int i2, int i3, View view) {
        mh mhVar = new mh(this, view);
        mhVar.setHorizontalOffset(0 - this.B.getWidth());
        mhVar.I();
        for (hk.k kVar : hk.k.values()) {
            if (hk.A2(kVar) && (!o1() || !hk.u2(kVar))) {
                mhVar.n(kVar.ordinal(), hk.d1(getResources(), kVar), hk.U0(kVar));
            }
        }
        hk hkVar = o0;
        if (hkVar != null) {
            hk.k C1 = hkVar.C1();
            hk.k kVar2 = hk.k.MAP;
            if (C1 != kVar2 || this.j0.u1(kVar2) == 0) {
                mhVar.l(5834324, 2131888935, 2130969243, mh.d.Top);
            }
        }
        if (Settings.j1(dq.R0(this))) {
            mhVar.G(2131887540);
        }
        mhVar.F(new f(i2, i3)).show();
    }

    private void f1() {
        this.l0 = false;
    }

    public void f2() {
        int i2;
        int t1;
        if (this.j0.g2()) {
            i2 = this.Y;
            t1 = this.j0.t1() - 1;
        } else {
            i2 = this.Y + 1;
            t1 = this.j0.t1();
        }
        new fn(this).a(2131888977, i2, 1, t1, new h()).show();
    }

    public void g1(int i2) {
        int i3 = i2 * 2;
        this.I.removeViewAt(i3);
        this.I.removeViewAt(i3);
        this.j0.D0(i2);
        N1();
    }

    private void g2() {
        TextBoxDialogFragment.Y(this, new k(), 2131887167);
    }

    private void h1() {
        List<dk> list = this.k0;
        if (list != null) {
            list.clear();
            this.k0 = null;
        }
        this.I = null;
        this.H = null;
        this.J = null;
        dk dkVar = this.j0;
        if (dkVar != null) {
            dkVar.v0();
            this.j0.E3(null);
            this.j0 = null;
        }
        this.z = null;
        this.A = null;
        this.C = null;
        this.D = null;
        this.B = null;
        this.E = null;
        this.F = null;
        this.G = null;
        this.K = null;
        this.L = null;
        this.N = null;
        this.O = null;
        this.P = null;
        this.Q = null;
        this.R = null;
        this.S = null;
        this.T = null;
        this.U = null;
        System.gc();
    }

    private void h2() {
        new fn(this).a(2131888974, this.j0.E1(), 0, 60, new i()).show();
    }

    private int i1(int i2, int i3) {
        return Math.abs(Math.abs(this.b0) - Math.abs(i2)) + Math.abs(Math.abs(this.c0) - Math.abs(i3));
    }

    private void i2(View view) {
        mh mhVar = new mh(this, view);
        for (o oVar : s2() ? o.values() : new o[]{o.NORMAL, o.RESIZE}) {
            mhVar.m(oVar.ordinal(), this.x[oVar.ordinal()], mh.d.Bottom);
        }
        mhVar.G(2131887543);
        mhVar.E((s2() ? this.v : this.w).ordinal(), true, false);
        mhVar.F(new j()).show();
    }

    private void j1() {
        this.j0.K0();
        M1();
        if (this.j0.g2()) {
            this.j0.U3();
        }
        m1();
        K1(2131100595);
        this.I.postInvalidate();
        this.H.postInvalidate();
    }

    public void j2(int r6, net.dinglisch.android.taskerm.hk r7) {
        throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.SceneEdit.j2(int, net.dinglisch.android.taskerm.hk):void");
    }

    public void k1(int i2) {
        l1(i2, true);
    }

    public void k2() {
        startActivityForResult(new Intent(this, (Class<?>) SceneEditElement.class).putExtra("el", this.j0.B1(true).U(0).c0()).putExtra("sc", this.j0.U(0).c0()), 1);
    }

    private void l1(int i2, boolean z) {
        if (i2 != -1) {
            hk a1 = this.j0.a1(i2);
            boolean z2 = false;
            boolean z3 = this.V == i2;
            boolean z4 = a1.E2() || a1.s2();
            boolean z5 = !z4 && z3 && this.f0 > 0;
            if (!z4 && z3 && this.f0 == 0) {
                z2 = true;
            }
            a1.d4(z);
            int i3 = 2131100612;
            if (s2()) {
                if (z5) {
                    i3 = RFactory.raw.joda_america_thule;
                } else if (z2) {
                    i3 = RFactory.raw.joda_america_swift_current;
                } else if (i2 == this.Y && this.v != o.NORMAL) {
                    i3 = tp.E(this, 2130968879, true);
                } else if (!a1.I2()) {
                    i3 = RFactory.raw.joda_america_st_vincent;
                } else if (!z4) {
                    i3 = RFactory.raw.joda_america_tegucigalpa;
                }
            }
            a1.k3(yd.k0.c(getResources(), i3, null));
            if (this.I.h()) {
                this.I.invalidate();
            }
        }
    }

    private void l2(int i2, long j2) {
        Handler handler = this.M[i2];
        if (handler != null) {
            handler.removeMessages(i2);
        }
        this.M[i2] = new m(i2);
        this.M[i2].sendEmptyMessageDelayed(i2, j2);
    }

    public void m1() {
        n1(true);
    }

    private void m2(int i2) {
        Handler handler = this.M[i2];
        if (handler != null) {
            handler.removeMessages(i2);
            this.M[i2] = null;
        }
    }

    private void n1(boolean z) {
        for (int i2 = 0; i2 < this.j0.t1(); i2++) {
            l1(i2, z);
        }
        System.gc();
    }

    private void n2() {
        for (int i2 = 0; i2 < 2; i2++) {
            m2(i2);
        }
    }

    private boolean o1() {
        return (this.h0 & 1) > 0;
    }

    private void o2(String str) {
        dq.S0(this).edit().putString("lScn", str).commit();
    }

    public static String p1(Context context, uo uoVar) {
        String string = dq.S0(context).getString("lScn", g6.n.b.a);
        if (!TextUtils.isEmpty(string)) {
            if (uoVar == null) {
                r7.f("SceneEdit", "getLastScene: null data");
            } else {
                if (uoVar.p(string)) {
                    return string;
                }
                r7.f("SceneEdit", "getLastScene: unknown scene: " + string);
            }
        }
        return null;
    }

    public void p2(String str, o oVar) {
        boolean z = oVar == o.MOVE || oVar == o.RESIZE;
        dq.Y2(this.N, z);
        dq.Y2(this.O, z);
        dq.Y2(this.P, z);
        ImageView imageView = this.R;
        o oVar2 = o.RESIZE;
        dq.Y2(imageView, oVar == oVar2);
        dq.Y2(this.S, oVar == oVar2);
        dq.Y2(this.U, oVar == oVar2);
        dq.Y2(this.T, oVar == oVar2);
        ViewGroup viewGroup = this.J;
        o oVar3 = o.NORMAL;
        dq.Y2(viewGroup, oVar == oVar3);
        dq.Y2(this.A, oVar != oVar3);
        dq.Y2(this.D, oVar != oVar3);
        dq.Y2(this.F, z);
        dq.Y2(this.K, oVar != oVar3);
        this.Q.setVisibility(z ? 0 : 4);
        ActionBar S = net.dinglisch.android.taskerm.a.S(this, "SceneEdit/switchTouchMode");
        if (S != null) {
            if (oVar == oVar3) {
                S.show();
            } else {
                S.hide();
            }
        }
        O1();
    }

    public int q1() {
        return this.I.getHeight();
    }

    private void q2() {
        if (this.k0.size() > 0) {
            dk remove = this.k0.remove(r0.size() - 1);
            this.j0.E3(null);
            this.j0.v0();
            this.j0 = remove;
            remove.H3(d1(s2()));
            if (this.Y >= this.j0.t1()) {
                this.Y = -1;
            }
            y1("undo");
            U1();
        }
    }

    public int r1() {
        return this.I.getWidth();
    }

    private boolean r2() {
        return (this.h0 & 2) > 0;
    }

    private void s1(int r17, int r18) {
        throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.SceneEdit.s1(int, int):void");
    }

    public boolean s2() {
        return this.y;
    }

    public void t1(int i2) {
        V1();
        hk a1 = this.j0.a1(i2);
        View findViewById = findViewById(R.id.home);
        if (findViewById == null && !dq.T1()) {
            findViewById = this.B;
        }
        if (findViewById == null) {
            findViewById = a1.y0();
        }
        if (findViewById == null) {
            findViewById = a1.J0();
        }
        if (findViewById == null) {
            findViewById = a1.I0();
        }
        if (findViewById == null) {
            findViewById = this.B;
        }
        mh mhVar = new mh(this, findViewById);
        boolean t2 = a1.t2();
        if (!t2) {
            mhVar.k(n.Delete.ordinal(), 2131888810, 2130969299);
        }
        if (a1.s2()) {
            mhVar.k(n.Add.ordinal(), 2131888975, 2130969155);
            mhVar.k(n.Edit.ordinal(), 2131888833, 2130969197);
        }
        if (!a1.s2() && !t2) {
            mhVar.k(n.Copy.ordinal(), 2131888801, 2130969183);
        }
        if ((!this.j0.g2() || a1.s2()) && !t2) {
            if (a1.s2()) {
                mhVar.k(n.SetForeground.ordinal(), 2131889000, 2130969210);
            } else {
                mhVar.k(n.SetBackground.ordinal(), 2131888999, 2130969210);
            }
        }
        if (!a1.s2() && ((!this.j0.g2() && this.j0.t1() > 1) || (this.j0.g2() && this.j0.t1() > 2))) {
            mhVar.k(n.SetDepth.ordinal(), 2131888977, 2130969188);
        }
        mhVar.k(n.Focus.ordinal(), 2131888868, a1.i4() ? 2130969239 : 2130969208);
        if (!a1.s2()) {
            if (a1.I2()) {
                mhVar.k(n.SetInvisible.ordinal(), 2131888881, 2130969307);
            } else {
                mhVar.k(n.SetVisible.ordinal(), 2131889011, 2130969307);
            }
            if (a1.E2()) {
                mhVar.k(n.Unpin.ordinal(), 2131889080, 2130969248);
            } else {
                mhVar.k(n.Pin.ordinal(), 2131888938, 2130969248);
            }
        }
        mhVar.F(new g(i2, a1)).G(2131887534).show();
    }

    private void u1(int i2, int i3) {
        boolean z;
        if (i2 == 0 && i3 == 0) {
            return;
        }
        int V1 = this.j0.V1() + i2;
        int i4 = 40;
        if (V1 >= this.H.getWidth()) {
            V1 = this.H.getWidth();
        } else if (V1 < 40) {
            V1 = 40;
        }
        int l1 = this.j0.l1() + i3;
        if (l1 >= this.H.getHeight()) {
            i4 = this.H.getHeight();
        } else if (l1 >= 40) {
            i4 = l1;
        }
        boolean z2 = true;
        if (V1 != this.j0.V1()) {
            r2 = V1 < this.j0.V1();
            this.j0.O3(V1);
            z = true;
        } else {
            z = false;
        }
        if (i4 != this.j0.l1()) {
            if (!r2) {
                this.j0.l1();
            }
            this.j0.u3(i4);
        } else {
            z2 = z;
        }
        if (z2) {
            M1();
            if (this.j0.g2()) {
                this.j0.U3();
            }
            O1();
            V1();
            this.H.postInvalidate();
        }
    }

    public void v1() {
        T1(!this.y);
        y1("zoom");
        this.H.postInvalidate();
        if (this.y) {
            lp.d(this, 2131890935);
        }
    }

    public boolean w1() {
        return (this.I.getWidth() == 0 || this.I.getHeight() == 0 || this.H.getWidth() == 0 || this.H.getHeight() == 0) ? false : true;
    }

    public int x1(int i2, int i3) {
        int i4 = -1;
        for (int t1 = this.j0.t1() - 1; t1 >= 0; t1--) {
            hk a1 = this.j0.a1(t1);
            if (a1.m2(i2, i3)) {
                if (!a1.E2() && !a1.s2()) {
                    return t1;
                }
                if (i4 == -1) {
                    i4 = t1;
                }
            }
        }
        return i4;
    }

    public void y1(String str) {
        r7.f("SceneEdit", "init (" + str + ")");
        dk dkVar = this.j0;
        if (dkVar == null) {
            MyActivity.L(this, "init s null");
            return;
        }
        dkVar.I0();
        dkVar.E3(this.I);
        dkVar.H3(1.0d);
        dkVar.t2(this.H.getWidth(), this.H.getHeight());
        dkVar.H3(d1(this.y));
        M1();
        dkVar.y0(this, 6);
        dkVar.G0(MyMapView.a.Resume, null);
        dkVar.X3(this, to.h2(this), 2);
        dkVar.Z2();
        J1();
        O1();
        this.B.setVisibility(s2() ? 0 : 4);
        N1();
        m1();
        Y1();
        U1();
        S1();
        this.I.setFrame(!s2());
        p2("init", s2() ? this.v : this.w);
    }

    public static void z1(dk dkVar, hk hkVar, int i2, int i3) {
        boolean i22 = hkVar.i2();
        boolean k2 = hkVar.k2();
        boolean g2 = hkVar.g2();
        boolean V1 = hkVar.V1();
        if (!g2) {
            hkVar.I3(hkVar.G0(dkVar.S1()));
        }
        if (!V1) {
            hkVar.q3(hkVar.F0(dkVar.Q1()));
        }
        if (!i22) {
            if (i2 != -1) {
                hkVar.K3(i2);
            } else {
                hkVar.K3((dkVar.S1() - hkVar.F1()) / 2);
            }
        }
        if (k2) {
            return;
        }
        if (i3 != -1) {
            hkVar.M3(i3);
        } else {
            hkVar.M3((dkVar.Q1() - hkVar.R0()) / 2);
        }
    }

    @Override
    protected void onActivityResult(int r9, int r10, android.content.Intent r11) {
        throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.SceneEdit.onActivityResult(int, int, android.content.Intent):void");
    }

    @Override
    public void onBackPressed() {
        if (s2()) {
            o oVar = this.v;
            o oVar2 = o.NORMAL;
            if (oVar != oVar2) {
                this.v = oVar2;
                p2("back", oVar2);
                m1();
                return;
            }
        }
        if (!s2()) {
            o oVar3 = this.w;
            o oVar4 = o.NORMAL;
            if (oVar3 != oVar4) {
                this.w = oVar4;
                p2("back", oVar4);
                return;
            }
        }
        I1();
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == 2131296577) {
            q2();
            return;
        }
        if (id == 2131296487 || id == 2131296488) {
            c2(view);
            return;
        }
        if (id == 2131296452) {
            this.b0 = -1;
            this.c0 = -1;
            e2(0, 0, view);
            return;
        }
        if (id == 2131296574 || id == 2131296575) {
            i2(view);
            return;
        }
        if (id == 2131296409) {
            s1(-1, 0);
            return;
        }
        if (id == 2131296411) {
            s1(1, 0);
            return;
        }
        if (id == 2131296413) {
            s1(0, -1);
            return;
        }
        if (id == 2131296407) {
            s1(0, 1);
            return;
        }
        if (id == 2131296410) {
            s1(-2, 0);
            return;
        }
        if (id == 2131296412) {
            s1(2, 0);
        } else if (id == 2131296414) {
            s1(0, -2);
        } else if (id == 2131296408) {
            s1(0, 2);
        }
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        w6.e(getBaseContext());
        this.j0.I0();
        this.j0.D3(configuration.orientation);
        G1();
        Z1();
        T1(this.y);
        p2("onConfig", this.v);
    }

    @Override
    public void onCreate(Bundle bundle) {
        Configuration configuration;
        r7.f("SceneEdit", "oncreate");
        MyActivity.W(this, 0);
        getWindow().requestFeature(9);
        super.onCreate(bundle);
        G1();
        Resources resources = getResources();
        boolean z = true;
        ActionBar T = net.dinglisch.android.taskerm.a.T(this, true);
        if (T != null) {
            T.setTitle(vh.g(this, 2131886729, new Object[0]));
            T.setBackgroundDrawable(yd.k0.g(resources, tp.J(this, 2130968982), null));
        }
        if (bundle == null) {
            this.W = System.currentTimeMillis();
            r7.f("SceneEdit", "no icicle");
            Intent intent = getIntent();
            if (intent.hasExtra(ProfileManager.EXTRA_PROFILE_NAME)) {
                String stringExtra = intent.getStringExtra(ProfileManager.EXTRA_PROFILE_NAME);
                to h2 = to.h2(this);
                if (h2.p(stringExtra)) {
                    this.j0 = h2.z2(stringExtra).B0();
                    this.h0 = intent.getIntExtra("flags", 0);
                    this.i0 = intent.getIntExtra("projectid", -1);
                } else {
                    dk dkVar = new dk();
                    this.j0 = dkVar;
                    dkVar.G(stringExtra);
                }
            } else if (intent.hasExtra("sc")) {
                this.j0 = new dk(new qi(intent.getBundleExtra("sc")));
            } else {
                r7.k("SceneEdit", "no name or scene bundle");
            }
            z = false;
            this.h0 = intent.getIntExtra("flags", 0);
            this.i0 = intent.getIntExtra("projectid", -1);
        } else {
            this.j0 = new dk(new qi(bundle.getBundle("sc")));
            if (bundle.containsKey("tm")) {
                this.v = o.valueOf(bundle.getString("tm"));
            }
            this.h0 = bundle.getInt("flags", 0);
            this.i0 = bundle.getInt("projectid", -1);
            this.g0 = bundle.getInt("ei");
            this.W = bundle.getLong("ct");
            z = bundle.getBoolean("zoomed");
        }
        P1();
        T1(z);
        this.j0.r0(getPackageManager(), to.h2(this));
        if (resources != null && (configuration = resources.getConfiguration()) != null) {
            this.j0.D3(configuration.orientation);
        }
        p2("onCreate", this.v);
        if (!z) {
            lp.d(this, 2131890934);
        }
        T.setSubtitle(this.j0.getName());
        Z1();
        o2(this.j0.getName());
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        menu.add(0, 5, 0, vh.g(this, 2131888788, new Object[0]));
        menu.add(0, 3, 0, vh.g(this, 2131888974, new Object[0]));
        menu.add(0, 8, 0, vh.g(this, 2131886896, new Object[0]));
        dq.l(this, menu, 7, 6);
        net.dinglisch.android.taskerm.a.d(this, 0, menu);
        return true;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.j0.G0(MyMapView.a.Destroy, null);
        MyActivity.e0(this, 2131297324);
        h1();
        if (Settings.f3(this)) {
            i4.a();
        }
    }

    @Override
    public void onLowMemory() {
        super.onLowMemory();
        this.j0.G0(MyMapView.a.LowMemory, null);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        int itemId = menuItem.getItemId();
        if (itemId == 0) {
            finish();
            return true;
        }
        if (itemId == 3) {
            h2();
            return true;
        }
        if (itemId == 16908332) {
            I1();
            return true;
        }
        if (itemId == 5) {
            g2();
            return true;
        }
        if (itemId == 6) {
            HTMLView.G0(this, "index.html");
            return true;
        }
        if (itemId == 7) {
            HTMLView.H0(this, "activity_sceneedit.html", -1, HTMLView.g.Inform);
            return true;
        }
        if (itemId != 8) {
            return true;
        }
        k2();
        return true;
    }

    @Override
    public void onPause() {
        super.onPause();
        this.j0.G0(MyMapView.a.Pause, null);
        n2();
    }

    @Override
    public void onResume() {
        super.onResume();
        e1();
        this.j0.G0(MyMapView.a.Resume, null);
    }

    @Override
    protected void onSaveInstanceState(Bundle bundle) {
        super.onSaveInstanceState(bundle);
        r7.f("SceneEdit", "osis");
        bundle.putBundle("sc", this.j0.U(0).c0());
        bundle.putString("tm", this.v.toString());
        bundle.putInt("flags", this.h0);
        bundle.putInt("ei", this.g0);
        bundle.putLong("ct", this.W);
        bundle.putBoolean("zoomed", this.y);
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        int x = (int) motionEvent.getX();
        int y = (int) motionEvent.getY();
        int action = motionEvent.getAction();
        if (action == 0) {
            return D1(x, y);
        }
        if (action == 1) {
            return F1(x, y);
        }
        if (action == 2) {
            return E1(x, y);
        }
        if (action != 3) {
            r7.f("SceneEdit", "unhandled touch event: " + motionEvent.getAction());
        } else {
            d2(true);
        }
        return false;
    }
}