CheetahGram v8.5.4版本的 MD5 值为:3d14e79cc242c314d3933620ff3ab030

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


package org.telegram.ui;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.StateListAnimator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.Property;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.animation.OvershootInterpolator;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.u;
import co.cheetah.gram.R;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.LocationController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.MessagesStorage;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.UserObject;
import org.telegram.messenger.p110.aw5;
import org.telegram.messenger.p110.ay4;
import org.telegram.messenger.p110.bs0;
import org.telegram.messenger.p110.ch0;
import org.telegram.messenger.p110.dj;
import org.telegram.messenger.p110.dl6;
import org.telegram.messenger.p110.eh0;
import org.telegram.messenger.p110.es1;
import org.telegram.messenger.p110.f27;
import org.telegram.messenger.p110.f86;
import org.telegram.messenger.p110.fa2;
import org.telegram.messenger.p110.g52;
import org.telegram.messenger.p110.g94;
import org.telegram.messenger.p110.ga2;
import org.telegram.messenger.p110.h27;
import org.telegram.messenger.p110.i95;
import org.telegram.messenger.p110.iv4;
import org.telegram.messenger.p110.ja2;
import org.telegram.messenger.p110.jj0;
import org.telegram.messenger.p110.k56;
import org.telegram.messenger.p110.mj1;
import org.telegram.messenger.p110.nk1;
import org.telegram.messenger.p110.nl5;
import org.telegram.messenger.p110.oa5;
import org.telegram.messenger.p110.ov5;
import org.telegram.messenger.p110.pa5;
import org.telegram.messenger.p110.q37;
import org.telegram.messenger.p110.qb2;
import org.telegram.messenger.p110.qn5;
import org.telegram.messenger.p110.rg;
import org.telegram.messenger.p110.rh2;
import org.telegram.messenger.p110.rn3;
import org.telegram.messenger.p110.rr1;
import org.telegram.messenger.p110.sb2;
import org.telegram.messenger.p110.sb5;
import org.telegram.messenger.p110.sd6;
import org.telegram.messenger.p110.sh2;
import org.telegram.messenger.p110.tb2;
import org.telegram.messenger.p110.u76;
import org.telegram.messenger.p110.u95;
import org.telegram.messenger.p110.uh2;
import org.telegram.messenger.p110.v76;
import org.telegram.messenger.p110.vy5;
import org.telegram.messenger.p110.wb5;
import org.telegram.messenger.p110.xh2;
import org.telegram.messenger.p110.yh2;
import org.telegram.messenger.p110.yo;
import org.telegram.messenger.p110.yp4;
import org.telegram.messenger.p110.ys3;
import org.telegram.messenger.p110.z95;
import org.telegram.messenger.p110.zo;
import org.telegram.messenger.p110.zq0;
import org.telegram.tgnet.RequestDelegate;
import org.telegram.ui.ActionBar.a;
import org.telegram.ui.ActionBar.a0;
import org.telegram.ui.ActionBar.d;
import org.telegram.ui.ActionBar.i;
import org.telegram.ui.ActionBar.w;
import org.telegram.ui.Components.EditTextBoldCursor;
import org.telegram.ui.Components.UndoView;
import org.telegram.ui.Components.b;
import org.telegram.ui.Components.h6;
import org.telegram.ui.Components.u5;
import org.telegram.ui.w5;

public class w5 extends org.telegram.ui.ActionBar.k implements NotificationCenter.NotificationCenterDelegate {
    private org.telegram.ui.ActionBar.d A;
    private boolean A0;
    private r B;
    private boolean B0;
    private boolean C0;
    private boolean D0;
    private Location E0;
    private Location F0;
    private es1 G;
    private int G0;
    private nl5 H0;
    private boolean I;
    private nl5 I0;
    private boolean J;
    private MessageObject J0;
    private boolean K0;
    private boolean L0;
    private boolean M0;
    private q N0;
    private int O0;
    private nk1 Q;
    private Runnable Q0;
    private yo R;
    private uh2 S;
    private yo T;
    private float U;
    private ch0 V;
    private double W;
    private boolean X;
    private org.telegram.ui.Components.u5 Y;
    private FrameLayout Z;
    private fa2 a0;
    private org.telegram.ui.Components.h6 b0;
    private org.telegram.ui.Components.h6 c0;
    private ga2 d0;
    private View e0;
    private androidx.recyclerview.widget.o f0;
    private org.telegram.ui.ActionBar.d g0;
    private v0 h0;
    private boolean i0;
    private long m0;
    private Runnable o0;
    private ImageView q;
    private ImageView r;
    private org.telegram.ui.ActionBar.d s;
    private AnimatorSet s0;
    private s t;
    private xh2 t0;
    private LinearLayout u;
    private t u0;
    private ImageView v;
    private FrameLayout v0;
    private TextView w;
    private TextView x;
    private Drawable y;
    private int y0;
    private View z;
    private boolean z0;
    private UndoView[] H = new UndoView[2];
    private boolean j0 = true;
    private boolean k0 = false;
    private boolean l0 = true;
    private boolean n0 = true;
    private ArrayList<p> p0 = new ArrayList<>();
    private androidx.collection.d<p> q0 = new androidx.collection.d<>();
    private ArrayList<t> r0 = new ArrayList<>();
    private boolean w0 = true;
    private boolean x0 = true;
    private int P0 = (AndroidUtilities.displaySize.x - org.telegram.ui.ActionBar.a.getCurrentActionBarHeight()) - AndroidUtilities.dp(66.0f);
    private Bitmap[] R0 = new Bitmap[7];

    class a extends u.t {
        a() {
        }

        @Override
        public void a(androidx.recyclerview.widget.u uVar, int i) {
            w5.this.X = i != 0;
            if (w5.this.X || w5.this.T == null) {
                return;
            }
            w5.this.T = null;
        }

        @Override
        public void b(androidx.recyclerview.widget.u uVar, int i, int i2) {
            w5.this.C4(false);
            if (w5.this.T != null) {
                w5.P2(w5.this, i2);
            }
        }
    }

    public class b extends uh2 {
        b(Context context) {
            super(context);
        }

        public void h() {
            if (w5.this.R != null) {
                w5.this.Q.i(w5.this.R);
                w5.this.R = null;
            }
        }

        @Override
        public boolean dispatchTouchEvent(MotionEvent motionEvent) {
            MotionEvent motionEvent2;
            if (w5.this.U != 0.0f) {
                motionEvent = MotionEvent.obtain(motionEvent);
                motionEvent.offsetLocation(0.0f, (-w5.this.U) / 2.0f);
                motionEvent2 = motionEvent;
            } else {
                motionEvent2 = null;
            }
            boolean dispatchTouchEvent = super.dispatchTouchEvent(motionEvent);
            if (motionEvent2 != null) {
                motionEvent2.recycle();
            }
            return dispatchTouchEvent;
        }

        @Override
        public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
            if (w5.this.J0 == null && w5.this.H0 == null) {
                if (motionEvent.getAction() == 0) {
                    if (w5.this.s0 != null) {
                        w5.this.s0.cancel();
                    }
                    w5.this.s0 = new AnimatorSet();
                    w5.this.s0.setDuration(200L);
                    w5.this.s0.playTogether(ObjectAnimator.ofFloat(w5.this.e0, (Property<View, Float>) View.TRANSLATION_Y, w5.this.G0 - AndroidUtilities.dp(10.0f)));
                    w5.this.s0.start();
                } else if (motionEvent.getAction() == 1) {
                    if (w5.this.s0 != null) {
                        w5.this.s0.cancel();
                    }
                    w5.this.U = 0.0f;
                    w5.this.s0 = new AnimatorSet();
                    w5.this.s0.setDuration(200L);
                    w5.this.s0.playTogether(ObjectAnimator.ofFloat(w5.this.e0, (Property<View, Float>) View.TRANSLATION_Y, w5.this.G0));
                    w5.this.s0.start();
                    w5.this.a0.c0();
                }
                if (motionEvent.getAction() == 2) {
                    if (!w5.this.K0) {
                        w5.this.q.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("location_actionIcon"), PorterDuff.Mode.MULTIPLY));
                        w5.this.q.setTag("location_actionIcon");
                        w5.this.K0 = true;
                    }
                    if (w5.this.Q != null && w5.this.F0 != null) {
                        w5.this.F0.setLatitude(w5.this.Q.e().a.a);
                        w5.this.F0.setLongitude(w5.this.Q.e().a.b);
                    }
                    w5.this.a0.i0(w5.this.F0);
                }
            }
            return super.onInterceptTouchEvent(motionEvent);
        }

        @Override
        protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
            super.onLayout(z, i, i2, i3, i4);
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    w5.b.this.h();
                }
            });
        }

        @Override
        public boolean onTouchEvent(MotionEvent motionEvent) {
            return super.onTouchEvent(motionEvent);
        }
    }

    class c extends ga2 {
        c(Context context) {
            super(context);
        }

        @Override
        public void j() {
            if (w5.this.A != null) {
                w5.this.A.setShowSearchProgress(w5.this.d0.P());
            }
            if (w5.this.x != null) {
                w5.this.x.setText(AndroidUtilities.replaceTags(LocaleController.formatString("NoPlacesFoundInfo", R.string.NoPlacesFoundInfo, w5.this.d0.O())));
            }
            super.j();
        }
    }

    class d extends u.t {
        d() {
        }

        @Override
        public void a(androidx.recyclerview.widget.u uVar, int i) {
            if (i == 1 && w5.this.z0 && w5.this.A0) {
                AndroidUtilities.hideKeyboard(w5.this.c0().getCurrentFocus());
            }
        }
    }

    class e extends View {
        private RectF a;
        final Rect b;

        e(Context context, Rect rect) {
            super(context);
            this.b = rect;
            this.a = new RectF();
        }

        @Override
        protected void onDraw(Canvas canvas) {
            w5.this.y.setBounds(-this.b.left, 0, getMeasuredWidth() + this.b.right, getMeasuredHeight());
            w5.this.y.draw(canvas);
            if (w5.this.O0 == 0 || w5.this.O0 == 1) {
                int dp = AndroidUtilities.dp(36.0f);
                this.a.set((getMeasuredWidth() - dp) / 2, this.b.top + AndroidUtilities.dp(10.0f), (getMeasuredWidth() + dp) / 2, r1 + AndroidUtilities.dp(4.0f));
                int r1 = org.telegram.ui.ActionBar.w.r1("key_sheet_scrollUp");
                Color.alpha(r1);
                org.telegram.ui.ActionBar.w.u0.setColor(r1);
                canvas.drawRoundRect(this.a, AndroidUtilities.dp(2.0f), AndroidUtilities.dp(2.0f), org.telegram.ui.ActionBar.w.u0);
            }
        }
    }

    public class f extends AnimatorListenerAdapter {
        f() {
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            w5.this.J = false;
            w5.this.j4();
        }
    }

    class g extends a.h {
        g() {
        }

        @Override
        public void b(int i) {
            if (i == -1) {
                w5.this.D();
                return;
            }
            if (i != 1) {
                if (i == 5) {
                    w5.this.q4(0);
                    return;
                }
                return;
            }
            try {
                double d = w5.this.J0.messageOwner.g.geo.c;
                double d2 = w5.this.J0.messageOwner.g.geo.b;
                w5.this.c0().startActivity(new Intent("android.intent.action.VIEW", Uri.parse("geo:" + d + "," + d2 + "?q=" + d + "," + d2)));
            } catch (Exception e) {
                FileLog.e(e);
            }
        }
    }

    class h extends d.n {
        h() {
        }

        @Override
        public void g() {
            w5.this.z0 = false;
            w5.this.A0 = false;
            w5.this.d0.X(null, null);
            w5.this.D4();
        }

        @Override
        public void h() {
            w5.this.z0 = true;
        }

        @Override
        public void k(EditText editText) {
            if (w5.this.d0 == null) {
                return;
            }
            String obj = editText.getText().toString();
            if (obj.length() != 0) {
                w5.this.A0 = true;
                w5.this.A.setShowSearchProgress(true);
                if (w5.this.g0 != null) {
                    w5.this.g0.setVisibility(8);
                }
                w5.this.b0.setVisibility(8);
                w5.this.Z.setVisibility(8);
                if (w5.this.c0.getAdapter() != w5.this.d0) {
                    w5.this.c0.setAdapter(w5.this.d0);
                }
                w5.this.c0.setVisibility(0);
                w5 w5Var = w5.this;
                w5Var.B0 = w5Var.d0.e() == 0;
            } else {
                if (w5.this.g0 != null) {
                    w5.this.g0.setVisibility(0);
                }
                w5.this.b0.setVisibility(0);
                w5.this.Z.setVisibility(0);
                w5.this.c0.setAdapter(null);
                w5.this.c0.setVisibility(8);
            }
            w5.this.D4();
            w5.this.d0.X(obj, w5.this.F0);
        }
    }

    class i extends FrameLayout {
        private boolean a;

        i(Context context) {
            super(context);
            this.a = true;
        }

        @Override
        protected boolean drawChild(Canvas canvas, View view, long j) {
            boolean drawChild = super.drawChild(canvas, view, j);
            if (view == ((org.telegram.ui.ActionBar.k) w5.this).g && ((org.telegram.ui.ActionBar.k) w5.this).f != null) {
                ((org.telegram.ui.ActionBar.k) w5.this).f.Z(canvas, ((org.telegram.ui.ActionBar.k) w5.this).g.getMeasuredHeight());
            }
            return drawChild;
        }

        @Override
        protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
            super.onLayout(z, i, i2, i3, i4);
            if (!z) {
                w5.this.C4(true);
            } else {
                w5.this.r3(this.a);
                this.a = false;
            }
        }
    }

    class j extends FrameLayout {
        j(Context context) {
            super(context);
        }

        @Override
        protected void onMeasure(int i, int i2) {
            super.onMeasure(i, i2);
            if (w5.this.B != null) {
                w5.this.B.g();
            }
        }
    }

    class k extends ViewOutlineProvider {
        k(w5 w5Var) {
        }

        @Override
        @SuppressLint({"NewApi"})
        public void getOutline(View view, Outline outline) {
            outline.setRoundRect(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight(), view.getMeasuredHeight() / 2);
        }
    }

    class l extends ViewOutlineProvider {
        l(w5 w5Var) {
        }

        @Override
        @SuppressLint({"NewApi"})
        public void getOutline(View view, Outline outline) {
            outline.setOval(0, 0, AndroidUtilities.dp(40.0f), AndroidUtilities.dp(40.0f));
        }
    }

    class m extends ViewOutlineProvider {
        m(w5 w5Var) {
        }

        @Override
        @SuppressLint({"NewApi"})
        public void getOutline(View view, Outline outline) {
            outline.setOval(0, 0, AndroidUtilities.dp(40.0f), AndroidUtilities.dp(40.0f));
        }
    }

    class n extends ViewOutlineProvider {
        n(w5 w5Var) {
        }

        @Override
        @SuppressLint({"NewApi"})
        public void getOutline(View view, Outline outline) {
            outline.setOval(0, 0, AndroidUtilities.dp(40.0f), AndroidUtilities.dp(40.0f));
        }
    }

    class o extends fa2 {
        o(Context context, int i, long j, boolean z, w.s sVar) {
            super(context, i, j, z, sVar);
        }

        @Override
        protected void g0() {
            Activity c0;
            if (Build.VERSION.SDK_INT >= 23 && (c0 = w5.this.c0()) != null && c0.checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) {
                w5.this.z4(true);
            } else if (w5.this.E0 != null) {
                try {
                    w5.this.c0().startActivity(w5.this.J0 != null ? new Intent("android.intent.action.VIEW", Uri.parse(String.format(Locale.US, "http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", Double.valueOf(w5.this.E0.getLatitude()), Double.valueOf(w5.this.E0.getLongitude()), Double.valueOf(w5.this.J0.messageOwner.g.geo.c), Double.valueOf(w5.this.J0.messageOwner.g.geo.b)))) : new Intent("android.intent.action.VIEW", Uri.parse(String.format(Locale.US, "http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", Double.valueOf(w5.this.E0.getLatitude()), Double.valueOf(w5.this.E0.getLongitude()), Double.valueOf(w5.this.H0.a.c), Double.valueOf(w5.this.H0.a.b)))));
                } catch (Exception e) {
                    FileLog.e(e);
                }
            }
        }
    }

    public static class p {
        public long a;
        public sb5 b;
        public f27 c;
        public u95 d;
        public xh2 e;
        public xh2 f;
        public boolean g;
    }

    public interface q {
        void b(wb5 wb5Var, int i, boolean z, int i2);
    }

    public class r extends FrameLayout {
        private HashMap<xh2, View> a;

        public class a implements ValueAnimator.AnimatorUpdateListener {
            private boolean a;
            private final float[] b = {0.0f, 1.0f};
            final FrameLayout c;

            a(FrameLayout frameLayout) {
                this.c = frameLayout;
            }

            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                float lerp = AndroidUtilities.lerp(this.b, valueAnimator.getAnimatedFraction());
                if (lerp >= 0.7f && !this.a && w5.this.v0 != null) {
                    AnimatorSet animatorSet = new AnimatorSet();
                    animatorSet.playTogether(ObjectAnimator.ofFloat(w5.this.v0, (Property<FrameLayout, Float>) View.SCALE_X, 0.0f, 1.0f), ObjectAnimator.ofFloat(w5.this.v0, (Property<FrameLayout, Float>) View.SCALE_Y, 0.0f, 1.0f), ObjectAnimator.ofFloat(w5.this.v0, (Property<FrameLayout, Float>) View.ALPHA, 0.0f, 1.0f));
                    animatorSet.setInterpolator(new OvershootInterpolator(1.02f));
                    animatorSet.setDuration(250L);
                    animatorSet.start();
                    this.a = true;
                }
                float interpolation = lerp <= 0.5f ? zq0.g.getInterpolation(lerp / 0.5f) * 1.1f : lerp <= 0.75f ? 1.1f - (zq0.g.getInterpolation((lerp - 0.5f) / 0.25f) * 0.2f) : (zq0.g.getInterpolation((lerp - 0.75f) / 0.25f) * 0.1f) + 0.9f;
                this.c.setScaleX(interpolation);
                this.c.setScaleY(interpolation);
            }
        }

        public r(Context context) {
            super(context);
            this.a = new HashMap<>();
        }

        public void d(t tVar, boolean z, int i) {
            w5.this.N0.b(tVar.c, w5.this.O0, z, i);
            w5.this.D();
        }

        public void e(final t tVar, View view) {
            if (w5.this.h0 != null && w5.this.h0.Ki()) {
                org.telegram.ui.Components.b.P1(w5.this.c0(), w5.this.h0.Th(), new b.a0() {
                    @Override
                    public final void a(boolean z, int i) {
                        w5.r.this.d(tVar, z, i);
                    }
                });
            } else {
                w5.this.N0.b(tVar.c, w5.this.O0, true, 0);
                w5.this.D();
            }
        }

        public void c(xh2 xh2Var) {
            final t tVar = (t) xh2Var.b();
            if (tVar == null || w5.this.u0 == tVar) {
                return;
            }
            w5.this.B4(false);
            if (w5.this.t0 != null) {
                f(w5.this.t0);
                w5.this.t0 = null;
            }
            w5.this.u0 = tVar;
            w5.this.t0 = xh2Var;
            Context context = getContext();
            FrameLayout frameLayout = new FrameLayout(context);
            addView(frameLayout, g52.a(-2, 114.0f));
            w5.this.v0 = new FrameLayout(context);
            w5.this.v0.setBackgroundResource(org.telegram.messenger.R.drawable.venue_tooltip);
            w5.this.v0.getBackground().setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("dialogBackground"), PorterDuff.Mode.MULTIPLY));
            frameLayout.addView(w5.this.v0, g52.a(-2, 71.0f));
            w5.this.v0.setAlpha(0.0f);
            w5.this.v0.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    w5.r.this.e(tVar, view);
                }
            });
            TextView textView = new TextView(context);
            textView.setTextSize(1, 16.0f);
            textView.setMaxLines(1);
            textView.setEllipsize(TextUtils.TruncateAt.END);
            textView.setSingleLine(true);
            textView.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteBlackText"));
            textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            textView.setGravity(LocaleController.isRTL ? 5 : 3);
            w5.this.v0.addView(textView, g52.b(-2, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, 18.0f, 10.0f, 18.0f, 0.0f));
            TextView textView2 = new TextView(context);
            textView2.setTextSize(1, 14.0f);
            textView2.setMaxLines(1);
            textView2.setEllipsize(TextUtils.TruncateAt.END);
            textView2.setSingleLine(true);
            textView2.setTextColor(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhiteGrayText3"));
            textView2.setGravity(LocaleController.isRTL ? 5 : 3);
            w5.this.v0.addView(textView2, g52.b(-2, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, 18.0f, 32.0f, 18.0f, 0.0f));
            textView.setText(tVar.c.title);
            textView2.setText(LocaleController.getString("TapToSendLocation", R.string.TapToSendLocation));
            FrameLayout frameLayout2 = new FrameLayout(context);
            frameLayout2.setBackground(org.telegram.ui.ActionBar.w.w0(AndroidUtilities.dp(36.0f), ja2.b(tVar.a)));
            frameLayout.addView(frameLayout2, g52.b(36, 36.0f, 81, 0.0f, 0.0f, 0.0f, 4.0f));
            org.telegram.messenger.p110.pf pfVar = new org.telegram.messenger.p110.pf(context);
            pfVar.c("https://ss3.4sqi.net/img/categories_v2/" + tVar.c.venue_type + "_64.png", null, null);
            frameLayout2.addView(pfVar, g52.c(30, 30, 17));
            ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
            ofFloat.addUpdateListener(new a(frameLayout2));
            ofFloat.setDuration(360L);
            ofFloat.start();
            this.a.put(xh2Var, frameLayout);
            w5.this.Q.d(zo.a(xh2Var.a()), 300, null);
        }

        public void f(xh2 xh2Var) {
            View view = this.a.get(xh2Var);
            if (view != null) {
                removeView(view);
                this.a.remove(xh2Var);
            }
        }

        public void g() {
            if (w5.this.Q == null) {
                return;
            }
            g94 g = w5.this.Q.g();
            for (Map.Entry<xh2, View> entry : this.a.entrySet()) {
                xh2 key = entry.getKey();
                View value = entry.getValue();
                Point a2 = g.a(key.a());
                value.setTranslationX(a2.x - (value.getMeasuredWidth() / 2));
                value.setTranslationY((a2.y - value.getMeasuredHeight()) + AndroidUtilities.dp(22.0f));
            }
        }
    }

    public static class s extends TextView {
        private float a;
        private float b;

        public s(Context context) {
            super(context);
        }

        private void b() {
            setTranslationY(this.b + this.a);
        }

        public void a(float f) {
            this.b = f;
            b();
        }

        @Override
        public float getTranslationX() {
            return this.a;
        }

        @Override
        public void setTranslationX(float f) {
            this.a = f;
            b();
        }
    }

    public static class t {
        public int a;
        public xh2 b;
        public f86 c;
    }

    public w5(int i2) {
        this.O0 = i2;
        AndroidUtilities.fixGoogleMapsBug();
    }

    public void A3(final org.telegram.ui.ActionBar.i[] iVarArr, final f86 f86Var, i95 i95Var, ov5 ov5Var) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                org.telegram.ui.w5.this.S3(iVarArr, f86Var);
            }
        });
    }

    private void A4() {
        if (this.a0.e() != 0 && this.f0.c2() == 0) {
            int dp = AndroidUtilities.dp(258.0f) + this.b0.getChildAt(0).getTop();
            if (dp < 0 || dp > AndroidUtilities.dp(258.0f)) {
                return;
            }
            this.b0.s1(0, dp);
        }
    }

    public void B3(int i2, DialogInterface dialogInterface) {
        K().cancelRequest(i2, true);
    }

    public void B4(boolean z) {
        s sVar;
        Location location;
        Location location2;
        if (z && (sVar = this.t) != null && sVar.getTag() == null && ((location = this.E0) == null || (location2 = this.F0) == null || location2.distanceTo(location) < 300.0f)) {
            z = false;
        }
        s sVar2 = this.t;
        if (sVar2 != null) {
            if (!z || sVar2.getTag() == null) {
                if (z || this.t.getTag() != null) {
                    this.t.setTag(z ? 1 : null);
                    AnimatorSet animatorSet = new AnimatorSet();
                    Animator[] animatorArr = new Animator[1];
                    s sVar3 = this.t;
                    Property property = View.TRANSLATION_X;
                    float[] fArr = new float[1];
                    fArr[0] = z ? 0.0f : -AndroidUtilities.dp(80.0f);
                    animatorArr[0] = ObjectAnimator.ofFloat(sVar3, (Property<s, Float>) property, fArr);
                    animatorSet.playTogether(animatorArr);
                    animatorSet.setDuration(180L);
                    animatorSet.setInterpolator(zq0.g);
                    animatorSet.start();
                }
            }
        }
    }

    public void C3(u76 u76Var, boolean z, int i2) {
        this.N0.b(u76Var, this.O0, z, i2);
        D();
    }

    public void C4(boolean z) {
        int i2;
        int i3;
        FrameLayout.LayoutParams layoutParams;
        u.d0 Z = this.b0.Z(0);
        if (Z != null) {
            i2 = (int) Z.a.getY();
            i3 = this.P0 + Math.min(i2, 0);
        } else {
            i2 = -this.Z.getMeasuredHeight();
            i3 = 0;
        }
        if (((FrameLayout.LayoutParams) this.Z.getLayoutParams()) != null) {
            int visibility = this.S.getVisibility();
            if (i3 <= 0) {
                if (visibility == 0) {
                    this.S.setVisibility(4);
                    this.Z.setVisibility(4);
                    r rVar = this.B;
                    if (rVar != null) {
                        rVar.setVisibility(4);
                    }
                }
            } else if (visibility == 4) {
                this.S.setVisibility(0);
                this.Z.setVisibility(0);
                r rVar2 = this.B;
                if (rVar2 != null) {
                    rVar2.setVisibility(0);
                }
            }
            this.Z.setTranslationY(Math.min(0, i2));
            int i4 = -i2;
            int i5 = i4 / 2;
            this.S.setTranslationY(Math.max(0, i5));
            r rVar3 = this.B;
            if (rVar3 != null) {
                rVar3.setTranslationY(Math.max(0, i5));
            }
            int measuredHeight = this.P0 - this.s.getMeasuredHeight();
            int i6 = this.O0;
            float min = Math.min(measuredHeight - AndroidUtilities.dp(64 + ((i6 == 0 || i6 == 1) ? 30 : 10)), i4);
            this.s.setTranslationY(min);
            this.r.setTranslationY(min);
            es1 es1Var = this.G;
            if (es1Var != null) {
                es1Var.setExtraTranslationY(min);
            }
            s sVar = this.t;
            if (sVar != null) {
                sVar.a(min);
            }
            View view = this.e0;
            if (view != null) {
                int dp = (i4 - AndroidUtilities.dp(view.getTag() == null ? 48.0f : 69.0f)) + (i3 / 2);
                this.G0 = dp;
                view.setTranslationY(dp);
            }
            if (z) {
                return;
            }
            FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) this.S.getLayoutParams();
            if (layoutParams2 != null && layoutParams2.height != this.P0 + AndroidUtilities.dp(10.0f)) {
                layoutParams2.height = this.P0 + AndroidUtilities.dp(10.0f);
                nk1 nk1Var = this.Q;
                if (nk1Var != null) {
                    nk1Var.r(AndroidUtilities.dp(70.0f), 0, AndroidUtilities.dp(70.0f), AndroidUtilities.dp(10.0f));
                }
                this.S.setLayoutParams(layoutParams2);
            }
            r rVar4 = this.B;
            if (rVar4 == null || (layoutParams = (FrameLayout.LayoutParams) rVar4.getLayoutParams()) == null || layoutParams.height == this.P0 + AndroidUtilities.dp(10.0f)) {
                return;
            }
            layoutParams.height = this.P0 + AndroidUtilities.dp(10.0f);
            this.B.setLayoutParams(layoutParams);
        }
    }

    public void D3(Object obj, boolean z, int i2) {
        this.N0.b((f86) obj, this.O0, z, i2);
        D();
    }

    public void D4() {
        if (!this.z0) {
            this.u.setVisibility(8);
        } else {
            if (!this.B0) {
                this.c0.setEmptyView(this.u);
                return;
            }
            this.c0.setEmptyView(null);
            this.u.setVisibility(8);
            this.c0.setVisibility(8);
        }
    }

    public void E3(View view, int i2) {
        Activity c0;
        long Th;
        b.a0 a0Var;
        q qVar;
        f86 f86Var;
        MessageObject messageObject;
        nk1 nk1Var;
        LatLng latLng;
        q qVar2;
        f86 f86Var2;
        final f86 f86Var3;
        int i3 = this.O0;
        int i4 = 4;
        if (i3 != 4) {
            if (i3 == 5) {
                nk1Var = this.Q;
                if (nk1Var == null) {
                    return;
                }
                pa5 pa5Var = this.H0.a;
                latLng = new LatLng(pa5Var.c, pa5Var.b);
            } else if (i2 == 1 && (messageObject = this.J0) != null && (!messageObject.isLiveLocation() || this.O0 == 6)) {
                nk1Var = this.Q;
                if (nk1Var == null) {
                    return;
                }
                pa5 pa5Var2 = this.J0.messageOwner.g.geo;
                latLng = new LatLng(pa5Var2.c, pa5Var2.b);
            } else if (i2 != 1 || this.O0 == 2) {
                if ((i2 == 2 && this.O0 == 1) || ((i2 == 1 && this.O0 == 2) || (i2 == 3 && this.O0 == 3))) {
                    if (!T().isSharingLocation(this.m0)) {
                        q4(0);
                        return;
                    } else {
                        T().removeSharingLocation(this.m0);
                        D();
                    }
                }
                final Object d0 = this.a0.d0(i2);
                if (!(d0 instanceof f86)) {
                    if (d0 instanceof p) {
                        this.Q.c(zo.c(((p) d0).e.a(), this.Q.f() - 4.0f));
                        return;
                    }
                    return;
                }
                v0 v0Var = this.h0;
                if (v0Var != null && v0Var.Ki()) {
                    c0 = c0();
                    Th = this.h0.Th();
                    a0Var = new b.a0() {
                        @Override
                        public final void a(boolean z, int i5) {
                            org.telegram.ui.w5.this.D3(d0, z, i5);
                        }
                    };
                    org.telegram.ui.Components.b.P1(c0, Th, a0Var);
                    return;
                }
                f86Var = (f86) d0;
                qVar = this.N0;
                i4 = this.O0;
                f86Var2 = f86Var;
                qVar2 = qVar;
            } else {
                if (this.N0 == null || this.F0 == null) {
                    return;
                }
                FrameLayout frameLayout = this.v0;
                if (frameLayout != null) {
                    frameLayout.callOnClick();
                    return;
                }
                final u76 u76Var = new u76();
                aw5 aw5Var = new aw5();
                u76Var.geo = aw5Var;
                aw5Var.c = AndroidUtilities.fixLocationCoord(this.F0.getLatitude());
                u76Var.geo.b = AndroidUtilities.fixLocationCoord(this.F0.getLongitude());
                v0 v0Var2 = this.h0;
                if (v0Var2 != null && v0Var2.Ki()) {
                    c0 = c0();
                    Th = this.h0.Th();
                    a0Var = new b.a0() {
                        @Override
                        public final void a(boolean z, int i5) {
                            org.telegram.ui.w5.this.C3(u76Var, z, i5);
                        }
                    };
                    org.telegram.ui.Components.b.P1(c0, Th, a0Var);
                    return;
                }
                f86Var = u76Var;
                qVar = this.N0;
                i4 = this.O0;
                f86Var2 = f86Var;
                qVar2 = qVar;
            }
            nk1Var.c(zo.c(latLng, this.Q.f() - 4.0f));
            return;
        }
        if (i2 != 1 || (f86Var3 = (f86) this.a0.d0(i2)) == null) {
            return;
        }
        if (this.m0 != 0) {
            final org.telegram.ui.ActionBar.i[] iVarArr = {new org.telegram.ui.ActionBar.i(c0(), 3)};
            qn5 qn5Var = new qn5();
            qn5Var.c = f86Var3.address;
            qn5Var.a = W().getInputChannel(-this.m0);
            vy5 vy5Var = new vy5();
            qn5Var.b = vy5Var;
            pa5 pa5Var3 = f86Var3.geo;
            vy5Var.b = pa5Var3.c;
            vy5Var.c = pa5Var3.b;
            final int sendRequest = K().sendRequest(qn5Var, new RequestDelegate() {
                @Override
                public final void run(i95 i95Var, ov5 ov5Var) {
                    org.telegram.ui.w5.this.A3(iVarArr, f86Var3, i95Var, ov5Var);
                }
            });
            iVarArr[0].setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public final void onCancel(DialogInterface dialogInterface) {
                    org.telegram.ui.w5.this.B3(sendRequest, dialogInterface);
                }
            });
            o1(iVarArr[0]);
            return;
        }
        f86Var2 = f86Var3;
        qVar2 = this.N0;
        qVar2.b(f86Var2, i4, true, 0);
        D();
    }

    public void E4(ArrayList<f86> arrayList) {
        if (arrayList == null) {
            return;
        }
        int size = this.r0.size();
        for (int i2 = 0; i2 < size; i2++) {
            this.r0.get(i2).b.c();
        }
        this.r0.clear();
        int size2 = arrayList.size();
        for (int i3 = 0; i3 < size2; i3++) {
            f86 f86Var = arrayList.get(i3);
            try {
                yh2 yh2Var = new yh2();
                pa5 pa5Var = f86Var.geo;
                yh2 H = yh2Var.H(new LatLng(pa5Var.c, pa5Var.b));
                H.D(dj.a(o3(i3)));
                H.l(0.5f, 0.5f);
                H.g0(f86Var.title);
                H.I(f86Var.address);
                t tVar = new t();
                tVar.a = i3;
                xh2 b2 = this.Q.b(H);
                tVar.b = b2;
                tVar.c = f86Var;
                b2.g(tVar);
                this.r0.add(tVar);
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        }
    }

    public void F3(nk1 nk1Var) {
        this.Q = nk1Var;
        if (w3()) {
            this.i0 = true;
            this.Q.j(sh2.l(ApplicationLoader.applicationContext, R.raw.mapstyle_night));
        }
        this.Q.r(AndroidUtilities.dp(70.0f), 0, AndroidUtilities.dp(70.0f), AndroidUtilities.dp(10.0f));
        o4();
    }

    public void G3(uh2 uh2Var) {
        if (this.S == null || c0() == null) {
            return;
        }
        try {
            uh2Var.b(null);
            com.google.android.gms.maps.a.a(ApplicationLoader.applicationContext);
            this.S.a(new rn3() {
                @Override
                public final void a(nk1 nk1Var) {
                    org.telegram.ui.w5.this.F3(nk1Var);
                }
            });
            this.C0 = true;
            if (this.D0) {
                this.S.f();
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    public void H3(final uh2 uh2Var) {
        try {
            uh2Var.b(null);
        } catch (Exception unused) {
        }
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                org.telegram.ui.w5.this.G3(uh2Var);
            }
        });
    }

    public void I3(ArrayList arrayList) {
        this.B0 = false;
        D4();
    }

    public void J3(f86 f86Var, boolean z, int i2) {
        this.N0.b(f86Var, this.O0, z, i2);
        D();
    }

    public void K3(int i2) {
        nk1 nk1Var = this.Q;
        if (nk1Var == null) {
            return;
        }
        int i3 = 2;
        if (i2 == 2) {
            nk1Var.k(1);
            return;
        }
        if (i2 != 3) {
            i3 = 4;
            if (i2 != 4) {
                return;
            }
        }
        nk1Var.k(i3);
    }

    public void L3(View view, int i2) {
        final f86 b0 = this.d0.b0(i2);
        if (b0 == null || this.N0 == null) {
            return;
        }
        v0 v0Var = this.h0;
        if (v0Var != null && v0Var.Ki()) {
            org.telegram.ui.Components.b.P1(c0(), this.h0.Th(), new b.a0() {
                @Override
                public final void a(boolean z, int i3) {
                    org.telegram.ui.w5.this.J3(b0, z, i3);
                }
            });
        } else {
            this.N0.b(b0, this.O0, true, 0);
            D();
        }
    }

    public void M3(View view) {
        nk1 nk1Var;
        Activity c0;
        if (Build.VERSION.SDK_INT >= 23 && (c0 = c0()) != null && c0.checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) {
            z4(false);
            return;
        }
        if (m3()) {
            if (this.J0 == null && this.H0 == null) {
                if (this.E0 != null && this.Q != null) {
                    this.q.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("location_actionActiveIcon"), PorterDuff.Mode.MULTIPLY));
                    this.q.setTag("location_actionActiveIcon");
                    this.a0.i0(null);
                    this.K0 = false;
                    B4(false);
                    this.Q.c(zo.a(new LatLng(this.E0.getLatitude(), this.E0.getLongitude())));
                    if (this.L0) {
                        Location location = this.E0;
                        if (location != null) {
                            this.a0.Z(null, location, true, true);
                        }
                        this.L0 = false;
                        A4();
                    }
                }
            } else if (this.E0 != null && (nk1Var = this.Q) != null) {
                nk1Var.c(zo.c(new LatLng(this.E0.getLatitude(), this.E0.getLongitude()), this.Q.f() - 4.0f));
            }
            s4();
        }
    }

    public void N3() {
        T().setProximityLocation(this.m0, 0, true);
        this.I = false;
    }

    public void O3(LocationController.SharingLocationInfo sharingLocationInfo) {
        this.r.setImageResource(org.telegram.messenger.R.drawable.msg_location_alert2);
        n3(sharingLocationInfo.proximityMeters);
        this.I = false;
    }

    static float P2(w5 w5Var, float f2) {
        float f3 = w5Var.U + f2;
        w5Var.U = f3;
        return f3;
    }

    public void P3(View view) {
        if (c0() == null || this.E0 == null || !m3() || this.Q == null) {
            return;
        }
        es1 es1Var = this.G;
        if (es1Var != null) {
            es1Var.h();
        }
        MessagesController.getGlobalMainSettings().edit().putInt("proximityhint", 3).commit();
        final LocationController.SharingLocationInfo sharingLocationInfo = T().getSharingLocationInfo(this.m0);
        if (this.I) {
            this.H[0].m(true, 1);
        }
        if (sharingLocationInfo == null || sharingLocationInfo.proximityMeters <= 0) {
            p4();
            return;
        }
        this.r.setImageResource(org.telegram.messenger.R.drawable.msg_location_alert);
        ch0 ch0Var = this.V;
        if (ch0Var != null) {
            ch0Var.b();
            this.V = null;
        }
        this.I = true;
        v3().A(0L, 25, 0, null, new Runnable() {
            @Override
            public final void run() {
                org.telegram.ui.w5.this.N3();
            }
        }, new Runnable() {
            @Override
            public final void run() {
                org.telegram.ui.w5.this.O3(sharingLocationInfo);
            }
        });
    }

    public static boolean Q3(View view, MotionEvent motionEvent) {
        return true;
    }

    public void R3() {
        C4(false);
    }

    public void S3(org.telegram.ui.ActionBar.i[] iVarArr, f86 f86Var) {
        try {
            iVarArr[0].dismiss();
        } catch (Throwable unused) {
        }
        iVarArr[0] = null;
        this.N0.b(f86Var, 4, true, 0);
        D();
    }

    public void T3(int i2) {
        this.f0.H2(0, -AndroidUtilities.dp(i2));
        C4(false);
    }

    public void U3() {
        Runnable runnable;
        T().markLiveLoactionsAsRead(this.m0);
        if (this.n || (runnable = this.Q0) == null) {
            return;
        }
        AndroidUtilities.runOnUIThread(runnable, 5000L);
    }

    public void V3(i95 i95Var, long j2) {
        if (this.Q == null) {
            return;
        }
        q37 q37Var = (q37) i95Var;
        int i2 = 0;
        while (i2 < q37Var.a.size()) {
            if (!(q37Var.a.get(i2).g instanceof v76)) {
                q37Var.a.remove(i2);
                i2--;
            }
            i2++;
        }
        X().putUsersAndChats(q37Var.c, q37Var.b, true, true);
        W().putUsers(q37Var.c, false);
        W().putChats(q37Var.b, false);
        T().locationsCache.put(j2, q37Var.a);
        Z().postNotificationName(NotificationCenter.liveLocationsCacheChanged, Long.valueOf(j2));
        q3(q37Var.a);
        T().markLiveLoactionsAsRead(this.m0);
        if (this.Q0 == null) {
            Runnable runnable = new Runnable() {
                @Override
                public final void run() {
                    org.telegram.ui.w5.this.U3();
                }
            };
            this.Q0 = runnable;
            AndroidUtilities.runOnUIThread(runnable, 5000L);
        }
    }

    public void W3(final long j2, final i95 i95Var, ov5 ov5Var) {
        if (i95Var != null) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    org.telegram.ui.w5.this.V3(i95Var, j2);
                }
            });
        }
    }

    public void X3() {
        ch0 ch0Var;
        int i2;
        this.s.setIconColor(org.telegram.ui.ActionBar.w.r1("location_actionIcon"));
        this.s.u0(org.telegram.ui.ActionBar.w.r1("actionBarDefaultSubmenuBackground"));
        this.s.D0(org.telegram.ui.ActionBar.w.r1("actionBarDefaultSubmenuItemIcon"), true);
        this.s.D0(org.telegram.ui.ActionBar.w.r1("actionBarDefaultSubmenuItem"), false);
        this.y.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("dialogBackground"), PorterDuff.Mode.MULTIPLY));
        this.z.invalidate();
        if (this.Q != null) {
            if (w3()) {
                if (this.i0) {
                    return;
                }
                this.i0 = true;
                this.Q.j(sh2.l(ApplicationLoader.applicationContext, R.raw.mapstyle_night));
                ch0 ch0Var2 = this.V;
                if (ch0Var2 == null) {
                    return;
                }
                ch0Var2.f(-1);
                ch0Var = this.V;
                i2 = 553648127;
            } else {
                if (!this.i0) {
                    return;
                }
                this.i0 = false;
                this.Q.j(null);
                ch0 ch0Var3 = this.V;
                if (ch0Var3 == null) {
                    return;
                }
                ch0Var3.f(com.batch.android.messaging.view.roundimage.b.v);
                ch0Var = this.V;
                i2 = 536870912;
            }
            ch0Var.d(i2);
        }
    }

    public void Y3(int i2) {
        View childAt;
        u.d0 U;
        if (i2 == 1) {
            B4(true);
            s4();
            if (this.X) {
                return;
            }
            int i3 = this.O0;
            if ((i3 == 0 || i3 == 1) && this.b0.getChildCount() > 0 && (childAt = this.b0.getChildAt(0)) != null && (U = this.b0.U(childAt)) != null && U.j() == 0) {
                int dp = this.O0 == 0 ? 0 : AndroidUtilities.dp(66.0f);
                int top = childAt.getTop();
                if (top < (-dp)) {
                    CameraPosition e2 = this.Q.e();
                    this.T = zo.c(e2.a, e2.b);
                    this.b0.s1(0, top + dp);
                }
            }
        }
    }

    public void Z3(Location location) {
        r4(location);
        T().setGoogleMapLocation(location, this.l0);
        this.l0 = false;
    }

    public boolean a4(xh2 xh2Var) {
        if (!(xh2Var.b() instanceof t)) {
            return true;
        }
        this.e0.setVisibility(4);
        if (!this.K0) {
            this.q.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("location_actionIcon"), PorterDuff.Mode.MULTIPLY));
            this.q.setTag("location_actionIcon");
            this.K0 = true;
        }
        this.B.c(xh2Var);
        return true;
    }

    public void b4() {
        r rVar = this.B;
        if (rVar != null) {
            rVar.g();
        }
    }

    public boolean c4(boolean z, int i2) {
        ch0 ch0Var = this.V;
        if (ch0Var != null) {
            ch0Var.e(i2);
            if (z) {
                n4(i2, true, true);
            }
        }
        if (DialogObject.isChatDialog(this.m0)) {
            return true;
        }
        int size = this.p0.size();
        for (int i3 = 0; i3 < size; i3++) {
            p pVar = this.p0.get(i3);
            if (pVar.b != null && !UserObject.isUserSelf(pVar.c)) {
                pa5 pa5Var = pVar.b.g.geo;
                Location location = new Location("network");
                location.setLatitude(pa5Var.c);
                location.setLongitude(pa5Var.b);
                if (this.E0.distanceTo(location) > i2) {
                    return true;
                }
            }
        }
        return false;
    }

    public void d4(f27 f27Var, int i2, DialogInterface dialogInterface, int i3) {
        h4(f27Var, 900, i2);
    }

    public boolean e4(final f27 f27Var, boolean z, final int i2) {
        if (T().getSharingLocationInfo(this.m0) != null) {
            this.Y.B();
            this.r.setImageResource(org.telegram.messenger.R.drawable.msg_location_alert2);
            v3().A(0L, 24, Integer.valueOf(i2), f27Var, null, null);
            T().setProximityLocation(this.m0, i2, true);
            return true;
        }
        i.C0142i c0142i = new i.C0142i(c0());
        c0142i.u(LocaleController.getString("ShareLocationAlertTitle", R.string.ShareLocationAlertTitle));
        c0142i.l(LocaleController.getString("ShareLocationAlertText", R.string.ShareLocationAlertText));
        c0142i.s(LocaleController.getString("ShareLocationAlertButton", R.string.ShareLocationAlertButton), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i3) {
                org.telegram.ui.w5.this.d4(f27Var, i2, dialogInterface, i3);
            }
        });
        c0142i.n(LocaleController.getString("Cancel", R.string.Cancel), null);
        o1(c0142i.a());
        return false;
    }

    public void f4() {
        nk1 nk1Var = this.Q;
        if (nk1Var != null) {
            nk1Var.r(AndroidUtilities.dp(70.0f), 0, AndroidUtilities.dp(70.0f), AndroidUtilities.dp(10.0f));
        }
        if (!this.Y.getRadiusSet()) {
            double d2 = this.W;
            if (d2 > 0.0d) {
                this.V.e(d2);
            } else {
                ch0 ch0Var = this.V;
                if (ch0Var != null) {
                    ch0Var.b();
                    this.V = null;
                }
            }
        }
        this.Y = null;
    }

    public void g4() {
        q4(this.y0);
    }

    public void i4(DialogInterface dialogInterface, int i2) {
        if (c0() == null) {
            return;
        }
        try {
            Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
            intent.setData(Uri.parse("package:" + ApplicationLoader.applicationContext.getPackageName()));
            c0().startActivity(intent);
        } catch (Exception e2) {
            FileLog.e(e2);
        }
    }

    public void j4() {
        SharedPreferences globalMainSettings;
        int i2;
        ImageView imageView = this.r;
        if (imageView == null || imageView.getVisibility() != 0 || this.J || (i2 = (globalMainSettings = MessagesController.getGlobalMainSettings()).getInt("proximityhint", 0)) >= 3) {
            return;
        }
        globalMainSettings.edit().putInt("proximityhint", i2 + 1).commit();
        if (DialogObject.isUserDialog(this.m0)) {
            this.G.setOverrideText(LocaleController.formatString("ProximityTooltioUser", R.string.ProximityTooltioUser, UserObject.getFirstName(W().getUser(Long.valueOf(this.m0)))));
        } else {
            this.G.setOverrideText(LocaleController.getString("ProximityTooltioGroup", R.string.ProximityTooltioGroup));
        }
        this.G.l(this.r, true);
    }

    private p k3(sb5 sb5Var) {
        long dialogId;
        pa5 pa5Var = sb5Var.g.geo;
        LatLng latLng = new LatLng(pa5Var.c, pa5Var.b);
        p pVar = this.q0.get(MessageObject.getFromChatId(sb5Var));
        if (pVar == null) {
            pVar = new p();
            pVar.b = sb5Var;
            if (sb5Var.b instanceof dl6) {
                pVar.c = W().getUser(Long.valueOf(pVar.b.b.a));
                dialogId = pVar.b.b.a;
            } else {
                dialogId = MessageObject.getDialogId(sb5Var);
                if (DialogObject.isUserDialog(dialogId)) {
                    pVar.c = W().getUser(Long.valueOf(dialogId));
                } else {
                    pVar.d = W().getChat(Long.valueOf(-dialogId));
                }
            }
            pVar.a = dialogId;
            try {
                yh2 H = new yh2().H(latLng);
                Bitmap p3 = p3(pVar);
                if (p3 != null) {
                    H.D(dj.a(p3));
                    H.l(0.5f, 0.907f);
                    pVar.e = this.Q.b(H);
                    if (!UserObject.isUserSelf(pVar.c)) {
                        yh2 p2 = new yh2().H(latLng).p(true);
                        p2.l(0.5f, 0.5f);
                        xh2 b2 = this.Q.b(p2);
                        pVar.f = b2;
                        int i2 = sb5Var.g.heading;
                        if (i2 != 0) {
                            b2.f(i2);
                            pVar.f.d(dj.b(org.telegram.messenger.R.drawable.map_pin_cone2));
                            pVar.g = true;
                        } else {
                            b2.f(0.0f);
                            pVar.f.d(dj.b(org.telegram.messenger.R.drawable.map_pin_circle));
                            pVar.g = false;
                        }
                    }
                    this.p0.add(pVar);
                    this.q0.put(pVar.a, pVar);
                    LocationController.SharingLocationInfo sharingLocationInfo = T().getSharingLocationInfo(this.m0);
                    if (pVar.a == l0().getClientUserId() && sharingLocationInfo != null && pVar.b.a == sharingLocationInfo.mid && this.E0 != null) {
                        pVar.e.e(new LatLng(this.E0.getLatitude(), this.E0.getLongitude()));
                    }
                }
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        } else {
            pVar.b = sb5Var;
            pVar.e.e(latLng);
        }
        org.telegram.ui.Components.u5 u5Var = this.Y;
        if (u5Var != null) {
            u5Var.E(true, true);
        }
        return pVar;
    }

    private static double k4(double d2) {
        return Math.toDegrees(d2 / 6366198.0d);
    }

    private p l3(nl5 nl5Var) {
        pa5 pa5Var = nl5Var.a;
        LatLng latLng = new LatLng(pa5Var.c, pa5Var.b);
        p pVar = new p();
        if (DialogObject.isUserDialog(this.m0)) {
            pVar.c = W().getUser(Long.valueOf(this.m0));
        } else {
            pVar.d = W().getChat(Long.valueOf(-this.m0));
        }
        pVar.a = this.m0;
        try {
            yh2 H = new yh2().H(latLng);
            Bitmap p3 = p3(pVar);
            if (p3 != null) {
                H.D(dj.a(p3));
                H.l(0.5f, 0.907f);
                pVar.e = this.Q.b(H);
                if (!UserObject.isUserSelf(pVar.c)) {
                    yh2 p2 = new yh2().H(latLng).p(true);
                    p2.D(dj.b(org.telegram.messenger.R.drawable.map_pin_circle));
                    p2.l(0.5f, 0.5f);
                    pVar.f = this.Q.b(p2);
                }
                this.p0.add(pVar);
                this.q0.put(pVar.a, pVar);
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        return pVar;
    }

    private static double l4(double d2, double d3) {
        return Math.toDegrees(d2 / (Math.cos(Math.toRadians(d3)) * 6366198.0d));
    }

    private boolean m3() {
        if (!c0().getPackageManager().hasSystemFeature("android.hardware.location.gps")) {
            return true;
        }
        try {
            if (!((LocationManager) ApplicationLoader.applicationContext.getSystemService("location")).isProviderEnabled("gps")) {
                i.C0142i c0142i = new i.C0142i(c0());
                c0142i.u(LocaleController.getString("GpsDisabledAlertTitle", R.string.GpsDisabledAlertTitle));
                c0142i.l(LocaleController.getString("GpsDisabledAlertText", R.string.GpsDisabledAlertText));
                c0142i.s(LocaleController.getString("ConnectingToProxyEnable", R.string.ConnectingToProxyEnable), new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i2) {
                        org.telegram.ui.w5.this.x3(dialogInterface, i2);
                    }
                });
                c0142i.n(LocaleController.getString("Cancel", R.string.Cancel), null);
                o1(c0142i.a());
                return false;
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        return true;
    }

    private static LatLng m4(LatLng latLng, double d2, double d3) {
        double l4 = l4(d3, latLng.a);
        return new LatLng(latLng.a + k4(d2), latLng.b + l4);
    }

    private void n3(int i2) {
        int i3;
        if (this.Q == null) {
            return;
        }
        List<ys3> asList = Arrays.asList(new mj1(20.0f), new bs0(20.0f));
        eh0 eh0Var = new eh0();
        eh0Var.l(new LatLng(this.E0.getLatitude(), this.E0.getLongitude()));
        eh0Var.C(i2);
        if (w3()) {
            eh0Var.D(-1771658281);
            i3 = 476488663;
        } else {
            eh0Var.D(-1774024971);
            i3 = 474121973;
        }
        eh0Var.p(i3);
        eh0Var.E(asList);
        eh0Var.F(2.0f);
        this.V = this.Q.a(eh0Var);
    }

    private void n4(int i2, boolean z, boolean z2) {
        LatLngBounds.a aVar = new LatLngBounds.a();
        aVar.b(new LatLng(this.E0.getLatitude(), this.E0.getLongitude()));
        try {
            try {
                if (z) {
                    int max = Math.max(i2, 250);
                    LatLng p2 = aVar.a().p();
                    double d2 = max;
                    LatLng m4 = m4(p2, d2, d2);
                    double d3 = -max;
                    aVar.b(m4(p2, d3, d3));
                    aVar.b(m4);
                    LatLngBounds a2 = aVar.a();
                    this.Q.r(AndroidUtilities.dp(70.0f), 0, AndroidUtilities.dp(70.0f), (int) ((this.Y.getCustomView().getMeasuredHeight() - AndroidUtilities.dp(40.0f)) + this.Z.getTranslationY()));
                    if (z2) {
                        this.Q.d(zo.b(a2, 0), 500, null);
                    } else {
                        this.Q.i(zo.b(a2, 0));
                    }
                } else {
                    int currentTime = K().getCurrentTime();
                    int size = this.p0.size();
                    for (int i3 = 0; i3 < size; i3++) {
                        sb5 sb5Var = this.p0.get(i3).b;
                        if (sb5Var.d + sb5Var.g.period > currentTime) {
                            pa5 pa5Var = sb5Var.g.geo;
                            aVar.b(new LatLng(pa5Var.c, pa5Var.b));
                        }
                    }
                    LatLng p3 = aVar.a().p();
                    LatLng m42 = m4(p3, 100.0d, 100.0d);
                    aVar.b(m4(p3, -100.0d, -100.0d));
                    aVar.b(m42);
                    LatLngBounds a3 = aVar.a();
                    this.Q.r(AndroidUtilities.dp(70.0f), 0, AndroidUtilities.dp(70.0f), this.Y.getCustomView().getMeasuredHeight() - AndroidUtilities.dp(100.0f));
                    this.Q.i(zo.b(a3, 0));
                }
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        } catch (Exception unused) {
        }
    }

    private Bitmap o3(int i2) {
        Bitmap[] bitmapArr = this.R0;
        int i3 = i2 % 7;
        if (bitmapArr[i3] != null) {
            return bitmapArr[i3];
        }
        try {
            Paint paint = new Paint(1);
            paint.setColor(-1);
            Bitmap createBitmap = Bitmap.createBitmap(AndroidUtilities.dp(12.0f), AndroidUtilities.dp(12.0f), Bitmap.Config.ARGB_8888);
            Canvas canvas = new Canvas(createBitmap);
            canvas.drawCircle(AndroidUtilities.dp(6.0f), AndroidUtilities.dp(6.0f), AndroidUtilities.dp(6.0f), paint);
            paint.setColor(ja2.b(i2));
            canvas.drawCircle(AndroidUtilities.dp(6.0f), AndroidUtilities.dp(6.0f), AndroidUtilities.dp(5.0f), paint);
            canvas.setBitmap(null);
            this.R0[i2 % 7] = createBitmap;
            return createBitmap;
        } catch (Throwable th) {
            FileLog.e(th);
            return null;
        }
    }

    private void o4() {
        p k3;
        ImageView imageView;
        LocationController.SharingLocationInfo sharingLocationInfo;
        int i2;
        if (this.Q == null) {
            return;
        }
        nl5 nl5Var = this.H0;
        if (nl5Var == null) {
            MessageObject messageObject = this.J0;
            if (messageObject == null) {
                Location location = new Location("network");
                this.F0 = location;
                if (this.I0 != null) {
                    pa5 pa5Var = this.I0.a;
                    LatLng latLng = new LatLng(pa5Var.c, pa5Var.b);
                    nk1 nk1Var = this.Q;
                    nk1Var.i(zo.c(latLng, nk1Var.f() - 4.0f));
                    this.F0.setLatitude(this.I0.a.c);
                    this.F0.setLongitude(this.I0.a.b);
                    this.a0.i0(this.F0);
                } else {
                    location.setLatitude(20.659322d);
                    this.F0.setLongitude(-11.40625d);
                }
            } else if (messageObject.isLiveLocation()) {
                k3 = k3(this.J0.messageOwner);
            } else {
                LatLng latLng2 = new LatLng(this.F0.getLatitude(), this.F0.getLongitude());
                try {
                    this.Q.b(new yh2().H(latLng2).D(dj.b(org.telegram.messenger.R.drawable.map_pin2)));
                } catch (Exception e2) {
                    FileLog.e(e2);
                }
                this.Q.i(zo.c(latLng2, this.Q.f() - 4.0f));
                this.n0 = false;
                u3();
            }
            this.Q.l(true);
            this.Q.h().b(false);
            this.Q.h().c(false);
            this.Q.h().a(false);
            this.Q.n(new nk1.c() {
                @Override
                public final void a(int i3) {
                    org.telegram.ui.w5.this.Y3(i3);
                }
            });
            this.Q.q(new nk1.f() {
                @Override
                public final void a(Location location2) {
                    org.telegram.ui.w5.this.Z3(location2);
                }
            });
            this.Q.p(new nk1.e() {
                @Override
                public final boolean a(xh2 xh2Var) {
                    boolean a4;
                    a4 = org.telegram.ui.w5.this.a4(xh2Var);
                    return a4;
                }
            });
            this.Q.m(new nk1.b() {
                @Override
                public final void a() {
                    org.telegram.ui.w5.this.b4();
                }
            });
            Location s3 = s3();
            this.E0 = s3;
            r4(s3);
            if (this.j0 && c0() != null) {
                this.j0 = false;
                m3();
            }
            imageView = this.r;
            if (imageView != null || imageView.getVisibility() != 0 || (sharingLocationInfo = T().getSharingLocationInfo(this.m0)) == null || (i2 = sharingLocationInfo.proximityMeters) <= 0) {
                return;
            }
            n3(i2);
            return;
        }
        k3 = l3(nl5Var);
        this.Q.i(zo.c(k3.e.a(), this.Q.f() - 4.0f));
        this.Q.l(true);
        this.Q.h().b(false);
        this.Q.h().c(false);
        this.Q.h().a(false);
        this.Q.n(new nk1.c() {
            @Override
            public final void a(int i3) {
                org.telegram.ui.w5.this.Y3(i3);
            }
        });
        this.Q.q(new nk1.f() {
            @Override
            public final void a(Location location2) {
                org.telegram.ui.w5.this.Z3(location2);
            }
        });
        this.Q.p(new nk1.e() {
            @Override
            public final boolean a(xh2 xh2Var) {
                boolean a4;
                a4 = org.telegram.ui.w5.this.a4(xh2Var);
                return a4;
            }
        });
        this.Q.m(new nk1.b() {
            @Override
            public final void a() {
                org.telegram.ui.w5.this.b4();
            }
        });
        Location s32 = s3();
        this.E0 = s32;
        r4(s32);
        if (this.j0) {
            this.j0 = false;
            m3();
        }
        imageView = this.r;
        if (imageView != null) {
        }
    }

    private Bitmap p3(p pVar) {
        oa5 oa5Var;
        z95 z95Var;
        h27 h27Var;
        Bitmap bitmap = null;
        try {
            f27 f27Var = pVar.c;
            if (f27Var == null || (h27Var = f27Var.g) == null) {
                u95 u95Var = pVar.d;
                oa5Var = (u95Var == null || (z95Var = u95Var.k) == null) ? null : z95Var.c;
            } else {
                oa5Var = h27Var.d;
            }
            Bitmap createBitmap = Bitmap.createBitmap(AndroidUtilities.dp(62.0f), AndroidUtilities.dp(85.0f), Bitmap.Config.ARGB_8888);
            try {
                createBitmap.eraseColor(0);
                Canvas canvas = new Canvas(createBitmap);
                Drawable drawable = ApplicationLoader.applicationContext.getResources().getDrawable(org.telegram.messenger.R.drawable.map_pin_photo);
                drawable.setBounds(0, 0, AndroidUtilities.dp(62.0f), AndroidUtilities.dp(85.0f));
                drawable.draw(canvas);
                Paint paint = new Paint(1);
                RectF rectF = new RectF();
                canvas.save();
                if (oa5Var != null) {
                    Bitmap decodeFile = BitmapFactory.decodeFile(FileLoader.getPathToAttach(oa5Var, true).toString());
                    if (decodeFile != null) {
                        Shader.TileMode tileMode = Shader.TileMode.CLAMP;
                        BitmapShader bitmapShader = new BitmapShader(decodeFile, tileMode, tileMode);
                        Matrix matrix = new Matrix();
                        float dp = AndroidUtilities.dp(50.0f) / decodeFile.getWidth();
                        matrix.postTranslate(AndroidUtilities.dp(6.0f), AndroidUtilities.dp(6.0f));
                        matrix.postScale(dp, dp);
                        paint.setShader(bitmapShader);
                        bitmapShader.setLocalMatrix(matrix);
                        rectF.set(AndroidUtilities.dp(6.0f), AndroidUtilities.dp(6.0f), AndroidUtilities.dp(56.0f), AndroidUtilities.dp(56.0f));
                        canvas.drawRoundRect(rectF, AndroidUtilities.dp(25.0f), AndroidUtilities.dp(25.0f), paint);
                    }
                } else {
                    org.telegram.messenger.p110.xe xeVar = new org.telegram.messenger.p110.xe();
                    f27 f27Var2 = pVar.c;
                    if (f27Var2 != null) {
                        xeVar.t(f27Var2);
                    } else {
                        u95 u95Var2 = pVar.d;
                        if (u95Var2 != null) {
                            xeVar.r(u95Var2);
                        }
                    }
                    canvas.translate(AndroidUtilities.dp(6.0f), AndroidUtilities.dp(6.0f));
                    xeVar.setBounds(0, 0, AndroidUtilities.dp(50.0f), AndroidUtilities.dp(50.0f));
                    xeVar.draw(canvas);
                }
                canvas.restore();
                try {
                    canvas.setBitmap(null);
                    return createBitmap;
                } catch (Exception unused) {
                    return createBitmap;
                }
            } catch (Throwable th) {
                th = th;
                bitmap = createBitmap;
                FileLog.e(th);
                return bitmap;
            }
        } catch (Throwable th2) {
            th = th2;
        }
    }

    private void p4() {
        ch0 ch0Var = this.V;
        if (ch0Var == null) {
            n3(500);
        } else {
            this.W = ch0Var.a();
        }
        final f27 user = DialogObject.isUserDialog(this.m0) ? W().getUser(Long.valueOf(this.m0)) : null;
        org.telegram.ui.Components.u5 u5Var = new org.telegram.ui.Components.u5(c0(), user, new u5.g() {
            @Override
            public final boolean a(boolean z, int i2) {
                boolean c4;
                c4 = org.telegram.ui.w5.this.c4(z, i2);
                return c4;
            }
        }, new u5.g() {
            @Override
            public final boolean a(boolean z, int i2) {
                boolean e4;
                e4 = org.telegram.ui.w5.this.e4(user, z, i2);
                return e4;
            }
        }, new Runnable() {
            @Override
            public final void run() {
                org.telegram.ui.w5.this.f4();
            }
        });
        this.Y = u5Var;
        ((FrameLayout) this.e).addView(u5Var, g52.a(-1, -1.0f));
        this.Y.C();
    }

    private void q3(ArrayList<sb5> arrayList) {
        LatLngBounds.a aVar = this.n0 ? new LatLngBounds.a() : null;
        int currentTime = K().getCurrentTime();
        for (int i2 = 0; i2 < arrayList.size(); i2++) {
            sb5 sb5Var = arrayList.get(i2);
            if (sb5Var.d + sb5Var.g.period > currentTime) {
                if (aVar != null) {
                    pa5 pa5Var = sb5Var.g.geo;
                    aVar.b(new LatLng(pa5Var.c, pa5Var.b));
                }
                k3(sb5Var);
                if (this.r.getVisibility() != 8 && MessageObject.getFromChatId(sb5Var) != l0().getClientUserId()) {
                    this.r.setVisibility(0);
                    this.J = true;
                    this.r.animate().alpha(1.0f).scaleX(1.0f).scaleY(1.0f).setDuration(180L).setListener(new f()).start();
                }
            }
        }
        if (aVar != null) {
            if (this.n0) {
                this.b0.s1(0, AndroidUtilities.dp(99.0f));
            }
            this.n0 = false;
            this.a0.k0(this.p0);
            if (this.J0.isLiveLocation()) {
                try {
                    LatLng p2 = aVar.a().p();
                    LatLng m4 = m4(p2, 100.0d, 100.0d);
                    aVar.b(m4(p2, -100.0d, -100.0d));
                    aVar.b(m4);
                    LatLngBounds a2 = aVar.a();
                    if (arrayList.size() > 1) {
                        try {
                            yo b2 = zo.b(a2, AndroidUtilities.dp(113.0f));
                            this.R = b2;
                            this.Q.i(b2);
                            this.R = null;
                        } catch (Exception e2) {
                            FileLog.e(e2);
                        }
                    }
                } catch (Exception unused) {
                }
            }
        }
    }

    public void q4(final int i2) {
        Activity c0;
        if (this.N0 == null || c0() == null || this.E0 == null || !m3()) {
            return;
        }
        if (this.x0 && Build.VERSION.SDK_INT >= 29 && (c0 = c0()) != null) {
            this.y0 = i2;
            this.x0 = false;
            SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
            if (Math.abs((System.currentTimeMillis() / 1000) - globalMainSettings.getInt("backgroundloc", 0)) > 86400 && c0.checkSelfPermission("android.permission.ACCESS_BACKGROUND_LOCATION") != 0) {
                globalMainSettings.edit().putInt("backgroundloc", (int) (System.currentTimeMillis() / 1000)).commit();
                org.telegram.ui.Components.b.l1(c0, W().getUser(Long.valueOf(l0().getClientUserId())), new Runnable() {
                    @Override
                    public final void run() {
                        org.telegram.ui.w5.this.g4();
                    }
                }, null).C();
                return;
            }
        }
        final f27 user = DialogObject.isUserDialog(this.m0) ? W().getUser(Long.valueOf(this.m0)) : null;
        o1(org.telegram.ui.Components.b.G1(c0(), user, new MessagesStorage.IntCallback() {
            @Override
            public final void run(int i3) {
                org.telegram.ui.w5.this.h4(user, i2, i3);
            }
        }, null));
    }

    public void r3(boolean z) {
        FrameLayout.LayoutParams layoutParams;
        if (this.b0 != null) {
            int currentActionBarHeight = (this.g.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + org.telegram.ui.ActionBar.a.getCurrentActionBarHeight();
            int measuredHeight = this.e.getMeasuredHeight();
            if (measuredHeight == 0) {
                return;
            }
            int i2 = this.O0;
            this.P0 = (measuredHeight - ((i2 != 6 && i2 == 2) ? AndroidUtilities.dp(73.0f) : AndroidUtilities.dp(66.0f))) - currentActionBarHeight;
            FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) this.b0.getLayoutParams();
            layoutParams2.topMargin = currentActionBarHeight;
            this.b0.setLayoutParams(layoutParams2);
            FrameLayout.LayoutParams layoutParams3 = (FrameLayout.LayoutParams) this.Z.getLayoutParams();
            layoutParams3.topMargin = currentActionBarHeight;
            layoutParams3.height = this.P0;
            this.Z.setLayoutParams(layoutParams3);
            org.telegram.ui.Components.h6 h6Var = this.c0;
            if (h6Var != null) {
                FrameLayout.LayoutParams layoutParams4 = (FrameLayout.LayoutParams) h6Var.getLayoutParams();
                layoutParams4.topMargin = currentActionBarHeight;
                this.c0.setLayoutParams(layoutParams4);
            }
            this.a0.n0(this.P0);
            FrameLayout.LayoutParams layoutParams5 = (FrameLayout.LayoutParams) this.S.getLayoutParams();
            if (layoutParams5 != null) {
                layoutParams5.height = this.P0 + AndroidUtilities.dp(10.0f);
                nk1 nk1Var = this.Q;
                if (nk1Var != null) {
                    nk1Var.r(AndroidUtilities.dp(70.0f), 0, AndroidUtilities.dp(70.0f), AndroidUtilities.dp(10.0f));
                }
                this.S.setLayoutParams(layoutParams5);
            }
            r rVar = this.B;
            if (rVar != null && (layoutParams = (FrameLayout.LayoutParams) rVar.getLayoutParams()) != null) {
                layoutParams.height = this.P0 + AndroidUtilities.dp(10.0f);
                this.B.setLayoutParams(layoutParams);
            }
            this.a0.j();
            if (!z) {
                C4(false);
                return;
            }
            int i3 = this.O0;
            final int i4 = i3 == 3 ? 73 : (i3 == 1 || i3 == 2) ? 66 : 0;
            this.f0.H2(0, -AndroidUtilities.dp(i4));
            C4(false);
            this.b0.post(new Runnable() {
                @Override
                public final void run() {
                    org.telegram.ui.w5.this.T3(i4);
                }
            });
        }
    }

    private void r4(Location location) {
        if (location == null) {
            return;
        }
        this.E0 = new Location(location);
        p pVar = this.q0.get(l0().getClientUserId());
        LocationController.SharingLocationInfo sharingLocationInfo = T().getSharingLocationInfo(this.m0);
        if (pVar != null && sharingLocationInfo != null && pVar.b.a == sharingLocationInfo.mid) {
            LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
            pVar.e.e(latLng);
            xh2 xh2Var = pVar.f;
            if (xh2Var != null) {
                xh2Var.e(latLng);
            }
        }
        if (this.J0 == null && this.H0 == null && this.Q != null) {
            LatLng latLng2 = new LatLng(location.getLatitude(), location.getLongitude());
            fa2 fa2Var = this.a0;
            if (fa2Var != null) {
                if (!this.L0 && this.O0 != 4) {
                    fa2Var.Y(null, this.E0, true);
                }
                this.a0.j0(this.E0);
            }
            if (!this.K0) {
                this.F0 = new Location(location);
                if (this.M0) {
                    this.Q.c(zo.a(latLng2));
                } else {
                    this.M0 = true;
                    this.Q.i(zo.c(latLng2, this.Q.f() - 4.0f));
                }
            }
        } else {
            this.a0.j0(this.E0);
        }
        org.telegram.ui.Components.u5 u5Var = this.Y;
        if (u5Var != null) {
            u5Var.E(true, true);
        }
        ch0 ch0Var = this.V;
        if (ch0Var != null) {
            ch0Var.c(new LatLng(this.E0.getLatitude(), this.E0.getLongitude()));
        }
    }

    private Location s3() {
        LocationManager locationManager = (LocationManager) ApplicationLoader.applicationContext.getSystemService("location");
        List<String> providers = locationManager.getProviders(true);
        Location location = null;
        for (int size = providers.size() - 1; size >= 0; size--) {
            location = locationManager.getLastKnownLocation(providers.get(size));
            if (location != null) {
                break;
            }
        }
        return location;
    }

    private void s4() {
        if (this.t0 != null) {
            this.e0.setVisibility(0);
            this.B.f(this.t0);
            this.t0 = null;
            this.u0 = null;
            this.v0 = null;
        }
    }

    private long t3(sb5 sb5Var) {
        return sb5Var.b != null ? MessageObject.getFromChatId(sb5Var) : MessageObject.getDialogId(sb5Var);
    }

    private boolean u3() {
        ArrayList<sb5> arrayList = T().locationsCache.get(this.J0.getDialogId());
        if (arrayList == null || !arrayList.isEmpty()) {
            arrayList = null;
        } else {
            q3(arrayList);
        }
        if (DialogObject.isChatDialog(this.m0)) {
            u95 chat = W().getChat(Long.valueOf(-this.m0));
            if (ChatObject.isChannel(chat) && !chat.o) {
                return false;
            }
        }
        sd6 sd6Var = new sd6();
        final long dialogId = this.J0.getDialogId();
        sd6Var.a = W().getInputPeer(dialogId);
        sd6Var.b = 100;
        K().sendRequest(sd6Var, new RequestDelegate() {
            @Override
            public final void run(i95 i95Var, ov5 ov5Var) {
                org.telegram.ui.w5.this.W3(dialogId, i95Var, ov5Var);
            }
        });
        return arrayList != null;
    }

    private UndoView v3() {
        if (this.H[0].getVisibility() == 0) {
            UndoView[] undoViewArr = this.H;
            UndoView undoView = undoViewArr[0];
            undoViewArr[0] = undoViewArr[1];
            undoViewArr[1] = undoView;
            undoView.m(true, 2);
            this.Z.removeView(this.H[0]);
            this.Z.addView(this.H[0]);
        }
        return this.H[0];
    }

    private boolean w3() {
        return org.telegram.ui.ActionBar.w.i1().J() || AndroidUtilities.computePerceivedBrightness(org.telegram.ui.ActionBar.w.r1("windowBackgroundWhite")) < 0.721f;
    }

    public void x3(DialogInterface dialogInterface, int i2) {
        if (c0() == null) {
            return;
        }
        try {
            c0().startActivity(new Intent("android.settings.LOCATION_SOURCE_SETTINGS"));
        } catch (Exception unused) {
        }
    }

    public void y3(View view) {
        B4(false);
        this.a0.Z(null, this.F0, true, true);
        this.L0 = true;
        A4();
    }

    public void h4(f27 f27Var, int i2, int i3) {
        v76 v76Var = new v76();
        aw5 aw5Var = new aw5();
        v76Var.geo = aw5Var;
        aw5Var.c = AndroidUtilities.fixLocationCoord(this.E0.getLatitude());
        v76Var.geo.b = AndroidUtilities.fixLocationCoord(this.E0.getLongitude());
        v76Var.heading = LocationController.getHeading(this.E0);
        int i4 = v76Var.flags | 1;
        v76Var.flags = i4;
        v76Var.period = i2;
        v76Var.proximity_notification_radius = i3;
        v76Var.flags = i4 | 8;
        this.N0.b(v76Var, this.O0, true, 0);
        if (i3 <= 0) {
            D();
            return;
        }
        this.Y.B();
        this.r.setImageResource(org.telegram.messenger.R.drawable.msg_location_alert2);
        org.telegram.ui.Components.u5 u5Var = this.Y;
        if (u5Var != null) {
            u5Var.t();
        }
        v3().A(0L, 24, Integer.valueOf(i3), f27Var, null, null);
    }

    public void z3(View view) {
        this.s.H0();
    }

    public void z4(boolean z) {
        int i2;
        String str;
        if (c0() == null) {
            return;
        }
        i.C0142i c0142i = new i.C0142i(c0());
        c0142i.u(LocaleController.getString("AppName", R.string.AppName));
        if (z) {
            i2 = R.string.PermissionNoLocationPosition;
            str = "PermissionNoLocationPosition";
        } else {
            i2 = R.string.PermissionNoLocation;
            str = "PermissionNoLocation";
        }
        c0142i.l(LocaleController.getString(str, i2));
        c0142i.n(LocaleController.getString("PermissionOpenSettings", R.string.PermissionOpenSettings), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i3) {
                org.telegram.ui.w5.this.i4(dialogInterface, i3);
            }
        });
        c0142i.s(LocaleController.getString("OK", R.string.OK), null);
        o1(c0142i.a());
    }

    @Override
    public boolean E0() {
        super.E0();
        Z().addObserver(this, NotificationCenter.closeChats);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.locationPermissionGranted);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.locationPermissionDenied);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.liveLocationsChanged);
        MessageObject messageObject = this.J0;
        if (messageObject == null || !messageObject.isLiveLocation()) {
            return true;
        }
        Z().addObserver(this, NotificationCenter.didReceiveNewMessages);
        Z().addObserver(this, NotificationCenter.replaceMessagesObjects);
        return true;
    }

    @Override
    public void F0() {
        super.F0();
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.locationPermissionGranted);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.locationPermissionDenied);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.liveLocationsChanged);
        Z().removeObserver(this, NotificationCenter.closeChats);
        Z().removeObserver(this, NotificationCenter.didReceiveNewMessages);
        Z().removeObserver(this, NotificationCenter.replaceMessagesObjects);
        try {
            nk1 nk1Var = this.Q;
            if (nk1Var != null) {
                nk1Var.l(false);
            }
        } catch (Exception e2) {
            FileLog.e(e2);
        }
        try {
            uh2 uh2Var = this.S;
            if (uh2Var != null) {
                uh2Var.c();
            }
        } catch (Exception e3) {
            FileLog.e(e3);
        }
        UndoView[] undoViewArr = this.H;
        if (undoViewArr[0] != null) {
            undoViewArr[0].m(true, 0);
        }
        fa2 fa2Var = this.a0;
        if (fa2Var != null) {
            fa2Var.N();
        }
        ga2 ga2Var = this.d0;
        if (ga2Var != null) {
            ga2Var.N();
        }
        Runnable runnable = this.o0;
        if (runnable != null) {
            AndroidUtilities.cancelRunOnUIThread(runnable);
            this.o0 = null;
        }
        Runnable runnable2 = this.Q0;
        if (runnable2 != null) {
            AndroidUtilities.cancelRunOnUIThread(runnable2);
            this.Q0 = null;
        }
    }

    @Override
    public void G0() {
        super.G0();
        uh2 uh2Var = this.S;
        if (uh2Var == null || !this.C0) {
            return;
        }
        uh2Var.d();
    }

    @Override
    public void H0() {
        super.H0();
        uh2 uh2Var = this.S;
        if (uh2Var != null && this.C0) {
            try {
                uh2Var.e();
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        }
        UndoView[] undoViewArr = this.H;
        if (undoViewArr[0] != null) {
            undoViewArr[0].m(true, 0);
        }
        this.D0 = false;
    }

    @Override
    public void K0(int i2, String[] strArr, int[] iArr) {
        if (i2 == 30) {
            q4(this.y0);
        }
    }

    @Override
    public void M0() {
        Activity c0;
        super.M0();
        AndroidUtilities.requestAdjustResize(c0(), this.k);
        AndroidUtilities.removeAdjustResize(c0(), this.k);
        uh2 uh2Var = this.S;
        if (uh2Var != null && this.C0) {
            try {
                uh2Var.f();
            } catch (Throwable th) {
                FileLog.e(th);
            }
        }
        this.D0 = true;
        nk1 nk1Var = this.Q;
        if (nk1Var != null) {
            try {
                nk1Var.l(true);
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        }
        r3(true);
        if (this.w0 && Build.VERSION.SDK_INT >= 23 && (c0 = c0()) != null) {
            this.w0 = false;
            if (c0.checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) {
                c0.requestPermissions(new String[]{"android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"}, 2);
            }
        }
        Runnable runnable = this.Q0;
        if (runnable != null) {
            AndroidUtilities.cancelRunOnUIThread(runnable);
            AndroidUtilities.runOnUIThread(this.Q0, 5000L);
        }
    }

    @Override
    public void O0(boolean z, boolean z2) {
        if (!z || z2) {
            return;
        }
        try {
            if (this.S.getParent() instanceof ViewGroup) {
                ((ViewGroup) this.S.getParent()).removeView(this.S);
            }
        } catch (Exception unused) {
        }
        FrameLayout frameLayout = this.Z;
        if (frameLayout == null) {
            View view = this.e;
            if (view != null) {
                ((FrameLayout) view).addView(this.S, 0, g52.c(-1, -1, 51));
                return;
            }
            return;
        }
        frameLayout.addView(this.S, 0, g52.c(-1, this.P0 + AndroidUtilities.dp(10.0f), 51));
        r rVar = this.B;
        if (rVar != null) {
            try {
                if (rVar.getParent() instanceof ViewGroup) {
                    ((ViewGroup) this.B.getParent()).removeView(this.B);
                }
            } catch (Exception unused2) {
            }
            this.Z.addView(this.B, 1, g52.c(-1, this.P0 + AndroidUtilities.dp(10.0f), 51));
        }
        C4(false);
        j4();
    }

    @Override
    public void didReceivedNotification(int i2, int i3, Object... objArr) {
        fa2 fa2Var;
        p pVar;
        fa2 fa2Var2;
        if (i2 == NotificationCenter.closeChats) {
            X0();
            return;
        }
        if (i2 == NotificationCenter.locationPermissionGranted) {
            this.k0 = false;
            fa2 fa2Var3 = this.a0;
            if (fa2Var3 != null) {
                fa2Var3.m0(false);
            }
            nk1 nk1Var = this.Q;
            if (nk1Var != null) {
                try {
                    nk1Var.l(true);
                    return;
                } catch (Exception e2) {
                    FileLog.e(e2);
                    return;
                }
            }
            return;
        }
        if (i2 == NotificationCenter.locationPermissionDenied) {
            this.k0 = true;
            fa2 fa2Var4 = this.a0;
            if (fa2Var4 != null) {
                fa2Var4.m0(true);
                return;
            }
            return;
        }
        if (i2 == NotificationCenter.liveLocationsChanged) {
            fa2 fa2Var5 = this.a0;
            if (fa2Var5 != null) {
                fa2Var5.q0();
                return;
            }
            return;
        }
        if (i2 == NotificationCenter.didReceiveNewMessages) {
            if (((Boolean) objArr[2]).booleanValue() || ((Long) objArr[0]).longValue() != this.m0 || this.J0 == null) {
                return;
            }
            ArrayList arrayList = (ArrayList) objArr[1];
            boolean z = false;
            for (int i4 = 0; i4 < arrayList.size(); i4++) {
                MessageObject messageObject = (MessageObject) arrayList.get(i4);
                if (messageObject.isLiveLocation()) {
                    k3(messageObject.messageOwner);
                    z = true;
                } else if ((messageObject.messageOwner.e instanceof k56) && DialogObject.isUserDialog(messageObject.getDialogId())) {
                    this.r.setImageResource(org.telegram.messenger.R.drawable.msg_location_alert);
                    ch0 ch0Var = this.V;
                    if (ch0Var != null) {
                        ch0Var.b();
                        this.V = null;
                    }
                }
            }
            if (!z || (fa2Var2 = this.a0) == null) {
                return;
            }
            fa2Var2.k0(this.p0);
            return;
        }
        if (i2 == NotificationCenter.replaceMessagesObjects) {
            long longValue = ((Long) objArr[0]).longValue();
            if (longValue != this.m0 || this.J0 == null) {
                return;
            }
            ArrayList arrayList2 = (ArrayList) objArr[1];
            boolean z2 = false;
            for (int i5 = 0; i5 < arrayList2.size(); i5++) {
                MessageObject messageObject2 = (MessageObject) arrayList2.get(i5);
                if (messageObject2.isLiveLocation() && (pVar = this.q0.get(t3(messageObject2.messageOwner))) != null) {
                    LocationController.SharingLocationInfo sharingLocationInfo = T().getSharingLocationInfo(longValue);
                    if (sharingLocationInfo == null || sharingLocationInfo.mid != messageObject2.getId()) {
                        pVar.b = messageObject2.messageOwner;
                        pa5 pa5Var = messageObject2.messageOwner.g.geo;
                        LatLng latLng = new LatLng(pa5Var.c, pa5Var.b);
                        pVar.e.e(latLng);
                        xh2 xh2Var = pVar.f;
                        if (xh2Var != null) {
                            xh2Var.a();
                            pVar.f.e(latLng);
                            int i6 = messageObject2.messageOwner.g.heading;
                            if (i6 != 0) {
                                pVar.f.f(i6);
                                if (!pVar.g) {
                                    pVar.f.d(dj.b(org.telegram.messenger.R.drawable.map_pin_cone2));
                                    pVar.g = true;
                                }
                            } else if (pVar.g) {
                                pVar.f.f(0.0f);
                                pVar.f.d(dj.b(org.telegram.messenger.R.drawable.map_pin_circle));
                                pVar.g = false;
                            }
                        }
                    }
                    z2 = true;
                }
            }
            if (!z2 || (fa2Var = this.a0) == null) {
                return;
            }
            fa2Var.r0();
            org.telegram.ui.Components.u5 u5Var = this.Y;
            if (u5Var != null) {
                u5Var.E(true, true);
            }
        }
    }

    @Override
    public ArrayList<org.telegram.ui.ActionBar.a0> i0() {
        ArrayList<org.telegram.ui.ActionBar.a0> arrayList = new ArrayList<>();
        a0.a aVar = new a0.a() {
            @Override
            public void a(float f2) {
                aa7.a(this, f2);
            }

            @Override
            public final void b() {
                org.telegram.ui.w5.this.X3();
            }
        };
        for (int i2 = 0; i2 < this.H.length; i2++) {
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], org.telegram.ui.ActionBar.a0.v, null, null, null, null, "undo_background"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"undoImageView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "undo_cancelColor"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"undoTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "undo_cancelColor"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"infoTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "undo_infoColor"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"subinfoTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "undo_infoColor"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"textPaint"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "undo_infoColor"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"progressPaint"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "undo_infoColor"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "BODY", "undo_background"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "Wibe Big", "undo_background"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "Wibe Big 3", "undo_infoColor"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "Wibe Small", "undo_infoColor"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "Body Main.**", "undo_infoColor"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "Body Top.**", "undo_infoColor"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "Line.**", "undo_infoColor"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "Curve Big.**", "undo_infoColor"));
            arrayList.add(new org.telegram.ui.ActionBar.a0(this.H[i2], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "Curve Small.**", "undo_infoColor"));
        }
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.e, org.telegram.ui.ActionBar.a0.q, null, null, null, aVar, "dialogBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.q, null, null, null, null, "dialogBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, org.telegram.ui.ActionBar.a0.F, null, null, null, null, "dialogBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.w, null, null, null, null, "dialogTextBlack"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.x, null, null, null, null, "dialogTextBlack"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.y, null, null, null, null, "dialogButtonSelector"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.R, null, null, null, null, "dialogTextBlack"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.Q, null, null, null, null, "chat_messagePanelHint"));
        org.telegram.ui.ActionBar.d dVar = this.A;
        arrayList.add(new org.telegram.ui.ActionBar.a0(dVar != null ? dVar.getSearchField() : null, org.telegram.ui.ActionBar.a0.O, null, null, null, null, "dialogTextBlack"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.V, null, null, null, aVar, "actionBarDefaultSubmenuBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.U, null, null, null, aVar, "actionBarDefaultSubmenuItem"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.g, org.telegram.ui.ActionBar.a0.t | org.telegram.ui.ActionBar.a0.U, null, null, null, aVar, "actionBarDefaultSubmenuItemIcon"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, org.telegram.ui.ActionBar.a0.C, null, null, null, null, "listSelectorSDK21"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, 0, new Class[]{View.class}, org.telegram.ui.ActionBar.w.l0, null, null, "divider"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.v, org.telegram.ui.ActionBar.a0.t, null, null, null, null, "dialogEmptyImage"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.w, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "dialogEmptyText"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.x, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "dialogEmptyText"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.z, 0, null, null, null, null, "key_sheet_scrollUp"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.q, org.telegram.ui.ActionBar.a0.t | org.telegram.ui.ActionBar.a0.I, null, null, null, null, "location_actionIcon"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.q, org.telegram.ui.ActionBar.a0.t | org.telegram.ui.ActionBar.a0.I, null, null, null, null, "location_actionActiveIcon"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.q, org.telegram.ui.ActionBar.a0.v, null, null, null, null, "location_actionBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.q, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "location_actionPressedBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.s, 0, null, null, null, aVar, "location_actionIcon"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.s, org.telegram.ui.ActionBar.a0.v, null, null, null, null, "location_actionBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.s, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "location_actionPressedBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.r, 0, null, null, null, aVar, "location_actionIcon"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.r, org.telegram.ui.ActionBar.a0.v, null, null, null, null, "location_actionBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.r, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "location_actionPressedBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.t, org.telegram.ui.ActionBar.a0.s, null, null, null, null, "location_actionActiveIcon"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.t, org.telegram.ui.ActionBar.a0.v, null, null, null, null, "location_actionBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.t, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.G, null, null, null, null, "location_actionPressedBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(null, 0, null, null, org.telegram.ui.ActionBar.w.s0, aVar, "avatar_text"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(null, 0, null, null, null, aVar, "avatar_backgroundRed"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(null, 0, null, null, null, aVar, "avatar_backgroundOrange"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(null, 0, null, null, null, aVar, "avatar_backgroundViolet"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(null, 0, null, null, null, aVar, "avatar_backgroundGreen"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(null, 0, null, null, null, aVar, "avatar_backgroundCyan"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(null, 0, null, null, null, aVar, "avatar_backgroundBlue"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(null, 0, null, null, null, aVar, "avatar_backgroundPink"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(null, 0, null, null, null, null, "location_liveLocationProgress"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(null, 0, null, null, null, null, "location_placeLocationBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(null, 0, null, null, null, null, "dialog_liveLocationProgress"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, org.telegram.ui.ActionBar.a0.H | org.telegram.ui.ActionBar.a0.I, new Class[]{yp4.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "location_sendLocationIcon"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, org.telegram.ui.ActionBar.a0.H | org.telegram.ui.ActionBar.a0.I, new Class[]{yp4.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "location_sendLiveLocationIcon"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.H | org.telegram.ui.ActionBar.a0.I, new Class[]{yp4.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "location_sendLocationBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.H | org.telegram.ui.ActionBar.a0.I, new Class[]{yp4.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "location_sendLiveLocationBackground"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, 0, new Class[]{yp4.class}, new String[]{"accurateTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteGrayText3"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, org.telegram.ui.ActionBar.a0.I, new Class[]{yp4.class}, new String[]{"titleTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "location_sendLiveLocationText"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, org.telegram.ui.ActionBar.a0.I, new Class[]{yp4.class}, new String[]{"titleTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "location_sendLocationText"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, 0, new Class[]{qb2.class}, new String[]{"buttonTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "featuredStickers_buttonText"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, org.telegram.ui.ActionBar.a0.H, new Class[]{qb2.class}, new String[]{"frameLayout"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "featuredStickers_addButton"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, org.telegram.ui.ActionBar.a0.H | org.telegram.ui.ActionBar.a0.G, new Class[]{qb2.class}, new String[]{"frameLayout"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "featuredStickers_addButtonPressed"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, org.telegram.ui.ActionBar.a0.v, new Class[]{iv4.class}, null, null, null, "windowBackgroundGrayShadow"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, org.telegram.ui.ActionBar.a0.v | org.telegram.ui.ActionBar.a0.u, new Class[]{iv4.class}, null, null, null, "windowBackgroundGray"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, 0, new Class[]{rr1.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "dialogTextBlue2"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, org.telegram.ui.ActionBar.a0.v, new Class[]{ja2.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteGrayText3"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, 0, new Class[]{ja2.class}, new String[]{"nameTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteBlackText"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, 0, new Class[]{ja2.class}, new String[]{"addressTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteGrayText3"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.c0, org.telegram.ui.ActionBar.a0.v, new Class[]{ja2.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteGrayText3"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.c0, 0, new Class[]{ja2.class}, new String[]{"nameTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteBlackText"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.c0, 0, new Class[]{ja2.class}, new String[]{"addressTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteGrayText3"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, 0, new Class[]{ay4.class}, new String[]{"nameTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteBlackText"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, 0, new Class[]{ay4.class}, new String[]{"distanceTextView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteGrayText3"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, 0, new Class[]{sb2.class}, new String[]{"progressBar"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "progressCircle"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, 0, new Class[]{sb2.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteGrayText3"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, 0, new Class[]{sb2.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteGrayText3"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, 0, new Class[]{tb2.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "windowBackgroundWhiteGrayText3"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, org.telegram.ui.ActionBar.a0.t, new Class[]{tb2.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "dialogEmptyImage"));
        arrayList.add(new org.telegram.ui.ActionBar.a0(this.b0, 0, new Class[]{tb2.class}, new String[]{"textView2"}, (Paint[]) null, (Drawable[]) null, (a0.a) null, "dialogEmptyText"));
        return arrayList;
    }

    @Override
    public boolean s0(MotionEvent motionEvent) {
        return false;
    }

    public void t4(long j2, nl5 nl5Var) {
        this.m0 = -j2;
        this.H0 = nl5Var;
    }

    public void u4(q qVar) {
        this.N0 = qVar;
    }

    public void v4(long j2) {
        this.m0 = j2;
    }

    public void w4(nl5 nl5Var) {
        this.I0 = nl5Var;
    }

    @Override
    public boolean x0() {
        org.telegram.ui.Components.u5 u5Var = this.Y;
        if (u5Var == null) {
            return super.x0();
        }
        u5Var.t();
        return false;
    }

    public void x4(MessageObject messageObject) {
        this.J0 = messageObject;
        this.m0 = messageObject.getDialogId();
    }

    @Override
    public void y0() {
        UndoView[] undoViewArr = this.H;
        if (undoViewArr[0] != null) {
            undoViewArr[0].m(true, 0);
        }
    }

    @Override
    public View z(Context context) {
        Location location;
        pa5 pa5Var;
        int i2;
        org.telegram.ui.ActionBar.a aVar;
        int i3;
        String str;
        org.telegram.ui.ActionBar.a aVar2;
        int i4;
        String str2;
        String str3;
        String str4;
        String str5;
        MessageObject messageObject;
        ImageView imageView;
        int i5;
        MessageObject messageObject2;
        nl5 nl5Var;
        MessageObject messageObject3;
        int i6;
        int i7;
        this.A0 = false;
        this.z0 = false;
        this.B0 = false;
        fa2 fa2Var = this.a0;
        if (fa2Var != null) {
            fa2Var.N();
        }
        ga2 ga2Var = this.d0;
        if (ga2Var != null) {
            ga2Var.N();
        }
        if (this.H0 == null) {
            if (this.J0 != null) {
                Location location2 = new Location("network");
                this.F0 = location2;
                location2.setLatitude(this.J0.messageOwner.g.geo.c);
                location = this.F0;
                pa5Var = this.J0.messageOwner.g.geo;
            }
            i2 = Build.VERSION.SDK_INT;
            this.k0 = (i2 >= 23 || c0() == null || c0().checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") == 0) ? false : true;
            this.g.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("dialogBackground"));
            this.g.setTitleColor(org.telegram.ui.ActionBar.w.r1("dialogTextBlack"));
            this.g.P(org.telegram.ui.ActionBar.w.r1("dialogTextBlack"), false);
            this.g.O(org.telegram.ui.ActionBar.w.r1("dialogButtonSelector"), false);
            this.g.setBackButtonImage(org.telegram.messenger.R.drawable.ic_ab_back);
            this.g.setAllowOverlayTitle(true);
            if (AndroidUtilities.isTablet()) {
                this.g.setOccupyStatusBar(false);
            }
            this.g.setAddToContainer(false);
            this.g.setActionBarMenuOnItemClick(new g());
            org.telegram.ui.ActionBar.b z = this.g.z();
            if (this.H0 != null) {
                MessageObject messageObject4 = this.J0;
                if (messageObject4 == null) {
                    this.g.setTitle(LocaleController.getString("ShareLocation", R.string.ShareLocation));
                    if (this.O0 != 4) {
                        this.B = new r(context);
                        org.telegram.ui.ActionBar.d y0 = z.b(0, org.telegram.messenger.R.drawable.ic_ab_search).A0(true).y0(new h());
                        this.A = y0;
                        y0.setSearchFieldHint(LocaleController.getString("Search", R.string.Search));
                        this.A.setContentDescription(LocaleController.getString("Search", R.string.Search));
                        EditTextBoldCursor searchField = this.A.getSearchField();
                        searchField.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogTextBlack"));
                        searchField.setCursorColor(org.telegram.ui.ActionBar.w.r1("dialogTextBlack"));
                        searchField.setHintTextColor(org.telegram.ui.ActionBar.w.r1("chat_messagePanelHint"));
                    }
                } else if (messageObject4.isLiveLocation()) {
                    aVar2 = this.g;
                    i4 = R.string.AttachLiveLocation;
                    str2 = "AttachLiveLocation";
                } else {
                    String str6 = this.J0.messageOwner.g.title;
                    if (str6 == null || str6.length() <= 0) {
                        aVar = this.g;
                        i3 = R.string.ChatLocation;
                        str = "ChatLocation";
                    } else {
                        aVar = this.g;
                        i3 = R.string.SharedPlace;
                        str = "SharedPlace";
                    }
                    aVar.setTitle(LocaleController.getString(str, i3));
                    org.telegram.ui.ActionBar.d b2 = z.b(0, org.telegram.messenger.R.drawable.ic_ab_other);
                    this.g0 = b2;
                    b2.J(1, org.telegram.messenger.R.drawable.msg_openin, LocaleController.getString("OpenInExternalApp", R.string.OpenInExternalApp));
                    if (!T().isSharingLocation(this.m0)) {
                        this.g0.J(5, org.telegram.messenger.R.drawable.menu_location, LocaleController.getString("SendLiveLocationMenu", R.string.SendLiveLocationMenu));
                    }
                    this.g0.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
                }
                i iVar = new i(context);
                this.e = iVar;
                i iVar2 = iVar;
                iVar.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("dialogBackground"));
                Drawable mutate = context.getResources().getDrawable(org.telegram.messenger.R.drawable.sheet_shadow_round).mutate();
                this.y = mutate;
                mutate.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("dialogBackground"), PorterDuff.Mode.MULTIPLY));
                Rect rect = new Rect();
                this.y.getPadding(rect);
                int i8 = this.O0;
                FrameLayout.LayoutParams layoutParams = (i8 != 0 || i8 == 1) ? new FrameLayout.LayoutParams(-1, AndroidUtilities.dp(21.0f) + rect.top) : new FrameLayout.LayoutParams(-1, AndroidUtilities.dp(6.0f) + rect.top);
                layoutParams.gravity = 83;
                j jVar = new j(context);
                this.Z = jVar;
                jVar.setBackgroundDrawable(new rh2());
                if (this.J0 == null && ((i7 = this.O0) == 0 || i7 == 1)) {
                    s sVar = new s(context);
                    this.t = sVar;
                    sVar.setTranslationX(-AndroidUtilities.dp(80.0f));
                    Drawable Z0 = org.telegram.ui.ActionBar.w.Z0(AndroidUtilities.dp(40.0f), org.telegram.ui.ActionBar.w.r1("location_actionBackground"), org.telegram.ui.ActionBar.w.r1("location_actionPressedBackground"));
                    if (i2 >= 21) {
                        Drawable mutate2 = context.getResources().getDrawable(org.telegram.messenger.R.drawable.places_btn).mutate();
                        mutate2.setColorFilter(new PorterDuffColorFilter(com.batch.android.messaging.view.roundimage.b.v, PorterDuff.Mode.MULTIPLY));
                        jj0 jj0Var = new jj0(mutate2, Z0, AndroidUtilities.dp(2.0f), AndroidUtilities.dp(2.0f));
                        jj0Var.d(true);
                        Z0 = jj0Var;
                    } else {
                        StateListAnimator stateListAnimator = new StateListAnimator();
                        int[] iArr = {android.R.attr.state_pressed};
                        s sVar2 = this.t;
                        Property property = View.TRANSLATION_Z;
                        stateListAnimator.addState(iArr, ObjectAnimator.ofFloat(sVar2, (Property<s, Float>) property, AndroidUtilities.dp(2.0f), AndroidUtilities.dp(4.0f)).setDuration(200L));
                        stateListAnimator.addState(new int[0], ObjectAnimator.ofFloat(this.t, (Property<s, Float>) property, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(2.0f)).setDuration(200L));
                        this.t.setStateListAnimator(stateListAnimator);
                        this.t.setOutlineProvider(new k(this));
                    }
                    this.t.setBackgroundDrawable(Z0);
                    this.t.setTextColor(org.telegram.ui.ActionBar.w.r1("location_actionActiveIcon"));
                    this.t.setTextSize(1, 14.0f);
                    this.t.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                    this.t.setText(LocaleController.getString("PlacesInThisArea", R.string.PlacesInThisArea));
                    this.t.setGravity(17);
                    this.t.setPadding(AndroidUtilities.dp(20.0f), 0, AndroidUtilities.dp(20.0f), 0);
                    this.Z.addView(this.t, g52.b(-2, i2 < 21 ? 40.0f : 44.0f, 49, 80.0f, 12.0f, 80.0f, 0.0f));
                    this.t.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public final void onClick(View view) {
                            org.telegram.ui.w5.this.y3(view);
                        }
                    });
                }
                org.telegram.ui.ActionBar.d dVar = new org.telegram.ui.ActionBar.d(context, null, 0, org.telegram.ui.ActionBar.w.r1("location_actionIcon"));
                this.s = dVar;
                dVar.setClickable(true);
                this.s.setSubMenuOpenSide(2);
                this.s.setAdditionalXOffset(AndroidUtilities.dp(10.0f));
                this.s.setAdditionalYOffset(-AndroidUtilities.dp(10.0f));
                this.s.J(2, org.telegram.messenger.R.drawable.msg_map, LocaleController.getString("Map", R.string.Map));
                this.s.J(3, org.telegram.messenger.R.drawable.msg_satellite, LocaleController.getString("Satellite", R.string.Satellite));
                this.s.J(4, org.telegram.messenger.R.drawable.msg_hybrid, LocaleController.getString("Hybrid", R.string.Hybrid));
                this.s.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
                Drawable Y0 = org.telegram.ui.ActionBar.w.Y0(AndroidUtilities.dp(40.0f), org.telegram.ui.ActionBar.w.r1("location_actionBackground"), org.telegram.ui.ActionBar.w.r1("location_actionPressedBackground"));
                if (i2 < 21) {
                    Drawable mutate3 = context.getResources().getDrawable(org.telegram.messenger.R.drawable.floating_shadow_profile).mutate();
                    mutate3.setColorFilter(new PorterDuffColorFilter(com.batch.android.messaging.view.roundimage.b.v, PorterDuff.Mode.MULTIPLY));
                    jj0 jj0Var2 = new jj0(mutate3, Y0, 0, 0);
                    jj0Var2.e(AndroidUtilities.dp(40.0f), AndroidUtilities.dp(40.0f));
                    Y0 = jj0Var2;
                    str3 = "location_actionIcon";
                } else {
                    StateListAnimator stateListAnimator2 = new StateListAnimator();
                    int[] iArr2 = {android.R.attr.state_pressed};
                    org.telegram.ui.ActionBar.d dVar2 = this.s;
                    Property property2 = View.TRANSLATION_Z;
                    str3 = "location_actionIcon";
                    stateListAnimator2.addState(iArr2, ObjectAnimator.ofFloat(dVar2, (Property<org.telegram.ui.ActionBar.d, Float>) property2, AndroidUtilities.dp(2.0f), AndroidUtilities.dp(4.0f)).setDuration(200L));
                    stateListAnimator2.addState(new int[0], ObjectAnimator.ofFloat(this.s, (Property<org.telegram.ui.ActionBar.d, Float>) property2, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(2.0f)).setDuration(200L));
                    this.s.setStateListAnimator(stateListAnimator2);
                    this.s.setOutlineProvider(new l(this));
                }
                this.s.setBackgroundDrawable(Y0);
                this.s.setIcon(org.telegram.messenger.R.drawable.location_type);
                this.Z.addView(this.s, g52.b(i2 >= 21 ? 40 : 44, i2 >= 21 ? 40.0f : 44.0f, 53, 0.0f, 12.0f, 12.0f, 0.0f));
                this.s.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        org.telegram.ui.w5.this.z3(view);
                    }
                });
                this.s.setDelegate(new d.m() {
                    @Override
                    public final void a(int i9) {
                        org.telegram.ui.w5.this.K3(i9);
                    }
                });
                this.q = new ImageView(context);
                Drawable Y02 = org.telegram.ui.ActionBar.w.Y0(AndroidUtilities.dp(40.0f), org.telegram.ui.ActionBar.w.r1("location_actionBackground"), org.telegram.ui.ActionBar.w.r1("location_actionPressedBackground"));
                if (i2 < 21) {
                    Drawable mutate4 = context.getResources().getDrawable(org.telegram.messenger.R.drawable.floating_shadow_profile).mutate();
                    mutate4.setColorFilter(new PorterDuffColorFilter(com.batch.android.messaging.view.roundimage.b.v, PorterDuff.Mode.MULTIPLY));
                    jj0 jj0Var3 = new jj0(mutate4, Y02, 0, 0);
                    jj0Var3.e(AndroidUtilities.dp(40.0f), AndroidUtilities.dp(40.0f));
                    str5 = "location_actionBackground";
                    Y02 = jj0Var3;
                    str4 = "location_actionPressedBackground";
                } else {
                    StateListAnimator stateListAnimator3 = new StateListAnimator();
                    int[] iArr3 = {android.R.attr.state_pressed};
                    ImageView imageView2 = this.q;
                    Property property3 = View.TRANSLATION_Z;
                    ObjectAnimator ofFloat = ObjectAnimator.ofFloat(imageView2, (Property<ImageView, Float>) property3, AndroidUtilities.dp(2.0f), AndroidUtilities.dp(4.0f));
                    str4 = "location_actionPressedBackground";
                    str5 = "location_actionBackground";
                    stateListAnimator3.addState(iArr3, ofFloat.setDuration(200L));
                    stateListAnimator3.addState(new int[0], ObjectAnimator.ofFloat(this.q, (Property<ImageView, Float>) property3, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(2.0f)).setDuration(200L));
                    this.q.setStateListAnimator(stateListAnimator3);
                    this.q.setOutlineProvider(new m(this));
                }
                this.q.setBackgroundDrawable(Y02);
                this.q.setImageResource(org.telegram.messenger.R.drawable.location_current);
                this.q.setScaleType(ImageView.ScaleType.CENTER);
                this.q.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("location_actionActiveIcon"), PorterDuff.Mode.MULTIPLY));
                this.q.setTag("location_actionActiveIcon");
                this.q.setContentDescription(LocaleController.getString("AccDescrMyLocation", R.string.AccDescrMyLocation));
                FrameLayout.LayoutParams b3 = g52.b(i2 >= 21 ? 40 : 44, i2 >= 21 ? 40.0f : 44.0f, 85, 0.0f, 0.0f, 12.0f, 12.0f);
                b3.bottomMargin += layoutParams.height - rect.top;
                this.Z.addView(this.q, b3);
                this.q.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        org.telegram.ui.w5.this.M3(view);
                    }
                });
                this.r = new ImageView(context);
                Drawable Y03 = org.telegram.ui.ActionBar.w.Y0(AndroidUtilities.dp(40.0f), org.telegram.ui.ActionBar.w.r1(str5), org.telegram.ui.ActionBar.w.r1(str4));
                if (i2 < 21) {
                    Drawable mutate5 = context.getResources().getDrawable(org.telegram.messenger.R.drawable.floating_shadow_profile).mutate();
                    mutate5.setColorFilter(new PorterDuffColorFilter(com.batch.android.messaging.view.roundimage.b.v, PorterDuff.Mode.MULTIPLY));
                    jj0 jj0Var4 = new jj0(mutate5, Y03, 0, 0);
                    jj0Var4.e(AndroidUtilities.dp(40.0f), AndroidUtilities.dp(40.0f));
                    Y03 = jj0Var4;
                } else {
                    StateListAnimator stateListAnimator4 = new StateListAnimator();
                    int[] iArr4 = {android.R.attr.state_pressed};
                    ImageView imageView3 = this.r;
                    Property property4 = View.TRANSLATION_Z;
                    stateListAnimator4.addState(iArr4, ObjectAnimator.ofFloat(imageView3, (Property<ImageView, Float>) property4, AndroidUtilities.dp(2.0f), AndroidUtilities.dp(4.0f)).setDuration(200L));
                    stateListAnimator4.addState(new int[0], ObjectAnimator.ofFloat(this.r, (Property<ImageView, Float>) property4, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(2.0f)).setDuration(200L));
                    this.r.setStateListAnimator(stateListAnimator4);
                    this.r.setOutlineProvider(new n(this));
                }
                this.r.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1(str3), PorterDuff.Mode.MULTIPLY));
                this.r.setBackgroundDrawable(Y03);
                this.r.setScaleType(ImageView.ScaleType.CENTER);
                this.r.setContentDescription(LocaleController.getString("AccDescrLocationNotify", R.string.AccDescrLocationNotify));
                this.Z.addView(this.r, g52.b(i2 >= 21 ? 40 : 44, i2 >= 21 ? 40.0f : 44.0f, 53, 0.0f, 62.0f, 12.0f, 0.0f));
                this.r.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        org.telegram.ui.w5.this.P3(view);
                    }
                });
                u95 chat = DialogObject.isChatDialog(this.m0) ? W().getChat(Long.valueOf(-this.m0)) : null;
                messageObject = this.J0;
                if (messageObject != null || !messageObject.isLiveLocation() || this.J0.isExpiredLiveLocation(K().getCurrentTime()) || (ChatObject.isChannel(chat) && !chat.o)) {
                    this.r.setVisibility(8);
                } else {
                    LocationController.SharingLocationInfo sharingLocationInfo = T().getSharingLocationInfo(this.m0);
                    if (sharingLocationInfo != null && sharingLocationInfo.proximityMeters > 0) {
                        imageView = this.r;
                        i5 = org.telegram.messenger.R.drawable.msg_location_alert2;
                        imageView.setImageResource(i5);
                        es1 es1Var = new es1(context, 6, true);
                        this.G = es1Var;
                        es1Var.setVisibility(4);
                        this.G.setShowingDuration(4000L);
                        this.Z.addView(this.G, g52.b(-2, -2.0f, 51, 10.0f, 0.0f, 10.0f, 0.0f));
                        LinearLayout linearLayout = new LinearLayout(context);
                        this.u = linearLayout;
                        linearLayout.setOrientation(1);
                        this.u.setGravity(1);
                        this.u.setPadding(0, AndroidUtilities.dp(160.0f), 0, 0);
                        this.u.setVisibility(8);
                        iVar2.addView(this.u, g52.a(-1, -1.0f));
                        this.u.setOnTouchListener(new View.OnTouchListener() {
                            @Override
                            public final boolean onTouch(View view, MotionEvent motionEvent) {
                                boolean Q3;
                                Q3 = org.telegram.ui.w5.Q3(view, motionEvent);
                                return Q3;
                            }
                        });
                        ImageView imageView4 = new ImageView(context);
                        this.v = imageView4;
                        imageView4.setImageResource(org.telegram.messenger.R.drawable.location_empty);
                        this.v.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("dialogEmptyImage"), PorterDuff.Mode.MULTIPLY));
                        this.u.addView(this.v, g52.f(-2, -2));
                        TextView textView = new TextView(context);
                        this.w = textView;
                        textView.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogEmptyText"));
                        this.w.setGravity(17);
                        this.w.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                        this.w.setTextSize(1, 17.0f);
                        this.w.setText(LocaleController.getString("NoPlacesFound", R.string.NoPlacesFound));
                        this.u.addView(this.w, g52.m(-2, -2, 17, 0, 11, 0, 0));
                        TextView textView2 = new TextView(context);
                        this.x = textView2;
                        textView2.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogEmptyText"));
                        this.x.setGravity(17);
                        this.x.setTextSize(1, 15.0f);
                        this.x.setPadding(AndroidUtilities.dp(40.0f), 0, AndroidUtilities.dp(40.0f), 0);
                        this.u.addView(this.x, g52.m(-2, -2, 17, 0, 6, 0, 0));
                        org.telegram.ui.Components.h6 h6Var = new org.telegram.ui.Components.h6(context);
                        this.b0 = h6Var;
                        o oVar = new o(context, this.O0, this.m0, false, null);
                        this.a0 = oVar;
                        h6Var.setAdapter(oVar);
                        this.a0.m0(this.k0);
                        this.a0.o0(new Runnable() {
                            @Override
                            public final void run() {
                                org.telegram.ui.w5.this.R3();
                            }
                        });
                        this.b0.setVerticalScrollBarEnabled(false);
                        org.telegram.ui.Components.h6 h6Var2 = this.b0;
                        androidx.recyclerview.widget.o oVar2 = new androidx.recyclerview.widget.o(context, 1, false);
                        this.f0 = oVar2;
                        h6Var2.setLayoutManager(oVar2);
                        iVar2.addView(this.b0, g52.c(-1, -1, 51));
                        this.b0.setOnScrollListener(new a());
                        ((androidx.recyclerview.widget.h) this.b0.getItemAnimator()).m0(false);
                        this.b0.setOnItemClickListener(new h6.m() {
                            @Override
                            public final void a(View view, int i9) {
                                org.telegram.ui.w5.this.E3(view, i9);
                            }
                        });
                        this.a0.a0(this.m0, new rg.a() {
                            @Override
                            public final void a(ArrayList arrayList) {
                                org.telegram.ui.w5.this.E4(arrayList);
                            }
                        });
                        this.a0.n0(this.P0);
                        iVar2.addView(this.Z, g52.c(-1, -1, 51));
                        final b bVar = new b(context);
                        this.S = bVar;
                        new Thread(new Runnable() {
                            @Override
                            public final void run() {
                                org.telegram.ui.w5.this.H3(bVar);
                            }
                        }).start();
                        messageObject2 = this.J0;
                        if (messageObject2 != null && this.H0 == null) {
                            if (chat != null && this.O0 == 4 && this.m0 != 0) {
                                FrameLayout frameLayout = new FrameLayout(context);
                                frameLayout.setBackgroundResource(org.telegram.messenger.R.drawable.livepin);
                                this.Z.addView(frameLayout, g52.c(62, 76, 49));
                                org.telegram.messenger.p110.pf pfVar = new org.telegram.messenger.p110.pf(context);
                                pfVar.setRoundRadius(AndroidUtilities.dp(26.0f));
                                pfVar.a(chat, new org.telegram.messenger.p110.xe(chat));
                                frameLayout.addView(pfVar, g52.b(52, 52.0f, 51, 5.0f, 5.0f, 0.0f, 0.0f));
                                this.e0 = frameLayout;
                                frameLayout.setTag(1);
                            }
                            if (this.e0 == null) {
                                ImageView imageView5 = new ImageView(context);
                                imageView5.setImageResource(org.telegram.messenger.R.drawable.map_pin2);
                                this.Z.addView(imageView5, g52.c(28, 48, 49));
                                this.e0 = imageView5;
                            }
                            org.telegram.ui.Components.h6 h6Var3 = new org.telegram.ui.Components.h6(context);
                            this.c0 = h6Var3;
                            h6Var3.setVisibility(8);
                            this.c0.setLayoutManager(new androidx.recyclerview.widget.o(context, 1, false));
                            c cVar = new c(context);
                            this.d0 = cVar;
                            cVar.a0(0L, new rg.a() {
                                @Override
                                public final void a(ArrayList arrayList) {
                                    org.telegram.ui.w5.this.I3(arrayList);
                                }
                            });
                            iVar2.addView(this.c0, g52.c(-1, -1, 51));
                            this.c0.setOnScrollListener(new d());
                            this.c0.setOnItemClickListener(new h6.m() {
                                @Override
                                public final void a(View view, int i9) {
                                    org.telegram.ui.w5.this.L3(view, i9);
                                }
                            });
                        } else if ((messageObject2 != null && !messageObject2.isLiveLocation()) || this.H0 != null) {
                            nl5Var = this.H0;
                            if (nl5Var != null) {
                                this.a0.h0(nl5Var);
                            } else {
                                MessageObject messageObject5 = this.J0;
                                if (messageObject5 != null) {
                                    this.a0.l0(messageObject5);
                                }
                            }
                        }
                        messageObject3 = this.J0;
                        if (messageObject3 != null && this.O0 == 6) {
                            this.a0.l0(messageObject3);
                        }
                        for (i6 = 0; i6 < 2; i6++) {
                            this.H[i6] = new UndoView(context);
                            this.H[i6].setAdditionalTranslationY(AndroidUtilities.dp(10.0f));
                            if (Build.VERSION.SDK_INT >= 21) {
                                this.H[i6].setTranslationZ(AndroidUtilities.dp(5.0f));
                            }
                            this.Z.addView(this.H[i6], g52.b(-1, -2.0f, 83, 8.0f, 0.0f, 8.0f, 8.0f));
                        }
                        e eVar = new e(context, rect);
                        this.z = eVar;
                        if (Build.VERSION.SDK_INT >= 21) {
                            eVar.setTranslationZ(AndroidUtilities.dp(6.0f));
                        }
                        this.Z.addView(this.z, layoutParams);
                        if (this.J0 == null && this.H0 == null && this.I0 != null) {
                            this.K0 = true;
                            this.q.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1(str3), PorterDuff.Mode.MULTIPLY));
                            this.q.setTag(str3);
                        }
                        iVar2.addView(this.g);
                        D4();
                        return this.e;
                    }
                    if (DialogObject.isUserDialog(this.m0) && this.J0.getFromChatId() == l0().getClientUserId()) {
                        this.r.setVisibility(4);
                        this.r.setAlpha(0.0f);
                        this.r.setScaleX(0.4f);
                        this.r.setScaleY(0.4f);
                    }
                }
                imageView = this.r;
                i5 = org.telegram.messenger.R.drawable.msg_location_alert;
                imageView.setImageResource(i5);
                es1 es1Var2 = new es1(context, 6, true);
                this.G = es1Var2;
                es1Var2.setVisibility(4);
                this.G.setShowingDuration(4000L);
                this.Z.addView(this.G, g52.b(-2, -2.0f, 51, 10.0f, 0.0f, 10.0f, 0.0f));
                LinearLayout linearLayout2 = new LinearLayout(context);
                this.u = linearLayout2;
                linearLayout2.setOrientation(1);
                this.u.setGravity(1);
                this.u.setPadding(0, AndroidUtilities.dp(160.0f), 0, 0);
                this.u.setVisibility(8);
                iVar2.addView(this.u, g52.a(-1, -1.0f));
                this.u.setOnTouchListener(new View.OnTouchListener() {
                    @Override
                    public final boolean onTouch(View view, MotionEvent motionEvent) {
                        boolean Q3;
                        Q3 = org.telegram.ui.w5.Q3(view, motionEvent);
                        return Q3;
                    }
                });
                ImageView imageView42 = new ImageView(context);
                this.v = imageView42;
                imageView42.setImageResource(org.telegram.messenger.R.drawable.location_empty);
                this.v.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("dialogEmptyImage"), PorterDuff.Mode.MULTIPLY));
                this.u.addView(this.v, g52.f(-2, -2));
                TextView textView3 = new TextView(context);
                this.w = textView3;
                textView3.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogEmptyText"));
                this.w.setGravity(17);
                this.w.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                this.w.setTextSize(1, 17.0f);
                this.w.setText(LocaleController.getString("NoPlacesFound", R.string.NoPlacesFound));
                this.u.addView(this.w, g52.m(-2, -2, 17, 0, 11, 0, 0));
                TextView textView22 = new TextView(context);
                this.x = textView22;
                textView22.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogEmptyText"));
                this.x.setGravity(17);
                this.x.setTextSize(1, 15.0f);
                this.x.setPadding(AndroidUtilities.dp(40.0f), 0, AndroidUtilities.dp(40.0f), 0);
                this.u.addView(this.x, g52.m(-2, -2, 17, 0, 6, 0, 0));
                org.telegram.ui.Components.h6 h6Var4 = new org.telegram.ui.Components.h6(context);
                this.b0 = h6Var4;
                o oVar3 = new o(context, this.O0, this.m0, false, null);
                this.a0 = oVar3;
                h6Var4.setAdapter(oVar3);
                this.a0.m0(this.k0);
                this.a0.o0(new Runnable() {
                    @Override
                    public final void run() {
                        org.telegram.ui.w5.this.R3();
                    }
                });
                this.b0.setVerticalScrollBarEnabled(false);
                org.telegram.ui.Components.h6 h6Var22 = this.b0;
                androidx.recyclerview.widget.o oVar22 = new androidx.recyclerview.widget.o(context, 1, false);
                this.f0 = oVar22;
                h6Var22.setLayoutManager(oVar22);
                iVar2.addView(this.b0, g52.c(-1, -1, 51));
                this.b0.setOnScrollListener(new a());
                ((androidx.recyclerview.widget.h) this.b0.getItemAnimator()).m0(false);
                this.b0.setOnItemClickListener(new h6.m() {
                    @Override
                    public final void a(View view, int i9) {
                        org.telegram.ui.w5.this.E3(view, i9);
                    }
                });
                this.a0.a0(this.m0, new rg.a() {
                    @Override
                    public final void a(ArrayList arrayList) {
                        org.telegram.ui.w5.this.E4(arrayList);
                    }
                });
                this.a0.n0(this.P0);
                iVar2.addView(this.Z, g52.c(-1, -1, 51));
                final uh2 bVar2 = new b(context);
                this.S = bVar2;
                new Thread(new Runnable() {
                    @Override
                    public final void run() {
                        org.telegram.ui.w5.this.H3(bVar2);
                    }
                }).start();
                messageObject2 = this.J0;
                if (messageObject2 != null) {
                }
                if (messageObject2 != null) {
                    nl5Var = this.H0;
                    if (nl5Var != null) {
                    }
                    messageObject3 = this.J0;
                    if (messageObject3 != null) {
                        this.a0.l0(messageObject3);
                    }
                    while (i6 < 2) {
                    }
                    e eVar2 = new e(context, rect);
                    this.z = eVar2;
                    if (Build.VERSION.SDK_INT >= 21) {
                    }
                    this.Z.addView(this.z, layoutParams);
                    if (this.J0 == null) {
                        this.K0 = true;
                        this.q.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1(str3), PorterDuff.Mode.MULTIPLY));
                        this.q.setTag(str3);
                    }
                    iVar2.addView(this.g);
                    D4();
                    return this.e;
                }
                nl5Var = this.H0;
                if (nl5Var != null) {
                }
                messageObject3 = this.J0;
                if (messageObject3 != null) {
                }
                while (i6 < 2) {
                }
                e eVar22 = new e(context, rect);
                this.z = eVar22;
                if (Build.VERSION.SDK_INT >= 21) {
                }
                this.Z.addView(this.z, layoutParams);
                if (this.J0 == null) {
                }
                iVar2.addView(this.g);
                D4();
                return this.e;
            }
            aVar2 = this.g;
            i4 = R.string.ChatLocation;
            str2 = "ChatLocation";
            aVar2.setTitle(LocaleController.getString(str2, i4));
            i iVar3 = new i(context);
            this.e = iVar3;
            i iVar22 = iVar3;
            iVar3.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("dialogBackground"));
            Drawable mutate6 = context.getResources().getDrawable(org.telegram.messenger.R.drawable.sheet_shadow_round).mutate();
            this.y = mutate6;
            mutate6.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("dialogBackground"), PorterDuff.Mode.MULTIPLY));
            Rect rect2 = new Rect();
            this.y.getPadding(rect2);
            int i82 = this.O0;
            FrameLayout.LayoutParams layoutParams2 = (i82 != 0 || i82 == 1) ? new FrameLayout.LayoutParams(-1, AndroidUtilities.dp(21.0f) + rect2.top) : new FrameLayout.LayoutParams(-1, AndroidUtilities.dp(6.0f) + rect2.top);
            layoutParams2.gravity = 83;
            j jVar2 = new j(context);
            this.Z = jVar2;
            jVar2.setBackgroundDrawable(new rh2());
            if (this.J0 == null) {
                s sVar3 = new s(context);
                this.t = sVar3;
                sVar3.setTranslationX(-AndroidUtilities.dp(80.0f));
                Drawable Z02 = org.telegram.ui.ActionBar.w.Z0(AndroidUtilities.dp(40.0f), org.telegram.ui.ActionBar.w.r1("location_actionBackground"), org.telegram.ui.ActionBar.w.r1("location_actionPressedBackground"));
                if (i2 >= 21) {
                }
                this.t.setBackgroundDrawable(Z02);
                this.t.setTextColor(org.telegram.ui.ActionBar.w.r1("location_actionActiveIcon"));
                this.t.setTextSize(1, 14.0f);
                this.t.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                this.t.setText(LocaleController.getString("PlacesInThisArea", R.string.PlacesInThisArea));
                this.t.setGravity(17);
                this.t.setPadding(AndroidUtilities.dp(20.0f), 0, AndroidUtilities.dp(20.0f), 0);
                this.Z.addView(this.t, g52.b(-2, i2 < 21 ? 40.0f : 44.0f, 49, 80.0f, 12.0f, 80.0f, 0.0f));
                this.t.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        org.telegram.ui.w5.this.y3(view);
                    }
                });
            }
            org.telegram.ui.ActionBar.d dVar3 = new org.telegram.ui.ActionBar.d(context, null, 0, org.telegram.ui.ActionBar.w.r1("location_actionIcon"));
            this.s = dVar3;
            dVar3.setClickable(true);
            this.s.setSubMenuOpenSide(2);
            this.s.setAdditionalXOffset(AndroidUtilities.dp(10.0f));
            this.s.setAdditionalYOffset(-AndroidUtilities.dp(10.0f));
            this.s.J(2, org.telegram.messenger.R.drawable.msg_map, LocaleController.getString("Map", R.string.Map));
            this.s.J(3, org.telegram.messenger.R.drawable.msg_satellite, LocaleController.getString("Satellite", R.string.Satellite));
            this.s.J(4, org.telegram.messenger.R.drawable.msg_hybrid, LocaleController.getString("Hybrid", R.string.Hybrid));
            this.s.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
            Drawable Y04 = org.telegram.ui.ActionBar.w.Y0(AndroidUtilities.dp(40.0f), org.telegram.ui.ActionBar.w.r1("location_actionBackground"), org.telegram.ui.ActionBar.w.r1("location_actionPressedBackground"));
            if (i2 < 21) {
            }
            this.s.setBackgroundDrawable(Y04);
            this.s.setIcon(org.telegram.messenger.R.drawable.location_type);
            this.Z.addView(this.s, g52.b(i2 >= 21 ? 40 : 44, i2 >= 21 ? 40.0f : 44.0f, 53, 0.0f, 12.0f, 12.0f, 0.0f));
            this.s.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    org.telegram.ui.w5.this.z3(view);
                }
            });
            this.s.setDelegate(new d.m() {
                @Override
                public final void a(int i9) {
                    org.telegram.ui.w5.this.K3(i9);
                }
            });
            this.q = new ImageView(context);
            Drawable Y022 = org.telegram.ui.ActionBar.w.Y0(AndroidUtilities.dp(40.0f), org.telegram.ui.ActionBar.w.r1("location_actionBackground"), org.telegram.ui.ActionBar.w.r1("location_actionPressedBackground"));
            if (i2 < 21) {
            }
            this.q.setBackgroundDrawable(Y022);
            this.q.setImageResource(org.telegram.messenger.R.drawable.location_current);
            this.q.setScaleType(ImageView.ScaleType.CENTER);
            this.q.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("location_actionActiveIcon"), PorterDuff.Mode.MULTIPLY));
            this.q.setTag("location_actionActiveIcon");
            this.q.setContentDescription(LocaleController.getString("AccDescrMyLocation", R.string.AccDescrMyLocation));
            FrameLayout.LayoutParams b32 = g52.b(i2 >= 21 ? 40 : 44, i2 >= 21 ? 40.0f : 44.0f, 85, 0.0f, 0.0f, 12.0f, 12.0f);
            b32.bottomMargin += layoutParams2.height - rect2.top;
            this.Z.addView(this.q, b32);
            this.q.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    org.telegram.ui.w5.this.M3(view);
                }
            });
            this.r = new ImageView(context);
            Drawable Y032 = org.telegram.ui.ActionBar.w.Y0(AndroidUtilities.dp(40.0f), org.telegram.ui.ActionBar.w.r1(str5), org.telegram.ui.ActionBar.w.r1(str4));
            if (i2 < 21) {
            }
            this.r.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1(str3), PorterDuff.Mode.MULTIPLY));
            this.r.setBackgroundDrawable(Y032);
            this.r.setScaleType(ImageView.ScaleType.CENTER);
            this.r.setContentDescription(LocaleController.getString("AccDescrLocationNotify", R.string.AccDescrLocationNotify));
            this.Z.addView(this.r, g52.b(i2 >= 21 ? 40 : 44, i2 >= 21 ? 40.0f : 44.0f, 53, 0.0f, 62.0f, 12.0f, 0.0f));
            this.r.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    org.telegram.ui.w5.this.P3(view);
                }
            });
            u95 chat2 = DialogObject.isChatDialog(this.m0) ? W().getChat(Long.valueOf(-this.m0)) : null;
            messageObject = this.J0;
            if (messageObject != null) {
            }
            this.r.setVisibility(8);
            imageView = this.r;
            i5 = org.telegram.messenger.R.drawable.msg_location_alert;
            imageView.setImageResource(i5);
            es1 es1Var22 = new es1(context, 6, true);
            this.G = es1Var22;
            es1Var22.setVisibility(4);
            this.G.setShowingDuration(4000L);
            this.Z.addView(this.G, g52.b(-2, -2.0f, 51, 10.0f, 0.0f, 10.0f, 0.0f));
            LinearLayout linearLayout22 = new LinearLayout(context);
            this.u = linearLayout22;
            linearLayout22.setOrientation(1);
            this.u.setGravity(1);
            this.u.setPadding(0, AndroidUtilities.dp(160.0f), 0, 0);
            this.u.setVisibility(8);
            iVar22.addView(this.u, g52.a(-1, -1.0f));
            this.u.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public final boolean onTouch(View view, MotionEvent motionEvent) {
                    boolean Q3;
                    Q3 = org.telegram.ui.w5.Q3(view, motionEvent);
                    return Q3;
                }
            });
            ImageView imageView422 = new ImageView(context);
            this.v = imageView422;
            imageView422.setImageResource(org.telegram.messenger.R.drawable.location_empty);
            this.v.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("dialogEmptyImage"), PorterDuff.Mode.MULTIPLY));
            this.u.addView(this.v, g52.f(-2, -2));
            TextView textView32 = new TextView(context);
            this.w = textView32;
            textView32.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogEmptyText"));
            this.w.setGravity(17);
            this.w.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            this.w.setTextSize(1, 17.0f);
            this.w.setText(LocaleController.getString("NoPlacesFound", R.string.NoPlacesFound));
            this.u.addView(this.w, g52.m(-2, -2, 17, 0, 11, 0, 0));
            TextView textView222 = new TextView(context);
            this.x = textView222;
            textView222.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogEmptyText"));
            this.x.setGravity(17);
            this.x.setTextSize(1, 15.0f);
            this.x.setPadding(AndroidUtilities.dp(40.0f), 0, AndroidUtilities.dp(40.0f), 0);
            this.u.addView(this.x, g52.m(-2, -2, 17, 0, 6, 0, 0));
            org.telegram.ui.Components.h6 h6Var42 = new org.telegram.ui.Components.h6(context);
            this.b0 = h6Var42;
            o oVar32 = new o(context, this.O0, this.m0, false, null);
            this.a0 = oVar32;
            h6Var42.setAdapter(oVar32);
            this.a0.m0(this.k0);
            this.a0.o0(new Runnable() {
                @Override
                public final void run() {
                    org.telegram.ui.w5.this.R3();
                }
            });
            this.b0.setVerticalScrollBarEnabled(false);
            org.telegram.ui.Components.h6 h6Var222 = this.b0;
            androidx.recyclerview.widget.o oVar222 = new androidx.recyclerview.widget.o(context, 1, false);
            this.f0 = oVar222;
            h6Var222.setLayoutManager(oVar222);
            iVar22.addView(this.b0, g52.c(-1, -1, 51));
            this.b0.setOnScrollListener(new a());
            ((androidx.recyclerview.widget.h) this.b0.getItemAnimator()).m0(false);
            this.b0.setOnItemClickListener(new h6.m() {
                @Override
                public final void a(View view, int i9) {
                    org.telegram.ui.w5.this.E3(view, i9);
                }
            });
            this.a0.a0(this.m0, new rg.a() {
                @Override
                public final void a(ArrayList arrayList) {
                    org.telegram.ui.w5.this.E4(arrayList);
                }
            });
            this.a0.n0(this.P0);
            iVar22.addView(this.Z, g52.c(-1, -1, 51));
            final uh2 bVar22 = new b(context);
            this.S = bVar22;
            new Thread(new Runnable() {
                @Override
                public final void run() {
                    org.telegram.ui.w5.this.H3(bVar22);
                }
            }).start();
            messageObject2 = this.J0;
            if (messageObject2 != null) {
            }
            if (messageObject2 != null) {
            }
            nl5Var = this.H0;
            if (nl5Var != null) {
            }
            messageObject3 = this.J0;
            if (messageObject3 != null) {
            }
            while (i6 < 2) {
            }
            e eVar222 = new e(context, rect2);
            this.z = eVar222;
            if (Build.VERSION.SDK_INT >= 21) {
            }
            this.Z.addView(this.z, layoutParams2);
            if (this.J0 == null) {
            }
            iVar22.addView(this.g);
            D4();
            return this.e;
        }
        Location location3 = new Location("network");
        this.F0 = location3;
        location3.setLatitude(this.H0.a.c);
        location = this.F0;
        pa5Var = this.H0.a;
        location.setLongitude(pa5Var.b);
        i2 = Build.VERSION.SDK_INT;
        this.k0 = (i2 >= 23 || c0() == null || c0().checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") == 0) ? false : true;
        this.g.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("dialogBackground"));
        this.g.setTitleColor(org.telegram.ui.ActionBar.w.r1("dialogTextBlack"));
        this.g.P(org.telegram.ui.ActionBar.w.r1("dialogTextBlack"), false);
        this.g.O(org.telegram.ui.ActionBar.w.r1("dialogButtonSelector"), false);
        this.g.setBackButtonImage(org.telegram.messenger.R.drawable.ic_ab_back);
        this.g.setAllowOverlayTitle(true);
        if (AndroidUtilities.isTablet()) {
        }
        this.g.setAddToContainer(false);
        this.g.setActionBarMenuOnItemClick(new g());
        org.telegram.ui.ActionBar.b z2 = this.g.z();
        if (this.H0 != null) {
        }
        aVar2.setTitle(LocaleController.getString(str2, i4));
        i iVar32 = new i(context);
        this.e = iVar32;
        i iVar222 = iVar32;
        iVar32.setBackgroundColor(org.telegram.ui.ActionBar.w.r1("dialogBackground"));
        Drawable mutate62 = context.getResources().getDrawable(org.telegram.messenger.R.drawable.sheet_shadow_round).mutate();
        this.y = mutate62;
        mutate62.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("dialogBackground"), PorterDuff.Mode.MULTIPLY));
        Rect rect22 = new Rect();
        this.y.getPadding(rect22);
        int i822 = this.O0;
        FrameLayout.LayoutParams layoutParams22 = (i822 != 0 || i822 == 1) ? new FrameLayout.LayoutParams(-1, AndroidUtilities.dp(21.0f) + rect22.top) : new FrameLayout.LayoutParams(-1, AndroidUtilities.dp(6.0f) + rect22.top);
        layoutParams22.gravity = 83;
        j jVar22 = new j(context);
        this.Z = jVar22;
        jVar22.setBackgroundDrawable(new rh2());
        if (this.J0 == null) {
        }
        org.telegram.ui.ActionBar.d dVar32 = new org.telegram.ui.ActionBar.d(context, null, 0, org.telegram.ui.ActionBar.w.r1("location_actionIcon"));
        this.s = dVar32;
        dVar32.setClickable(true);
        this.s.setSubMenuOpenSide(2);
        this.s.setAdditionalXOffset(AndroidUtilities.dp(10.0f));
        this.s.setAdditionalYOffset(-AndroidUtilities.dp(10.0f));
        this.s.J(2, org.telegram.messenger.R.drawable.msg_map, LocaleController.getString("Map", R.string.Map));
        this.s.J(3, org.telegram.messenger.R.drawable.msg_satellite, LocaleController.getString("Satellite", R.string.Satellite));
        this.s.J(4, org.telegram.messenger.R.drawable.msg_hybrid, LocaleController.getString("Hybrid", R.string.Hybrid));
        this.s.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
        Drawable Y042 = org.telegram.ui.ActionBar.w.Y0(AndroidUtilities.dp(40.0f), org.telegram.ui.ActionBar.w.r1("location_actionBackground"), org.telegram.ui.ActionBar.w.r1("location_actionPressedBackground"));
        if (i2 < 21) {
        }
        this.s.setBackgroundDrawable(Y042);
        this.s.setIcon(org.telegram.messenger.R.drawable.location_type);
        this.Z.addView(this.s, g52.b(i2 >= 21 ? 40 : 44, i2 >= 21 ? 40.0f : 44.0f, 53, 0.0f, 12.0f, 12.0f, 0.0f));
        this.s.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                org.telegram.ui.w5.this.z3(view);
            }
        });
        this.s.setDelegate(new d.m() {
            @Override
            public final void a(int i9) {
                org.telegram.ui.w5.this.K3(i9);
            }
        });
        this.q = new ImageView(context);
        Drawable Y0222 = org.telegram.ui.ActionBar.w.Y0(AndroidUtilities.dp(40.0f), org.telegram.ui.ActionBar.w.r1("location_actionBackground"), org.telegram.ui.ActionBar.w.r1("location_actionPressedBackground"));
        if (i2 < 21) {
        }
        this.q.setBackgroundDrawable(Y0222);
        this.q.setImageResource(org.telegram.messenger.R.drawable.location_current);
        this.q.setScaleType(ImageView.ScaleType.CENTER);
        this.q.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("location_actionActiveIcon"), PorterDuff.Mode.MULTIPLY));
        this.q.setTag("location_actionActiveIcon");
        this.q.setContentDescription(LocaleController.getString("AccDescrMyLocation", R.string.AccDescrMyLocation));
        FrameLayout.LayoutParams b322 = g52.b(i2 >= 21 ? 40 : 44, i2 >= 21 ? 40.0f : 44.0f, 85, 0.0f, 0.0f, 12.0f, 12.0f);
        b322.bottomMargin += layoutParams22.height - rect22.top;
        this.Z.addView(this.q, b322);
        this.q.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                org.telegram.ui.w5.this.M3(view);
            }
        });
        this.r = new ImageView(context);
        Drawable Y0322 = org.telegram.ui.ActionBar.w.Y0(AndroidUtilities.dp(40.0f), org.telegram.ui.ActionBar.w.r1(str5), org.telegram.ui.ActionBar.w.r1(str4));
        if (i2 < 21) {
        }
        this.r.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1(str3), PorterDuff.Mode.MULTIPLY));
        this.r.setBackgroundDrawable(Y0322);
        this.r.setScaleType(ImageView.ScaleType.CENTER);
        this.r.setContentDescription(LocaleController.getString("AccDescrLocationNotify", R.string.AccDescrLocationNotify));
        this.Z.addView(this.r, g52.b(i2 >= 21 ? 40 : 44, i2 >= 21 ? 40.0f : 44.0f, 53, 0.0f, 62.0f, 12.0f, 0.0f));
        this.r.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                org.telegram.ui.w5.this.P3(view);
            }
        });
        u95 chat22 = DialogObject.isChatDialog(this.m0) ? W().getChat(Long.valueOf(-this.m0)) : null;
        messageObject = this.J0;
        if (messageObject != null) {
        }
        this.r.setVisibility(8);
        imageView = this.r;
        i5 = org.telegram.messenger.R.drawable.msg_location_alert;
        imageView.setImageResource(i5);
        es1 es1Var222 = new es1(context, 6, true);
        this.G = es1Var222;
        es1Var222.setVisibility(4);
        this.G.setShowingDuration(4000L);
        this.Z.addView(this.G, g52.b(-2, -2.0f, 51, 10.0f, 0.0f, 10.0f, 0.0f));
        LinearLayout linearLayout222 = new LinearLayout(context);
        this.u = linearLayout222;
        linearLayout222.setOrientation(1);
        this.u.setGravity(1);
        this.u.setPadding(0, AndroidUtilities.dp(160.0f), 0, 0);
        this.u.setVisibility(8);
        iVar222.addView(this.u, g52.a(-1, -1.0f));
        this.u.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public final boolean onTouch(View view, MotionEvent motionEvent) {
                boolean Q3;
                Q3 = org.telegram.ui.w5.Q3(view, motionEvent);
                return Q3;
            }
        });
        ImageView imageView4222 = new ImageView(context);
        this.v = imageView4222;
        imageView4222.setImageResource(org.telegram.messenger.R.drawable.location_empty);
        this.v.setColorFilter(new PorterDuffColorFilter(org.telegram.ui.ActionBar.w.r1("dialogEmptyImage"), PorterDuff.Mode.MULTIPLY));
        this.u.addView(this.v, g52.f(-2, -2));
        TextView textView322 = new TextView(context);
        this.w = textView322;
        textView322.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogEmptyText"));
        this.w.setGravity(17);
        this.w.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        this.w.setTextSize(1, 17.0f);
        this.w.setText(LocaleController.getString("NoPlacesFound", R.string.NoPlacesFound));
        this.u.addView(this.w, g52.m(-2, -2, 17, 0, 11, 0, 0));
        TextView textView2222 = new TextView(context);
        this.x = textView2222;
        textView2222.setTextColor(org.telegram.ui.ActionBar.w.r1("dialogEmptyText"));
        this.x.setGravity(17);
        this.x.setTextSize(1, 15.0f);
        this.x.setPadding(AndroidUtilities.dp(40.0f), 0, AndroidUtilities.dp(40.0f), 0);
        this.u.addView(this.x, g52.m(-2, -2, 17, 0, 6, 0, 0));
        org.telegram.ui.Components.h6 h6Var422 = new org.telegram.ui.Components.h6(context);
        this.b0 = h6Var422;
        o oVar322 = new o(context, this.O0, this.m0, false, null);
        this.a0 = oVar322;
        h6Var422.setAdapter(oVar322);
        this.a0.m0(this.k0);
        this.a0.o0(new Runnable() {
            @Override
            public final void run() {
                org.telegram.ui.w5.this.R3();
            }
        });
        this.b0.setVerticalScrollBarEnabled(false);
        org.telegram.ui.Components.h6 h6Var2222 = this.b0;
        androidx.recyclerview.widget.o oVar2222 = new androidx.recyclerview.widget.o(context, 1, false);
        this.f0 = oVar2222;
        h6Var2222.setLayoutManager(oVar2222);
        iVar222.addView(this.b0, g52.c(-1, -1, 51));
        this.b0.setOnScrollListener(new a());
        ((androidx.recyclerview.widget.h) this.b0.getItemAnimator()).m0(false);
        this.b0.setOnItemClickListener(new h6.m() {
            @Override
            public final void a(View view, int i9) {
                org.telegram.ui.w5.this.E3(view, i9);
            }
        });
        this.a0.a0(this.m0, new rg.a() {
            @Override
            public final void a(ArrayList arrayList) {
                org.telegram.ui.w5.this.E4(arrayList);
            }
        });
        this.a0.n0(this.P0);
        iVar222.addView(this.Z, g52.c(-1, -1, 51));
        final uh2 bVar222 = new b(context);
        this.S = bVar222;
        new Thread(new Runnable() {
            @Override
            public final void run() {
                org.telegram.ui.w5.this.H3(bVar222);
            }
        }).start();
        messageObject2 = this.J0;
        if (messageObject2 != null) {
        }
        if (messageObject2 != null) {
        }
        nl5Var = this.H0;
        if (nl5Var != null) {
        }
        messageObject3 = this.J0;
        if (messageObject3 != null) {
        }
        while (i6 < 2) {
        }
        e eVar2222 = new e(context, rect22);
        this.z = eVar2222;
        if (Build.VERSION.SDK_INT >= 21) {
        }
        this.Z.addView(this.z, layoutParams22);
        if (this.J0 == null) {
        }
        iVar222.addView(this.g);
        D4();
        return this.e;
    }
}