导航菜单

页面标题

页面副标题

Tasker v6.6.3 - SceneEdit.java 源代码

正在查看: Tasker v6.6.3 应用的 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.d6;
import net.dinglisch.android.taskerm.fh;
import net.dinglisch.android.taskerm.gr;
import net.dinglisch.android.taskerm.pm;
import net.dinglisch.android.taskerm.qj;
import net.dinglisch.android.taskerm.ud;

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 qj 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 mj j0;
    private List<mj> 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 && (((pp.Q1(SceneEdit.this) && i >= i2) || (!pp.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(qj.f1(SceneEdit.this.getResources(), qj.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 {
                    o7.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 fh.f {
        e() {
        }

        @Override
        public void a(fh fhVar) {
            if (fhVar.v()) {
                return;
            }
            String B = fhVar.B();
            qj 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 (fhVar.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 fh.f {
        final int a;
        final int b;

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

        @Override
        public void a(fh fhVar) {
            if (fhVar.v()) {
                return;
            }
            SceneEdit.this.c1();
            SceneEdit.this.U1();
            int A = fhVar.A();
            if (A == 5834324) {
                qj L = SceneEdit.o0.L(true);
                L.w3(SceneEdit.this.j0.s1(L.getName()));
                SceneEdit.this.W1(L, this.a, L.H1());
                SceneEdit.this.X1(L, this.b, L.T0());
                L.w(fo.j2(SceneEdit.this));
                SceneEdit.this.j2(-1, L);
            } else {
                qj.k kVar = qj.k.values()[A];
                if (kVar == qj.k.MAP && MyMapView.k(SceneEdit.this)) {
                    pp.i0(SceneEdit.this, "Map elements unavailable on this device due to ROM bug", new Object[0]);
                } else {
                    qj Y0 = qj.Y0(SceneEdit.this, kVar);
                    Y0.w3(SceneEdit.this.j0.r1(SceneEdit.this.getResources(), Y0.E1()));
                    SceneEdit.this.j2(-1, Y0);
                }
            }
            SceneEdit.this.N1();
        }
    }

    class g implements fh.f {
        final int a;
        final qj b;

        g(int i, qj qjVar) {
            this.a = i;
            this.b = qjVar;
        }

        @Override
        public void a(fh fhVar) {
            if (fhVar.v()) {
                return;
            }
            qj a1 = SceneEdit.this.j0.a1(this.a);
            switch (n.values()[fhVar.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.K3(SceneEdit.this.r1() / 2);
                    a1.s3(SceneEdit.this.q1() / 2);
                    a1.m(SceneEdit.this.r1(), SceneEdit.this.q1());
                    a1.X3();
                    SceneEdit.this.k1(this.a);
                    break;
                case 5:
                    a1.N2(SceneEdit.this.r1(), SceneEdit.this.q1());
                    a1.X3();
                    a1.F3(false);
                    SceneEdit.this.L1(0);
                    break;
                case ClockContract.InstancesColumns.MISSED_STATE:
                    SceneEdit.this.f2();
                    break;
                case 7:
                    if (a1.k4()) {
                        a1.J3(false);
                    } else {
                        SceneEdit.this.j0.w3(a1.getName());
                    }
                    mj mjVar = SceneEdit.this.j0;
                    SceneEdit sceneEdit2 = SceneEdit.this;
                    mjVar.X3(sceneEdit2, fo.j2(sceneEdit2), 2);
                    break;
                case 8:
                case 9:
                    this.b.I3(!r5.K2());
                    qj qjVar = this.b;
                    SceneEdit sceneEdit3 = SceneEdit.this;
                    qjVar.a4(sceneEdit3, fo.j2(sceneEdit3), 2, null);
                    SceneEdit.this.k1(this.a);
                    break;
                case 10:
                case 11:
                    SceneEdit.this.j0.a1(this.a).Y3();
                    SceneEdit.this.k1(this.a);
                    break;
            }
        }
    }

    class h implements pm.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 pm.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 fh.f {

        class a implements Runnable {
            a() {
            }

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

        j() {
        }

        @Override
        public void a(fh fhVar) {
            if (!fhVar.v()) {
                o oVar = o.values()[fhVar.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) {
                            xo.d(SceneEdit.this, 2131890958);
                        } else if (SceneEdit.this.v == o.RESIZE) {
                            xo.d(SceneEdit.this, 2131890959);
                        }
                    }
                } 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[]{2131888991, 2131886877, 2131888990, 2131888992};
        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(qj qjVar) {
        int gridSize = this.I.getGridSize();
        this.I.setGridCellSize(0);
        double A3 = qjVar.A3(1.0d);
        z1(this.j0, qjVar, this.b0, this.c0);
        Rect F0 = qjVar.F0();
        qjVar.M3(this.I.f(F0.left));
        qjVar.O3(this.I.g(F0.top));
        qjVar.K3(Math.max(1, this.I.f(F0.right) - qjVar.J1()));
        qjVar.s3(Math.max(1, this.I.g(F0.bottom) - qjVar.L1()));
        qjVar.f0(this.j0.S1(), this.j0.Q1());
        qjVar.A3(A3);
        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;
        }
        o7.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;
                qj a1 = this.j0.a1(x1);
                this.Z = i2 - a1.J1();
                this.a0 = i3 - a1.L1();
                this.V = this.Y;
                o oVar = this.v;
                if (oVar != o.MOVE) {
                    o oVar2 = o.RESIZE;
                    int H1 = oVar == oVar2 ? a1.H1() / 2 : Math.max((a1.H1() * 30) / 100, 40);
                    int T0 = this.v == oVar2 ? a1.T0() / 2 : Math.max((a1.T0() * 30) / 100, 40);
                    if (this.Z < H1) {
                        this.f0 |= 8;
                    }
                    if (i2 > a1.o1() - H1) {
                        this.f0 |= 2;
                    }
                    if (this.a0 < T0) {
                        this.f0 |= 1;
                    }
                    if (i3 > a1.D0() - T0) {
                        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);
                qj a1 = this.j0.a1(this.Y);
                if (!a1.G2() && !a1.u2()) {
                    Rect F0 = a1.F0();
                    if (this.f0 == 0) {
                        W1(a1, this.I.f(i2 - this.Z), a1.H1());
                        X1(a1, this.I.g(i3 - this.a0), a1.T0());
                    } else {
                        int f2 = this.I.f(i2);
                        int g2 = this.I.g(i3);
                        int H1 = a1.H1() / 2;
                        int T0 = a1.T0() / 2;
                        if (f2 < a1.J1() + H1 && (this.f0 & 8) != 0 && f2 >= 0) {
                            int H12 = a1.H1() + (a1.J1() - f2);
                            if (H12 >= 40) {
                                a1.M3(f2);
                                a1.K3(this.I.f(H12));
                            }
                            this.f0 &= -3;
                        }
                        if (f2 >= a1.J1() + H1 && f2 < this.j0.V1() && (this.f0 & 2) != 0) {
                            int H13 = (a1.H1() + f2) - a1.o1();
                            if (H13 >= 40 && a1.J1() + H13 < this.j0.V1()) {
                                a1.K3(H13);
                            }
                            this.f0 &= -9;
                        }
                        if (g2 < a1.L1() + T0 && g2 >= 0 && (this.f0 & 1) != 0) {
                            int T02 = a1.T0() + (a1.L1() - g2);
                            if (T02 >= 40) {
                                a1.O3(g2);
                                a1.s3(this.I.g(T02));
                            }
                            this.f0 &= -5;
                        }
                        if (g2 > a1.L1() + T0 && (this.f0 & 4) != 0 && g2 < this.j0.l1()) {
                            int T03 = (a1.T0() + g2) - a1.D0();
                            if (T03 >= 40) {
                                a1.s3(T03);
                            }
                            this.f0 &= -2;
                            V1();
                        }
                    }
                    if (!a1.F0().equals(F0)) {
                        k1(this.Y);
                        O1();
                        V1();
                    }
                }
            }
        } else if (this.w == o.NORMAL) {
            d2(false);
            int I2 = pp.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) {
                qj a1 = this.j0.a1(i4);
                if (!a1.G2() && !a1.u2() && 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(2131297604);
        this.J = (ViewGroup) findViewById(2131296437);
        ImageView imageView = (ImageView) findViewById(2131296575);
        this.A = imageView;
        imageView.setOnClickListener(this);
        pp.T2(this.A, 2131887550, true);
        ImageView imageView2 = (ImageView) findViewById(2131296413);
        this.P = imageView2;
        pp.T2(imageView2, 2131891298, true);
        ImageView imageView3 = (ImageView) findViewById(2131296407);
        this.Q = imageView3;
        pp.T2(imageView3, 2131891176, true);
        ImageView imageView4 = (ImageView) findViewById(2131296409);
        this.N = imageView4;
        pp.T2(imageView4, 2131891212, true);
        ImageView imageView5 = (ImageView) findViewById(2131296411);
        this.O = imageView5;
        pp.T2(imageView5, 2131891256, true);
        ImageView imageView6 = (ImageView) findViewById(2131296414);
        this.T = imageView6;
        pp.T2(imageView6, 2131891298, true);
        ImageView imageView7 = (ImageView) findViewById(2131296408);
        this.U = imageView7;
        pp.T2(imageView7, 2131891176, true);
        ImageView imageView8 = (ImageView) findViewById(2131296410);
        this.R = imageView8;
        pp.T2(imageView8, 2131891212, true);
        ImageView imageView9 = (ImageView) findViewById(2131296412);
        this.S = imageView9;
        pp.T2(imageView9, 2131891256, true);
        for (int i2 : n0) {
            findViewById(i2).setOnClickListener(this);
        }
        a aVar = new a();
        ImageView imageView10 = (ImageView) findViewById(2131296586);
        this.E = imageView10;
        imageView10.setOnClickListener(aVar);
        pp.T2(this.E, 2131890103, true);
        ImageView imageView11 = (ImageView) findViewById(2131296587);
        this.F = imageView11;
        imageView11.setOnClickListener(aVar);
        pp.T2(this.F, 2131890103, true);
        this.L = (TextView) findViewById(2131296964);
        ImageView imageView12 = (ImageView) findViewById(2131296577);
        this.z = imageView12;
        imageView12.setOnClickListener(this);
        pp.T2(this.z, 2131886822, true);
        ImageView imageView13 = (ImageView) findViewById(2131296452);
        this.B = imageView13;
        imageView13.setOnClickListener(this);
        pp.T2(this.B, 2131889814, true);
        ImageView imageView14 = (ImageView) findViewById(2131296488);
        this.D = imageView14;
        imageView14.setOnClickListener(this);
        pp.T2(this.D, 2131887543, true);
        ImageView imageView15 = (ImageView) findViewById(2131296487);
        this.C = imageView15;
        imageView15.setOnClickListener(this);
        pp.T2(this.C, 2131887543, true);
        ImageView imageView16 = (ImageView) findViewById(2131296574);
        this.G = imageView16;
        imageView16.setOnClickListener(this);
        pp.T2(this.G, 2131887550, true);
        this.H = (ViewGroup) findViewById(2131296764);
        MyRelativeLayout myRelativeLayout = (MyRelativeLayout) findViewById(2131296866);
        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.X(0).c0());
        } else {
            fo.j2(this).A0(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(ud.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(oh.g(this, 2131888243, new Object[0]));
                z = true;
            }
            int i2 = this.Y;
            if (i2 >= 0) {
                Q1(this.j0.a1(i2));
            } else {
                R1();
            }
        } else {
            R1();
        }
        pp.Y2(this.L, z);
    }

    private void P1() {
        mj mjVar = this.j0;
        if (mjVar != null) {
            com.joaomgcd.taskerm.util.b7.s6(this, lk.j5(mjVar.W0()), "SceneEdit:setRequestedOrientation");
        }
    }

    public void Q1(qj qjVar) {
        String str = qjVar.getName() + ConstantsCommonTaskerServer.ID_SEPARATOR + pp.u0(qjVar.F1());
        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() + ": " + pp.i1(this.j0.S1(), this.j0.Q1()));
        }
    }

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

    private void T1(boolean z) {
        int J = fp.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(qj qjVar, int i2, int i3) {
        int r1 = r1();
        if (i2 + i3 > r1) {
            qjVar.M3(r1 - i3);
        } else if (i2 < 0) {
            qjVar.M3(0);
        } else {
            qjVar.M3(i2);
        }
    }

    public void X1(qj qjVar, int i2, int i3) {
        int q1 = q1();
        if (i2 + i3 > q1) {
            qjVar.O3(q1 - i3);
        } else if (i2 < 0) {
            qjVar.O3(0);
        } else {
            qjVar.O3(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 = gr.b(this, gr.a.Launcher);
        if (b2 != null) {
            ud.x0.c(this.H, b2);
            return;
        }
        int B = fp.B(this);
        if (B == -1) {
            B = -16777216;
        }
        this.H.setBackgroundColor(B);
    }

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

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

    public void c1() {
        List<mj> 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() {
        o7.f("SceneEdit", "check init map");
        if (this.m0 || !this.j0.k2(qj.k.MAP)) {
            return;
        }
        o7.f("SceneEdit", "play services initialized OK");
        u9.d.a(this);
        this.m0 = true;
    }

    public void e2(int i2, int i3, View view) {
        fh fhVar = new fh(this, view);
        fhVar.setHorizontalOffset(0 - this.B.getWidth());
        fhVar.I();
        for (qj.k kVar : qj.k.values()) {
            if (qj.C2(kVar) && (!o1() || !qj.w2(kVar))) {
                fhVar.n(kVar.ordinal(), qj.f1(getResources(), kVar), qj.W0(kVar));
            }
        }
        qj qjVar = o0;
        if (qjVar != null) {
            qj.k E1 = qjVar.E1();
            qj.k kVar2 = qj.k.MAP;
            if (E1 != kVar2 || this.j0.u1(kVar2) == 0) {
                fhVar.l(5834324, 2131888947, 2130969243, fh.d.Top);
            }
        }
        if (Settings.j1(pp.R0(this))) {
            fhVar.G(2131887547);
        }
        fhVar.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 pm(this).a(2131888989, 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(), 2131887173);
    }

    private void h1() {
        List<mj> list = this.k0;
        if (list != null) {
            list.clear();
            this.k0 = null;
        }
        this.I = null;
        this.H = null;
        this.J = null;
        mj mjVar = this.j0;
        if (mjVar != null) {
            mjVar.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 pm(this).a(2131888986, 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) {
        fh fhVar = new fh(this, view);
        for (o oVar : s2() ? o.values() : new o[]{o.NORMAL, o.RESIZE}) {
            fhVar.m(oVar.ordinal(), this.x[oVar.ordinal()], fh.d.Bottom);
        }
        fhVar.G(2131887550);
        fhVar.E((s2() ? this.v : this.w).ordinal(), true, false);
        fhVar.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.qj r7) {
        throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.SceneEdit.j2(int, net.dinglisch.android.taskerm.qj):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).X(0).c0()).putExtra("sc", this.j0.X(0).c0()), 1);
    }

    private void l1(int i2, boolean z) {
        if (i2 != -1) {
            qj a1 = this.j0.a1(i2);
            boolean z2 = false;
            boolean z3 = this.V == i2;
            boolean z4 = a1.G2() || a1.u2();
            boolean z5 = !z4 && z3 && this.f0 > 0;
            if (!z4 && z3 && this.f0 == 0) {
                z2 = true;
            }
            a1.f4(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 = fp.E(this, 2130968879, true);
                } else if (!a1.K2()) {
                    i3 = RFactory.raw.joda_america_st_vincent;
                } else if (!z4) {
                    i3 = RFactory.raw.joda_america_tegucigalpa;
                }
            }
            a1.m3(ud.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) {
        pp.S0(this).edit().putString("lScn", str).commit();
    }

    public static String p1(Context context, go goVar) {
        String string = pp.S0(context).getString("lScn", d6.n.b.a);
        if (!TextUtils.isEmpty(string)) {
            if (goVar == null) {
                o7.f("SceneEdit", "getLastScene: null data");
            } else {
                if (goVar.p(string)) {
                    return string;
                }
                o7.f("SceneEdit", "getLastScene: unknown scene: " + string);
            }
        }
        return null;
    }

    public void p2(String str, o oVar) {
        boolean z = oVar == o.MOVE || oVar == o.RESIZE;
        pp.Y2(this.N, z);
        pp.Y2(this.O, z);
        pp.Y2(this.P, z);
        ImageView imageView = this.R;
        o oVar2 = o.RESIZE;
        pp.Y2(imageView, oVar == oVar2);
        pp.Y2(this.S, oVar == oVar2);
        pp.Y2(this.U, oVar == oVar2);
        pp.Y2(this.T, oVar == oVar2);
        ViewGroup viewGroup = this.J;
        o oVar3 = o.NORMAL;
        pp.Y2(viewGroup, oVar == oVar3);
        pp.Y2(this.A, oVar != oVar3);
        pp.Y2(this.D, oVar != oVar3);
        pp.Y2(this.F, z);
        pp.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) {
            mj 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();
        qj a1 = this.j0.a1(i2);
        View findViewById = findViewById(R.id.home);
        if (findViewById == null && !pp.T1()) {
            findViewById = this.B;
        }
        if (findViewById == null) {
            findViewById = a1.A0();
        }
        if (findViewById == null) {
            findViewById = a1.L0();
        }
        if (findViewById == null) {
            findViewById = a1.K0();
        }
        if (findViewById == null) {
            findViewById = this.B;
        }
        fh fhVar = new fh(this, findViewById);
        boolean v2 = a1.v2();
        if (!v2) {
            fhVar.k(n.Delete.ordinal(), 2131888822, 2130969299);
        }
        if (a1.u2()) {
            fhVar.k(n.Add.ordinal(), 2131888987, 2130969155);
            fhVar.k(n.Edit.ordinal(), 2131888845, 2130969197);
        }
        if (!a1.u2() && !v2) {
            fhVar.k(n.Copy.ordinal(), 2131888813, 2130969183);
        }
        if ((!this.j0.g2() || a1.u2()) && !v2) {
            if (a1.u2()) {
                fhVar.k(n.SetForeground.ordinal(), 2131889012, 2130969210);
            } else {
                fhVar.k(n.SetBackground.ordinal(), 2131889011, 2130969210);
            }
        }
        if (!a1.u2() && ((!this.j0.g2() && this.j0.t1() > 1) || (this.j0.g2() && this.j0.t1() > 2))) {
            fhVar.k(n.SetDepth.ordinal(), 2131888989, 2130969188);
        }
        fhVar.k(n.Focus.ordinal(), 2131888880, a1.k4() ? 2130969239 : 2130969208);
        if (!a1.u2()) {
            if (a1.K2()) {
                fhVar.k(n.SetInvisible.ordinal(), 2131888893, 2130969307);
            } else {
                fhVar.k(n.SetVisible.ordinal(), 2131889023, 2130969307);
            }
            if (a1.G2()) {
                fhVar.k(n.Unpin.ordinal(), 2131889092, 2130969248);
            } else {
                fhVar.k(n.Pin.ordinal(), 2131888950, 2130969248);
            }
        }
        fhVar.F(new g(i2, a1)).G(2131887541).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) {
            xo.d(this, 2131890954);
        }
    }

    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--) {
            qj a1 = this.j0.a1(t1);
            if (a1.o2(i2, i3)) {
                if (!a1.G2() && !a1.u2()) {
                    return t1;
                }
                if (i4 == -1) {
                    i4 = t1;
                }
            }
        }
        return i4;
    }

    public void y1(String str) {
        o7.f("SceneEdit", "init (" + str + ")");
        mj mjVar = this.j0;
        if (mjVar == null) {
            MyActivity.L(this, "init s null");
            return;
        }
        mjVar.I0();
        mjVar.E3(this.I);
        mjVar.H3(1.0d);
        mjVar.t2(this.H.getWidth(), this.H.getHeight());
        mjVar.H3(d1(this.y));
        M1();
        mjVar.y0(this, 6);
        mjVar.G0(MyMapView.a.Resume, null);
        mjVar.X3(this, fo.j2(this), 2);
        mjVar.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(mj mjVar, qj qjVar, int i2, int i3) {
        boolean k2 = qjVar.k2();
        boolean m2 = qjVar.m2();
        boolean i22 = qjVar.i2();
        boolean X1 = qjVar.X1();
        if (!i22) {
            qjVar.K3(qjVar.I0(mjVar.S1()));
        }
        if (!X1) {
            qjVar.s3(qjVar.H0(mjVar.Q1()));
        }
        if (!k2) {
            if (i2 != -1) {
                qjVar.M3(i2);
            } else {
                qjVar.M3((mjVar.S1() - qjVar.H1()) / 2);
            }
        }
        if (m2) {
            return;
        }
        if (i3 != -1) {
            qjVar.O3(i3);
        } else {
            qjVar.O3((mjVar.Q1() - qjVar.T0()) / 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);
        t6.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;
        o7.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(oh.g(this, 2131886732, new Object[0]));
            T.setBackgroundDrawable(ud.k0.g(resources, fp.J(this, 2130968982), null));
        }
        if (bundle == null) {
            this.W = System.currentTimeMillis();
            o7.f("SceneEdit", "no icicle");
            Intent intent = getIntent();
            if (intent.hasExtra(ProfileManager.EXTRA_PROFILE_NAME)) {
                String stringExtra = intent.getStringExtra(ProfileManager.EXTRA_PROFILE_NAME);
                fo j2 = fo.j2(this);
                if (j2.p(stringExtra)) {
                    this.j0 = j2.B2(stringExtra).B0();
                    this.h0 = intent.getIntExtra("flags", 0);
                    this.i0 = intent.getIntExtra("projectid", -1);
                } else {
                    mj mjVar = new mj();
                    this.j0 = mjVar;
                    mjVar.C(stringExtra);
                }
            } else if (intent.hasExtra("sc")) {
                this.j0 = new mj(new ii(intent.getBundleExtra("sc")));
            } else {
                o7.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 mj(new ii(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.q0(getPackageManager(), fo.j2(this));
        if (resources != null && (configuration = resources.getConfiguration()) != null) {
            this.j0.D3(configuration.orientation);
        }
        p2("onCreate", this.v);
        if (!z) {
            xo.d(this, 2131890953);
        }
        T.setSubtitle(this.j0.getName());
        Z1();
        o2(this.j0.getName());
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        menu.add(0, 5, 0, oh.g(this, 2131888800, new Object[0]));
        menu.add(0, 3, 0, oh.g(this, 2131888986, new Object[0]));
        menu.add(0, 8, 0, oh.g(this, 2131886899, new Object[0]));
        pp.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, 2131297325);
        h1();
        if (Settings.f3(this)) {
            e4.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);
        o7.f("SceneEdit", "osis");
        bundle.putBundle("sc", this.j0.X(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) {
            o7.f("SceneEdit", "unhandled touch event: " + motionEvent.getAction());
        } else {
            d2(true);
        }
        return false;
    }
}