歌尔基办 v2.7.0版本的 MD5 值为:921fd7c85ec097e8cab7f049269b36e4

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


package im.ovithmjoec.ui;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.StateListAnimator;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
import android.util.SparseArray;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.BitmapDescriptorFactory;
import com.baidu.mapapi.map.CircleOptions;
import com.baidu.mapapi.map.MapStatus;
import com.baidu.mapapi.map.MapStatusUpdateFactory;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.MarkerOptions;
import com.baidu.mapapi.map.Overlay;
import com.baidu.mapapi.model.LatLng;
import com.baidu.mapapi.model.LatLngBounds;
import com.baidu.mapsdkplatform.comapi.location.CoordinateType;
import com.bjz.comm.net.premission.PermissionUtils;
import im.ovithmjoec.messenger.AndroidUtilities;
import im.ovithmjoec.messenger.ApplicationLoader;
import im.ovithmjoec.messenger.ChatObject;
import im.ovithmjoec.messenger.FileLoader;
import im.ovithmjoec.messenger.FileLog;
import im.ovithmjoec.messenger.ImageLocation;
import im.ovithmjoec.messenger.LocaleController;
import im.ovithmjoec.messenger.LocationController;
import im.ovithmjoec.messenger.MessageObject;
import im.ovithmjoec.messenger.MessagesStorage;
import im.ovithmjoec.messenger.NotificationCenter;
import im.ovithmjoec.messenger.R;
import im.ovithmjoec.messenger.UserObject;
import im.ovithmjoec.tgnet.RequestDelegate;
import im.ovithmjoec.tgnet.TLObject;
import im.ovithmjoec.tgnet.TLRPC;
import im.ovithmjoec.ui.LocationActivity;
import im.ovithmjoec.ui.actionbar.ActionBar;
import im.ovithmjoec.ui.actionbar.ActionBarMenu;
import im.ovithmjoec.ui.actionbar.ActionBarMenuItem;
import im.ovithmjoec.ui.actionbar.AlertDialog;
import im.ovithmjoec.ui.actionbar.BaseFragment;
import im.ovithmjoec.ui.actionbar.Theme;
import im.ovithmjoec.ui.actionbar.ThemeDescription;
import im.ovithmjoec.ui.adapters.BaseLocationAdapter;
import im.ovithmjoec.ui.adapters.LocationActivityAdapter;
import im.ovithmjoec.ui.adapters.LocationActivitySearchAdapter;
import im.ovithmjoec.ui.cells.GraySectionCell;
import im.ovithmjoec.ui.cells.LocationCell;
import im.ovithmjoec.ui.cells.LocationLoadingCell;
import im.ovithmjoec.ui.cells.LocationPoweredCell;
import im.ovithmjoec.ui.cells.SendLocationCell;
import im.ovithmjoec.ui.components.AlertsCreator;
import im.ovithmjoec.ui.components.AvatarDrawable;
import im.ovithmjoec.ui.components.BackupImageView;
import im.ovithmjoec.ui.components.CombinedDrawable;
import im.ovithmjoec.ui.components.EmptyTextProgressView;
import im.ovithmjoec.ui.components.LayoutHelper;
import im.ovithmjoec.ui.components.MapPlaceholderDrawable;
import im.ovithmjoec.ui.components.RecyclerListView;
import java.util.ArrayList;
import java.util.Locale;
@Deprecated
public class LocationActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
    public static final int LOCATION_TYPE_GROUP = 4;
    public static final int LOCATION_TYPE_GROUP_VIEW = 5;
    public static final int LOCATION_TYPE_SEND = 0;
    private static final int map_list_menu_hybrid = 4;
    private static final int map_list_menu_map = 2;
    private static final int map_list_menu_satellite = 3;
    private static final int share = 1;
    private LocationActivityAdapter adapter;
    private AnimatorSet animatorSet;
    private AvatarDrawable avatarDrawable;
    private TLRPC.TL_channelLocation chatLocation;
    private CircleOptions circleOptions;
    private LocationActivityDelegate delegate;
    private long dialogId;
    private EmptyTextProgressView emptyView;
    private boolean firstWas;
    private TLRPC.TL_channelLocation initialLocation;
    private LinearLayoutManager layoutManager;
    private RecyclerListView listView;
    private ImageView locationButton;
    private int locationType;
    private BaiduMap mBaiduMap;
    private LocationClient mLocClient;
    private MyLocationListener mLocationListener;
    private MapView mMapView;
    private FrameLayout mapViewClip;
    private boolean mapsInitialized;
    private View markerImageView;
    private int markerTop;
    private MessageObject messageObject;
    private BDLocation myLocation;
    private boolean onResumeCalled;
    private ActionBarMenuItem otherItem;
    private ChatActivity parentFragment;
    private ImageView routeButton;
    private LocationActivitySearchAdapter searchAdapter;
    private RecyclerListView searchListView;
    private boolean searchWas;
    private boolean searching;
    private Runnable updateRunnable;
    private BDLocation userLocation;
    private boolean userLocationMoved;
    private boolean wasResults;
    private boolean checkGpsEnabled = true;
    private boolean isFirstLocation = true;
    private boolean firstFocus = true;
    private ArrayList<LiveLocation> markers = new ArrayList<>();
    private SparseArray<LiveLocation> markersMap = new SparseArray<>();
    private boolean checkPermission = true;
    private int overScrollHeight = (AndroidUtilities.displaySize.x - ActionBar.getCurrentActionBarHeight()) - AndroidUtilities.dp(66.0f);

    public interface LocationActivityDelegate {
        void didSelectLocation(TLRPC.MessageMedia messageMedia, int i, boolean z, int i2);
    }

    public static void lambda$getThemeDescriptions$19() {
    }

    public class LiveLocation {
        public TLRPC.Chat chat;
        public int id;
        public Marker marker;
        public TLRPC.Message object;
        public TLRPC.User user;

        public LiveLocation() {
        }
    }

    public class Marker {
        public LatLng latLng;
        public Overlay marker;

        public Marker(Overlay overlay, LatLng latLng) {
            this.marker = overlay;
            this.latLng = latLng;
        }

        public void setPosition(LatLng latLng) {
            this.latLng = latLng;
        }

        public LatLng getPosition() {
            return this.latLng;
        }
    }

    public LocationActivity(int i) {
        this.locationType = i;
    }

    @Override
    public boolean onFragmentCreate() {
        super.onFragmentCreate();
        this.swipeBackEnabled = false;
        getNotificationCenter().addObserver(this, NotificationCenter.closeChats);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.locationPermissionGranted);
        MessageObject messageObject = this.messageObject;
        if (messageObject == null || !messageObject.isLiveLocation()) {
            return true;
        }
        getNotificationCenter().addObserver(this, NotificationCenter.didReceiveNewMessages);
        getNotificationCenter().addObserver(this, NotificationCenter.replaceMessagesObjects);
        return true;
    }

    @Override
    public void onFragmentDestroy() {
        super.onFragmentDestroy();
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.locationPermissionGranted);
        getNotificationCenter().removeObserver(this, NotificationCenter.closeChats);
        getNotificationCenter().removeObserver(this, NotificationCenter.didReceiveNewMessages);
        getNotificationCenter().removeObserver(this, NotificationCenter.replaceMessagesObjects);
        try {
            if (this.mMapView != null) {
                this.mMapView.onDestroy();
            }
        } catch (Exception e) {
            FileLog.e(e);
        }
        LocationActivityAdapter locationActivityAdapter = this.adapter;
        if (locationActivityAdapter != null) {
            locationActivityAdapter.destroy();
        }
        LocationActivitySearchAdapter locationActivitySearchAdapter = this.searchAdapter;
        if (locationActivitySearchAdapter != null) {
            locationActivitySearchAdapter.destroy();
        }
        Runnable runnable = this.updateRunnable;
        if (runnable != null) {
            AndroidUtilities.cancelRunOnUIThread(runnable);
            this.updateRunnable = null;
        }
    }

    @Override
    public View createView(Context context) {
        TLRPC.Chat chat;
        this.actionBar.setBackButtonImage(R.mipmap.ic_back);
        this.actionBar.setAllowOverlayTitle(true);
        if (AndroidUtilities.isTablet()) {
            this.actionBar.setOccupyStatusBar(false);
        }
        this.actionBar.setAddToContainer(false);
        this.actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
            @Override
            public void onItemClick(int i) {
                if (i == -1) {
                    LocationActivity.this.finishFragment();
                } else if (i == 2) {
                    if (LocationActivity.this.mBaiduMap != null) {
                        LocationActivity.this.mBaiduMap.setMapType(1);
                    }
                } else if (i == 3) {
                    if (LocationActivity.this.mBaiduMap != null) {
                        LocationActivity.this.mBaiduMap.setMapType(2);
                    }
                } else if (i == 1) {
                    try {
                        double d = LocationActivity.this.messageObject.messageOwner.media.geo.lat;
                        double d2 = LocationActivity.this.messageObject.messageOwner.media.geo._long;
                        FragmentActivity parentActivity = LocationActivity.this.getParentActivity();
                        parentActivity.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("geo:" + d + "," + d2 + "?q=" + d + "," + d2)));
                    } catch (Exception e) {
                        FileLog.e(e);
                    }
                }
            }
        });
        ActionBarMenu createMenu = this.actionBar.createMenu();
        if (this.chatLocation != null) {
            this.actionBar.setTitle(LocaleController.getString("ChatLocation", R.string.ChatLocation));
        } else {
            MessageObject messageObject = this.messageObject;
            if (messageObject != null) {
                if (messageObject.isLiveLocation()) {
                    this.actionBar.setTitle(LocaleController.getString("AttachLiveLocation", R.string.AttachLiveLocation));
                } else {
                    if (this.messageObject.messageOwner.media.title != null && this.messageObject.messageOwner.media.title.length() > 0) {
                        this.actionBar.setTitle(LocaleController.getString("SharedPlace", R.string.SharedPlace));
                    } else {
                        this.actionBar.setTitle(LocaleController.getString("ChatLocation", R.string.ChatLocation));
                    }
                    createMenu.addItem(1, R.drawable.share).setContentDescription(LocaleController.getString("ShareFile", R.string.ShareFile));
                }
            } else {
                this.actionBar.setTitle(LocaleController.getString("ShareLocation", R.string.ShareLocation));
                if (this.locationType != 4) {
                    createMenu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
                        @Override
                        public void onSearchExpand() {
                            LocationActivity.this.searching = true;
                            LocationActivity.this.otherItem.setVisibility(8);
                            LocationActivity.this.listView.setVisibility(8);
                            LocationActivity.this.mapViewClip.setVisibility(8);
                            LocationActivity.this.searchListView.setVisibility(0);
                            LocationActivity.this.searchListView.setEmptyView(LocationActivity.this.emptyView);
                            LocationActivity.this.emptyView.showTextView();
                        }

                        @Override
                        public void onSearchCollapse() {
                            LocationActivity.this.searching = false;
                            LocationActivity.this.searchWas = false;
                            LocationActivity.this.otherItem.setVisibility(0);
                            LocationActivity.this.searchListView.setEmptyView(null);
                            LocationActivity.this.listView.setVisibility(0);
                            LocationActivity.this.mapViewClip.setVisibility(0);
                            LocationActivity.this.searchListView.setVisibility(8);
                            LocationActivity.this.emptyView.setVisibility(8);
                            LocationActivity.this.searchAdapter.searchDelayed(null, null);
                        }

                        @Override
                        public void onTextChanged(EditText editText) {
                            if (LocationActivity.this.searchAdapter == null) {
                                return;
                            }
                            String obj = editText.getText().toString();
                            if (obj.length() != 0) {
                                LocationActivity.this.searchWas = true;
                            }
                            LocationActivity.this.emptyView.showProgress();
                            LocationActivity.this.searchAdapter.searchDelayed(obj, LocationActivity.this.userLocation);
                        }
                    }).setSearchFieldHint(LocaleController.getString("Search", R.string.Search));
                }
            }
        }
        ActionBarMenuItem addItem = createMenu.addItem(0, R.drawable.ic_ab_other);
        this.otherItem = addItem;
        addItem.addSubItem(2, R.drawable.msg_map, LocaleController.getString("Map", R.string.Map));
        this.otherItem.addSubItem(3, R.drawable.msg_satellite, LocaleController.getString("Satellite", R.string.Satellite));
        this.otherItem.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
        this.fragmentView = new FrameLayout(context) {
            private boolean first = true;

            @Override
            protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
                super.onLayout(z, i, i2, i3, i4);
                if (z) {
                    LocationActivity.this.fixLayoutInternal(this.first);
                    this.first = false;
                }
            }
        };
        FrameLayout frameLayout = (FrameLayout) this.fragmentView;
        this.locationButton = new ImageView(context);
        Drawable createSimpleSelectorCircleDrawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56.0f), Theme.getColor(Theme.key_profile_actionBackground), Theme.getColor(Theme.key_profile_actionPressedBackground));
        if (Build.VERSION.SDK_INT < 21) {
            Drawable mutate = context.getResources().getDrawable(R.drawable.floating_shadow_profile).mutate();
            mutate.setColorFilter(new PorterDuffColorFilter(-16777216, PorterDuff.Mode.MULTIPLY));
            CombinedDrawable combinedDrawable = new CombinedDrawable(mutate, createSimpleSelectorCircleDrawable, 0, 0);
            combinedDrawable.setIconSize(AndroidUtilities.dp(56.0f), AndroidUtilities.dp(56.0f));
            createSimpleSelectorCircleDrawable = combinedDrawable;
        }
        this.locationButton.setBackgroundDrawable(createSimpleSelectorCircleDrawable);
        this.locationButton.setImageResource(R.drawable.myloc_on);
        this.locationButton.setScaleType(ImageView.ScaleType.CENTER);
        this.locationButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_profile_actionIcon), PorterDuff.Mode.MULTIPLY));
        this.locationButton.setContentDescription(LocaleController.getString("AccDescrMyLocation", R.string.AccDescrMyLocation));
        if (Build.VERSION.SDK_INT >= 21) {
            StateListAnimator stateListAnimator = new StateListAnimator();
            stateListAnimator.addState(new int[]{16842919}, ObjectAnimator.ofFloat(this.locationButton, View.TRANSLATION_Z, AndroidUtilities.dp(2.0f), AndroidUtilities.dp(4.0f)).setDuration(200L));
            stateListAnimator.addState(new int[0], ObjectAnimator.ofFloat(this.locationButton, View.TRANSLATION_Z, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(2.0f)).setDuration(200L));
            this.locationButton.setStateListAnimator(stateListAnimator);
            this.locationButton.setOutlineProvider(new ViewOutlineProvider() {
                @Override
                public void getOutline(View view, Outline outline) {
                    outline.setOval(0, 0, AndroidUtilities.dp(56.0f), AndroidUtilities.dp(56.0f));
                }
            });
        }
        if (this.chatLocation != null) {
            BDLocation bDLocation = new BDLocation("network");
            this.userLocation = bDLocation;
            bDLocation.setLatitude(this.chatLocation.geo_point.lat);
            this.userLocation.setLongitude(this.chatLocation.geo_point._long);
        } else if (this.messageObject != null) {
            BDLocation bDLocation2 = new BDLocation("network");
            this.userLocation = bDLocation2;
            bDLocation2.setLatitude(this.messageObject.messageOwner.media.geo.lat);
            this.userLocation.setLongitude(this.messageObject.messageOwner.media.geo._long);
        }
        this.searchWas = false;
        this.searching = false;
        FrameLayout frameLayout2 = new FrameLayout(context);
        this.mapViewClip = frameLayout2;
        frameLayout2.setBackgroundDrawable(new MapPlaceholderDrawable());
        LocationActivityAdapter locationActivityAdapter = this.adapter;
        if (locationActivityAdapter != null) {
            locationActivityAdapter.destroy();
        }
        LocationActivitySearchAdapter locationActivitySearchAdapter = this.searchAdapter;
        if (locationActivitySearchAdapter != null) {
            locationActivitySearchAdapter.destroy();
        }
        RecyclerListView recyclerListView = new RecyclerListView(context);
        this.listView = recyclerListView;
        recyclerListView.setItemAnimator(null);
        this.listView.setLayoutAnimation(null);
        RecyclerListView recyclerListView2 = this.listView;
        LocationActivityAdapter locationActivityAdapter2 = new LocationActivityAdapter(context, this.locationType, this.dialogId);
        this.adapter = locationActivityAdapter2;
        recyclerListView2.setAdapter(locationActivityAdapter2);
        this.listView.setVerticalScrollBarEnabled(false);
        RecyclerListView recyclerListView3 = this.listView;
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context, 1, false) {
            @Override
            public boolean supportsPredictiveItemAnimations() {
                return false;
            }
        };
        this.layoutManager = linearLayoutManager;
        recyclerListView3.setLayoutManager(linearLayoutManager);
        frameLayout.addView(this.listView, LayoutHelper.createFrame(-1, -1, 51));
        this.listView.setOnScrollListener(new AnonymousClass6());
        this.listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
            @Override
            public final void onItemClick(View view, int i) {
                LocationActivity.this.lambda$createView$6$LocationActivity(view, i);
            }
        });
        this.adapter.setDelegate(this.dialogId, new BaseLocationAdapter.BaseLocationAdapterDelegate() {
            @Override
            public final void didLoadedSearchResult(ArrayList arrayList) {
                LocationActivity.this.lambda$createView$7$LocationActivity(arrayList);
            }
        });
        this.adapter.setOverScrollHeight(this.overScrollHeight);
        frameLayout.addView(this.mapViewClip, LayoutHelper.createFrame(-1, -1, 51));
        initBaiduMap(context);
        View view = new View(context);
        view.setBackgroundResource(R.drawable.header_shadow_reverse);
        this.mapViewClip.addView(view, LayoutHelper.createFrame(-1, 3, 83));
        if (this.messageObject == null && this.chatLocation == null) {
            if (this.locationType == 4 && this.dialogId != 0 && (chat = getMessagesController().getChat(Integer.valueOf(-((int) this.dialogId)))) != null) {
                FrameLayout frameLayout3 = new FrameLayout(context);
                frameLayout3.setBackgroundResource(R.drawable.livepin);
                this.mapViewClip.addView(frameLayout3, LayoutHelper.createFrame(62, 76, 49));
                BackupImageView backupImageView = new BackupImageView(context);
                backupImageView.setRoundRadius(AndroidUtilities.dp(26.0f));
                backupImageView.setImage(ImageLocation.getForChat(chat, false), "50_50", new AvatarDrawable(chat), chat);
                frameLayout3.addView(backupImageView, LayoutHelper.createFrame(52.0f, 52.0f, 51, 5.0f, 5.0f, 0.0f, 0.0f));
                this.markerImageView = frameLayout3;
                frameLayout3.setTag(1);
            }
            if (this.markerImageView == null) {
                ImageView imageView = new ImageView(context);
                imageView.setImageResource(R.drawable.map_pin2);
                this.mapViewClip.addView(imageView, LayoutHelper.createFrame(28, 48, 49));
                this.markerImageView = imageView;
            }
            EmptyTextProgressView emptyTextProgressView = new EmptyTextProgressView(context);
            this.emptyView = emptyTextProgressView;
            emptyTextProgressView.setText(LocaleController.getString("NoResult", R.string.NoResult));
            this.emptyView.setShowAtCenter(true);
            this.emptyView.setVisibility(8);
            frameLayout.addView(this.emptyView, LayoutHelper.createFrame(-1, -1.0f));
            RecyclerListView recyclerListView4 = new RecyclerListView(context);
            this.searchListView = recyclerListView4;
            recyclerListView4.setVisibility(8);
            this.searchListView.setLayoutManager(new LinearLayoutManager(context, 1, false));
            RecyclerListView recyclerListView5 = this.searchListView;
            LocationActivitySearchAdapter locationActivitySearchAdapter2 = new LocationActivitySearchAdapter(context);
            this.searchAdapter = locationActivitySearchAdapter2;
            recyclerListView5.setAdapter(locationActivitySearchAdapter2);
            frameLayout.addView(this.searchListView, LayoutHelper.createFrame(-1, -1, 51));
            this.searchListView.setOnScrollListener(new RecyclerView.OnScrollListener() {
                @Override
                public void onScrollStateChanged(RecyclerView recyclerView, int i) {
                    if (i == 1 && LocationActivity.this.searching && LocationActivity.this.searchWas) {
                        AndroidUtilities.hideKeyboard(LocationActivity.this.getParentActivity().getCurrentFocus());
                    }
                }
            });
            this.searchListView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
                @Override
                public final void onItemClick(View view2, int i) {
                    LocationActivity.this.lambda$createView$9$LocationActivity(view2, i);
                }
            });
        } else {
            MessageObject messageObject2 = this.messageObject;
            if ((messageObject2 != null && !messageObject2.isLiveLocation()) || this.chatLocation != null) {
                this.routeButton = new ImageView(context);
                Drawable createSimpleSelectorCircleDrawable2 = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56.0f), Theme.getColor(Theme.key_chats_actionBackground), Theme.getColor(Theme.key_chats_actionPressedBackground));
                if (Build.VERSION.SDK_INT < 21) {
                    Drawable mutate2 = context.getResources().getDrawable(R.drawable.floating_shadow).mutate();
                    mutate2.setColorFilter(new PorterDuffColorFilter(-16777216, PorterDuff.Mode.MULTIPLY));
                    CombinedDrawable combinedDrawable2 = new CombinedDrawable(mutate2, createSimpleSelectorCircleDrawable2, 0, 0);
                    combinedDrawable2.setIconSize(AndroidUtilities.dp(56.0f), AndroidUtilities.dp(56.0f));
                    createSimpleSelectorCircleDrawable2 = combinedDrawable2;
                }
                this.routeButton.setBackgroundDrawable(createSimpleSelectorCircleDrawable2);
                this.routeButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionIcon), PorterDuff.Mode.MULTIPLY));
                this.routeButton.setImageResource(R.drawable.navigate);
                this.routeButton.setScaleType(ImageView.ScaleType.CENTER);
                if (Build.VERSION.SDK_INT >= 21) {
                    StateListAnimator stateListAnimator2 = new StateListAnimator();
                    stateListAnimator2.addState(new int[]{16842919}, ObjectAnimator.ofFloat(this.routeButton, View.TRANSLATION_Z, AndroidUtilities.dp(2.0f), AndroidUtilities.dp(4.0f)).setDuration(200L));
                    stateListAnimator2.addState(new int[0], ObjectAnimator.ofFloat(this.routeButton, View.TRANSLATION_Z, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(2.0f)).setDuration(200L));
                    this.routeButton.setStateListAnimator(stateListAnimator2);
                    this.routeButton.setOutlineProvider(new ViewOutlineProvider() {
                        @Override
                        public void getOutline(View view2, Outline outline) {
                            outline.setOval(0, 0, AndroidUtilities.dp(56.0f), AndroidUtilities.dp(56.0f));
                        }
                    });
                }
                frameLayout.addView(this.routeButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56.0f : 60.0f, Build.VERSION.SDK_INT >= 21 ? 56.0f : 60.0f, (LocaleController.isRTL ? 3 : 5) | 80, LocaleController.isRTL ? 14.0f : 0.0f, 0.0f, LocaleController.isRTL ? 0.0f : 14.0f, 37.0f));
                this.routeButton.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view2) {
                        LocationActivity.this.lambda$createView$10$LocationActivity(view2);
                    }
                });
                TLRPC.TL_channelLocation tL_channelLocation = this.chatLocation;
                if (tL_channelLocation != null) {
                    this.adapter.setChatLocation(tL_channelLocation);
                } else {
                    MessageObject messageObject3 = this.messageObject;
                    if (messageObject3 != null) {
                        this.adapter.setMessageObject(messageObject3);
                    }
                }
            }
        }
        MessageObject messageObject4 = this.messageObject;
        if ((messageObject4 != null && !messageObject4.isLiveLocation()) || this.chatLocation != null) {
            this.mapViewClip.addView(this.locationButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56.0f : 60.0f, Build.VERSION.SDK_INT >= 21 ? 56.0f : 60.0f, (LocaleController.isRTL ? 3 : 5) | 80, LocaleController.isRTL ? 14.0f : 0.0f, 0.0f, LocaleController.isRTL ? 0.0f : 14.0f, 43.0f));
        } else {
            this.mapViewClip.addView(this.locationButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56.0f : 60.0f, Build.VERSION.SDK_INT >= 21 ? 56.0f : 60.0f, (LocaleController.isRTL ? 3 : 5) | 80, LocaleController.isRTL ? 14.0f : 0.0f, 0.0f, LocaleController.isRTL ? 0.0f : 14.0f, 14.0f));
        }
        this.locationButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view2) {
                LocationActivity.this.lambda$createView$11$LocationActivity(view2);
            }
        });
        if (this.messageObject == null && this.chatLocation == null) {
            if (this.initialLocation == null) {
                this.locationButton.setAlpha(0.0f);
            } else {
                this.userLocationMoved = true;
            }
        }
        frameLayout.addView(this.actionBar);
        return this.fragmentView;
    }

    public class AnonymousClass6 extends RecyclerView.OnScrollListener {
        AnonymousClass6() {
        }

        @Override
        public void onScrolled(RecyclerView recyclerView, int i, int i2) {
            int findFirstVisibleItemPosition;
            if (LocationActivity.this.adapter.getItemCount() == 0 || (findFirstVisibleItemPosition = LocationActivity.this.layoutManager.findFirstVisibleItemPosition()) == -1) {
                return;
            }
            LocationActivity.this.updateClipView(findFirstVisibleItemPosition);
            if (LocationActivity.this.locationType == 4 || i2 <= 0 || LocationActivity.this.adapter.isPulledUp()) {
                return;
            }
            LocationActivity.this.adapter.setPulledUp();
            if (LocationActivity.this.myLocation != null) {
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public final void run() {
                        LocationActivity.AnonymousClass6.this.lambda$onScrolled$0$LocationActivity$6();
                    }
                });
            }
        }

        public void lambda$onScrolled$0$LocationActivity$6() {
            LocationActivity.this.adapter.searchPlacesWithQuery(null, LocationActivity.this.myLocation, true);
        }
    }

    public void lambda$createView$6$LocationActivity(View view, int i) {
        MessageObject messageObject;
        final TLRPC.TL_messageMediaVenue tL_messageMediaVenue;
        int i2 = this.locationType;
        if (i2 == 4) {
            if (i != 1 || (tL_messageMediaVenue = (TLRPC.TL_messageMediaVenue) this.adapter.getItem(i)) == null) {
                return;
            }
            if (this.dialogId == 0) {
                this.delegate.didSelectLocation(tL_messageMediaVenue, 4, true, 0);
                finishFragment();
                return;
            }
            final AlertDialog[] alertDialogArr = {new AlertDialog(getParentActivity(), 3)};
            TLRPC.TL_channels_editLocation tL_channels_editLocation = new TLRPC.TL_channels_editLocation();
            tL_channels_editLocation.address = tL_messageMediaVenue.address;
            tL_channels_editLocation.channel = getMessagesController().getInputChannel(-((int) this.dialogId));
            tL_channels_editLocation.geo_point = new TLRPC.TL_inputGeoPoint();
            tL_channels_editLocation.geo_point.lat = tL_messageMediaVenue.geo.lat;
            tL_channels_editLocation.geo_point._long = tL_messageMediaVenue.geo._long;
            final int sendRequest = getConnectionsManager().sendRequest(tL_channels_editLocation, new RequestDelegate() {
                @Override
                public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                    LocationActivity.this.lambda$null$1$LocationActivity(alertDialogArr, tL_messageMediaVenue, tLObject, tL_error);
                }
            });
            alertDialogArr[0].setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public final void onCancel(DialogInterface dialogInterface) {
                    LocationActivity.this.lambda$null$2$LocationActivity(sendRequest, dialogInterface);
                }
            });
            showDialog(alertDialogArr[0]);
        } else if (i2 == 5) {
            if (this.mBaiduMap != null) {
                LatLng latLng = new LatLng(this.chatLocation.geo_point.lat, this.chatLocation.geo_point._long);
                MapStatus.Builder builder = new MapStatus.Builder();
                builder.target(latLng).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f);
                this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
            }
        } else if (i == 1 && (messageObject = this.messageObject) != null && !messageObject.isLiveLocation()) {
            if (this.mBaiduMap != null) {
                LatLng latLng2 = new LatLng(this.messageObject.messageOwner.media.geo.lat, this.messageObject.messageOwner.media.geo._long);
                MapStatus.Builder builder2 = new MapStatus.Builder();
                builder2.target(latLng2).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f);
                this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder2.build()));
            }
        } else if (i == 1 && this.locationType != 2) {
            if (this.delegate == null || this.userLocation == null) {
                return;
            }
            final TLRPC.TL_messageMediaGeo tL_messageMediaGeo = new TLRPC.TL_messageMediaGeo();
            tL_messageMediaGeo.geo = new TLRPC.TL_geoPoint();
            tL_messageMediaGeo.geo.lat = AndroidUtilities.fixLocationCoord(this.userLocation.getLatitude());
            tL_messageMediaGeo.geo._long = AndroidUtilities.fixLocationCoord(this.userLocation.getLongitude());
            ChatActivity chatActivity = this.parentFragment;
            if (chatActivity != null && chatActivity.isInScheduleMode()) {
                AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), UserObject.isUserSelf(this.parentFragment.getCurrentUser()), new AlertsCreator.ScheduleDatePickerDelegate() {
                    @Override
                    public final void didSelectDate(boolean z, int i3) {
                        LocationActivity.this.lambda$null$3$LocationActivity(tL_messageMediaGeo, z, i3);
                    }
                });
                return;
            }
            this.delegate.didSelectLocation(tL_messageMediaGeo, this.locationType, true, 0);
            finishFragment();
        } else if ((i == 2 && this.locationType == 1) || ((i == 1 && this.locationType == 2) || (i == 3 && this.locationType == 3))) {
            if (getLocationController().isSharingLocation(this.dialogId)) {
                getLocationController().removeSharingLocation(this.dialogId);
                finishFragment();
            } else if (this.delegate == null || getParentActivity() == null || this.myLocation == null) {
            } else {
                showDialog(AlertsCreator.createLocationUpdateDialog(getParentActivity(), ((int) this.dialogId) > 0 ? getMessagesController().getUser(Integer.valueOf((int) this.dialogId)) : null, new MessagesStorage.IntCallback() {
                    @Override
                    public final void run(int i3) {
                        LocationActivity.this.lambda$null$4$LocationActivity(i3);
                    }
                }));
            }
        } else {
            final Object item = this.adapter.getItem(i);
            if (item instanceof TLRPC.TL_messageMediaVenue) {
                ChatActivity chatActivity2 = this.parentFragment;
                if (chatActivity2 != null && chatActivity2.isInScheduleMode()) {
                    AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), UserObject.isUserSelf(this.parentFragment.getCurrentUser()), new AlertsCreator.ScheduleDatePickerDelegate() {
                        @Override
                        public final void didSelectDate(boolean z, int i3) {
                            LocationActivity.this.lambda$null$5$LocationActivity(item, z, i3);
                        }
                    });
                    return;
                }
                this.delegate.didSelectLocation((TLRPC.TL_messageMediaVenue) item, this.locationType, true, 0);
                finishFragment();
            } else if (item instanceof LiveLocation) {
                LiveLocation liveLocation = (LiveLocation) item;
                LatLng latLng3 = new LatLng(liveLocation.object.media.geo.lat, liveLocation.object.media.geo._long);
                MapStatus.Builder builder3 = new MapStatus.Builder();
                builder3.target(latLng3).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f);
                this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder3.build()));
            }
        }
    }

    public void lambda$null$1$LocationActivity(final AlertDialog[] alertDialogArr, final TLRPC.TL_messageMediaVenue tL_messageMediaVenue, TLObject tLObject, TLRPC.TL_error tL_error) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                LocationActivity.this.lambda$null$0$LocationActivity(alertDialogArr, tL_messageMediaVenue);
            }
        });
    }

    public void lambda$null$0$LocationActivity(AlertDialog[] alertDialogArr, TLRPC.TL_messageMediaVenue tL_messageMediaVenue) {
        try {
            alertDialogArr[0].dismiss();
        } catch (Throwable unused) {
        }
        alertDialogArr[0] = null;
        this.delegate.didSelectLocation(tL_messageMediaVenue, 4, true, 0);
        finishFragment();
    }

    public void lambda$null$2$LocationActivity(int i, DialogInterface dialogInterface) {
        getConnectionsManager().cancelRequest(i, true);
    }

    public void lambda$null$3$LocationActivity(TLRPC.TL_messageMediaGeo tL_messageMediaGeo, boolean z, int i) {
        this.delegate.didSelectLocation(tL_messageMediaGeo, this.locationType, z, i);
        finishFragment();
    }

    public void lambda$null$4$LocationActivity(int i) {
        TLRPC.TL_messageMediaGeoLive tL_messageMediaGeoLive = new TLRPC.TL_messageMediaGeoLive();
        tL_messageMediaGeoLive.geo = new TLRPC.TL_geoPoint();
        tL_messageMediaGeoLive.geo.lat = AndroidUtilities.fixLocationCoord(this.myLocation.getLatitude());
        tL_messageMediaGeoLive.geo._long = AndroidUtilities.fixLocationCoord(this.myLocation.getLongitude());
        tL_messageMediaGeoLive.period = i;
        this.delegate.didSelectLocation(tL_messageMediaGeoLive, this.locationType, true, 0);
        finishFragment();
    }

    public void lambda$null$5$LocationActivity(Object obj, boolean z, int i) {
        this.delegate.didSelectLocation((TLRPC.TL_messageMediaVenue) obj, this.locationType, z, i);
        finishFragment();
    }

    public void lambda$createView$7$LocationActivity(ArrayList arrayList) {
        if (!this.wasResults && !arrayList.isEmpty()) {
            this.wasResults = true;
        }
        this.emptyView.showTextView();
    }

    public void lambda$createView$9$LocationActivity(View view, int i) {
        final TLRPC.TL_messageMediaVenue item = this.searchAdapter.getItem(i);
        if (item == null || this.delegate == null) {
            return;
        }
        ChatActivity chatActivity = this.parentFragment;
        if (chatActivity != null && chatActivity.isInScheduleMode()) {
            AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), UserObject.isUserSelf(this.parentFragment.getCurrentUser()), new AlertsCreator.ScheduleDatePickerDelegate() {
                @Override
                public final void didSelectDate(boolean z, int i2) {
                    LocationActivity.this.lambda$null$8$LocationActivity(item, z, i2);
                }
            });
            return;
        }
        this.delegate.didSelectLocation(item, this.locationType, true, 0);
        finishFragment();
    }

    public void lambda$null$8$LocationActivity(TLRPC.TL_messageMediaVenue tL_messageMediaVenue, boolean z, int i) {
        this.delegate.didSelectLocation(tL_messageMediaVenue, this.locationType, z, i);
        finishFragment();
    }

    public void lambda$createView$10$LocationActivity(View view) {
        Intent intent;
        FragmentActivity parentActivity;
        if (Build.VERSION.SDK_INT >= 23 && (parentActivity = getParentActivity()) != null && parentActivity.checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) {
            showPermissionAlert(true);
        } else if (this.myLocation != null) {
            try {
                if (this.messageObject != null) {
                    intent = 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(this.myLocation.getLatitude()), Double.valueOf(this.myLocation.getLongitude()), Double.valueOf(this.messageObject.messageOwner.media.geo.lat), Double.valueOf(this.messageObject.messageOwner.media.geo._long))));
                } else {
                    intent = 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(this.myLocation.getLatitude()), Double.valueOf(this.myLocation.getLongitude()), Double.valueOf(this.chatLocation.geo_point.lat), Double.valueOf(this.chatLocation.geo_point._long))));
                }
                getParentActivity().startActivity(intent);
            } catch (Exception e) {
                FileLog.e(e);
            }
        }
    }

    public void lambda$createView$11$LocationActivity(View view) {
        FragmentActivity parentActivity;
        if (Build.VERSION.SDK_INT >= 23 && (parentActivity = getParentActivity()) != null && parentActivity.checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) {
            showPermissionAlert(false);
        } else if (this.messageObject != null || this.chatLocation != null) {
            BDLocation bDLocation = this.myLocation;
            if (bDLocation == null || this.mBaiduMap == null) {
                return;
            }
            LatLng latLng = new LatLng(bDLocation.getLatitude(), this.myLocation.getLongitude());
            MapStatus.Builder builder = new MapStatus.Builder();
            builder.target(latLng).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f);
            this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
        } else if (this.myLocation == null || this.mBaiduMap == null) {
        } else {
            AnimatorSet animatorSet = new AnimatorSet();
            animatorSet.setDuration(200L);
            animatorSet.play(ObjectAnimator.ofFloat(this.locationButton, View.ALPHA, 0.0f));
            animatorSet.start();
            this.adapter.setCustomLocation(null);
            this.userLocationMoved = false;
            LatLng latLng2 = new LatLng(this.myLocation.getLatitude(), this.myLocation.getLongitude());
            MapStatus.Builder builder2 = new MapStatus.Builder();
            builder2.target(latLng2);
            this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder2.build()));
        }
    }

    private void initBaiduMap(Context context) {
        MapView mapView = new MapView(context);
        this.mMapView = mapView;
        this.mBaiduMap = mapView.getMap();
        this.mMapView.showZoomControls(false);
        this.mMapView.showScaleControl(false);
        this.mBaiduMap.getUiSettings().setCompassEnabled(false);
        this.mBaiduMap.setMapType(1);
        this.mBaiduMap.setMyLocationEnabled(true);
        this.mBaiduMap.setOnMapTouchListener(new BaiduMap.OnMapTouchListener() {
            @Override
            public final void onTouch(MotionEvent motionEvent) {
                LocationActivity.this.lambda$initBaiduMap$12$LocationActivity(motionEvent);
            }
        });
        this.mBaiduMap.setOnMapLoadedCallback(new BaiduMap.OnMapLoadedCallback() {
            @Override
            public final void onMapLoaded() {
                LocationActivity.this.lambda$initBaiduMap$13$LocationActivity();
            }
        });
        initLocationClient();
    }

    public void lambda$initBaiduMap$12$LocationActivity(MotionEvent motionEvent) {
        BDLocation bDLocation;
        if (this.messageObject == null && this.chatLocation == null) {
            if (motionEvent.getAction() == 0) {
                AnimatorSet animatorSet = this.animatorSet;
                if (animatorSet != null) {
                    animatorSet.cancel();
                }
                AnimatorSet animatorSet2 = new AnimatorSet();
                this.animatorSet = animatorSet2;
                animatorSet2.setDuration(200L);
                this.animatorSet.playTogether(ObjectAnimator.ofFloat(this.markerImageView, View.TRANSLATION_Y, this.markerTop - AndroidUtilities.dp(10.0f)));
                this.animatorSet.start();
            } else if (motionEvent.getAction() == 1) {
                AnimatorSet animatorSet3 = this.animatorSet;
                if (animatorSet3 != null) {
                    animatorSet3.cancel();
                }
                AnimatorSet animatorSet4 = new AnimatorSet();
                this.animatorSet = animatorSet4;
                animatorSet4.setDuration(200L);
                this.animatorSet.playTogether(ObjectAnimator.ofFloat(this.markerImageView, View.TRANSLATION_Y, this.markerTop));
                this.animatorSet.start();
                this.adapter.fetchLocationAddress();
            }
            if (motionEvent.getAction() == 2) {
                if (!this.userLocationMoved) {
                    AnimatorSet animatorSet5 = new AnimatorSet();
                    animatorSet5.setDuration(200L);
                    animatorSet5.play(ObjectAnimator.ofFloat(this.locationButton, View.ALPHA, 1.0f));
                    animatorSet5.start();
                    this.userLocationMoved = true;
                }
                BaiduMap baiduMap = this.mBaiduMap;
                if (baiduMap != null && (bDLocation = this.userLocation) != null) {
                    bDLocation.setLatitude(baiduMap.getLocationData().latitude);
                    this.userLocation.setLongitude(this.mBaiduMap.getLocationData().longitude);
                }
                this.adapter.setCustomLocation(this.userLocation);
            }
        }
    }

    public void lambda$initBaiduMap$13$LocationActivity() {
        if (this.mMapView == null || getParentActivity() == null) {
            return;
        }
        this.mBaiduMap.setViewPadding(AndroidUtilities.dp(70.0f), 0, AndroidUtilities.dp(70.0f), AndroidUtilities.dp(10.0f));
        onMapInit();
        this.mapsInitialized = true;
        if (this.onResumeCalled) {
            this.mMapView.onResume();
        }
    }

    private void initLocationClient() {
        LocationClient locationClient = new LocationClient(getParentActivity());
        this.mLocClient = locationClient;
        MyLocationListener myLocationListener = new MyLocationListener();
        this.mLocationListener = myLocationListener;
        locationClient.registerLocationListener(myLocationListener);
        LocationClientOption locationClientOption = new LocationClientOption();
        locationClientOption.setOpenGps(true);
        locationClientOption.setCoorType(CoordinateType.GCJ02);
        locationClientOption.setScanSpan(1000);
        locationClientOption.setIgnoreKillProcess(false);
        locationClientOption.setIsNeedAddress(true);
        this.mLocClient.setLocOption(locationClientOption);
        this.mLocClient.start();
    }

    private Bitmap createUserBitmap(LiveLocation liveLocation) {
        TLRPC.FileLocation fileLocation;
        Bitmap bitmap = null;
        try {
            if (liveLocation.user != null && liveLocation.user.photo != null) {
                fileLocation = liveLocation.user.photo.photo_small;
            } else {
                fileLocation = (liveLocation.chat == null || liveLocation.chat.photo == null) ? null : liveLocation.chat.photo.photo_small;
            }
            Bitmap createBitmap = Bitmap.createBitmap(AndroidUtilities.dp(62.0f), AndroidUtilities.dp(76.0f), Bitmap.Config.ARGB_8888);
            try {
                createBitmap.eraseColor(0);
                Canvas canvas = new Canvas(createBitmap);
                Drawable drawable = ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.livepin);
                drawable.setBounds(0, 0, AndroidUtilities.dp(62.0f), AndroidUtilities.dp(76.0f));
                drawable.draw(canvas);
                Paint paint = new Paint(1);
                RectF rectF = new RectF();
                canvas.save();
                if (fileLocation != null) {
                    Bitmap decodeFile = BitmapFactory.decodeFile(FileLoader.getPathToAttach(fileLocation, true).toString());
                    if (decodeFile != null) {
                        BitmapShader bitmapShader = new BitmapShader(decodeFile, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
                        Matrix matrix = new Matrix();
                        float dp = AndroidUtilities.dp(52.0f) / decodeFile.getWidth();
                        matrix.postTranslate(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f));
                        matrix.postScale(dp, dp);
                        paint.setShader(bitmapShader);
                        bitmapShader.setLocalMatrix(matrix);
                        rectF.set(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f), AndroidUtilities.dp(57.0f), AndroidUtilities.dp(57.0f));
                        canvas.drawRoundRect(rectF, AndroidUtilities.dp(26.0f), AndroidUtilities.dp(26.0f), paint);
                    }
                } else {
                    AvatarDrawable avatarDrawable = new AvatarDrawable();
                    if (liveLocation.user != null) {
                        avatarDrawable.setInfo(liveLocation.user);
                    } else if (liveLocation.chat != null) {
                        avatarDrawable.setInfo(liveLocation.chat);
                    }
                    canvas.translate(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f));
                    avatarDrawable.setBounds(0, 0, AndroidUtilities.dp(52.2f), AndroidUtilities.dp(52.2f));
                    avatarDrawable.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 int getMessageId(TLRPC.Message message) {
        if (message.from_id != 0) {
            return message.from_id;
        }
        return (int) MessageObject.getDialogId(message);
    }

    private LiveLocation addUserMarker(TLRPC.Message message) {
        LatLng latLng = new LatLng(message.media.geo.lat, message.media.geo._long);
        LiveLocation liveLocation = this.markersMap.get(message.from_id);
        if (liveLocation == null) {
            liveLocation = new LiveLocation();
            liveLocation.object = message;
            if (liveLocation.object.from_id != 0) {
                liveLocation.user = getMessagesController().getUser(Integer.valueOf(liveLocation.object.from_id));
                liveLocation.id = liveLocation.object.from_id;
            } else {
                int dialogId = (int) MessageObject.getDialogId(message);
                if (dialogId > 0) {
                    liveLocation.user = getMessagesController().getUser(Integer.valueOf(dialogId));
                    liveLocation.id = dialogId;
                } else {
                    liveLocation.chat = getMessagesController().getChat(Integer.valueOf(-dialogId));
                    liveLocation.id = dialogId;
                }
            }
            liveLocation.marker = createUserMarker(latLng, liveLocation);
            this.markers.add(liveLocation);
            this.markersMap.put(liveLocation.id, liveLocation);
            LocationController.SharingLocationInfo sharingLocationInfo = getLocationController().getSharingLocationInfo(this.dialogId);
            if (liveLocation.id == getUserConfig().getClientUserId() && sharingLocationInfo != null && liveLocation.object.id == sharingLocationInfo.mid && this.myLocation != null) {
                liveLocation.marker.setPosition(new LatLng(this.myLocation.getLatitude(), this.myLocation.getLongitude()));
            }
        } else {
            liveLocation.object = message;
            liveLocation.marker.setPosition(latLng);
        }
        return liveLocation;
    }

    private LiveLocation addUserMarker(TLRPC.TL_channelLocation tL_channelLocation) {
        LatLng latLng = new LatLng(tL_channelLocation.geo_point.lat, tL_channelLocation.geo_point._long);
        LiveLocation liveLocation = new LiveLocation();
        int i = (int) this.dialogId;
        if (i > 0) {
            liveLocation.user = getMessagesController().getUser(Integer.valueOf(i));
            liveLocation.id = i;
        } else {
            liveLocation.chat = getMessagesController().getChat(Integer.valueOf(-i));
            liveLocation.id = i;
        }
        liveLocation.marker = createUserMarker(latLng, liveLocation);
        this.markers.add(liveLocation);
        this.markersMap.put(liveLocation.id, liveLocation);
        return liveLocation;
    }

    private Marker addLocMarker(LatLng latLng) {
        return new Marker(this.mBaiduMap.addOverlay(new MarkerOptions().position(latLng).icon(BitmapDescriptorFactory.fromResource(R.drawable.map_pin2)).draggable(false).flat(false)), latLng);
    }

    private Marker createUserMarker(LatLng latLng, LiveLocation liveLocation) {
        return new Marker(this.mBaiduMap.addOverlay(new MarkerOptions().position(latLng).icon(BitmapDescriptorFactory.fromBitmap(createUserBitmap(liveLocation))).draggable(false).flat(false).anchor(0.5f, 0.907f)), latLng);
    }

    public class MyLocationListener extends BDAbstractLocationListener {
        public MyLocationListener() {
        }

        @Override
        public void onReceiveLocation(BDLocation bDLocation) {
            LocationActivity.this.positionMarker(bDLocation);
            LocationActivity.this.getLocationController().setBaiduMapLocation(bDLocation, LocationActivity.this.isFirstLocation);
            LocationActivity.this.isFirstLocation = false;
        }
    }

    private void onMapInit() {
        if (this.mBaiduMap == null) {
            return;
        }
        TLRPC.TL_channelLocation tL_channelLocation = this.chatLocation;
        if (tL_channelLocation != null) {
            LiveLocation addUserMarker = addUserMarker(tL_channelLocation);
            MapStatus.Builder builder = new MapStatus.Builder();
            builder.target(addUserMarker.marker.getPosition()).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f);
            this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
        } else {
            MessageObject messageObject = this.messageObject;
            if (messageObject != null) {
                if (messageObject.isLiveLocation()) {
                    LiveLocation addUserMarker2 = addUserMarker(this.messageObject.messageOwner);
                    if (!getRecentLocations()) {
                        MapStatus.Builder builder2 = new MapStatus.Builder();
                        builder2.target(addUserMarker2.marker.getPosition()).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f);
                        this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder2.build()));
                    }
                } else {
                    LatLng latLng = new LatLng(this.userLocation.getLatitude(), this.userLocation.getLongitude());
                    try {
                        addLocMarker(latLng);
                    } catch (Exception e) {
                        FileLog.e(e);
                    }
                    MapStatus.Builder builder3 = new MapStatus.Builder();
                    builder3.target(latLng).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f);
                    this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder3.build()));
                    this.firstFocus = false;
                    getRecentLocations();
                }
            } else {
                BDLocation bDLocation = new BDLocation("network");
                this.userLocation = bDLocation;
                TLRPC.TL_channelLocation tL_channelLocation2 = this.initialLocation;
                if (tL_channelLocation2 != null) {
                    LatLng latLng2 = new LatLng(tL_channelLocation2.geo_point.lat, this.initialLocation.geo_point._long);
                    MapStatus.Builder builder4 = new MapStatus.Builder();
                    builder4.target(latLng2).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f);
                    this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder4.build()));
                    this.userLocation.setLatitude(this.initialLocation.geo_point.lat);
                    this.userLocation.setLongitude(this.initialLocation.geo_point._long);
                    this.adapter.setCustomLocation(this.userLocation);
                } else {
                    bDLocation.setLatitude(20.659322d);
                    this.userLocation.setLongitude(-11.40625d);
                }
            }
        }
        BDLocation lastLocation = getLastLocation();
        this.myLocation = lastLocation;
        positionMarker(lastLocation);
        if (!this.checkGpsEnabled || getParentActivity() == null) {
            return;
        }
        this.checkGpsEnabled = false;
        if (getParentActivity().getPackageManager().hasSystemFeature("android.hardware.location.gps")) {
            try {
                if (((LocationManager) ApplicationLoader.applicationContext.getSystemService("location")).isProviderEnabled("gps")) {
                    return;
                }
                AlertDialog.Builder builder5 = new AlertDialog.Builder(getParentActivity());
                builder5.setTitle(LocaleController.getString("AppName", R.string.AppName));
                builder5.setMessage(LocaleController.getString("GpsDisabledAlert", R.string.GpsDisabledAlert));
                builder5.setPositiveButton(LocaleController.getString("ConnectingToProxyEnable", R.string.ConnectingToProxyEnable), new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i) {
                        LocationActivity.this.lambda$onMapInit$14$LocationActivity(dialogInterface, i);
                    }
                });
                builder5.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                showDialog(builder5.create());
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        }
    }

    public void lambda$onMapInit$14$LocationActivity(DialogInterface dialogInterface, int i) {
        if (getParentActivity() == null) {
            return;
        }
        try {
            getParentActivity().startActivity(new Intent("android.settings.LOCATION_SOURCE_SETTINGS"));
        } catch (Exception unused) {
        }
    }

    private void showPermissionAlert(boolean z) {
        if (getParentActivity() == null) {
            return;
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
        if (z) {
            builder.setMessage(LocaleController.getString("PermissionNoLocationPosition", R.string.PermissionNoLocationPosition));
        } else {
            builder.setMessage(LocaleController.getString("PermissionNoLocation", R.string.PermissionNoLocation));
        }
        builder.setNegativeButton(LocaleController.getString("PermissionOpenSettings", R.string.PermissionOpenSettings), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                LocationActivity.this.lambda$showPermissionAlert$15$LocationActivity(dialogInterface, i);
            }
        });
        builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
        showDialog(builder.create());
    }

    public void lambda$showPermissionAlert$15$LocationActivity(DialogInterface dialogInterface, int i) {
        if (getParentActivity() == null) {
            return;
        }
        try {
            Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
            intent.setData(Uri.parse("package:" + ApplicationLoader.applicationContext.getPackageName()));
            getParentActivity().startActivity(intent);
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    @Override
    public void onTransitionAnimationEnd(boolean z, boolean z2) {
        if (z) {
            try {
                if (this.mMapView.getParent() instanceof ViewGroup) {
                    ((ViewGroup) this.mMapView.getParent()).removeView(this.mMapView);
                }
            } catch (Exception e) {
                FileLog.e(e);
            }
            FrameLayout frameLayout = this.mapViewClip;
            if (frameLayout != null) {
                frameLayout.addView(this.mMapView, 0, LayoutHelper.createFrame(-1, this.overScrollHeight + AndroidUtilities.dp(10.0f), 51));
                updateClipView(this.layoutManager.findFirstVisibleItemPosition());
            } else if (this.fragmentView != null) {
                ((FrameLayout) this.fragmentView).addView(this.mMapView, 0, LayoutHelper.createFrame(-1, -1, 51));
            }
        }
    }

    public void updateClipView(int i) {
        View childAt;
        int i2;
        int i3;
        if (i == -1 || (childAt = this.listView.getChildAt(0)) == null) {
            return;
        }
        if (i == 0) {
            i2 = childAt.getTop();
            i3 = this.overScrollHeight + (i2 < 0 ? i2 : 0);
        } else {
            i2 = 0;
            i3 = 0;
        }
        if (((FrameLayout.LayoutParams) this.mapViewClip.getLayoutParams()) != null) {
            if (i3 <= 0) {
                if (this.mMapView.getVisibility() == 0) {
                    this.mMapView.setVisibility(4);
                    this.mapViewClip.setVisibility(4);
                }
            } else if (this.mMapView.getVisibility() == 4) {
                this.mMapView.setVisibility(0);
                this.mapViewClip.setVisibility(0);
            }
            this.mapViewClip.setTranslationY(Math.min(0, i2));
            int i4 = -i2;
            this.mMapView.setTranslationY(Math.max(0, i4 / 2));
            View view = this.markerImageView;
            if (view != null) {
                int dp = (i4 - AndroidUtilities.dp(view.getTag() == null ? 48.0f : 69.0f)) + (i3 / 2);
                this.markerTop = dp;
                view.setTranslationY(dp);
            }
            ImageView imageView = this.routeButton;
            if (imageView != null) {
                imageView.setTranslationY(i2);
            }
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.mMapView.getLayoutParams();
            if (layoutParams == null || layoutParams.height == this.overScrollHeight + AndroidUtilities.dp(10.0f)) {
                return;
            }
            layoutParams.height = this.overScrollHeight + AndroidUtilities.dp(10.0f);
            BaiduMap baiduMap = this.mBaiduMap;
            if (baiduMap != null) {
                baiduMap.setPadding(AndroidUtilities.dp(70.0f), 0, AndroidUtilities.dp(70.0f), AndroidUtilities.dp(10.0f));
            }
            this.mMapView.setLayoutParams(layoutParams);
        }
    }

    public void fixLayoutInternal(boolean z) {
        if (this.listView != null) {
            int currentActionBarHeight = (this.actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight();
            int measuredHeight = this.fragmentView.getMeasuredHeight();
            if (measuredHeight == 0) {
                return;
            }
            this.overScrollHeight = (measuredHeight - AndroidUtilities.dp(66.0f)) - currentActionBarHeight;
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.listView.getLayoutParams();
            layoutParams.topMargin = currentActionBarHeight;
            this.listView.setLayoutParams(layoutParams);
            FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) this.mapViewClip.getLayoutParams();
            layoutParams2.topMargin = currentActionBarHeight;
            layoutParams2.height = this.overScrollHeight;
            this.mapViewClip.setLayoutParams(layoutParams2);
            RecyclerListView recyclerListView = this.searchListView;
            if (recyclerListView != null) {
                FrameLayout.LayoutParams layoutParams3 = (FrameLayout.LayoutParams) recyclerListView.getLayoutParams();
                layoutParams3.topMargin = currentActionBarHeight;
                this.searchListView.setLayoutParams(layoutParams3);
            }
            this.adapter.setOverScrollHeight(this.overScrollHeight);
            FrameLayout.LayoutParams layoutParams4 = (FrameLayout.LayoutParams) this.mMapView.getLayoutParams();
            if (layoutParams4 != null) {
                layoutParams4.height = this.overScrollHeight + AndroidUtilities.dp(10.0f);
                BaiduMap baiduMap = this.mBaiduMap;
                if (baiduMap != null) {
                    baiduMap.setPadding(AndroidUtilities.dp(70.0f), 0, AndroidUtilities.dp(70.0f), AndroidUtilities.dp(10.0f));
                }
                this.mMapView.setLayoutParams(layoutParams4);
            }
            this.adapter.notifyDataSetChanged();
            if (z) {
                LinearLayoutManager linearLayoutManager = this.layoutManager;
                int i = this.locationType;
                linearLayoutManager.scrollToPositionWithOffset(0, -AndroidUtilities.dp(32 + ((i == 1 || i == 2) ? 66 : 0)));
                updateClipView(this.layoutManager.findFirstVisibleItemPosition());
                this.listView.post(new Runnable() {
                    @Override
                    public final void run() {
                        LocationActivity.this.lambda$fixLayoutInternal$16$LocationActivity();
                    }
                });
                return;
            }
            updateClipView(this.layoutManager.findFirstVisibleItemPosition());
        }
    }

    public void lambda$fixLayoutInternal$16$LocationActivity() {
        LinearLayoutManager linearLayoutManager = this.layoutManager;
        int i = this.locationType;
        linearLayoutManager.scrollToPositionWithOffset(0, -AndroidUtilities.dp(32 + ((i == 1 || i == 2) ? 66 : 0)));
        updateClipView(this.layoutManager.findFirstVisibleItemPosition());
    }

    private BDLocation getLastLocation() {
        return this.mLocClient.getLastKnownLocation();
    }

    public void positionMarker(BDLocation bDLocation) {
        if (bDLocation == null) {
            return;
        }
        this.myLocation = new BDLocation(bDLocation);
        LiveLocation liveLocation = this.markersMap.get(getUserConfig().getClientUserId());
        LocationController.SharingLocationInfo sharingLocationInfo = getLocationController().getSharingLocationInfo(this.dialogId);
        if (liveLocation != null && sharingLocationInfo != null && liveLocation.object.id == sharingLocationInfo.mid) {
            liveLocation.marker.setPosition(new LatLng(bDLocation.getLatitude(), bDLocation.getLongitude()));
        }
        if (this.messageObject == null && this.chatLocation == null && this.mBaiduMap != null) {
            LatLng latLng = new LatLng(bDLocation.getLatitude(), bDLocation.getLongitude());
            LocationActivityAdapter locationActivityAdapter = this.adapter;
            if (locationActivityAdapter != null) {
                if (locationActivityAdapter.isPulledUp()) {
                    this.adapter.searchPlacesWithQuery(null, this.myLocation, true);
                }
                this.adapter.setGpsLocation(this.myLocation);
            }
            if (this.userLocationMoved) {
                return;
            }
            this.userLocation = new BDLocation(bDLocation);
            if (this.firstWas) {
                MapStatus.Builder builder = new MapStatus.Builder();
                builder.target(latLng).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f);
                this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
                return;
            }
            this.firstWas = true;
            MapStatus.Builder builder2 = new MapStatus.Builder();
            builder2.target(latLng).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f);
            this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder2.build()));
            return;
        }
        this.adapter.setGpsLocation(this.myLocation);
    }

    public void setMessageObject(MessageObject messageObject) {
        this.messageObject = messageObject;
        this.dialogId = messageObject.getDialogId();
    }

    public void setChatLocation(int i, TLRPC.TL_channelLocation tL_channelLocation) {
        this.dialogId = -i;
        this.chatLocation = tL_channelLocation;
    }

    public void setDialogId(long j) {
        this.dialogId = j;
    }

    public void setInitialLocation(TLRPC.TL_channelLocation tL_channelLocation) {
        this.initialLocation = tL_channelLocation;
    }

    private void fetchRecentLocations(ArrayList<TLRPC.Message> arrayList) {
        LatLngBounds.Builder builder = this.firstFocus ? new LatLngBounds.Builder() : null;
        int currentTime = getConnectionsManager().getCurrentTime();
        for (int i = 0; i < arrayList.size(); i++) {
            TLRPC.Message message = arrayList.get(i);
            if (message.date + message.media.period > currentTime) {
                if (builder != null) {
                    builder.include(new LatLng(message.media.geo.lat, message.media.geo._long));
                }
                addUserMarker(message);
            }
        }
        if (builder != null) {
            this.firstFocus = false;
            this.adapter.setLiveLocations(this.markers);
            if (this.messageObject.isLiveLocation()) {
                try {
                    LatLngBounds build = builder.build();
                    if (arrayList.size() > 1) {
                        try {
                            this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newLatLngBounds(build, AndroidUtilities.dp(60.0f), AndroidUtilities.dp(60.0f)));
                        } catch (Exception e) {
                            FileLog.e(e);
                        }
                    }
                } catch (Exception unused) {
                }
            }
        }
    }

    private boolean getRecentLocations() {
        ArrayList<TLRPC.Message> arrayList = getLocationController().locationsCache.get(this.messageObject.getDialogId());
        if (arrayList == null || arrayList.isEmpty()) {
            arrayList = null;
        } else {
            fetchRecentLocations(arrayList);
        }
        int i = (int) this.dialogId;
        if (i < 0) {
            TLRPC.Chat chat = getMessagesController().getChat(Integer.valueOf(-i));
            if (ChatObject.isChannel(chat) && !chat.megagroup) {
                return false;
            }
        }
        TLRPC.TL_messages_getRecentLocations tL_messages_getRecentLocations = new TLRPC.TL_messages_getRecentLocations();
        final long dialogId = this.messageObject.getDialogId();
        tL_messages_getRecentLocations.peer = getMessagesController().getInputPeer((int) dialogId);
        tL_messages_getRecentLocations.limit = 100;
        getConnectionsManager().sendRequest(tL_messages_getRecentLocations, new RequestDelegate() {
            @Override
            public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                LocationActivity.this.lambda$getRecentLocations$18$LocationActivity(dialogId, tLObject, tL_error);
            }
        });
        return arrayList != null;
    }

    public void lambda$getRecentLocations$18$LocationActivity(final long j, final TLObject tLObject, TLRPC.TL_error tL_error) {
        if (tLObject != null) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    LocationActivity.this.lambda$null$17$LocationActivity(tLObject, j);
                }
            });
        }
    }

    public void lambda$null$17$LocationActivity(TLObject tLObject, long j) {
        if (this.mBaiduMap == null) {
            return;
        }
        TLRPC.messages_Messages messages_messages = (TLRPC.messages_Messages) tLObject;
        int i = 0;
        while (i < messages_messages.messages.size()) {
            if (!(messages_messages.messages.get(i).media instanceof TLRPC.TL_messageMediaGeoLive)) {
                messages_messages.messages.remove(i);
                i--;
            }
            i++;
        }
        getMessagesStorage().putUsersAndChats(messages_messages.users, messages_messages.chats, true, true);
        getMessagesController().putUsers(messages_messages.users, false);
        getMessagesController().putChats(messages_messages.chats, false);
        getLocationController().locationsCache.put(j, messages_messages.messages);
        getNotificationCenter().postNotificationName(NotificationCenter.liveLocationsCacheChanged, Long.valueOf(j));
        fetchRecentLocations(messages_messages.messages);
    }

    @Override
    public void didReceivedNotification(int i, int i2, Object... objArr) {
        LocationActivityAdapter locationActivityAdapter;
        LiveLocation liveLocation;
        LocationActivityAdapter locationActivityAdapter2;
        if (i == NotificationCenter.closeChats) {
            removeSelfFromStack();
        } else if (i == NotificationCenter.locationPermissionGranted) {
            BaiduMap baiduMap = this.mBaiduMap;
            if (baiduMap != null) {
                try {
                    baiduMap.setMyLocationEnabled(true);
                } catch (Exception e) {
                    FileLog.e(e);
                }
            }
        } else {
            int i3 = 0;
            if (i == NotificationCenter.didReceiveNewMessages) {
                if (((Boolean) objArr[2]).booleanValue() || ((Long) objArr[0]).longValue() != this.dialogId || this.messageObject == null) {
                    return;
                }
                ArrayList arrayList = (ArrayList) objArr[1];
                boolean z = false;
                while (i3 < arrayList.size()) {
                    MessageObject messageObject = (MessageObject) arrayList.get(i3);
                    if (messageObject.isLiveLocation()) {
                        addUserMarker(messageObject.messageOwner);
                        z = true;
                    }
                    i3++;
                }
                if (!z || (locationActivityAdapter2 = this.adapter) == null) {
                    return;
                }
                locationActivityAdapter2.setLiveLocations(this.markers);
            } else if (i == NotificationCenter.replaceMessagesObjects) {
                long longValue = ((Long) objArr[0]).longValue();
                if (longValue != this.dialogId || this.messageObject == null) {
                    return;
                }
                ArrayList arrayList2 = (ArrayList) objArr[1];
                boolean z2 = false;
                while (i3 < arrayList2.size()) {
                    MessageObject messageObject2 = (MessageObject) arrayList2.get(i3);
                    if (messageObject2.isLiveLocation() && (liveLocation = this.markersMap.get(getMessageId(messageObject2.messageOwner))) != null) {
                        LocationController.SharingLocationInfo sharingLocationInfo = getLocationController().getSharingLocationInfo(longValue);
                        if (sharingLocationInfo == null || sharingLocationInfo.mid != messageObject2.getId()) {
                            liveLocation.marker.setPosition(new LatLng(messageObject2.messageOwner.media.geo.lat, messageObject2.messageOwner.media.geo._long));
                        }
                        z2 = true;
                    }
                    i3++;
                }
                if (!z2 || (locationActivityAdapter = this.adapter) == null) {
                    return;
                }
                locationActivityAdapter.updateLiveLocations();
            }
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        MapView mapView = this.mMapView;
        if (mapView != null && this.mapsInitialized) {
            try {
                mapView.onPause();
            } catch (Exception e) {
                FileLog.e(e);
            }
        }
        this.onResumeCalled = false;
    }

    @Override
    public void onResume() {
        FragmentActivity parentActivity;
        super.onResume();
        AndroidUtilities.requestAdjustResize(getParentActivity(), this.classGuid);
        AndroidUtilities.removeAdjustResize(getParentActivity(), this.classGuid);
        MapView mapView = this.mMapView;
        if (mapView != null && this.mapsInitialized) {
            try {
                mapView.onResume();
            } catch (Throwable th) {
                FileLog.e(th);
            }
        }
        this.onResumeCalled = true;
        BaiduMap baiduMap = this.mBaiduMap;
        if (baiduMap != null) {
            try {
                baiduMap.setMyLocationEnabled(true);
            } catch (Exception e) {
                FileLog.e(e);
            }
        }
        fixLayoutInternal(true);
        if (!this.checkPermission || Build.VERSION.SDK_INT < 23 || (parentActivity = getParentActivity()) == null) {
            return;
        }
        this.checkPermission = false;
        if (parentActivity.checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) {
            parentActivity.requestPermissions(new String[]{"android.permission.ACCESS_COARSE_LOCATION", PermissionUtils.FINE_LOCATION}, 2);
        }
    }

    public void setDelegate(LocationActivityDelegate locationActivityDelegate) {
        this.delegate = locationActivityDelegate;
    }

    public void setChatActivity(ChatActivity chatActivity) {
        this.parentFragment = chatActivity;
    }

    private void updateSearchInterface() {
        LocationActivityAdapter locationActivityAdapter = this.adapter;
        if (locationActivityAdapter != null) {
            locationActivityAdapter.notifyDataSetChanged();
        }
    }

    @Override
    public ThemeDescription[] getThemeDescriptions() {
        $$Lambda$LocationActivity$aA_Fvp34IwzZldFx7iENFJVOwM __lambda_locationactivity_aa_fvp34iwzzldfx7ienfjvowm = new ThemeDescription.ThemeDescriptionDelegate() {
            @Override
            public final void didSetColor() {
                LocationActivity.lambda$getThemeDescriptions$19();
            }
        };
        return new ThemeDescription[]{new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault), new ThemeDescription(this.listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultSearch), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, null, null, null, null, Theme.key_actionBarDefaultSearchPlaceholder), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SUBMENUBACKGROUND, null, null, null, null, Theme.key_actionBarDefaultSubmenuBackground), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM, null, null, null, null, Theme.key_actionBarDefaultSubmenuItem), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM | ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_actionBarDefaultSubmenuItemIcon), new ThemeDescription(this.listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector), new ThemeDescription(this.listView, 0, new Class[]{View.class}, Theme.dividerPaint, null, null, Theme.key_divider), new ThemeDescription(this.emptyView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_emptyListPlaceholder), new ThemeDescription(this.emptyView, ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_progressCircle), new ThemeDescription(this.locationButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_profile_actionIcon), new ThemeDescription(this.locationButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_profile_actionBackground), new ThemeDescription(this.locationButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_profile_actionPressedBackground), new ThemeDescription(this.routeButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionIcon), new ThemeDescription(this.routeButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chats_actionBackground), new ThemeDescription(this.routeButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_chats_actionPressedBackground), new ThemeDescription(this.listView, 0, new Class[]{GraySectionCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_graySectionText), new ThemeDescription(this.listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{GraySectionCell.class}, null, null, null, Theme.key_graySection), new ThemeDescription(null, 0, null, null, new Drawable[]{Theme.avatar_savedDrawable}, __lambda_locationactivity_aa_fvp34iwzzldfx7ienfjvowm, Theme.key_avatar_text), new ThemeDescription(null, 0, null, null, null, __lambda_locationactivity_aa_fvp34iwzzldfx7ienfjvowm, Theme.key_avatar_backgroundRed), new ThemeDescription(null, 0, null, null, null, __lambda_locationactivity_aa_fvp34iwzzldfx7ienfjvowm, Theme.key_avatar_backgroundOrange), new ThemeDescription(null, 0, null, null, null, __lambda_locationactivity_aa_fvp34iwzzldfx7ienfjvowm, Theme.key_avatar_backgroundViolet), new ThemeDescription(null, 0, null, null, null, __lambda_locationactivity_aa_fvp34iwzzldfx7ienfjvowm, Theme.key_avatar_backgroundGreen), new ThemeDescription(null, 0, null, null, null, __lambda_locationactivity_aa_fvp34iwzzldfx7ienfjvowm, Theme.key_avatar_backgroundCyan), new ThemeDescription(null, 0, null, null, null, __lambda_locationactivity_aa_fvp34iwzzldfx7ienfjvowm, Theme.key_avatar_backgroundBlue), new ThemeDescription(null, 0, null, null, null, __lambda_locationactivity_aa_fvp34iwzzldfx7ienfjvowm, Theme.key_avatar_backgroundPink), new ThemeDescription(null, 0, null, null, null, null, Theme.key_location_liveLocationProgress), new ThemeDescription(null, 0, null, null, null, null, Theme.key_location_placeLocationBackground), new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialog_liveLocationProgress), new ThemeDescription(this.listView, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_CHECKTAG, new Class[]{SendLocationCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_location_sendLocationIcon), new ThemeDescription(this.listView, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_CHECKTAG, new Class[]{SendLocationCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_location_sendLiveLocationIcon), new ThemeDescription(this.listView, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_CHECKTAG, new Class[]{SendLocationCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_location_sendLocationBackground), new ThemeDescription(this.listView, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_CHECKTAG, new Class[]{SendLocationCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_location_sendLiveLocationBackground), new ThemeDescription(this.listView, 0, new Class[]{SendLocationCell.class}, new String[]{"accurateTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{SendLocationCell.class}, new String[]{"titleTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteRedText2), new ThemeDescription(this.listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{SendLocationCell.class}, new String[]{"titleTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlueText7), new ThemeDescription(this.listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{LocationCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.listView, 0, new Class[]{LocationCell.class}, new String[]{"nameTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlackText), new ThemeDescription(this.listView, 0, new Class[]{LocationCell.class}, new String[]{"addressTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.searchListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{LocationCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.searchListView, 0, new Class[]{LocationCell.class}, new String[]{"nameTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlackText), new ThemeDescription(this.searchListView, 0, new Class[]{LocationCell.class}, new String[]{"addressTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.listView, 0, new Class[]{LocationLoadingCell.class}, new String[]{"progressBar"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_progressCircle), new ThemeDescription(this.listView, 0, new Class[]{LocationLoadingCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.listView, 0, new Class[]{LocationPoweredCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.listView, 0, new Class[]{LocationPoweredCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.listView, 0, new Class[]{LocationPoweredCell.class}, new String[]{"textView2"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3)};
    }
}