正在查看: Plus 12 v10.13.1.1 应用的 ChatAttachAlertLocationLayout.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Plus 12 v10.13.1.1 应用的 ChatAttachAlertLocationLayout.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package org.telegram.ui.Components;
import android.animation.Animator;
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.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.location.LocationManager;
import android.media.ExifInterface;
import android.media.MediaMetadataRetriever;
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.core.util.Consumer;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScroller;
import androidx.recyclerview.widget.RecyclerView;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildConfig;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.IMapsProvider$CameraPosition;
import org.telegram.messenger.IMapsProvider$ICallableMethod;
import org.telegram.messenger.IMapsProvider$ICameraUpdate;
import org.telegram.messenger.IMapsProvider$IMap;
import org.telegram.messenger.IMapsProvider$IMapView;
import org.telegram.messenger.IMapsProvider$IMarker;
import org.telegram.messenger.IMapsProvider$IMarkerOptions;
import org.telegram.messenger.IMapsProvider$IProjection;
import org.telegram.messenger.IMapsProvider$ITouchInterceptor;
import org.telegram.messenger.IMapsProvider$LatLng;
import org.telegram.messenger.IMapsProvider$OnCameraMoveStartedListener;
import org.telegram.messenger.IMapsProvider$OnMarkerClickListener;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.LocationController;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.MessagesStorage;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.UserObject;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarMenu;
import org.telegram.ui.ActionBar.ActionBarMenuItem;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ActionBar.ThemeDescription;
import org.telegram.ui.Adapters.BaseLocationAdapter;
import org.telegram.ui.Adapters.LocationActivityAdapter;
import org.telegram.ui.Adapters.LocationActivitySearchAdapter;
import org.telegram.ui.Cells.HeaderCell;
import org.telegram.ui.Cells.LocationCell;
import org.telegram.ui.Cells.LocationDirectionCell;
import org.telegram.ui.Cells.LocationLoadingCell;
import org.telegram.ui.Cells.LocationPoweredCell;
import org.telegram.ui.Cells.SendLocationCell;
import org.telegram.ui.Cells.ShadowSectionCell;
import org.telegram.ui.Cells.SharingLiveLocationCell;
import org.telegram.ui.ChatActivity;
import org.telegram.ui.Components.AlertsCreator;
import org.telegram.ui.Components.ChatAttachAlert;
import org.telegram.ui.Components.ChatAttachAlertLocationLayout;
import org.telegram.ui.Components.RecyclerListView;
public class ChatAttachAlertLocationLayout extends ChatAttachAlert.AttachAlertLayout implements NotificationCenter.NotificationCenterDelegate {
public LocationActivityAdapter adapter;
public AnimatorSet animatorSet;
public boolean askedForLocation;
public Paint backgroundPaint;
public Bitmap[] bitmapCache;
public boolean checkBackgroundPermission;
public boolean checkGpsEnabled;
public boolean checkPermission;
public int clipSize;
public boolean currentMapStyleDark;
public LocationActivityDelegate delegate;
public long dialogId;
public boolean doNotDrawMap;
public ImageView emptyImageView;
public TextView emptySubtitleTextView;
public TextView emptyTitleTextView;
public LinearLayout emptyView;
public boolean first;
public boolean firstWas;
public IMapsProvider$ICameraUpdate forceUpdate;
public boolean ignoreIdleCamera;
public boolean ignoreLayout;
public boolean isFirstLocation;
public IMapsProvider$IMarker lastPressedMarker;
public FrameLayout lastPressedMarkerView;
public VenueLocation lastPressedVenue;
public FillLastLinearLayoutManager layoutManager;
public RecyclerListView listView;
public View loadingMapView;
public ImageView locationButton;
public boolean locationDenied;
public int locationType;
public IMapsProvider$IMap map;
public int mapHeight;
public ActionBarMenuItem mapTypeButton;
public IMapsProvider$IMapView mapView;
public FrameLayout mapViewClip;
public boolean mapsInitialized;
public ImageView markerImageView;
public int markerTop;
public Location myLocation;
public int nonClipSize;
public boolean onResumeCalled;
public ActionBarMenuItem otherItem;
public int overScrollHeight;
public MapOverlayView overlayView;
public ArrayList<VenueLocation> placeMarkers;
public boolean scrolling;
public LocationActivitySearchAdapter searchAdapter;
public SearchButton searchAreaButton;
public boolean searchInProgress;
public ActionBarMenuItem searchItem;
public RecyclerListView searchListView;
public boolean searchWas;
public boolean searchedForCustomLocations;
public boolean searching;
public Location userLocation;
public boolean userLocationMoved;
public float yOffset;
public static class LiveLocation {
public IMapsProvider$IMarker marker;
}
public interface LocationActivityDelegate {
void didSelectLocation(TLRPC.MessageMedia location, int live, boolean notify, int scheduleDate);
}
public static class VenueLocation {
public IMapsProvider$IMarker marker;
public int num;
public TLRPC.TL_messageMediaVenue venue;
}
public static boolean lambda$new$4(View view, MotionEvent motionEvent) {
return true;
}
@Override
public int needsActionBar() {
return 1;
}
public static class SearchButton extends TextView {
public float additionanTranslationY;
public float currentTranslationY;
public SearchButton(Context context) {
super(context);
}
@Override
public float getTranslationX() {
return this.additionanTranslationY;
}
@Override
public void setTranslationX(float translationX) {
this.additionanTranslationY = translationX;
updateTranslationY();
}
public void setTranslation(float value) {
this.currentTranslationY = value;
updateTranslationY();
}
public final void updateTranslationY() {
setTranslationY(this.currentTranslationY + this.additionanTranslationY);
}
}
public class MapOverlayView extends FrameLayout {
public HashMap<IMapsProvider$IMarker, View> views;
public MapOverlayView(Context context) {
super(context);
this.views = new HashMap<>();
}
public void addInfoView(IMapsProvider$IMarker marker) {
final VenueLocation venueLocation = (VenueLocation) marker.getTag();
if (ChatAttachAlertLocationLayout.this.lastPressedVenue == venueLocation) {
return;
}
ChatAttachAlertLocationLayout.this.showSearchPlacesButton(false);
if (ChatAttachAlertLocationLayout.this.lastPressedMarker != null) {
removeInfoView(ChatAttachAlertLocationLayout.this.lastPressedMarker);
ChatAttachAlertLocationLayout.this.lastPressedMarker = null;
}
ChatAttachAlertLocationLayout.this.lastPressedVenue = venueLocation;
ChatAttachAlertLocationLayout.this.lastPressedMarker = marker;
Context context = getContext();
FrameLayout frameLayout = new FrameLayout(context);
addView(frameLayout, LayoutHelper.createFrame(-2, 114.0f));
ChatAttachAlertLocationLayout.this.lastPressedMarkerView = new FrameLayout(context);
ChatAttachAlertLocationLayout.this.lastPressedMarkerView.setBackgroundResource(R.drawable.venue_tooltip);
ChatAttachAlertLocationLayout.this.lastPressedMarkerView.getBackground().setColorFilter(new PorterDuffColorFilter(ChatAttachAlertLocationLayout.this.getThemedColor(Theme.key_dialogBackground), PorterDuff.Mode.MULTIPLY));
frameLayout.addView(ChatAttachAlertLocationLayout.this.lastPressedMarkerView, LayoutHelper.createFrame(-2, 71.0f));
ChatAttachAlertLocationLayout.this.lastPressedMarkerView.setAlpha(0.0f);
ChatAttachAlertLocationLayout.this.lastPressedMarkerView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatAttachAlertLocationLayout.MapOverlayView.this.lambda$addInfoView$1(venueLocation, view);
}
});
TextView textView = new TextView(context);
textView.setTextSize(1, 16.0f);
textView.setMaxLines(1);
textView.setEllipsize(TextUtils.TruncateAt.END);
textView.setSingleLine(true);
textView.setTextColor(ChatAttachAlertLocationLayout.this.getThemedColor(Theme.key_windowBackgroundWhiteBlackText));
textView.setTypeface(AndroidUtilities.bold());
textView.setGravity(LocaleController.isRTL ? 5 : 3);
ChatAttachAlertLocationLayout.this.lastPressedMarkerView.addView(textView, LayoutHelper.createFrame(-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(ChatAttachAlertLocationLayout.this.getThemedColor(Theme.key_windowBackgroundWhiteGrayText3));
textView2.setGravity(LocaleController.isRTL ? 5 : 3);
ChatAttachAlertLocationLayout.this.lastPressedMarkerView.addView(textView2, LayoutHelper.createFrame(-2, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, 18.0f, 32.0f, 18.0f, 0.0f));
textView.setText(venueLocation.venue.title);
textView2.setText(LocaleController.getString("TapToSendLocation", R.string.TapToSendLocation));
final FrameLayout frameLayout2 = new FrameLayout(context);
frameLayout2.setBackground(Theme.createCircleDrawable(AndroidUtilities.dp(36.0f), LocationCell.getColorForIndex(venueLocation.num)));
frameLayout.addView(frameLayout2, LayoutHelper.createFrame(36, 36.0f, 81, 0.0f, 0.0f, 0.0f, 4.0f));
BackupImageView backupImageView = new BackupImageView(context);
backupImageView.setImage("https://ss3.4sqi.net/img/categories_v2/" + venueLocation.venue.venue_type + "_64.png", null, null);
frameLayout2.addView(backupImageView, LayoutHelper.createFrame(30, 30, 17));
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public final float[] animatorValues = {0.0f, 1.0f};
public boolean startedInner;
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float interpolation;
float lerp = AndroidUtilities.lerp(this.animatorValues, animation.getAnimatedFraction());
if (lerp >= 0.7f && !this.startedInner && ChatAttachAlertLocationLayout.this.lastPressedMarkerView != null) {
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(ChatAttachAlertLocationLayout.this.lastPressedMarkerView, (Property<FrameLayout, Float>) View.SCALE_X, 0.0f, 1.0f), ObjectAnimator.ofFloat(ChatAttachAlertLocationLayout.this.lastPressedMarkerView, (Property<FrameLayout, Float>) View.SCALE_Y, 0.0f, 1.0f), ObjectAnimator.ofFloat(ChatAttachAlertLocationLayout.this.lastPressedMarkerView, (Property<FrameLayout, Float>) View.ALPHA, 0.0f, 1.0f));
animatorSet.setInterpolator(new OvershootInterpolator(1.02f));
animatorSet.setDuration(250L);
animatorSet.start();
this.startedInner = true;
}
if (lerp <= 0.5f) {
interpolation = CubicBezierInterpolator.EASE_OUT.getInterpolation(lerp / 0.5f) * 1.1f;
} else if (lerp <= 0.75f) {
interpolation = 1.1f - (CubicBezierInterpolator.EASE_OUT.getInterpolation((lerp - 0.5f) / 0.25f) * 0.2f);
} else {
interpolation = (CubicBezierInterpolator.EASE_OUT.getInterpolation((lerp - 0.75f) / 0.25f) * 0.1f) + 0.9f;
}
frameLayout2.setScaleX(interpolation);
frameLayout2.setScaleY(interpolation);
}
});
ofFloat.setDuration(360L);
ofFloat.start();
this.views.put(marker, frameLayout);
ChatAttachAlertLocationLayout.this.map.animateCamera(ApplicationLoader.getMapsProvider().newCameraUpdateLatLng(marker.getPosition()), 300, null);
}
public void lambda$addInfoView$1(final VenueLocation venueLocation, View view) {
ChatActivity chatActivity = ChatAttachAlertLocationLayout.this.parentAlert.baseFragment;
if (chatActivity.isInScheduleMode()) {
AlertsCreator.createScheduleDatePickerDialog(ChatAttachAlertLocationLayout.this.getParentActivity(), chatActivity.getDialogId(), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i) {
ChatAttachAlertLocationLayout.MapOverlayView.this.lambda$addInfoView$0(venueLocation, z, i);
}
}, ChatAttachAlertLocationLayout.this.resourcesProvider);
} else {
ChatAttachAlertLocationLayout.this.delegate.didSelectLocation(venueLocation.venue, ChatAttachAlertLocationLayout.this.locationType, true, 0);
ChatAttachAlertLocationLayout.this.parentAlert.dismiss(true);
}
}
public void lambda$addInfoView$0(VenueLocation venueLocation, boolean z, int i) {
ChatAttachAlertLocationLayout.this.delegate.didSelectLocation(venueLocation.venue, ChatAttachAlertLocationLayout.this.locationType, z, i);
ChatAttachAlertLocationLayout.this.parentAlert.dismiss(true);
}
public void removeInfoView(IMapsProvider$IMarker marker) {
View view = this.views.get(marker);
if (view != null) {
removeView(view);
this.views.remove(marker);
}
}
public void updatePositions() {
if (ChatAttachAlertLocationLayout.this.map == null) {
return;
}
IMapsProvider$IProjection projection = ChatAttachAlertLocationLayout.this.map.getProjection();
for (Map.Entry<IMapsProvider$IMarker, View> entry : this.views.entrySet()) {
IMapsProvider$IMarker key = entry.getKey();
View value = entry.getValue();
android.graphics.Point screenLocation = projection.toScreenLocation(key.getPosition());
value.setTranslationX(screenLocation.x - (value.getMeasuredWidth() / 2));
value.setTranslationY((screenLocation.y - value.getMeasuredHeight()) + AndroidUtilities.dp(22.0f));
}
}
}
public ChatAttachAlertLocationLayout(ChatAttachAlert alert, Context context, final Theme.ResourcesProvider resourcesProvider) {
super(alert, context, resourcesProvider);
this.checkGpsEnabled = true;
this.askedForLocation = false;
this.locationDenied = false;
this.isFirstLocation = true;
this.backgroundPaint = new Paint();
this.placeMarkers = new ArrayList<>();
this.checkPermission = true;
this.checkBackgroundPermission = true;
int currentActionBarHeight = (AndroidUtilities.displaySize.x - ActionBar.getCurrentActionBarHeight()) - AndroidUtilities.dp(66.0f);
this.overScrollHeight = currentActionBarHeight;
this.mapHeight = currentActionBarHeight;
this.first = true;
this.bitmapCache = new Bitmap[7];
AndroidUtilities.fixGoogleMapsBug();
final ChatActivity chatActivity = this.parentAlert.baseFragment;
this.dialogId = chatActivity.getDialogId();
ChatAttachAlert chatAttachAlert = this.parentAlert;
if (chatAttachAlert.isStoryLocationPicker) {
this.locationType = 7;
} else if (chatAttachAlert.isBizLocationPicker) {
this.locationType = 8;
} else if (chatActivity.getCurrentEncryptedChat() == null && !chatActivity.isInScheduleMode() && !UserObject.isUserSelf(chatActivity.getCurrentUser())) {
this.locationType = 1;
} else {
this.locationType = 0;
}
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.locationPermissionGranted);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.locationPermissionDenied);
this.searchWas = false;
this.searching = false;
this.searchInProgress = false;
LocationActivityAdapter locationActivityAdapter = this.adapter;
if (locationActivityAdapter != null) {
locationActivityAdapter.destroy();
}
LocationActivitySearchAdapter locationActivitySearchAdapter = this.searchAdapter;
if (locationActivitySearchAdapter != null) {
locationActivitySearchAdapter.destroy();
}
int i = Build.VERSION.SDK_INT;
this.locationDenied = (i < 23 || getParentActivity() == null || getParentActivity().checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") == 0) ? false : true;
ActionBarMenu createMenu = this.parentAlert.actionBar.createMenu();
this.overlayView = new MapOverlayView(context);
ActionBarMenuItem actionBarMenuItemSearchListener = createMenu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
public void onSearchExpand() {
ChatAttachAlertLocationLayout.this.searching = true;
ChatAttachAlertLocationLayout chatAttachAlertLocationLayout = ChatAttachAlertLocationLayout.this;
chatAttachAlertLocationLayout.parentAlert.makeFocusable(chatAttachAlertLocationLayout.searchItem.getSearchField(), true);
}
public void onSearchCollapse() {
ChatAttachAlertLocationLayout.this.searching = false;
ChatAttachAlertLocationLayout.this.searchWas = false;
ChatAttachAlertLocationLayout.this.searchAdapter.searchDelayed((String) null, (Location) null);
ChatAttachAlertLocationLayout.this.updateEmptyView();
if (ChatAttachAlertLocationLayout.this.otherItem != null) {
ChatAttachAlertLocationLayout.this.otherItem.setVisibility(0);
}
ChatAttachAlertLocationLayout.this.listView.setVisibility(0);
ChatAttachAlertLocationLayout.this.mapViewClip.setVisibility(0);
ChatAttachAlertLocationLayout.this.searchListView.setVisibility(8);
ChatAttachAlertLocationLayout.this.emptyView.setVisibility(8);
}
public void onTextChanged(EditText editText) {
if (ChatAttachAlertLocationLayout.this.searchAdapter == null) {
return;
}
String obj = editText.getText().toString();
if (obj.length() != 0) {
ChatAttachAlertLocationLayout.this.searchWas = true;
ChatAttachAlertLocationLayout.this.searchItem.setShowSearchProgress(true);
if (ChatAttachAlertLocationLayout.this.otherItem != null) {
ChatAttachAlertLocationLayout.this.otherItem.setVisibility(8);
}
ChatAttachAlertLocationLayout.this.listView.setVisibility(8);
ChatAttachAlertLocationLayout.this.mapViewClip.setVisibility(8);
if (ChatAttachAlertLocationLayout.this.searchListView.getAdapter() != ChatAttachAlertLocationLayout.this.searchAdapter) {
ChatAttachAlertLocationLayout.this.searchListView.setAdapter(ChatAttachAlertLocationLayout.this.searchAdapter);
}
ChatAttachAlertLocationLayout.this.searchListView.setVisibility(0);
ChatAttachAlertLocationLayout chatAttachAlertLocationLayout = ChatAttachAlertLocationLayout.this;
chatAttachAlertLocationLayout.searchInProgress = chatAttachAlertLocationLayout.searchAdapter.isEmpty();
ChatAttachAlertLocationLayout.this.updateEmptyView();
} else {
if (ChatAttachAlertLocationLayout.this.otherItem != null) {
ChatAttachAlertLocationLayout.this.otherItem.setVisibility(0);
}
ChatAttachAlertLocationLayout.this.listView.setVisibility(0);
ChatAttachAlertLocationLayout.this.mapViewClip.setVisibility(0);
ChatAttachAlertLocationLayout.this.searchListView.setAdapter(null);
ChatAttachAlertLocationLayout.this.searchListView.setVisibility(8);
ChatAttachAlertLocationLayout.this.emptyView.setVisibility(8);
}
ChatAttachAlertLocationLayout.this.searchAdapter.searchDelayed(obj, ChatAttachAlertLocationLayout.this.userLocation);
}
});
this.searchItem = actionBarMenuItemSearchListener;
actionBarMenuItemSearchListener.setVisibility(((!this.locationDenied || this.parentAlert.isStoryLocationPicker) && !this.parentAlert.isBizLocationPicker) ? 0 : 8);
ActionBarMenuItem actionBarMenuItem = this.searchItem;
int i2 = R.string.Search;
actionBarMenuItem.setSearchFieldHint(LocaleController.getString("Search", i2));
this.searchItem.setContentDescription(LocaleController.getString("Search", i2));
EditTextBoldCursor searchField = this.searchItem.getSearchField();
int i3 = Theme.key_dialogTextBlack;
searchField.setTextColor(getThemedColor(i3));
searchField.setCursorColor(getThemedColor(i3));
searchField.setHintTextColor(getThemedColor(Theme.key_chat_messagePanelHint));
new FrameLayout.LayoutParams(-1, AndroidUtilities.dp(21.0f)).gravity = 83;
FrameLayout frameLayout = new FrameLayout(context) {
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (ChatAttachAlertLocationLayout.this.overlayView != null) {
ChatAttachAlertLocationLayout.this.overlayView.updatePositions();
}
}
@Override
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
canvas.save();
canvas.clipRect(0, 0, getMeasuredWidth(), getMeasuredHeight() - ChatAttachAlertLocationLayout.this.clipSize);
boolean drawChild = ChatAttachAlertLocationLayout.this.doNotDrawMap ? false : super.drawChild(canvas, child, drawingTime);
canvas.restore();
return drawChild;
}
@Override
public void onDraw(Canvas canvas) {
ChatAttachAlertLocationLayout.this.backgroundPaint.setColor(ChatAttachAlertLocationLayout.this.getThemedColor(Theme.key_dialogBackground));
canvas.drawRect(0.0f, 0.0f, getMeasuredWidth(), getMeasuredHeight() - ChatAttachAlertLocationLayout.this.clipSize, ChatAttachAlertLocationLayout.this.backgroundPaint);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (ev.getY() > getMeasuredHeight() - ChatAttachAlertLocationLayout.this.clipSize) {
return false;
}
return super.onInterceptTouchEvent(ev);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (ev.getY() > getMeasuredHeight() - ChatAttachAlertLocationLayout.this.clipSize) {
return false;
}
return super.dispatchTouchEvent(ev);
}
};
this.mapViewClip = frameLayout;
frameLayout.setWillNotDraw(false);
View view = new View(context);
this.loadingMapView = view;
view.setBackgroundDrawable(new MapPlaceholderDrawable());
SearchButton searchButton = new SearchButton(context);
this.searchAreaButton = searchButton;
searchButton.setTranslationX(-AndroidUtilities.dp(80.0f));
this.searchAreaButton.setVisibility(4);
int dp = AndroidUtilities.dp(40.0f);
int i4 = Theme.key_location_actionBackground;
int themedColor = getThemedColor(i4);
int i5 = Theme.key_location_actionPressedBackground;
Drawable createSimpleSelectorRoundRectDrawable = Theme.createSimpleSelectorRoundRectDrawable(dp, themedColor, getThemedColor(i5));
if (i < 21) {
Drawable mutate = context.getResources().getDrawable(R.drawable.places_btn).mutate();
mutate.setColorFilter(new PorterDuffColorFilter(-16777216, PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable = new CombinedDrawable(mutate, createSimpleSelectorRoundRectDrawable, AndroidUtilities.dp(2.0f), AndroidUtilities.dp(2.0f));
combinedDrawable.setFullsize(true);
createSimpleSelectorRoundRectDrawable = combinedDrawable;
} else {
StateListAnimator stateListAnimator = new StateListAnimator();
int[] iArr = {android.R.attr.state_pressed};
SearchButton searchButton2 = this.searchAreaButton;
Property property = View.TRANSLATION_Z;
stateListAnimator.addState(iArr, ObjectAnimator.ofFloat(searchButton2, (Property<SearchButton, Float>) property, AndroidUtilities.dp(2.0f), AndroidUtilities.dp(4.0f)).setDuration(200L));
stateListAnimator.addState(new int[0], ObjectAnimator.ofFloat(this.searchAreaButton, (Property<SearchButton, Float>) property, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(2.0f)).setDuration(200L));
this.searchAreaButton.setStateListAnimator(stateListAnimator);
this.searchAreaButton.setOutlineProvider(new ViewOutlineProvider(this) {
@Override
@SuppressLint({"NewApi"})
public void getOutline(View view2, Outline outline) {
outline.setRoundRect(0, 0, view2.getMeasuredWidth(), view2.getMeasuredHeight(), view2.getMeasuredHeight() / 2);
}
});
}
this.searchAreaButton.setBackgroundDrawable(createSimpleSelectorRoundRectDrawable);
SearchButton searchButton3 = this.searchAreaButton;
int i6 = Theme.key_location_actionActiveIcon;
searchButton3.setTextColor(getThemedColor(i6));
this.searchAreaButton.setTextSize(1, 14.0f);
this.searchAreaButton.setTypeface(AndroidUtilities.bold());
this.searchAreaButton.setText(LocaleController.getString("PlacesInThisArea", R.string.PlacesInThisArea));
this.searchAreaButton.setGravity(17);
this.searchAreaButton.setPadding(AndroidUtilities.dp(20.0f), 0, AndroidUtilities.dp(20.0f), 0);
this.mapViewClip.addView(this.searchAreaButton, LayoutHelper.createFrame(-2, i >= 21 ? 40.0f : 44.0f, 49, 80.0f, 12.0f, 80.0f, 0.0f));
this.searchAreaButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ChatAttachAlertLocationLayout.this.lambda$new$0(view2);
}
});
ActionBarMenuItem actionBarMenuItem2 = new ActionBarMenuItem(context, (ActionBarMenu) null, 0, getThemedColor(Theme.key_location_actionIcon), resourcesProvider);
this.mapTypeButton = actionBarMenuItem2;
actionBarMenuItem2.setClickable(true);
this.mapTypeButton.setSubMenuOpenSide(2);
this.mapTypeButton.setAdditionalXOffset(AndroidUtilities.dp(10.0f));
this.mapTypeButton.setAdditionalYOffset(-AndroidUtilities.dp(10.0f));
this.mapTypeButton.addSubItem(2, R.drawable.msg_map, LocaleController.getString("Map", R.string.Map), resourcesProvider);
this.mapTypeButton.addSubItem(3, R.drawable.msg_satellite, LocaleController.getString("Satellite", R.string.Satellite), resourcesProvider);
this.mapTypeButton.addSubItem(4, R.drawable.msg_hybrid, LocaleController.getString("Hybrid", R.string.Hybrid), resourcesProvider);
this.mapTypeButton.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
Drawable createSimpleSelectorCircleDrawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(40.0f), getThemedColor(i4), getThemedColor(i5));
if (i < 21) {
Drawable mutate2 = context.getResources().getDrawable(R.drawable.floating_shadow_profile).mutate();
mutate2.setColorFilter(new PorterDuffColorFilter(-16777216, PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable2 = new CombinedDrawable(mutate2, createSimpleSelectorCircleDrawable, 0, 0);
combinedDrawable2.setIconSize(AndroidUtilities.dp(40.0f), AndroidUtilities.dp(40.0f));
createSimpleSelectorCircleDrawable = combinedDrawable2;
} else {
StateListAnimator stateListAnimator2 = new StateListAnimator();
int[] iArr2 = {android.R.attr.state_pressed};
ActionBarMenuItem actionBarMenuItem3 = this.mapTypeButton;
Property property2 = View.TRANSLATION_Z;
stateListAnimator2.addState(iArr2, ObjectAnimator.ofFloat(actionBarMenuItem3, (Property<ActionBarMenuItem, Float>) property2, AndroidUtilities.dp(2.0f), AndroidUtilities.dp(4.0f)).setDuration(200L));
stateListAnimator2.addState(new int[0], ObjectAnimator.ofFloat(this.mapTypeButton, (Property<ActionBarMenuItem, Float>) property2, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(2.0f)).setDuration(200L));
this.mapTypeButton.setStateListAnimator(stateListAnimator2);
this.mapTypeButton.setOutlineProvider(new ViewOutlineProvider(this) {
@Override
@SuppressLint({"NewApi"})
public void getOutline(View view2, Outline outline) {
outline.setOval(0, 0, AndroidUtilities.dp(40.0f), AndroidUtilities.dp(40.0f));
}
});
}
this.mapTypeButton.setBackgroundDrawable(createSimpleSelectorCircleDrawable);
this.mapTypeButton.setIcon(R.drawable.msg_map_type);
this.mapViewClip.addView((View) this.mapTypeButton, (ViewGroup.LayoutParams) LayoutHelper.createFrame(i >= 21 ? 40 : 44, i >= 21 ? 40.0f : 44.0f, 53, 0.0f, 12.0f, 12.0f, 0.0f));
this.mapTypeButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ChatAttachAlertLocationLayout.this.lambda$new$1(view2);
}
});
this.mapTypeButton.setDelegate(new ActionBarMenuItem.ActionBarMenuItemDelegate() {
public final void onItemClick(int i7) {
ChatAttachAlertLocationLayout.this.lambda$new$2(i7);
}
});
this.locationButton = new ImageView(context);
Drawable createSimpleSelectorCircleDrawable2 = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(40.0f), getThemedColor(i4), getThemedColor(i5));
if (i < 21) {
Drawable mutate3 = context.getResources().getDrawable(R.drawable.floating_shadow_profile).mutate();
mutate3.setColorFilter(new PorterDuffColorFilter(-16777216, PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable3 = new CombinedDrawable(mutate3, createSimpleSelectorCircleDrawable2, 0, 0);
combinedDrawable3.setIconSize(AndroidUtilities.dp(40.0f), AndroidUtilities.dp(40.0f));
createSimpleSelectorCircleDrawable2 = combinedDrawable3;
} else {
StateListAnimator stateListAnimator3 = new StateListAnimator();
int[] iArr3 = {android.R.attr.state_pressed};
ImageView imageView = this.locationButton;
Property property3 = View.TRANSLATION_Z;
stateListAnimator3.addState(iArr3, ObjectAnimator.ofFloat(imageView, (Property<ImageView, Float>) property3, AndroidUtilities.dp(2.0f), AndroidUtilities.dp(4.0f)).setDuration(200L));
stateListAnimator3.addState(new int[0], ObjectAnimator.ofFloat(this.locationButton, (Property<ImageView, Float>) property3, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(2.0f)).setDuration(200L));
this.locationButton.setStateListAnimator(stateListAnimator3);
this.locationButton.setOutlineProvider(new ViewOutlineProvider(this) {
@Override
@SuppressLint({"NewApi"})
public void getOutline(View view2, Outline outline) {
outline.setOval(0, 0, AndroidUtilities.dp(40.0f), AndroidUtilities.dp(40.0f));
}
});
}
this.locationButton.setBackgroundDrawable(createSimpleSelectorCircleDrawable2);
this.locationButton.setImageResource(R.drawable.msg_current_location);
this.locationButton.setScaleType(ImageView.ScaleType.CENTER);
this.locationButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(i6), PorterDuff.Mode.MULTIPLY));
this.locationButton.setTag(Integer.valueOf(i6));
this.locationButton.setContentDescription(LocaleController.getString("AccDescrMyLocation", R.string.AccDescrMyLocation));
this.mapViewClip.addView(this.locationButton, LayoutHelper.createFrame(i >= 21 ? 40 : 44, i >= 21 ? 40.0f : 44.0f, 85, 0.0f, 0.0f, 12.0f, 12.0f));
this.locationButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ChatAttachAlertLocationLayout.this.lambda$new$3(view2);
}
});
LinearLayout linearLayout = new LinearLayout(context);
this.emptyView = linearLayout;
linearLayout.setOrientation(1);
this.emptyView.setGravity(1);
this.emptyView.setPadding(0, AndroidUtilities.dp(160.0f), 0, 0);
this.emptyView.setVisibility(8);
addView(this.emptyView, LayoutHelper.createFrame(-1, -1.0f));
this.emptyView.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view2, MotionEvent motionEvent) {
boolean lambda$new$4;
lambda$new$4 = ChatAttachAlertLocationLayout.lambda$new$4(view2, motionEvent);
return lambda$new$4;
}
});
ImageView imageView2 = new ImageView(context);
this.emptyImageView = imageView2;
imageView2.setImageResource(R.drawable.location_empty);
this.emptyImageView.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_dialogEmptyImage), PorterDuff.Mode.MULTIPLY));
this.emptyView.addView(this.emptyImageView, LayoutHelper.createLinear(-2, -2));
TextView textView = new TextView(context);
this.emptyTitleTextView = textView;
int i7 = Theme.key_dialogEmptyText;
textView.setTextColor(getThemedColor(i7));
this.emptyTitleTextView.setGravity(17);
this.emptyTitleTextView.setTypeface(AndroidUtilities.bold());
this.emptyTitleTextView.setTextSize(1, 17.0f);
this.emptyTitleTextView.setText(LocaleController.getString("NoPlacesFound", R.string.NoPlacesFound));
this.emptyView.addView(this.emptyTitleTextView, LayoutHelper.createLinear(-2, -2, 17, 0, 11, 0, 0));
TextView textView2 = new TextView(context);
this.emptySubtitleTextView = textView2;
textView2.setTextColor(getThemedColor(i7));
this.emptySubtitleTextView.setGravity(17);
this.emptySubtitleTextView.setTextSize(1, 15.0f);
this.emptySubtitleTextView.setPadding(AndroidUtilities.dp(40.0f), 0, AndroidUtilities.dp(40.0f), 0);
this.emptyView.addView(this.emptySubtitleTextView, LayoutHelper.createLinear(-2, -2, 17, 0, 6, 0, 0));
RecyclerListView recyclerListView = new RecyclerListView(context, resourcesProvider) {
@Override
public void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
ChatAttachAlertLocationLayout.this.updateClipView();
}
};
this.listView = recyclerListView;
recyclerListView.setClipToPadding(false);
RecyclerListView recyclerListView2 = this.listView;
int i8 = this.locationType;
long j = this.dialogId;
ChatAttachAlert chatAttachAlert2 = this.parentAlert;
LocationActivityAdapter locationActivityAdapter2 = new LocationActivityAdapter(context, i8, j, true, resourcesProvider, chatAttachAlert2.isStoryLocationPicker, chatAttachAlert2.isBizLocationPicker);
this.adapter = locationActivityAdapter2;
recyclerListView2.setAdapter(locationActivityAdapter2);
DefaultItemAnimator defaultItemAnimator = new DefaultItemAnimator();
defaultItemAnimator.setDurations(350L);
defaultItemAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
defaultItemAnimator.setDelayAnimations(false);
defaultItemAnimator.setSupportsChangeAnimations(false);
this.listView.setItemAnimator(defaultItemAnimator);
this.adapter.setUpdateRunnable(new Runnable() {
@Override
public final void run() {
ChatAttachAlertLocationLayout.this.updateClipView();
}
});
this.adapter.setMyLocationDenied(this.locationDenied, this.askedForLocation);
this.listView.setVerticalScrollBarEnabled(false);
RecyclerListView recyclerListView3 = this.listView;
FillLastLinearLayoutManager fillLastLinearLayoutManager = new FillLastLinearLayoutManager(context, 1, false, 0, recyclerListView3) {
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) {
LinearSmoothScroller linearSmoothScroller = new LinearSmoothScroller(recyclerView.getContext()) {
public int calculateDyToMakeVisible(View view2, int snapPreference) {
return super.calculateDyToMakeVisible(view2, snapPreference) - (ChatAttachAlertLocationLayout.this.listView.getPaddingTop() - (ChatAttachAlertLocationLayout.this.mapHeight - ChatAttachAlertLocationLayout.this.overScrollHeight));
}
public int calculateTimeForDeceleration(int dx) {
return super.calculateTimeForDeceleration(dx) * 4;
}
};
linearSmoothScroller.setTargetPosition(position);
startSmoothScroll(linearSmoothScroller);
}
};
this.layoutManager = fillLastLinearLayoutManager;
recyclerListView3.setLayoutManager(fillLastLinearLayoutManager);
addView((View) this.listView, LayoutHelper.createFrame(-1, -1, 51));
this.listView.setOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
RecyclerListView.Holder holder;
ChatAttachAlertLocationLayout.this.scrolling = newState != 0;
if (!ChatAttachAlertLocationLayout.this.scrolling && ChatAttachAlertLocationLayout.this.forceUpdate != null) {
ChatAttachAlertLocationLayout.this.forceUpdate = null;
}
if (newState == 0) {
int dp2 = AndroidUtilities.dp(13.0f);
int backgroundPaddingTop = ChatAttachAlertLocationLayout.this.parentAlert.getBackgroundPaddingTop();
if (((ChatAttachAlertLocationLayout.this.parentAlert.scrollOffsetY[0] - backgroundPaddingTop) - dp2) + backgroundPaddingTop >= ActionBar.getCurrentActionBarHeight() || (holder = (RecyclerListView.Holder) ChatAttachAlertLocationLayout.this.listView.findViewHolderForAdapterPosition(0)) == null || ((RecyclerView.ViewHolder) holder).itemView.getTop() <= ChatAttachAlertLocationLayout.this.mapHeight - ChatAttachAlertLocationLayout.this.overScrollHeight) {
return;
}
ChatAttachAlertLocationLayout.this.listView.smoothScrollBy(0, ((RecyclerView.ViewHolder) holder).itemView.getTop() - (ChatAttachAlertLocationLayout.this.mapHeight - ChatAttachAlertLocationLayout.this.overScrollHeight));
}
}
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
ChatAttachAlertLocationLayout.this.updateClipView();
if (ChatAttachAlertLocationLayout.this.forceUpdate != null) {
ChatAttachAlertLocationLayout.this.yOffset += dy;
}
ChatAttachAlertLocationLayout chatAttachAlertLocationLayout = ChatAttachAlertLocationLayout.this;
chatAttachAlertLocationLayout.parentAlert.updateLayout(chatAttachAlertLocationLayout, true, dy);
}
});
this.listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
@Override
public final void onItemClick(View view2, int i9) {
ChatAttachAlertLocationLayout.this.lambda$new$7(chatActivity, resourcesProvider, view2, i9);
}
});
this.adapter.setDelegate(this.dialogId, new BaseLocationAdapter.BaseLocationAdapterDelegate() {
public final void didLoadSearchResult(ArrayList arrayList) {
ChatAttachAlertLocationLayout.this.updatePlacesMarkers(arrayList);
}
});
this.adapter.setOverScrollHeight(this.overScrollHeight);
addView(this.mapViewClip, LayoutHelper.createFrame(-1, -1, 51));
IMapsProvider$IMapView onCreateMapView = ApplicationLoader.getMapsProvider().onCreateMapView(context);
this.mapView = onCreateMapView;
onCreateMapView.setOnDispatchTouchEventInterceptor(new IMapsProvider$ITouchInterceptor() {
@Override
public final boolean onInterceptTouchEvent(MotionEvent motionEvent, IMapsProvider$ICallableMethod iMapsProvider$ICallableMethod) {
boolean lambda$new$8;
lambda$new$8 = ChatAttachAlertLocationLayout.this.lambda$new$8(motionEvent, iMapsProvider$ICallableMethod);
return lambda$new$8;
}
});
this.mapView.setOnInterceptTouchEventInterceptor(new IMapsProvider$ITouchInterceptor() {
@Override
public final boolean onInterceptTouchEvent(MotionEvent motionEvent, IMapsProvider$ICallableMethod iMapsProvider$ICallableMethod) {
boolean lambda$new$9;
lambda$new$9 = ChatAttachAlertLocationLayout.this.lambda$new$9(motionEvent, iMapsProvider$ICallableMethod);
return lambda$new$9;
}
});
final IMapsProvider$IMapView iMapsProvider$IMapView = this.mapView;
new Thread(new Runnable() {
@Override
public final void run() {
ChatAttachAlertLocationLayout.this.lambda$new$14(iMapsProvider$IMapView);
}
}).start();
ImageView imageView3 = new ImageView(context);
this.markerImageView = imageView3;
imageView3.setImageResource(R.drawable.map_pin2);
this.mapViewClip.addView(this.markerImageView, LayoutHelper.createFrame(28, 48, 49));
RecyclerListView recyclerListView4 = new RecyclerListView(context, resourcesProvider);
this.searchListView = recyclerListView4;
recyclerListView4.setVisibility(8);
this.searchListView.setLayoutManager(new LinearLayoutManager(context, 1, false));
ChatAttachAlert chatAttachAlert3 = this.parentAlert;
LocationActivitySearchAdapter locationActivitySearchAdapter2 = new LocationActivitySearchAdapter(context, resourcesProvider, chatAttachAlert3.isStoryLocationPicker, chatAttachAlert3.isBizLocationPicker) {
public void notifyDataSetChanged() {
if (ChatAttachAlertLocationLayout.this.searchItem != null) {
ChatAttachAlertLocationLayout.this.searchItem.setShowSearchProgress(ChatAttachAlertLocationLayout.this.searchAdapter.isSearching());
}
if (ChatAttachAlertLocationLayout.this.emptySubtitleTextView != null) {
ChatAttachAlertLocationLayout.this.emptySubtitleTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("NoPlacesFoundInfo", R.string.NoPlacesFoundInfo, new Object[]{ChatAttachAlertLocationLayout.this.searchAdapter.getLastSearchString()})));
}
super/*androidx.recyclerview.widget.RecyclerView.Adapter*/.notifyDataSetChanged();
}
};
this.searchAdapter = locationActivitySearchAdapter2;
locationActivitySearchAdapter2.setMyLocationDenied(this.locationDenied);
this.searchAdapter.setDelegate(0L, new BaseLocationAdapter.BaseLocationAdapterDelegate() {
public final void didLoadSearchResult(ArrayList arrayList) {
ChatAttachAlertLocationLayout.this.lambda$new$15(arrayList);
}
});
this.searchListView.setItemAnimator((RecyclerView.ItemAnimator) null);
addView((View) this.searchListView, LayoutHelper.createFrame(-1, -1, 51));
this.searchListView.setOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if (newState == 1 && ChatAttachAlertLocationLayout.this.searching && ChatAttachAlertLocationLayout.this.searchWas) {
AndroidUtilities.hideKeyboard(ChatAttachAlertLocationLayout.this.parentAlert.getCurrentFocus());
}
}
});
this.searchListView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
@Override
public final void onItemClick(View view2, int i9) {
ChatAttachAlertLocationLayout.this.lambda$new$17(chatActivity, resourcesProvider, view2, i9);
}
});
updateEmptyView();
}
public void lambda$new$0(View view) {
showSearchPlacesButton(false);
this.adapter.searchPlacesWithQuery((String) null, this.userLocation, true, true);
this.searchedForCustomLocations = true;
showResults();
}
public void lambda$new$1(View view) {
this.mapTypeButton.toggleSubMenu();
}
public void lambda$new$2(int i) {
IMapsProvider$IMap iMapsProvider$IMap = this.map;
if (iMapsProvider$IMap == null) {
return;
}
if (i == 2) {
iMapsProvider$IMap.setMapType(0);
} else if (i == 3) {
iMapsProvider$IMap.setMapType(1);
} else if (i == 4) {
iMapsProvider$IMap.setMapType(2);
}
}
public void lambda$new$3(View view) {
Activity parentActivity;
if (Build.VERSION.SDK_INT >= 23 && (parentActivity = getParentActivity()) != null && parentActivity.checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) {
AlertsCreator.createLocationRequiredDialog(getParentActivity(), true).show();
return;
}
if (this.myLocation != null && this.map != null) {
ImageView imageView = this.locationButton;
int i = Theme.key_location_actionActiveIcon;
imageView.setColorFilter(new PorterDuffColorFilter(getThemedColor(i), PorterDuff.Mode.MULTIPLY));
this.locationButton.setTag(Integer.valueOf(i));
this.adapter.setCustomLocation((Location) null);
this.userLocationMoved = false;
showSearchPlacesButton(false);
this.map.animateCamera(ApplicationLoader.getMapsProvider().newCameraUpdateLatLng(new IMapsProvider$LatLng(this.myLocation.getLatitude(), this.myLocation.getLongitude())));
if (this.searchedForCustomLocations) {
Location location = this.myLocation;
if (location != null && this.locationType != 8) {
this.adapter.searchPlacesWithQuery((String) null, location, true, true);
}
this.searchedForCustomLocations = false;
showResults();
}
}
removeInfoView();
}
public void lambda$new$7(ChatActivity chatActivity, Theme.ResourcesProvider resourcesProvider, View view, int i) {
TLRPC.TL_messageMediaVenue tL_messageMediaVenue;
TLRPC.TL_messageMediaVenue tL_messageMediaVenue2;
int i2 = this.locationType;
if (i2 == 7) {
if (i == 1 && (tL_messageMediaVenue2 = this.adapter.city) != null) {
this.delegate.didSelectLocation(tL_messageMediaVenue2, i2, true, 0);
this.parentAlert.dismiss(true);
return;
} else if (i == 2 && (tL_messageMediaVenue = this.adapter.street) != null) {
this.delegate.didSelectLocation(tL_messageMediaVenue, i2, true, 0);
this.parentAlert.dismiss(true);
return;
}
} else {
if (i == 1) {
if (this.delegate != null && this.userLocation != null) {
FrameLayout frameLayout = this.lastPressedMarkerView;
if (frameLayout != null) {
frameLayout.callOnClick();
return;
}
final TLRPC.TL_messageMediaGeo tL_messageMediaGeo = new TLRPC.TL_messageMediaGeo();
TLRPC.TL_geoPoint tL_geoPoint = new TLRPC.TL_geoPoint();
tL_messageMediaGeo.geo = tL_geoPoint;
tL_geoPoint.lat = AndroidUtilities.fixLocationCoord(this.userLocation.getLatitude());
tL_messageMediaGeo.geo._long = AndroidUtilities.fixLocationCoord(this.userLocation.getLongitude());
if (chatActivity.isInScheduleMode()) {
AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), chatActivity.getDialogId(), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i3) {
ChatAttachAlertLocationLayout.this.lambda$new$5(tL_messageMediaGeo, z, i3);
}
}, resourcesProvider);
return;
} else {
this.delegate.didSelectLocation(tL_messageMediaGeo, this.locationType, true, 0);
this.parentAlert.dismiss(true);
return;
}
}
if (this.locationDenied) {
AlertsCreator.createLocationRequiredDialog(getParentActivity(), true).show();
return;
}
return;
}
if (i == 2 && i2 == 1) {
if (getLocationController().isSharingLocation(this.dialogId)) {
getLocationController().removeSharingLocation(this.dialogId);
this.parentAlert.dismiss(true);
return;
} else if (this.myLocation == null && this.locationDenied) {
AlertsCreator.createLocationRequiredDialog(getParentActivity(), true).show();
return;
} else {
openShareLiveLocation();
return;
}
}
}
final Object item = this.adapter.getItem(i);
if (item instanceof TLRPC.TL_messageMediaVenue) {
if (chatActivity.isInScheduleMode()) {
AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), chatActivity.getDialogId(), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i3) {
ChatAttachAlertLocationLayout.this.lambda$new$6(item, z, i3);
}
}, resourcesProvider);
return;
} else {
this.delegate.didSelectLocation((TLRPC.TL_messageMediaVenue) item, this.locationType, true, 0);
this.parentAlert.dismiss(true);
return;
}
}
if (item instanceof LiveLocation) {
LiveLocation liveLocation = (LiveLocation) item;
this.map.animateCamera(ApplicationLoader.getMapsProvider().newCameraUpdateLatLngZoom(new IMapsProvider$LatLng(liveLocation.marker.getPosition().latitude, liveLocation.marker.getPosition().longitude), this.map.getMaxZoomLevel() - 4.0f));
}
}
public void lambda$new$5(TLRPC.TL_messageMediaGeo tL_messageMediaGeo, boolean z, int i) {
this.delegate.didSelectLocation(tL_messageMediaGeo, this.locationType, z, i);
this.parentAlert.dismiss(true);
}
public void lambda$new$6(Object obj, boolean z, int i) {
this.delegate.didSelectLocation((TLRPC.TL_messageMediaVenue) obj, this.locationType, z, i);
this.parentAlert.dismiss(true);
}
public boolean lambda$new$8(MotionEvent motionEvent, IMapsProvider$ICallableMethod iMapsProvider$ICallableMethod) {
MotionEvent motionEvent2;
if (this.yOffset != 0.0f) {
motionEvent = MotionEvent.obtain(motionEvent);
motionEvent.offsetLocation(0.0f, (-this.yOffset) / 2.0f);
motionEvent2 = motionEvent;
} else {
motionEvent2 = null;
}
boolean booleanValue = ((Boolean) iMapsProvider$ICallableMethod.call(motionEvent)).booleanValue();
if (motionEvent2 != null) {
motionEvent2.recycle();
}
return booleanValue;
}
public boolean lambda$new$9(MotionEvent motionEvent, IMapsProvider$ICallableMethod iMapsProvider$ICallableMethod) {
Location location;
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, (Property<ImageView, Float>) 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();
}
this.yOffset = 0.0f;
AnimatorSet animatorSet4 = new AnimatorSet();
this.animatorSet = animatorSet4;
animatorSet4.setDuration(200L);
this.animatorSet.playTogether(ObjectAnimator.ofFloat(this.markerImageView, (Property<ImageView, Float>) View.TRANSLATION_Y, this.markerTop));
this.animatorSet.start();
}
if (motionEvent.getAction() == 2) {
if (!this.userLocationMoved) {
ImageView imageView = this.locationButton;
int i = Theme.key_location_actionIcon;
imageView.setColorFilter(new PorterDuffColorFilter(getThemedColor(i), PorterDuff.Mode.MULTIPLY));
this.locationButton.setTag(Integer.valueOf(i));
this.userLocationMoved = true;
}
IMapsProvider$IMap iMapsProvider$IMap = this.map;
if (iMapsProvider$IMap != null && (location = this.userLocation) != null) {
location.setLatitude(iMapsProvider$IMap.getCameraPosition().target.latitude);
this.userLocation.setLongitude(this.map.getCameraPosition().target.longitude);
}
this.adapter.setCustomLocation(this.userLocation);
}
return ((Boolean) iMapsProvider$ICallableMethod.call(motionEvent)).booleanValue();
}
public void lambda$new$14(final IMapsProvider$IMapView iMapsProvider$IMapView) {
try {
iMapsProvider$IMapView.onCreate(null);
} catch (Exception unused) {
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatAttachAlertLocationLayout.this.lambda$new$13(iMapsProvider$IMapView);
}
});
}
public void lambda$new$13(IMapsProvider$IMapView iMapsProvider$IMapView) {
if (this.mapView == null || getParentActivity() == null) {
return;
}
try {
iMapsProvider$IMapView.onCreate(null);
ApplicationLoader.getMapsProvider().initializeMaps(ApplicationLoader.applicationContext);
this.mapView.getMapAsync(new Consumer() {
public final void accept(Object obj) {
ChatAttachAlertLocationLayout.this.lambda$new$12((IMapsProvider$IMap) obj);
}
});
this.mapsInitialized = true;
if (this.onResumeCalled) {
this.mapView.onResume();
}
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$new$12(IMapsProvider$IMap iMapsProvider$IMap) {
this.map = iMapsProvider$IMap;
iMapsProvider$IMap.setOnMapLoadedCallback(new Runnable() {
@Override
public final void run() {
ChatAttachAlertLocationLayout.this.lambda$new$11();
}
});
if (isActiveThemeDark()) {
this.currentMapStyleDark = true;
this.map.setMapStyle(ApplicationLoader.getMapsProvider().loadRawResourceStyle(ApplicationLoader.applicationContext, R.raw.mapstyle_night));
}
onMapInit();
}
public void lambda$new$11() {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatAttachAlertLocationLayout.this.lambda$new$10();
}
});
}
public void lambda$new$10() {
this.loadingMapView.setTag(1);
this.loadingMapView.animate().alpha(0.0f).setDuration(180L).start();
}
public void lambda$new$15(ArrayList arrayList) {
this.searchInProgress = false;
updateEmptyView();
}
public void lambda$new$17(ChatActivity chatActivity, Theme.ResourcesProvider resourcesProvider, View view, int i) {
final TLRPC.TL_messageMediaVenue item = this.searchAdapter.getItem(i);
if (item == null || this.delegate == null) {
return;
}
if (chatActivity.isInScheduleMode()) {
AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), chatActivity.getDialogId(), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i2) {
ChatAttachAlertLocationLayout.this.lambda$new$16(item, z, i2);
}
}, resourcesProvider);
} else {
this.delegate.didSelectLocation(item, this.locationType, true, 0);
this.parentAlert.dismiss(true);
}
}
public void lambda$new$16(TLRPC.TL_messageMediaVenue tL_messageMediaVenue, boolean z, int i) {
this.delegate.didSelectLocation(tL_messageMediaVenue, this.locationType, z, i);
this.parentAlert.dismiss(true);
}
@Override
public boolean shouldHideBottomButtons() {
return !this.locationDenied;
}
@Override
public void onPause() {
IMapsProvider$IMapView iMapsProvider$IMapView = this.mapView;
if (iMapsProvider$IMapView != null && this.mapsInitialized) {
try {
iMapsProvider$IMapView.onPause();
} catch (Exception e) {
FileLog.e(e);
}
}
this.onResumeCalled = false;
}
@Override
public void onDestroy() {
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.locationPermissionGranted);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.locationPermissionDenied);
this.doNotDrawMap = true;
FrameLayout frameLayout = this.mapViewClip;
if (frameLayout != null) {
frameLayout.invalidate();
}
try {
IMapsProvider$IMap iMapsProvider$IMap = this.map;
if (iMapsProvider$IMap != null) {
iMapsProvider$IMap.setMyLocationEnabled(false);
}
} catch (Exception e) {
FileLog.e(e);
}
IMapsProvider$IMapView iMapsProvider$IMapView = this.mapView;
if (iMapsProvider$IMapView != null) {
iMapsProvider$IMapView.getView().setTranslationY((-AndroidUtilities.displaySize.y) * 3);
}
try {
IMapsProvider$IMapView iMapsProvider$IMapView2 = this.mapView;
if (iMapsProvider$IMapView2 != null) {
iMapsProvider$IMapView2.onPause();
}
} catch (Exception unused) {
}
try {
IMapsProvider$IMapView iMapsProvider$IMapView3 = this.mapView;
if (iMapsProvider$IMapView3 != null) {
iMapsProvider$IMapView3.onDestroy();
this.mapView = null;
}
} catch (Exception unused2) {
}
LocationActivityAdapter locationActivityAdapter = this.adapter;
if (locationActivityAdapter != null) {
locationActivityAdapter.destroy();
}
LocationActivitySearchAdapter locationActivitySearchAdapter = this.searchAdapter;
if (locationActivitySearchAdapter != null) {
locationActivitySearchAdapter.destroy();
}
this.parentAlert.actionBar.closeSearchField();
this.parentAlert.actionBar.createMenu().removeView(this.searchItem);
}
@Override
public void onHide() {
this.searchItem.setVisibility(8);
}
@Override
public boolean onDismiss() {
onDestroy();
return false;
}
@Override
public int getCurrentItemTop() {
if (this.listView.getChildCount() <= 0) {
return Integer.MAX_VALUE;
}
RecyclerListView.Holder holder = (RecyclerListView.Holder) this.listView.findViewHolderForAdapterPosition(0);
return (holder != null ? Math.max(((int) ((RecyclerView.ViewHolder) holder).itemView.getY()) - this.nonClipSize, 0) : 0) + AndroidUtilities.dp(56.0f);
}
@Override
public void setTranslationY(float translationY) {
super.setTranslationY(translationY);
this.parentAlert.getSheetContainer().invalidate();
updateClipView();
}
@Override
public int getListTopPadding() {
return this.listView.getPaddingTop();
}
@Override
public int getFirstOffset() {
return getListTopPadding() + AndroidUtilities.dp(56.0f);
}
@Override
public void onPreMeasure(int r4, int r5) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Components.ChatAttachAlertLocationLayout.onPreMeasure(int, int):void");
}
@Override
public void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (changed) {
fixLayoutInternal(this.first);
this.first = false;
}
}
@Override
public int getButtonsHideOffset() {
return AndroidUtilities.dp(56.0f);
}
@Override
public void requestLayout() {
if (this.ignoreLayout) {
return;
}
super.requestLayout();
}
@Override
public void scrollToTop() {
this.listView.smoothScrollToPosition(0);
}
public final boolean isActiveThemeDark() {
return Theme.getActiveTheme().isDark() || AndroidUtilities.computePerceivedBrightness(getThemedColor(Theme.key_windowBackgroundWhite)) < 0.721f;
}
public final void updateEmptyView() {
if (this.searching) {
if (this.searchInProgress) {
this.searchListView.setEmptyView(null);
this.emptyView.setVisibility(8);
return;
} else {
this.searchListView.setEmptyView(this.emptyView);
return;
}
}
this.emptyView.setVisibility(8);
}
public final void showSearchPlacesButton(boolean show) {
SearchButton searchButton;
Location location;
Location location2;
if (this.locationDenied) {
show = false;
}
if (show && (searchButton = this.searchAreaButton) != null && searchButton.getTag() == null && ((location = this.myLocation) == null || (location2 = this.userLocation) == null || location2.distanceTo(location) < 300.0f)) {
show = false;
}
if (this.locationType == 8) {
show = false;
}
SearchButton searchButton2 = this.searchAreaButton;
if (searchButton2 != null) {
if (!show || searchButton2.getTag() == null) {
if (show || this.searchAreaButton.getTag() != null) {
this.searchAreaButton.setVisibility(show ? 0 : 4);
this.searchAreaButton.setTag(show ? 1 : null);
AnimatorSet animatorSet = new AnimatorSet();
Animator[] animatorArr = new Animator[1];
SearchButton searchButton3 = this.searchAreaButton;
Property property = View.TRANSLATION_X;
float[] fArr = new float[1];
fArr[0] = show ? 0.0f : -AndroidUtilities.dp(80.0f);
animatorArr[0] = ObjectAnimator.ofFloat(searchButton3, (Property<SearchButton, Float>) property, fArr);
animatorSet.playTogether(animatorArr);
animatorSet.setDuration(180L);
animatorSet.setInterpolator(CubicBezierInterpolator.EASE_OUT);
animatorSet.start();
}
}
}
}
public void openShareLiveLocation() {
Activity parentActivity;
if (this.delegate == null || getParentActivity() == null || this.myLocation == null) {
return;
}
if (this.checkBackgroundPermission && Build.VERSION.SDK_INT >= 29 && (parentActivity = getParentActivity()) != null) {
this.checkBackgroundPermission = false;
SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
if (Math.abs((System.currentTimeMillis() / 1000) - globalMainSettings.getInt("backgroundloc", 0)) > 86400 && parentActivity.checkSelfPermission("android.permission.ACCESS_BACKGROUND_LOCATION") != 0) {
globalMainSettings.edit().putInt("backgroundloc", (int) (System.currentTimeMillis() / 1000)).commit();
AlertsCreator.createBackgroundLocationPermissionDialog(parentActivity, getMessagesController().getUser(Long.valueOf(getUserConfig().getClientUserId())), new Runnable() {
@Override
public final void run() {
ChatAttachAlertLocationLayout.this.openShareLiveLocation();
}
}, this.resourcesProvider).show();
return;
}
}
AlertsCreator.createLocationUpdateDialog(getParentActivity(), false, DialogObject.isUserDialog(this.dialogId) ? this.parentAlert.baseFragment.getMessagesController().getUser(Long.valueOf(this.dialogId)) : null, new MessagesStorage.IntCallback() {
@Override
public final void run(int i) {
ChatAttachAlertLocationLayout.this.lambda$openShareLiveLocation$18(i);
}
}, this.resourcesProvider).show();
}
public void lambda$openShareLiveLocation$18(int i) {
TLRPC.TL_messageMediaGeoLive tL_messageMediaGeoLive = new TLRPC.TL_messageMediaGeoLive();
TLRPC.TL_geoPoint tL_geoPoint = new TLRPC.TL_geoPoint();
tL_messageMediaGeoLive.geo = tL_geoPoint;
tL_geoPoint.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);
this.parentAlert.dismiss(true);
}
public final Bitmap createPlaceBitmap(int num) {
Bitmap[] bitmapArr = this.bitmapCache;
int i = num % 7;
if (bitmapArr[i] != null) {
return bitmapArr[i];
}
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(LocationCell.getColorForIndex(num));
canvas.drawCircle(AndroidUtilities.dp(6.0f), AndroidUtilities.dp(6.0f), AndroidUtilities.dp(5.0f), paint);
canvas.setBitmap(null);
this.bitmapCache[num % 7] = createBitmap;
return createBitmap;
} catch (Throwable th) {
FileLog.e(th);
return null;
}
}
public final void updatePlacesMarkers(ArrayList<TLRPC.TL_messageMediaVenue> places) {
if (places == null) {
return;
}
int size = this.placeMarkers.size();
for (int i = 0; i < size; i++) {
this.placeMarkers.get(i).marker.remove();
}
this.placeMarkers.clear();
int size2 = places.size();
for (int i2 = 0; i2 < size2; i2++) {
TLRPC.TL_messageMediaVenue tL_messageMediaVenue = places.get(i2);
try {
IMapsProvider$IMarkerOptions onCreateMarkerOptions = ApplicationLoader.getMapsProvider().onCreateMarkerOptions();
TLRPC.GeoPoint geoPoint = tL_messageMediaVenue.geo;
IMapsProvider$IMarkerOptions position = onCreateMarkerOptions.position(new IMapsProvider$LatLng(geoPoint.lat, geoPoint._long));
position.icon(createPlaceBitmap(i2));
position.anchor(0.5f, 0.5f);
position.title(tL_messageMediaVenue.title);
position.snippet(tL_messageMediaVenue.address);
VenueLocation venueLocation = new VenueLocation();
venueLocation.num = i2;
IMapsProvider$IMarker addMarker = this.map.addMarker(position);
venueLocation.marker = addMarker;
venueLocation.venue = tL_messageMediaVenue;
addMarker.setTag(venueLocation);
this.placeMarkers.add(venueLocation);
} catch (Exception e) {
FileLog.e(e);
}
}
}
private MessagesController getMessagesController() {
return this.parentAlert.baseFragment.getMessagesController();
}
private LocationController getLocationController() {
return this.parentAlert.baseFragment.getLocationController();
}
private UserConfig getUserConfig() {
return this.parentAlert.baseFragment.getUserConfig();
}
public Activity getParentActivity() {
BaseFragment baseFragment;
ChatAttachAlert chatAttachAlert = this.parentAlert;
if (chatAttachAlert == null || (baseFragment = chatAttachAlert.baseFragment) == null) {
return null;
}
return baseFragment.getParentActivity();
}
public final void onMapInit() {
PackageManager packageManager;
if (this.map == null) {
return;
}
Location location = new Location("network");
this.userLocation = location;
location.setLatitude(20.659322d);
this.userLocation.setLongitude(-11.40625d);
try {
this.map.setMyLocationEnabled(true);
} catch (Exception e) {
FileLog.e(e);
}
this.map.getUiSettings().setMyLocationButtonEnabled(false);
this.map.getUiSettings().setZoomControlsEnabled(false);
this.map.getUiSettings().setCompassEnabled(false);
this.map.setOnCameraMoveStartedListener(new IMapsProvider$OnCameraMoveStartedListener() {
@Override
public final void onCameraMoveStarted(int i) {
ChatAttachAlertLocationLayout.this.lambda$onMapInit$19(i);
}
});
this.map.setOnCameraIdleListener(new Runnable() {
@Override
public final void run() {
ChatAttachAlertLocationLayout.this.lambda$onMapInit$20();
}
});
this.map.setOnMyLocationChangeListener(new Consumer() {
public final void accept(Object obj) {
ChatAttachAlertLocationLayout.this.lambda$onMapInit$21((Location) obj);
}
});
this.map.setOnMarkerClickListener(new IMapsProvider$OnMarkerClickListener() {
@Override
public final boolean onClick(IMapsProvider$IMarker iMapsProvider$IMarker) {
boolean lambda$onMapInit$22;
lambda$onMapInit$22 = ChatAttachAlertLocationLayout.this.lambda$onMapInit$22(iMapsProvider$IMarker);
return lambda$onMapInit$22;
}
});
this.map.setOnCameraMoveListener(new Runnable() {
@Override
public final void run() {
ChatAttachAlertLocationLayout.this.lambda$onMapInit$23();
}
});
positionMarker();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatAttachAlertLocationLayout.this.lambda$onMapInit$24();
}
}, 200L);
if (this.checkGpsEnabled && getParentActivity() != null) {
this.checkGpsEnabled = false;
Activity parentActivity = getParentActivity();
if (parentActivity != null && (packageManager = parentActivity.getPackageManager()) != null && !packageManager.hasSystemFeature("android.hardware.location.gps")) {
return;
}
try {
if (!((LocationManager) ApplicationLoader.applicationContext.getSystemService("location")).isProviderEnabled("gps")) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity(), this.resourcesProvider);
builder.setTopAnimation(R.raw.permission_request_location, 72, false, Theme.getColor(Theme.key_dialogTopBackground, this.resourcesProvider));
builder.setMessage(LocaleController.getString("GpsDisabledAlertText", R.string.GpsDisabledAlertText));
builder.setPositiveButton(LocaleController.getString("ConnectingToProxyEnable", R.string.ConnectingToProxyEnable), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatAttachAlertLocationLayout.this.lambda$onMapInit$25(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), (DialogInterface.OnClickListener) null);
builder.show();
}
} catch (Exception e2) {
FileLog.e(e2);
}
}
updateClipView();
}
public void lambda$onMapInit$19(int i) {
View childAt;
RecyclerView.ViewHolder findContainingViewHolder;
if (i == 1) {
showSearchPlacesButton(true);
removeInfoView();
if (this.scrolling || this.listView.getChildCount() <= 0 || (childAt = this.listView.getChildAt(0)) == null || (findContainingViewHolder = this.listView.findContainingViewHolder(childAt)) == null || findContainingViewHolder.getAdapterPosition() != 0) {
return;
}
int dp = this.locationType == 0 ? 0 : AndroidUtilities.dp(66.0f);
int top = childAt.getTop();
if (top < (-dp)) {
IMapsProvider$CameraPosition cameraPosition = this.map.getCameraPosition();
this.forceUpdate = ApplicationLoader.getMapsProvider().newCameraUpdateLatLngZoom(cameraPosition.target, cameraPosition.zoom);
this.listView.smoothScrollBy(0, top + dp);
}
}
}
public void lambda$onMapInit$20() {
Location location;
if (this.ignoreIdleCamera) {
this.ignoreIdleCamera = false;
return;
}
IMapsProvider$IMap iMapsProvider$IMap = this.map;
if (iMapsProvider$IMap != null && (location = this.userLocation) != null) {
location.setLatitude(iMapsProvider$IMap.getCameraPosition().target.latitude);
this.userLocation.setLongitude(this.map.getCameraPosition().target.longitude);
}
this.adapter.setCustomLocation(this.userLocation);
this.adapter.fetchLocationAddress();
}
public void lambda$onMapInit$21(Location location) {
int i;
ChatAttachAlert chatAttachAlert = this.parentAlert;
if (chatAttachAlert == null || chatAttachAlert.baseFragment == null) {
return;
}
positionMarker(location);
LocationActivityAdapter locationActivityAdapter = this.adapter;
if (locationActivityAdapter != null && (((i = this.locationType) == 7 || i == 8) && !this.userLocationMoved)) {
locationActivityAdapter.setCustomLocation(this.userLocation);
}
getLocationController().setMapLocation(location, this.isFirstLocation);
this.isFirstLocation = false;
}
public boolean lambda$onMapInit$22(IMapsProvider$IMarker iMapsProvider$IMarker) {
if (!(iMapsProvider$IMarker.getTag() instanceof VenueLocation)) {
return true;
}
this.markerImageView.setVisibility(4);
if (!this.userLocationMoved) {
ImageView imageView = this.locationButton;
int i = Theme.key_location_actionIcon;
imageView.setColorFilter(new PorterDuffColorFilter(getThemedColor(i), PorterDuff.Mode.MULTIPLY));
this.locationButton.setTag(Integer.valueOf(i));
this.userLocationMoved = true;
}
this.overlayView.addInfoView(iMapsProvider$IMarker);
return true;
}
public void lambda$onMapInit$23() {
MapOverlayView mapOverlayView = this.overlayView;
if (mapOverlayView != null) {
mapOverlayView.updatePositions();
}
}
public void lambda$onMapInit$24() {
if (this.loadingMapView.getTag() == null) {
this.loadingMapView.animate().alpha(0.0f).setDuration(180L).start();
}
}
public void lambda$onMapInit$25(DialogInterface dialogInterface, int i) {
if (getParentActivity() == null) {
return;
}
try {
getParentActivity().startActivity(new Intent("android.settings.LOCATION_SOURCE_SETTINGS"));
} catch (Exception unused) {
}
}
public final void lambda$positionMarker$27(double lat, double _long) {
IMapsProvider$ICameraUpdate newCameraUpdateLatLngZoom;
if (this.map == null) {
return;
}
if (lat != 0.0d && _long != 0.0d) {
Location location = new Location(BuildConfig.APP_CENTER_HASH);
this.userLocation = location;
location.reset();
this.userLocation.setLatitude(lat);
this.userLocation.setLongitude(_long);
} else {
Location location2 = new Location(BuildConfig.APP_CENTER_HASH);
this.myLocation = location2;
location2.reset();
this.myLocation.setLatitude(lat);
this.myLocation.setLongitude(_long);
}
IMapsProvider$LatLng iMapsProvider$LatLng = new IMapsProvider$LatLng(lat, _long);
if (lat != 0.0d && _long != 0.0d) {
newCameraUpdateLatLngZoom = ApplicationLoader.getMapsProvider().newCameraUpdateLatLngZoom(iMapsProvider$LatLng, this.map.getMaxZoomLevel() - 4.0f);
} else {
newCameraUpdateLatLngZoom = ApplicationLoader.getMapsProvider().newCameraUpdateLatLngZoom(iMapsProvider$LatLng, this.map.getMinZoomLevel());
}
this.forceUpdate = newCameraUpdateLatLngZoom;
this.map.moveCamera(newCameraUpdateLatLngZoom);
if (lat != 0.0d && _long != 0.0d) {
this.adapter.setCustomLocation(this.userLocation);
} else {
this.adapter.setGpsLocation(this.myLocation);
}
this.adapter.fetchLocationAddress();
this.listView.smoothScrollBy(0, 1);
this.ignoreIdleCamera = true;
if (lat == 0.0d || _long == 0.0d) {
return;
}
this.userLocationMoved = true;
showSearchPlacesButton(false);
if (this.locationType != 8) {
this.adapter.searchPlacesWithQuery((String) null, this.userLocation, true, true);
}
this.searchedForCustomLocations = true;
showResults();
}
public final void removeInfoView() {
if (this.lastPressedMarker != null) {
this.markerImageView.setVisibility(0);
this.overlayView.removeInfoView(this.lastPressedMarker);
this.lastPressedMarker = null;
this.lastPressedVenue = null;
this.lastPressedMarkerView = null;
}
}
public final void showResults() {
if (this.adapter.getItemCount() != 0 && this.layoutManager.findFirstVisibleItemPosition() == 0) {
int dp = AndroidUtilities.dp(258.0f) + this.listView.getChildAt(0).getTop();
if (dp < 0 || dp > AndroidUtilities.dp(258.0f)) {
return;
}
this.listView.smoothScrollBy(0, dp);
}
}
public final void updateClipView() {
int i;
int i2;
IMapsProvider$LatLng iMapsProvider$LatLng;
Location location;
IMapsProvider$IMap iMapsProvider$IMap;
if (this.mapView == null || this.mapViewClip == null) {
return;
}
RecyclerView.ViewHolder findViewHolderForAdapterPosition = this.listView.findViewHolderForAdapterPosition(0);
if (findViewHolderForAdapterPosition != null) {
i = (int) findViewHolderForAdapterPosition.itemView.getY();
i2 = this.overScrollHeight + Math.min(i, 0);
} else {
i = -this.mapViewClip.getMeasuredHeight();
i2 = 0;
}
if (((FrameLayout.LayoutParams) this.mapViewClip.getLayoutParams()) != null) {
if (i2 <= 0) {
if (this.mapView.getView().getVisibility() == 0) {
this.mapView.getView().setVisibility(4);
this.mapViewClip.setVisibility(4);
MapOverlayView mapOverlayView = this.overlayView;
if (mapOverlayView != null) {
mapOverlayView.setVisibility(4);
}
}
this.mapView.getView().setTranslationY(i);
return;
}
if (this.mapView.getView().getVisibility() == 4) {
this.mapView.getView().setVisibility(0);
this.mapViewClip.setVisibility(0);
MapOverlayView mapOverlayView2 = this.overlayView;
if (mapOverlayView2 != null) {
mapOverlayView2.setVisibility(0);
}
}
int max = Math.max(0, (-((i - this.mapHeight) + this.overScrollHeight)) / 2);
int i3 = this.mapHeight - this.overScrollHeight;
float max2 = 1.0f - Math.max(0.0f, Math.min(1.0f, (this.listView.getPaddingTop() - i) / (this.listView.getPaddingTop() - i3)));
int i4 = this.clipSize;
if (this.locationDenied && isTypeSend()) {
i3 += Math.min(i, this.listView.getPaddingTop());
}
this.clipSize = (int) (i3 * max2);
float f = max;
this.mapView.getView().setTranslationY(f);
this.nonClipSize = i3 - this.clipSize;
this.mapViewClip.invalidate();
this.mapViewClip.setTranslationY(i - this.nonClipSize);
IMapsProvider$IMap iMapsProvider$IMap2 = this.map;
if (iMapsProvider$IMap2 != null) {
iMapsProvider$IMap2.setPadding(0, AndroidUtilities.dp(6.0f), 0, this.clipSize + AndroidUtilities.dp(6.0f));
}
MapOverlayView mapOverlayView3 = this.overlayView;
if (mapOverlayView3 != null) {
mapOverlayView3.setTranslationY(f);
}
float min = Math.min(Math.max(this.nonClipSize - i, 0), (this.mapHeight - this.mapTypeButton.getMeasuredHeight()) - AndroidUtilities.dp(80.0f));
this.mapTypeButton.setTranslationY(min);
this.searchAreaButton.setTranslation(min);
this.locationButton.setTranslationY(-this.clipSize);
ImageView imageView = this.markerImageView;
int dp = (((this.mapHeight - this.clipSize) / 2) - AndroidUtilities.dp(48.0f)) + max;
this.markerTop = dp;
imageView.setTranslationY(dp);
if (i4 != this.clipSize) {
IMapsProvider$IMarker iMapsProvider$IMarker = this.lastPressedMarker;
if (iMapsProvider$IMarker != null) {
iMapsProvider$LatLng = new IMapsProvider$LatLng(iMapsProvider$IMarker.getPosition().latitude, this.lastPressedMarker.getPosition().longitude);
} else if (this.userLocationMoved && (location = this.userLocation) != null) {
iMapsProvider$LatLng = new IMapsProvider$LatLng(location.getLatitude(), this.userLocation.getLongitude());
} else {
Location location2 = this.myLocation;
iMapsProvider$LatLng = location2 != null ? new IMapsProvider$LatLng(location2.getLatitude(), this.myLocation.getLongitude()) : null;
}
if (iMapsProvider$LatLng != null && (iMapsProvider$IMap = this.map) != null) {
iMapsProvider$IMap.moveCamera(ApplicationLoader.getMapsProvider().newCameraUpdateLatLng(iMapsProvider$LatLng));
}
}
if (this.locationDenied && isTypeSend()) {
int itemCount = this.adapter.getItemCount();
for (int i5 = 1; i5 < itemCount; i5++) {
RecyclerView.ViewHolder findViewHolderForAdapterPosition2 = this.listView.findViewHolderForAdapterPosition(i5);
if (findViewHolderForAdapterPosition2 != null) {
findViewHolderForAdapterPosition2.itemView.setTranslationY(this.listView.getPaddingTop() - i);
}
}
}
}
}
public final boolean isTypeSend() {
int i = this.locationType;
return i == 0 || i == 1;
}
public final int buttonsHeight() {
int dp = AndroidUtilities.dp(66.0f);
int i = this.locationType;
return (i == 1 || i == 7 || i == 8) ? dp + AndroidUtilities.dp(66.0f) : dp;
}
public final void fixLayoutInternal(final boolean resume) {
FrameLayout.LayoutParams layoutParams;
if (getMeasuredHeight() == 0 || this.mapView == null) {
return;
}
int currentActionBarHeight = ActionBar.getCurrentActionBarHeight();
int buttonsHeight = ((AndroidUtilities.displaySize.y - currentActionBarHeight) - buttonsHeight()) - AndroidUtilities.dp(90.0f);
int dp = AndroidUtilities.dp(189.0f);
this.overScrollHeight = dp;
if (!this.locationDenied || !isTypeSend()) {
buttonsHeight = Math.min(AndroidUtilities.dp(310.0f), buttonsHeight);
}
this.mapHeight = Math.max(dp, buttonsHeight);
if (this.locationDenied && isTypeSend()) {
this.overScrollHeight = this.mapHeight;
}
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) this.listView.getLayoutParams();
layoutParams2.topMargin = currentActionBarHeight;
this.listView.setLayoutParams(layoutParams2);
FrameLayout.LayoutParams layoutParams3 = (FrameLayout.LayoutParams) this.mapViewClip.getLayoutParams();
layoutParams3.topMargin = currentActionBarHeight;
layoutParams3.height = this.mapHeight;
this.mapViewClip.setLayoutParams(layoutParams3);
FrameLayout.LayoutParams layoutParams4 = (FrameLayout.LayoutParams) this.searchListView.getLayoutParams();
layoutParams4.topMargin = currentActionBarHeight;
this.searchListView.setLayoutParams(layoutParams4);
this.adapter.setOverScrollHeight((this.locationDenied && isTypeSend()) ? this.overScrollHeight - this.listView.getPaddingTop() : this.overScrollHeight);
FrameLayout.LayoutParams layoutParams5 = (FrameLayout.LayoutParams) this.mapView.getView().getLayoutParams();
if (layoutParams5 != null) {
layoutParams5.height = this.mapHeight + AndroidUtilities.dp(10.0f);
this.mapView.getView().setLayoutParams(layoutParams5);
}
MapOverlayView mapOverlayView = this.overlayView;
if (mapOverlayView != null && (layoutParams = (FrameLayout.LayoutParams) mapOverlayView.getLayoutParams()) != null) {
layoutParams.height = this.mapHeight + AndroidUtilities.dp(10.0f);
this.overlayView.setLayoutParams(layoutParams);
}
this.adapter.notifyDataSetChanged();
updateClipView();
}
@SuppressLint({"MissingPermission"})
private Location getLastLocation() {
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;
}
public final void positionMarker() {
ChatAttachAlert chatAttachAlert = this.parentAlert;
if (chatAttachAlert.isStoryLocationPicker) {
if (chatAttachAlert.storyLocationPickerLatLong != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatAttachAlertLocationLayout.this.lambda$positionMarker$26();
}
});
return;
}
if (!this.locationDenied) {
File file = chatAttachAlert.storyLocationPickerPhotoFile;
boolean z = chatAttachAlert.storyLocationPickerFileIsVideo;
boolean z2 = true;
if (file != null) {
try {
if (z) {
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
mediaMetadataRetriever.setDataSource(file.getAbsolutePath());
String extractMetadata = mediaMetadataRetriever.extractMetadata(23);
if (extractMetadata != null) {
Matcher matcher = Pattern.compile("([+\\-][0-9.]+)([+\\-][0-9.]+)").matcher(extractMetadata);
if (matcher.find() && matcher.groupCount() == 2) {
String group = matcher.group(1);
String group2 = matcher.group(2);
final double parseDouble = Double.parseDouble(group);
final double parseDouble2 = Double.parseDouble(group2);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatAttachAlertLocationLayout.this.lambda$positionMarker$27(parseDouble, parseDouble2);
}
});
}
}
} else {
ExifInterface exifInterface = new ExifInterface(file.getAbsolutePath());
final float[] fArr = new float[2];
if (exifInterface.getLatLong(fArr)) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatAttachAlertLocationLayout.this.lambda$positionMarker$28(fArr);
}
});
}
}
z2 = false;
} catch (NumberFormatException | Exception unused) {
}
}
if (z2) {
Location lastLocation = getLastLocation();
this.myLocation = lastLocation;
positionMarker(lastLocation);
return;
}
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatAttachAlertLocationLayout.this.lambda$positionMarker$29();
}
});
return;
}
Location lastLocation2 = getLastLocation();
this.myLocation = lastLocation2;
positionMarker(lastLocation2);
}
public void lambda$positionMarker$26() {
double[] dArr = this.parentAlert.storyLocationPickerLatLong;
lambda$positionMarker$27(dArr[0], dArr[1]);
}
public void lambda$positionMarker$28(float[] fArr) {
lambda$positionMarker$27(fArr[0], fArr[1]);
}
public void lambda$positionMarker$29() {
lambda$positionMarker$27(0.0d, 0.0d);
}
public final void positionMarker(Location location) {
if (location == null) {
return;
}
Location location2 = new Location(location);
this.myLocation = location2;
if (this.map != null) {
IMapsProvider$LatLng iMapsProvider$LatLng = new IMapsProvider$LatLng(location.getLatitude(), location.getLongitude());
LocationActivityAdapter locationActivityAdapter = this.adapter;
if (locationActivityAdapter != null) {
if (!this.searchedForCustomLocations && this.locationType != 8) {
locationActivityAdapter.searchPlacesWithQuery((String) null, this.myLocation, true);
}
this.adapter.setGpsLocation(this.myLocation);
}
if (this.userLocationMoved) {
return;
}
this.userLocation = new Location(location);
if (this.firstWas) {
this.map.animateCamera(ApplicationLoader.getMapsProvider().newCameraUpdateLatLng(iMapsProvider$LatLng));
return;
} else {
this.firstWas = true;
this.map.moveCamera(ApplicationLoader.getMapsProvider().newCameraUpdateLatLngZoom(iMapsProvider$LatLng, this.map.getMaxZoomLevel() - 4.0f));
return;
}
}
this.adapter.setGpsLocation(location2);
}
public void didReceivedNotification(int id, int account, Object... args) {
if (id == NotificationCenter.locationPermissionGranted) {
this.locationDenied = false;
this.askedForLocation = false;
positionMarker();
LocationActivityAdapter locationActivityAdapter = this.adapter;
if (locationActivityAdapter != null) {
locationActivityAdapter.setMyLocationDenied(this.locationDenied, this.askedForLocation);
}
LocationActivitySearchAdapter locationActivitySearchAdapter = this.searchAdapter;
if (locationActivitySearchAdapter != null) {
locationActivitySearchAdapter.setMyLocationDenied(this.locationDenied);
}
IMapsProvider$IMap iMapsProvider$IMap = this.map;
if (iMapsProvider$IMap != null) {
try {
iMapsProvider$IMap.setMyLocationEnabled(true);
} catch (Exception e) {
FileLog.e(e);
}
}
} else if (id == NotificationCenter.locationPermissionDenied) {
this.locationDenied = true;
this.askedForLocation = false;
LocationActivityAdapter locationActivityAdapter2 = this.adapter;
if (locationActivityAdapter2 != null) {
locationActivityAdapter2.setMyLocationDenied(true, false);
}
LocationActivitySearchAdapter locationActivitySearchAdapter2 = this.searchAdapter;
if (locationActivitySearchAdapter2 != null) {
locationActivitySearchAdapter2.setMyLocationDenied(this.locationDenied);
}
}
fixLayoutInternal(true);
this.searchItem.setVisibility(((this.locationDenied && !this.parentAlert.isStoryLocationPicker) || this.parentAlert.isBizLocationPicker) ? 8 : 0);
}
@Override
public void onResume() {
IMapsProvider$IMapView iMapsProvider$IMapView = this.mapView;
if (iMapsProvider$IMapView != null && this.mapsInitialized) {
try {
iMapsProvider$IMapView.onResume();
} catch (Throwable th) {
FileLog.e(th);
}
}
this.onResumeCalled = true;
}
@Override
public void onShow(ChatAttachAlert.AttachAlertLayout previousLayout) {
this.parentAlert.actionBar.setTitle(LocaleController.getString("ShareLocation", R.string.ShareLocation));
if (this.mapView.getView().getParent() == null) {
this.mapViewClip.addView(this.mapView.getView(), 0, LayoutHelper.createFrame(-1, this.overScrollHeight + AndroidUtilities.dp(10.0f), 51));
this.mapViewClip.addView(this.overlayView, 1, LayoutHelper.createFrame(-1, this.overScrollHeight + AndroidUtilities.dp(10.0f), 51));
this.mapViewClip.addView(this.loadingMapView, 2, LayoutHelper.createFrame(-1, -1.0f));
}
this.searchItem.setVisibility(0);
IMapsProvider$IMapView iMapsProvider$IMapView = this.mapView;
if (iMapsProvider$IMapView != null && this.mapsInitialized) {
try {
iMapsProvider$IMapView.onResume();
} catch (Throwable th) {
FileLog.e(th);
}
}
this.onResumeCalled = true;
IMapsProvider$IMap iMapsProvider$IMap = this.map;
if (iMapsProvider$IMap != null) {
try {
iMapsProvider$IMap.setMyLocationEnabled(true);
} catch (Exception e) {
FileLog.e(e);
}
}
fixLayoutInternal(true);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatAttachAlertLocationLayout.this.lambda$onShow$30();
}
}, this.parentAlert.delegate.needEnterComment() ? 200L : 0L);
this.layoutManager.scrollToPositionWithOffset(0, 0);
updateClipView();
}
public void lambda$onShow$30() {
int i;
Activity parentActivity;
String[] strArr;
if (!this.checkPermission || (i = Build.VERSION.SDK_INT) < 23 || (parentActivity = getParentActivity()) == null) {
return;
}
this.checkPermission = false;
if (parentActivity.checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) {
ChatAttachAlert chatAttachAlert = this.parentAlert;
if (chatAttachAlert.isStoryLocationPicker && chatAttachAlert.storyLocationPickerPhotoFile != null && i >= 29) {
strArr = new String[]{"android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION", "android.permission.ACCESS_MEDIA_LOCATION"};
} else {
strArr = new String[]{"android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"};
}
this.askedForLocation = true;
LocationActivityAdapter locationActivityAdapter = this.adapter;
if (locationActivityAdapter != null) {
locationActivityAdapter.setMyLocationDenied(this.locationDenied, true);
}
parentActivity.requestPermissions(strArr, 2);
return;
}
if (i >= 29) {
ChatAttachAlert chatAttachAlert2 = this.parentAlert;
if (!chatAttachAlert2.isStoryLocationPicker || chatAttachAlert2.storyLocationPickerPhotoFile == null || parentActivity.checkSelfPermission("android.permission.ACCESS_MEDIA_LOCATION") == 0) {
return;
}
this.askedForLocation = true;
LocationActivityAdapter locationActivityAdapter2 = this.adapter;
if (locationActivityAdapter2 != null) {
locationActivityAdapter2.setMyLocationDenied(this.locationDenied, true);
}
parentActivity.requestPermissions(new String[]{"android.permission.ACCESS_MEDIA_LOCATION"}, 211);
}
}
public void setDelegate(LocationActivityDelegate delegate) {
this.delegate = delegate;
}
@Override
public ArrayList<ThemeDescription> getThemeDescriptions() {
ArrayList<ThemeDescription> arrayList = new ArrayList<>();
ThemeDescription.ThemeDescriptionDelegate themeDescriptionDelegate = new ThemeDescription.ThemeDescriptionDelegate() {
public final void didSetColor() {
ChatAttachAlertLocationLayout.this.lambda$getThemeDescriptions$31();
}
public void onAnimationProgress(float f) {
ThemeDescription.ThemeDescriptionDelegate.-CC.$default$onAnimationProgress(this, f);
}
};
arrayList.add(new ThemeDescription(this.mapViewClip, ThemeDescription.FLAG_BACKGROUND, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_dialogBackground));
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_LISTGLOWCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_dialogScrollGlow));
ActionBarMenuItem actionBarMenuItem = this.searchItem;
arrayList.add(new ThemeDescription(actionBarMenuItem != null ? actionBarMenuItem.getSearchField() : null, ThemeDescription.FLAG_CURSORCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_dialogTextBlack));
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_SELECTOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_listSelector));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{View.class}, Theme.dividerPaint, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_divider));
ImageView imageView = this.emptyImageView;
int i = ThemeDescription.FLAG_IMAGECOLOR;
int i2 = Theme.key_dialogEmptyImage;
arrayList.add(new ThemeDescription(imageView, i, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i2));
TextView textView = this.emptyTitleTextView;
int i3 = ThemeDescription.FLAG_TEXTCOLOR;
int i4 = Theme.key_dialogEmptyText;
arrayList.add(new ThemeDescription(textView, i3, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i4));
arrayList.add(new ThemeDescription(this.emptySubtitleTextView, ThemeDescription.FLAG_TEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i4));
ImageView imageView2 = this.locationButton;
int i5 = ThemeDescription.FLAG_IMAGECOLOR | ThemeDescription.FLAG_CHECKTAG;
int i6 = Theme.key_location_actionIcon;
arrayList.add(new ThemeDescription(imageView2, i5, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i6));
ImageView imageView3 = this.locationButton;
int i7 = ThemeDescription.FLAG_IMAGECOLOR | ThemeDescription.FLAG_CHECKTAG;
int i8 = Theme.key_location_actionActiveIcon;
arrayList.add(new ThemeDescription(imageView3, i7, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i8));
ImageView imageView4 = this.locationButton;
int i9 = ThemeDescription.FLAG_BACKGROUNDFILTER;
int i10 = Theme.key_location_actionBackground;
arrayList.add(new ThemeDescription(imageView4, i9, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i10));
ImageView imageView5 = this.locationButton;
int i11 = ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE;
int i12 = Theme.key_location_actionPressedBackground;
arrayList.add(new ThemeDescription(imageView5, i11, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i12));
arrayList.add(new ThemeDescription(this.mapTypeButton, 0, (Class[]) null, (Paint) null, (Drawable[]) null, themeDescriptionDelegate, i6));
arrayList.add(new ThemeDescription(this.mapTypeButton, ThemeDescription.FLAG_BACKGROUNDFILTER, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i10));
arrayList.add(new ThemeDescription(this.mapTypeButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i12));
arrayList.add(new ThemeDescription(this.searchAreaButton, ThemeDescription.FLAG_TEXTCOLOR, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i8));
arrayList.add(new ThemeDescription(this.searchAreaButton, ThemeDescription.FLAG_BACKGROUNDFILTER, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i10));
arrayList.add(new ThemeDescription(this.searchAreaButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i12));
arrayList.add(new ThemeDescription((View) null, 0, (Class[]) null, (Paint) null, Theme.avatarDrawables, themeDescriptionDelegate, Theme.key_avatar_text));
arrayList.add(new ThemeDescription((View) null, 0, (Class[]) null, (Paint) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_avatar_backgroundRed));
arrayList.add(new ThemeDescription((View) null, 0, (Class[]) null, (Paint) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_avatar_backgroundOrange));
arrayList.add(new ThemeDescription((View) null, 0, (Class[]) null, (Paint) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_avatar_backgroundViolet));
arrayList.add(new ThemeDescription((View) null, 0, (Class[]) null, (Paint) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_avatar_backgroundGreen));
arrayList.add(new ThemeDescription((View) null, 0, (Class[]) null, (Paint) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_avatar_backgroundCyan));
arrayList.add(new ThemeDescription((View) null, 0, (Class[]) null, (Paint) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_avatar_backgroundBlue));
arrayList.add(new ThemeDescription((View) null, 0, (Class[]) null, (Paint) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_avatar_backgroundPink));
arrayList.add(new ThemeDescription((View) null, 0, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_location_liveLocationProgress));
arrayList.add(new ThemeDescription((View) null, 0, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_location_placeLocationBackground));
arrayList.add(new ThemeDescription((View) null, 0, (Class[]) null, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_dialog_liveLocationProgress));
arrayList.add(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));
arrayList.add(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));
arrayList.add(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));
arrayList.add(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));
int i13 = Theme.key_windowBackgroundWhiteGrayText3;
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{SendLocationCell.class}, new String[]{"accurateTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i13));
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{SendLocationCell.class}, new String[]{"titleTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_location_sendLiveLocationText));
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{SendLocationCell.class}, new String[]{"titleTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_location_sendLocationText));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{LocationDirectionCell.class}, new String[]{"buttonTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_featuredStickers_buttonText));
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE, new Class[]{LocationDirectionCell.class}, new String[]{"frameLayout"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_featuredStickers_addButton));
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, new Class[]{LocationDirectionCell.class}, new String[]{"frameLayout"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_featuredStickers_addButtonPressed));
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundGrayShadow));
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{ShadowSectionCell.class}, (Paint) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundGray));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_dialogTextBlue2));
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{LocationCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i13));
int i14 = Theme.key_windowBackgroundWhiteBlackText;
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{LocationCell.class}, new String[]{"nameTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i14));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{LocationCell.class}, new String[]{"addressTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i13));
arrayList.add(new ThemeDescription(this.searchListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{LocationCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i13));
arrayList.add(new ThemeDescription(this.searchListView, 0, new Class[]{LocationCell.class}, new String[]{"nameTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i14));
arrayList.add(new ThemeDescription(this.searchListView, 0, new Class[]{LocationCell.class}, new String[]{"addressTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i13));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{SharingLiveLocationCell.class}, new String[]{"nameTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i14));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{SharingLiveLocationCell.class}, new String[]{"distanceTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i13));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{LocationLoadingCell.class}, new String[]{"progressBar"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_progressCircle));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{LocationLoadingCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i13));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{LocationLoadingCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i13));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{LocationPoweredCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i13));
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{LocationPoweredCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i2));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{LocationPoweredCell.class}, new String[]{"textView2"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i4));
return arrayList;
}
public void lambda$getThemeDescriptions$31() {
this.mapTypeButton.setIconColor(getThemedColor(Theme.key_location_actionIcon));
this.mapTypeButton.redrawPopup(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground));
this.mapTypeButton.setPopupItemsColor(getThemedColor(Theme.key_actionBarDefaultSubmenuItemIcon), true);
this.mapTypeButton.setPopupItemsColor(getThemedColor(Theme.key_actionBarDefaultSubmenuItem), false);
if (this.map != null) {
if (isActiveThemeDark()) {
if (this.currentMapStyleDark) {
return;
}
this.currentMapStyleDark = true;
this.map.setMapStyle(ApplicationLoader.getMapsProvider().loadRawResourceStyle(ApplicationLoader.applicationContext, R.raw.mapstyle_night));
return;
}
if (this.currentMapStyleDark) {
this.currentMapStyleDark = false;
this.map.setMapStyle(null);
}
}
}
@Override
public void onPanTransitionStart(boolean keyboardVisible, int contentHeight) {
if (keyboardVisible) {
this.adapter.animated = false;
}
}
@Override
public void onPanTransitionEnd() {
LocationActivityAdapter locationActivityAdapter = this.adapter;
ChatAttachAlert chatAttachAlert = this.parentAlert;
locationActivityAdapter.animated = (chatAttachAlert == null || chatAttachAlert.isKeyboardVisible()) ? false : true;
}
}