package im.guobwnxjuc.ui; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.StateListAnimator; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.RectF; import android.graphics.Shader; import android.graphics.drawable.Drawable; import android.location.LocationManager; import android.net.Uri; import android.os.Build; import android.util.SparseArray; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; import androidx.fragment.app.FragmentActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.baidu.location.BDAbstractLocationListener; import com.baidu.location.BDLocation; import com.baidu.location.LocationClient; import com.baidu.location.LocationClientOption; import com.baidu.mapapi.map.BaiduMap; import com.baidu.mapapi.map.BitmapDescriptorFactory; import com.baidu.mapapi.map.CircleOptions; import com.baidu.mapapi.map.MapStatus; import com.baidu.mapapi.map.MapStatusUpdateFactory; import com.baidu.mapapi.map.MapView; import com.baidu.mapapi.map.MarkerOptions; import com.baidu.mapapi.map.Overlay; import com.baidu.mapapi.model.LatLng; import com.baidu.mapapi.model.LatLngBounds; import com.baidu.mapsdkplatform.comapi.location.CoordinateType; import com.bjz.comm.net.premission.PermissionUtils; import im.guobwnxjuc.messenger.AndroidUtilities; import im.guobwnxjuc.messenger.ApplicationLoader; import im.guobwnxjuc.messenger.ChatObject; import im.guobwnxjuc.messenger.FileLoader; import im.guobwnxjuc.messenger.FileLog; import im.guobwnxjuc.messenger.ImageLocation; import im.guobwnxjuc.messenger.LocaleController; import im.guobwnxjuc.messenger.LocationController; import im.guobwnxjuc.messenger.MessageObject; import im.guobwnxjuc.messenger.MessagesStorage; import im.guobwnxjuc.messenger.NotificationCenter; import im.guobwnxjuc.messenger.R; import im.guobwnxjuc.messenger.UserObject; import im.guobwnxjuc.tgnet.RequestDelegate; import im.guobwnxjuc.tgnet.TLObject; import im.guobwnxjuc.tgnet.TLRPC; import im.guobwnxjuc.ui.LocationActivity; import im.guobwnxjuc.ui.actionbar.ActionBar; import im.guobwnxjuc.ui.actionbar.ActionBarMenu; import im.guobwnxjuc.ui.actionbar.ActionBarMenuItem; import im.guobwnxjuc.ui.actionbar.AlertDialog; import im.guobwnxjuc.ui.actionbar.BaseFragment; import im.guobwnxjuc.ui.actionbar.Theme; import im.guobwnxjuc.ui.actionbar.ThemeDescription; import im.guobwnxjuc.ui.adapters.BaseLocationAdapter; import im.guobwnxjuc.ui.adapters.LocationActivityAdapter; import im.guobwnxjuc.ui.adapters.LocationActivitySearchAdapter; import im.guobwnxjuc.ui.cells.GraySectionCell; import im.guobwnxjuc.ui.cells.LocationCell; import im.guobwnxjuc.ui.cells.LocationLoadingCell; import im.guobwnxjuc.ui.cells.LocationPoweredCell; import im.guobwnxjuc.ui.cells.SendLocationCell; import im.guobwnxjuc.ui.components.AlertsCreator; import im.guobwnxjuc.ui.components.AvatarDrawable; import im.guobwnxjuc.ui.components.BackupImageView; import im.guobwnxjuc.ui.components.CombinedDrawable; import im.guobwnxjuc.ui.components.EmptyTextProgressView; import im.guobwnxjuc.ui.components.LayoutHelper; import im.guobwnxjuc.ui.components.MapPlaceholderDrawable; import im.guobwnxjuc.ui.components.RecyclerListView; import java.util.ArrayList; import java.util.Locale; @Deprecated public class LocationActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { public static final int LOCATION_TYPE_GROUP = 4; public static final int LOCATION_TYPE_GROUP_VIEW = 5; public static final int LOCATION_TYPE_SEND = 0; private static final int map_list_menu_hybrid = 4; private static final int map_list_menu_map = 2; private static final int map_list_menu_satellite = 3; private static final int share = 1; private LocationActivityAdapter adapter; private AnimatorSet animatorSet; private AvatarDrawable avatarDrawable; private TLRPC.TL_channelLocation chatLocation; private boolean checkGpsEnabled = true; private boolean checkPermission = true; private CircleOptions circleOptions; private LocationActivityDelegate delegate; private long dialogId; private EmptyTextProgressView emptyView; private boolean firstFocus = true; private boolean firstWas; private TLRPC.TL_channelLocation initialLocation; private boolean isFirstLocation = true; private LinearLayoutManager layoutManager; private RecyclerListView listView; private ImageView locationButton; private int locationType; private BaiduMap mBaiduMap; private LocationClient mLocClient; private MyLocationListener mLocationListener; private MapView mMapView; private FrameLayout mapViewClip; private boolean mapsInitialized; private View markerImageView; private int markerTop; private ArrayList<LiveLocation> markers = new ArrayList<>(); private SparseArray<LiveLocation> markersMap = new SparseArray<>(); private MessageObject messageObject; private BDLocation myLocation; private boolean onResumeCalled; private ActionBarMenuItem otherItem; private int overScrollHeight = ((AndroidUtilities.displaySize.x - ActionBar.getCurrentActionBarHeight()) - AndroidUtilities.dp(66.0f)); private ChatActivity parentFragment; private ImageView routeButton; private LocationActivitySearchAdapter searchAdapter; private RecyclerListView searchListView; private boolean searchWas; private boolean searching; private Runnable updateRunnable; private BDLocation userLocation; private boolean userLocationMoved; private boolean wasResults; public interface LocationActivityDelegate { void didSelectLocation(TLRPC.MessageMedia messageMedia, int i, boolean z, int i2); } static /* synthetic */ void lambda$getThemeDescriptions$19() { } public class LiveLocation { public TLRPC.Chat chat; public int id; public Marker marker; public TLRPC.Message object; public TLRPC.User user; public LiveLocation() { } } public class Marker { public LatLng latLng; public Overlay marker; public Marker(Overlay overlay, LatLng latLng2) { this.marker = overlay; this.latLng = latLng2; } public void setPosition(LatLng latLng2) { this.latLng = latLng2; } public LatLng getPosition() { return this.latLng; } } public LocationActivity(int i) { this.locationType = i; } @Override // im.guobwnxjuc.ui.actionbar.BaseFragment public boolean onFragmentCreate() { super.onFragmentCreate(); this.swipeBackEnabled = false; getNotificationCenter().addObserver(this, NotificationCenter.closeChats); NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.locationPermissionGranted); MessageObject messageObject2 = this.messageObject; if (messageObject2 == null || !messageObject2.isLiveLocation()) { return true; } getNotificationCenter().addObserver(this, NotificationCenter.didReceiveNewMessages); getNotificationCenter().addObserver(this, NotificationCenter.replaceMessagesObjects); return true; } @Override // im.guobwnxjuc.ui.actionbar.BaseFragment public void onFragmentDestroy() { super.onFragmentDestroy(); NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.locationPermissionGranted); getNotificationCenter().removeObserver(this, NotificationCenter.closeChats); getNotificationCenter().removeObserver(this, NotificationCenter.didReceiveNewMessages); getNotificationCenter().removeObserver(this, NotificationCenter.replaceMessagesObjects); try { if (this.mMapView != null) { this.mMapView.onDestroy(); } } catch (Exception e) { FileLog.e(e); } LocationActivityAdapter locationActivityAdapter = this.adapter; if (locationActivityAdapter != null) { locationActivityAdapter.destroy(); } LocationActivitySearchAdapter locationActivitySearchAdapter = this.searchAdapter; if (locationActivitySearchAdapter != null) { locationActivitySearchAdapter.destroy(); } Runnable runnable = this.updateRunnable; if (runnable != null) { AndroidUtilities.cancelRunOnUIThread(runnable); this.updateRunnable = null; } } @Override // im.guobwnxjuc.ui.actionbar.BaseFragment public View createView(Context context) { TLRPC.Chat chat; this.actionBar.setBackButtonImage(R.mipmap.ic_back); this.actionBar.setAllowOverlayTitle(true); if (AndroidUtilities.isTablet()) { this.actionBar.setOccupyStatusBar(false); } this.actionBar.setAddToContainer(false); this.actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { /* class im.guobwnxjuc.ui.LocationActivity.AnonymousClass1 */ @Override // im.guobwnxjuc.ui.actionbar.ActionBar.ActionBarMenuOnItemClick public void onItemClick(int i) { if (i == -1) { LocationActivity.this.finishFragment(); } else if (i == 2) { if (LocationActivity.this.mBaiduMap != null) { LocationActivity.this.mBaiduMap.setMapType(1); } } else if (i == 3) { if (LocationActivity.this.mBaiduMap != null) { LocationActivity.this.mBaiduMap.setMapType(2); } } else if (i == 1) { try { double d = LocationActivity.this.messageObject.messageOwner.media.geo.lat; double d2 = LocationActivity.this.messageObject.messageOwner.media.geo._long; FragmentActivity parentActivity = LocationActivity.this.getParentActivity(); parentActivity.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("geo:" + d + "," + d2 + "?q=" + d + "," + d2))); } catch (Exception e) { FileLog.e(e); } } } }); ActionBarMenu createMenu = this.actionBar.createMenu(); if (this.chatLocation != null) { this.actionBar.setTitle(LocaleController.getString("ChatLocation", R.string.ChatLocation)); } else { MessageObject messageObject2 = this.messageObject; if (messageObject2 == null) { this.actionBar.setTitle(LocaleController.getString("ShareLocation", R.string.ShareLocation)); if (this.locationType != 4) { createMenu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() { /* class im.guobwnxjuc.ui.LocationActivity.AnonymousClass2 */ @Override // im.guobwnxjuc.ui.actionbar.ActionBarMenuItem.ActionBarMenuItemSearchListener public void onSearchExpand() { LocationActivity.this.searching = true; LocationActivity.this.otherItem.setVisibility(8); LocationActivity.this.listView.setVisibility(8); LocationActivity.this.mapViewClip.setVisibility(8); LocationActivity.this.searchListView.setVisibility(0); LocationActivity.this.searchListView.setEmptyView(LocationActivity.this.emptyView); LocationActivity.this.emptyView.showTextView(); } @Override // im.guobwnxjuc.ui.actionbar.ActionBarMenuItem.ActionBarMenuItemSearchListener public void onSearchCollapse() { LocationActivity.this.searching = false; LocationActivity.this.searchWas = false; LocationActivity.this.otherItem.setVisibility(0); LocationActivity.this.searchListView.setEmptyView(null); LocationActivity.this.listView.setVisibility(0); LocationActivity.this.mapViewClip.setVisibility(0); LocationActivity.this.searchListView.setVisibility(8); LocationActivity.this.emptyView.setVisibility(8); LocationActivity.this.searchAdapter.searchDelayed(null, null); } @Override // im.guobwnxjuc.ui.actionbar.ActionBarMenuItem.ActionBarMenuItemSearchListener public void onTextChanged(EditText editText) { if (LocationActivity.this.searchAdapter != null) { String obj = editText.getText().toString(); if (obj.length() != 0) { LocationActivity.this.searchWas = true; } LocationActivity.this.emptyView.showProgress(); LocationActivity.this.searchAdapter.searchDelayed(obj, LocationActivity.this.userLocation); } } }).setSearchFieldHint(LocaleController.getString("Search", R.string.Search)); } } else if (messageObject2.isLiveLocation()) { this.actionBar.setTitle(LocaleController.getString("AttachLiveLocation", R.string.AttachLiveLocation)); } else { if (this.messageObject.messageOwner.media.title == null || this.messageObject.messageOwner.media.title.length() <= 0) { this.actionBar.setTitle(LocaleController.getString("ChatLocation", R.string.ChatLocation)); } else { this.actionBar.setTitle(LocaleController.getString("SharedPlace", R.string.SharedPlace)); } createMenu.addItem(1, R.drawable.share).setContentDescription(LocaleController.getString("ShareFile", R.string.ShareFile)); } } ActionBarMenuItem addItem = createMenu.addItem(0, R.drawable.ic_ab_other); this.otherItem = addItem; addItem.addSubItem(2, R.drawable.msg_map, LocaleController.getString("Map", R.string.Map)); this.otherItem.addSubItem(3, R.drawable.msg_satellite, LocaleController.getString("Satellite", R.string.Satellite)); this.otherItem.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions)); this.fragmentView = new FrameLayout(context) { /* class im.guobwnxjuc.ui.LocationActivity.AnonymousClass3 */ private boolean first = true; /* access modifiers changed from: protected */ public void onLayout(boolean z, int i, int i2, int i3, int i4) { super.onLayout(z, i, i2, i3, i4); if (z) { LocationActivity.this.fixLayoutInternal(this.first); this.first = false; } } }; FrameLayout frameLayout = (FrameLayout) this.fragmentView; this.locationButton = new ImageView(context); Drawable createSimpleSelectorCircleDrawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56.0f), Theme.getColor(Theme.key_profile_actionBackground), Theme.getColor(Theme.key_profile_actionPressedBackground)); if (Build.VERSION.SDK_INT < 21) { Drawable mutate = context.getResources().getDrawable(R.drawable.floating_shadow_profile).mutate(); mutate.setColorFilter(new PorterDuffColorFilter(-16777216, PorterDuff.Mode.MULTIPLY)); CombinedDrawable combinedDrawable = new CombinedDrawable(mutate, createSimpleSelectorCircleDrawable, 0, 0); combinedDrawable.setIconSize(AndroidUtilities.dp(56.0f), AndroidUtilities.dp(56.0f)); createSimpleSelectorCircleDrawable = combinedDrawable; } this.locationButton.setBackgroundDrawable(createSimpleSelectorCircleDrawable); this.locationButton.setImageResource(R.drawable.myloc_on); this.locationButton.setScaleType(ImageView.ScaleType.CENTER); this.locationButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_profile_actionIcon), PorterDuff.Mode.MULTIPLY)); this.locationButton.setContentDescription(LocaleController.getString("AccDescrMyLocation", R.string.AccDescrMyLocation)); if (Build.VERSION.SDK_INT >= 21) { StateListAnimator stateListAnimator = new StateListAnimator(); stateListAnimator.addState(new int[]{16842919}, ObjectAnimator.ofFloat(this.locationButton, View.TRANSLATION_Z, (float) AndroidUtilities.dp(2.0f), (float) AndroidUtilities.dp(4.0f)).setDuration(200L)); stateListAnimator.addState(new int[0], ObjectAnimator.ofFloat(this.locationButton, View.TRANSLATION_Z, (float) AndroidUtilities.dp(4.0f), (float) AndroidUtilities.dp(2.0f)).setDuration(200L)); this.locationButton.setStateListAnimator(stateListAnimator); this.locationButton.setOutlineProvider(new ViewOutlineProvider() { /* class im.guobwnxjuc.ui.LocationActivity.AnonymousClass4 */ public void getOutline(View view, Outline outline) { outline.setOval(0, 0, AndroidUtilities.dp(56.0f), AndroidUtilities.dp(56.0f)); } }); } if (this.chatLocation != null) { BDLocation bDLocation = new BDLocation("network"); this.userLocation = bDLocation; bDLocation.setLatitude(this.chatLocation.geo_point.lat); this.userLocation.setLongitude(this.chatLocation.geo_point._long); } else if (this.messageObject != null) { BDLocation bDLocation2 = new BDLocation("network"); this.userLocation = bDLocation2; bDLocation2.setLatitude(this.messageObject.messageOwner.media.geo.lat); this.userLocation.setLongitude(this.messageObject.messageOwner.media.geo._long); } this.searchWas = false; this.searching = false; FrameLayout frameLayout2 = new FrameLayout(context); this.mapViewClip = frameLayout2; frameLayout2.setBackgroundDrawable(new MapPlaceholderDrawable()); LocationActivityAdapter locationActivityAdapter = this.adapter; if (locationActivityAdapter != null) { locationActivityAdapter.destroy(); } LocationActivitySearchAdapter locationActivitySearchAdapter = this.searchAdapter; if (locationActivitySearchAdapter != null) { locationActivitySearchAdapter.destroy(); } RecyclerListView recyclerListView = new RecyclerListView(context); this.listView = recyclerListView; recyclerListView.setItemAnimator(null); this.listView.setLayoutAnimation(null); RecyclerListView recyclerListView2 = this.listView; LocationActivityAdapter locationActivityAdapter2 = new LocationActivityAdapter(context, this.locationType, this.dialogId); this.adapter = locationActivityAdapter2; recyclerListView2.setAdapter(locationActivityAdapter2); this.listView.setVerticalScrollBarEnabled(false); RecyclerListView recyclerListView3 = this.listView; AnonymousClass5 r6 = new LinearLayoutManager(context, 1, false) { /* class im.guobwnxjuc.ui.LocationActivity.AnonymousClass5 */ @Override // androidx.recyclerview.widget.RecyclerView.LayoutManager, androidx.recyclerview.widget.LinearLayoutManager public boolean supportsPredictiveItemAnimations() { return false; } }; this.layoutManager = r6; recyclerListView3.setLayoutManager(r6); frameLayout.addView(this.listView, LayoutHelper.createFrame(-1, -1, 51)); this.listView.setOnScrollListener(new RecyclerView.OnScrollListener() { /* class im.guobwnxjuc.ui.LocationActivity.AnonymousClass6 */ @Override // androidx.recyclerview.widget.RecyclerView.OnScrollListener public void onScrolled(RecyclerView recyclerView, int i, int i2) { int findFirstVisibleItemPosition; if (LocationActivity.this.adapter.getItemCount() != 0 && (findFirstVisibleItemPosition = LocationActivity.this.layoutManager.findFirstVisibleItemPosition()) != -1) { LocationActivity.this.updateClipView(findFirstVisibleItemPosition); if (LocationActivity.this.locationType != 4 && i2 > 0 && !LocationActivity.this.adapter.isPulledUp()) { LocationActivity.this.adapter.setPulledUp(); if (LocationActivity.this.myLocation != null) { AndroidUtilities.runOnUIThread(new Runnable() { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$6$YLLokdtq8BF6Ug1mqMnEowhgGcU */ public final void run() { LocationActivity.AnonymousClass6.this.lambda$onScrolled$0$LocationActivity$6(); } }); } } } } public /* synthetic */ void lambda$onScrolled$0$LocationActivity$6() { LocationActivity.this.adapter.searchPlacesWithQuery(null, LocationActivity.this.myLocation, true); } }); this.listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$lTANG4xOWXLU1gvffkWhqrdfZoI */ @Override // im.guobwnxjuc.ui.components.RecyclerListView.OnItemClickListener public final void onItemClick(View view, int i) { LocationActivity.this.lambda$createView$6$LocationActivity(view, i); } }); this.adapter.setDelegate(this.dialogId, new BaseLocationAdapter.BaseLocationAdapterDelegate() { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$zpvjdZSmA3rGXkAg2agG2fmHkQQ */ @Override // im.guobwnxjuc.ui.adapters.BaseLocationAdapter.BaseLocationAdapterDelegate public final void didLoadedSearchResult(ArrayList arrayList) { LocationActivity.this.lambda$createView$7$LocationActivity(arrayList); } }); this.adapter.setOverScrollHeight(this.overScrollHeight); frameLayout.addView(this.mapViewClip, LayoutHelper.createFrame(-1, -1, 51)); initBaiduMap(context); View view = new View(context); view.setBackgroundResource(R.drawable.header_shadow_reverse); this.mapViewClip.addView(view, LayoutHelper.createFrame(-1, 3, 83)); if (this.messageObject == null && this.chatLocation == null) { if (!(this.locationType != 4 || this.dialogId == 0 || (chat = getMessagesController().getChat(Integer.valueOf(-((int) this.dialogId)))) == null)) { FrameLayout frameLayout3 = new FrameLayout(context); frameLayout3.setBackgroundResource(R.drawable.livepin); this.mapViewClip.addView(frameLayout3, LayoutHelper.createFrame(62, 76, 49)); BackupImageView backupImageView = new BackupImageView(context); backupImageView.setRoundRadius(AndroidUtilities.dp(26.0f)); backupImageView.setImage(ImageLocation.getForChat(chat, false), "50_50", new AvatarDrawable(chat), chat); frameLayout3.addView(backupImageView, LayoutHelper.createFrame(52.0f, 52.0f, 51, 5.0f, 5.0f, 0.0f, 0.0f)); this.markerImageView = frameLayout3; frameLayout3.setTag(1); } if (this.markerImageView == null) { ImageView imageView = new ImageView(context); imageView.setImageResource(R.drawable.map_pin2); this.mapViewClip.addView(imageView, LayoutHelper.createFrame(28, 48, 49)); this.markerImageView = imageView; } EmptyTextProgressView emptyTextProgressView = new EmptyTextProgressView(context); this.emptyView = emptyTextProgressView; emptyTextProgressView.setText(LocaleController.getString("NoResult", R.string.NoResult)); this.emptyView.setShowAtCenter(true); this.emptyView.setVisibility(8); frameLayout.addView(this.emptyView, LayoutHelper.createFrame(-1, -1.0f)); RecyclerListView recyclerListView4 = new RecyclerListView(context); this.searchListView = recyclerListView4; recyclerListView4.setVisibility(8); this.searchListView.setLayoutManager(new LinearLayoutManager(context, 1, false)); RecyclerListView recyclerListView5 = this.searchListView; LocationActivitySearchAdapter locationActivitySearchAdapter2 = new LocationActivitySearchAdapter(context); this.searchAdapter = locationActivitySearchAdapter2; recyclerListView5.setAdapter(locationActivitySearchAdapter2); frameLayout.addView(this.searchListView, LayoutHelper.createFrame(-1, -1, 51)); this.searchListView.setOnScrollListener(new RecyclerView.OnScrollListener() { /* class im.guobwnxjuc.ui.LocationActivity.AnonymousClass7 */ @Override // androidx.recyclerview.widget.RecyclerView.OnScrollListener public void onScrollStateChanged(RecyclerView recyclerView, int i) { if (i == 1 && LocationActivity.this.searching && LocationActivity.this.searchWas) { AndroidUtilities.hideKeyboard(LocationActivity.this.getParentActivity().getCurrentFocus()); } } }); this.searchListView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$Zx3jf1auiGWDjJjRZj1EMbTtao */ @Override // im.guobwnxjuc.ui.components.RecyclerListView.OnItemClickListener public final void onItemClick(View view, int i) { LocationActivity.this.lambda$createView$9$LocationActivity(view, i); } }); } else { MessageObject messageObject3 = this.messageObject; if ((messageObject3 != null && !messageObject3.isLiveLocation()) || this.chatLocation != null) { this.routeButton = new ImageView(context); Drawable createSimpleSelectorCircleDrawable2 = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56.0f), Theme.getColor(Theme.key_chats_actionBackground), Theme.getColor(Theme.key_chats_actionPressedBackground)); if (Build.VERSION.SDK_INT < 21) { Drawable mutate2 = context.getResources().getDrawable(R.drawable.floating_shadow).mutate(); mutate2.setColorFilter(new PorterDuffColorFilter(-16777216, PorterDuff.Mode.MULTIPLY)); CombinedDrawable combinedDrawable2 = new CombinedDrawable(mutate2, createSimpleSelectorCircleDrawable2, 0, 0); combinedDrawable2.setIconSize(AndroidUtilities.dp(56.0f), AndroidUtilities.dp(56.0f)); createSimpleSelectorCircleDrawable2 = combinedDrawable2; } this.routeButton.setBackgroundDrawable(createSimpleSelectorCircleDrawable2); this.routeButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionIcon), PorterDuff.Mode.MULTIPLY)); this.routeButton.setImageResource(R.drawable.navigate); this.routeButton.setScaleType(ImageView.ScaleType.CENTER); if (Build.VERSION.SDK_INT >= 21) { StateListAnimator stateListAnimator2 = new StateListAnimator(); stateListAnimator2.addState(new int[]{16842919}, ObjectAnimator.ofFloat(this.routeButton, View.TRANSLATION_Z, (float) AndroidUtilities.dp(2.0f), (float) AndroidUtilities.dp(4.0f)).setDuration(200L)); stateListAnimator2.addState(new int[0], ObjectAnimator.ofFloat(this.routeButton, View.TRANSLATION_Z, (float) AndroidUtilities.dp(4.0f), (float) AndroidUtilities.dp(2.0f)).setDuration(200L)); this.routeButton.setStateListAnimator(stateListAnimator2); this.routeButton.setOutlineProvider(new ViewOutlineProvider() { /* class im.guobwnxjuc.ui.LocationActivity.AnonymousClass8 */ public void getOutline(View view, Outline outline) { outline.setOval(0, 0, AndroidUtilities.dp(56.0f), AndroidUtilities.dp(56.0f)); } }); } frameLayout.addView(this.routeButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56.0f : 60.0f, Build.VERSION.SDK_INT >= 21 ? 56.0f : 60.0f, (LocaleController.isRTL ? 3 : 5) | 80, LocaleController.isRTL ? 14.0f : 0.0f, 0.0f, LocaleController.isRTL ? 0.0f : 14.0f, 37.0f)); this.routeButton.setOnClickListener(new View.OnClickListener() { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$nCKFOauIHY27NdSAavKzXpRYZ3Y */ public final void onClick(View view) { LocationActivity.this.lambda$createView$10$LocationActivity(view); } }); TLRPC.TL_channelLocation tL_channelLocation = this.chatLocation; if (tL_channelLocation != null) { this.adapter.setChatLocation(tL_channelLocation); } else { MessageObject messageObject4 = this.messageObject; if (messageObject4 != null) { this.adapter.setMessageObject(messageObject4); } } } } MessageObject messageObject5 = this.messageObject; if ((messageObject5 == null || messageObject5.isLiveLocation()) && this.chatLocation == null) { this.mapViewClip.addView(this.locationButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56.0f : 60.0f, Build.VERSION.SDK_INT >= 21 ? 56.0f : 60.0f, (LocaleController.isRTL ? 3 : 5) | 80, LocaleController.isRTL ? 14.0f : 0.0f, 0.0f, LocaleController.isRTL ? 0.0f : 14.0f, 14.0f)); } else { this.mapViewClip.addView(this.locationButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56.0f : 60.0f, Build.VERSION.SDK_INT >= 21 ? 56.0f : 60.0f, (LocaleController.isRTL ? 3 : 5) | 80, LocaleController.isRTL ? 14.0f : 0.0f, 0.0f, LocaleController.isRTL ? 0.0f : 14.0f, 43.0f)); } this.locationButton.setOnClickListener(new View.OnClickListener() { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$pCht_VwSHQTl_gfzVJZQm2psDNo */ public final void onClick(View view) { LocationActivity.this.lambda$createView$11$LocationActivity(view); } }); if (this.messageObject == null && this.chatLocation == null) { if (this.initialLocation == null) { this.locationButton.setAlpha(0.0f); } else { this.userLocationMoved = true; } } frameLayout.addView(this.actionBar); return this.fragmentView; } public /* synthetic */ void lambda$createView$6$LocationActivity(View view, int i) { MessageObject messageObject2; TLRPC.TL_messageMediaVenue tL_messageMediaVenue; int i2 = this.locationType; if (i2 == 4) { if (i == 1 && (tL_messageMediaVenue = (TLRPC.TL_messageMediaVenue) this.adapter.getItem(i)) != null) { if (this.dialogId == 0) { this.delegate.didSelectLocation(tL_messageMediaVenue, 4, true, 0); finishFragment(); return; } AlertDialog[] alertDialogArr = {new AlertDialog(getParentActivity(), 3)}; TLRPC.TL_channels_editLocation tL_channels_editLocation = new TLRPC.TL_channels_editLocation(); tL_channels_editLocation.address = tL_messageMediaVenue.address; tL_channels_editLocation.channel = getMessagesController().getInputChannel(-((int) this.dialogId)); tL_channels_editLocation.geo_point = new TLRPC.TL_inputGeoPoint(); tL_channels_editLocation.geo_point.lat = tL_messageMediaVenue.geo.lat; tL_channels_editLocation.geo_point._long = tL_messageMediaVenue.geo._long; alertDialogArr[0].setOnCancelListener(new DialogInterface.OnCancelListener(getConnectionsManager().sendRequest(tL_channels_editLocation, new RequestDelegate(alertDialogArr, tL_messageMediaVenue) { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$JSqHCn5FRIMHZ1oq_2rxpy8TU40 */ private final /* synthetic */ AlertDialog[] f$1; private final /* synthetic */ TLRPC.TL_messageMediaVenue f$2; { this.f$1 = r2; this.f$2 = r3; } @Override // im.guobwnxjuc.tgnet.RequestDelegate public final void run(TLObject tLObject, TLRPC.TL_error tL_error) { LocationActivity.this.lambda$null$1$LocationActivity(this.f$1, this.f$2, tLObject, tL_error); } })) { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$PJChxvGWLPbMxYQxikHVyKHQDCo */ private final /* synthetic */ int f$1; { this.f$1 = r2; } public final void onCancel(DialogInterface dialogInterface) { LocationActivity.this.lambda$null$2$LocationActivity(this.f$1, dialogInterface); } }); showDialog(alertDialogArr[0]); } } else if (i2 == 5) { if (this.mBaiduMap != null) { LatLng latLng = new LatLng(this.chatLocation.geo_point.lat, this.chatLocation.geo_point._long); MapStatus.Builder builder = new MapStatus.Builder(); builder.target(latLng).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f); this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); } } else if (i != 1 || (messageObject2 = this.messageObject) == null || messageObject2.isLiveLocation()) { if (i != 1 || this.locationType == 2) { if ((i != 2 || this.locationType != 1) && ((i != 1 || this.locationType != 2) && (i != 3 || this.locationType != 3))) { Object item = this.adapter.getItem(i); if (item instanceof TLRPC.TL_messageMediaVenue) { ChatActivity chatActivity = this.parentFragment; if (chatActivity == null || !chatActivity.isInScheduleMode()) { this.delegate.didSelectLocation((TLRPC.TL_messageMediaVenue) item, this.locationType, true, 0); finishFragment(); return; } AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), UserObject.isUserSelf(this.parentFragment.getCurrentUser()), new AlertsCreator.ScheduleDatePickerDelegate(item) { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$NiFY3p8LdPrpQ5SLuhvVmvgJpY */ private final /* synthetic */ Object f$1; { this.f$1 = r2; } @Override // im.guobwnxjuc.ui.components.AlertsCreator.ScheduleDatePickerDelegate public final void didSelectDate(boolean z, int i) { LocationActivity.this.lambda$null$5$LocationActivity(this.f$1, z, i); } }); } else if (item instanceof LiveLocation) { LiveLocation liveLocation = (LiveLocation) item; LatLng latLng2 = new LatLng(liveLocation.object.media.geo.lat, liveLocation.object.media.geo._long); MapStatus.Builder builder2 = new MapStatus.Builder(); builder2.target(latLng2).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f); this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder2.build())); } } else if (getLocationController().isSharingLocation(this.dialogId)) { getLocationController().removeSharingLocation(this.dialogId); finishFragment(); } else if (this.delegate != null && getParentActivity() != null && this.myLocation != null) { TLRPC.User user = null; if (((int) this.dialogId) > 0) { user = getMessagesController().getUser(Integer.valueOf((int) this.dialogId)); } showDialog(AlertsCreator.createLocationUpdateDialog(getParentActivity(), user, new MessagesStorage.IntCallback() { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$ZPSJbdOIm6FR0neYwpPKkXYtiss */ @Override // im.guobwnxjuc.messenger.MessagesStorage.IntCallback public final void run(int i) { LocationActivity.this.lambda$null$4$LocationActivity(i); } })); } } else if (this.delegate != null && this.userLocation != null) { TLRPC.TL_messageMediaGeo tL_messageMediaGeo = new TLRPC.TL_messageMediaGeo(); tL_messageMediaGeo.geo = new TLRPC.TL_geoPoint(); tL_messageMediaGeo.geo.lat = AndroidUtilities.fixLocationCoord(this.userLocation.getLatitude()); tL_messageMediaGeo.geo._long = AndroidUtilities.fixLocationCoord(this.userLocation.getLongitude()); ChatActivity chatActivity2 = this.parentFragment; if (chatActivity2 == null || !chatActivity2.isInScheduleMode()) { this.delegate.didSelectLocation(tL_messageMediaGeo, this.locationType, true, 0); finishFragment(); return; } AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), UserObject.isUserSelf(this.parentFragment.getCurrentUser()), new AlertsCreator.ScheduleDatePickerDelegate(tL_messageMediaGeo) { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$xEcGhqP11pg8Tw9lMF0x8bdd508 */ private final /* synthetic */ TLRPC.TL_messageMediaGeo f$1; { this.f$1 = r2; } @Override // im.guobwnxjuc.ui.components.AlertsCreator.ScheduleDatePickerDelegate public final void didSelectDate(boolean z, int i) { LocationActivity.this.lambda$null$3$LocationActivity(this.f$1, z, i); } }); } } else if (this.mBaiduMap != null) { LatLng latLng3 = new LatLng(this.messageObject.messageOwner.media.geo.lat, this.messageObject.messageOwner.media.geo._long); MapStatus.Builder builder3 = new MapStatus.Builder(); builder3.target(latLng3).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f); this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder3.build())); } } public /* synthetic */ void lambda$null$1$LocationActivity(AlertDialog[] alertDialogArr, TLRPC.TL_messageMediaVenue tL_messageMediaVenue, TLObject tLObject, TLRPC.TL_error tL_error) { AndroidUtilities.runOnUIThread(new Runnable(alertDialogArr, tL_messageMediaVenue) { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$3wdRaQnqWPCA6ATGr20aAmJF3po */ private final /* synthetic */ AlertDialog[] f$1; private final /* synthetic */ TLRPC.TL_messageMediaVenue f$2; { this.f$1 = r2; this.f$2 = r3; } public final void run() { LocationActivity.this.lambda$null$0$LocationActivity(this.f$1, this.f$2); } }); } public /* synthetic */ void lambda$null$0$LocationActivity(AlertDialog[] alertDialogArr, TLRPC.TL_messageMediaVenue tL_messageMediaVenue) { try { alertDialogArr[0].dismiss(); } catch (Throwable unused) { } alertDialogArr[0] = null; this.delegate.didSelectLocation(tL_messageMediaVenue, 4, true, 0); finishFragment(); } public /* synthetic */ void lambda$null$2$LocationActivity(int i, DialogInterface dialogInterface) { getConnectionsManager().cancelRequest(i, true); } public /* synthetic */ void lambda$null$3$LocationActivity(TLRPC.TL_messageMediaGeo tL_messageMediaGeo, boolean z, int i) { this.delegate.didSelectLocation(tL_messageMediaGeo, this.locationType, z, i); finishFragment(); } public /* synthetic */ void lambda$null$4$LocationActivity(int i) { TLRPC.TL_messageMediaGeoLive tL_messageMediaGeoLive = new TLRPC.TL_messageMediaGeoLive(); tL_messageMediaGeoLive.geo = new TLRPC.TL_geoPoint(); tL_messageMediaGeoLive.geo.lat = AndroidUtilities.fixLocationCoord(this.myLocation.getLatitude()); tL_messageMediaGeoLive.geo._long = AndroidUtilities.fixLocationCoord(this.myLocation.getLongitude()); tL_messageMediaGeoLive.period = i; this.delegate.didSelectLocation(tL_messageMediaGeoLive, this.locationType, true, 0); finishFragment(); } public /* synthetic */ void lambda$null$5$LocationActivity(Object obj, boolean z, int i) { this.delegate.didSelectLocation((TLRPC.TL_messageMediaVenue) obj, this.locationType, z, i); finishFragment(); } public /* synthetic */ void lambda$createView$7$LocationActivity(ArrayList arrayList) { if (!this.wasResults && !arrayList.isEmpty()) { this.wasResults = true; } this.emptyView.showTextView(); } public /* synthetic */ void lambda$createView$9$LocationActivity(View view, int i) { TLRPC.TL_messageMediaVenue item = this.searchAdapter.getItem(i); if (item != null && this.delegate != null) { ChatActivity chatActivity = this.parentFragment; if (chatActivity == null || !chatActivity.isInScheduleMode()) { this.delegate.didSelectLocation(item, this.locationType, true, 0); finishFragment(); return; } AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), UserObject.isUserSelf(this.parentFragment.getCurrentUser()), new AlertsCreator.ScheduleDatePickerDelegate(item) { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$4NfXas5SPwslbdgo5rYDOGL89Lw */ private final /* synthetic */ TLRPC.TL_messageMediaVenue f$1; { this.f$1 = r2; } @Override // im.guobwnxjuc.ui.components.AlertsCreator.ScheduleDatePickerDelegate public final void didSelectDate(boolean z, int i) { LocationActivity.this.lambda$null$8$LocationActivity(this.f$1, z, i); } }); } } public /* synthetic */ void lambda$null$8$LocationActivity(TLRPC.TL_messageMediaVenue tL_messageMediaVenue, boolean z, int i) { this.delegate.didSelectLocation(tL_messageMediaVenue, this.locationType, z, i); finishFragment(); } public /* synthetic */ void lambda$createView$10$LocationActivity(View view) { Intent intent; FragmentActivity parentActivity; if (Build.VERSION.SDK_INT >= 23 && (parentActivity = getParentActivity()) != null && parentActivity.checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) { showPermissionAlert(true); } else if (this.myLocation != null) { try { if (this.messageObject != null) { intent = new Intent("android.intent.action.VIEW", Uri.parse(String.format(Locale.US, "http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", Double.valueOf(this.myLocation.getLatitude()), Double.valueOf(this.myLocation.getLongitude()), Double.valueOf(this.messageObject.messageOwner.media.geo.lat), Double.valueOf(this.messageObject.messageOwner.media.geo._long)))); } else { intent = new Intent("android.intent.action.VIEW", Uri.parse(String.format(Locale.US, "http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f", Double.valueOf(this.myLocation.getLatitude()), Double.valueOf(this.myLocation.getLongitude()), Double.valueOf(this.chatLocation.geo_point.lat), Double.valueOf(this.chatLocation.geo_point._long)))); } getParentActivity().startActivity(intent); } catch (Exception e) { FileLog.e(e); } } } public /* synthetic */ void lambda$createView$11$LocationActivity(View view) { FragmentActivity parentActivity; if (Build.VERSION.SDK_INT >= 23 && (parentActivity = getParentActivity()) != null && parentActivity.checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) { showPermissionAlert(false); } else if (this.messageObject != null || this.chatLocation != null) { BDLocation bDLocation = this.myLocation; if (bDLocation != null && this.mBaiduMap != null) { LatLng latLng = new LatLng(bDLocation.getLatitude(), this.myLocation.getLongitude()); MapStatus.Builder builder = new MapStatus.Builder(); builder.target(latLng).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f); this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); } } else if (this.myLocation != null && this.mBaiduMap != null) { AnimatorSet animatorSet2 = new AnimatorSet(); animatorSet2.setDuration(200L); animatorSet2.play(ObjectAnimator.ofFloat(this.locationButton, View.ALPHA, 0.0f)); animatorSet2.start(); this.adapter.setCustomLocation(null); this.userLocationMoved = false; LatLng latLng2 = new LatLng(this.myLocation.getLatitude(), this.myLocation.getLongitude()); MapStatus.Builder builder2 = new MapStatus.Builder(); builder2.target(latLng2); this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder2.build())); } } private void initBaiduMap(Context context) { MapView mapView = new MapView(context); this.mMapView = mapView; this.mBaiduMap = mapView.getMap(); this.mMapView.showZoomControls(false); this.mMapView.showScaleControl(false); this.mBaiduMap.getUiSettings().setCompassEnabled(false); this.mBaiduMap.setMapType(1); this.mBaiduMap.setMyLocationEnabled(true); this.mBaiduMap.setOnMapTouchListener(new BaiduMap.OnMapTouchListener() { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$b5EwIjhm1m8eWHb7pNZXYag6imY */ @Override // com.baidu.mapapi.map.BaiduMap.OnMapTouchListener public final void onTouch(MotionEvent motionEvent) { LocationActivity.this.lambda$initBaiduMap$12$LocationActivity(motionEvent); } }); this.mBaiduMap.setOnMapLoadedCallback(new BaiduMap.OnMapLoadedCallback() { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$Cm3H3BZHS3DfxHUMah6qhM38ZAY */ @Override // com.baidu.mapapi.map.BaiduMap.OnMapLoadedCallback public final void onMapLoaded() { LocationActivity.this.lambda$initBaiduMap$13$LocationActivity(); } }); initLocationClient(); } public /* synthetic */ void lambda$initBaiduMap$12$LocationActivity(MotionEvent motionEvent) { BDLocation bDLocation; if (this.messageObject == null && this.chatLocation == null) { if (motionEvent.getAction() == 0) { AnimatorSet animatorSet2 = this.animatorSet; if (animatorSet2 != null) { animatorSet2.cancel(); } AnimatorSet animatorSet3 = new AnimatorSet(); this.animatorSet = animatorSet3; animatorSet3.setDuration(200L); this.animatorSet.playTogether(ObjectAnimator.ofFloat(this.markerImageView, View.TRANSLATION_Y, (float) (this.markerTop - AndroidUtilities.dp(10.0f)))); this.animatorSet.start(); } else if (motionEvent.getAction() == 1) { AnimatorSet animatorSet4 = this.animatorSet; if (animatorSet4 != null) { animatorSet4.cancel(); } AnimatorSet animatorSet5 = new AnimatorSet(); this.animatorSet = animatorSet5; animatorSet5.setDuration(200L); this.animatorSet.playTogether(ObjectAnimator.ofFloat(this.markerImageView, View.TRANSLATION_Y, (float) this.markerTop)); this.animatorSet.start(); this.adapter.fetchLocationAddress(); } if (motionEvent.getAction() == 2) { if (!this.userLocationMoved) { AnimatorSet animatorSet6 = new AnimatorSet(); animatorSet6.setDuration(200L); animatorSet6.play(ObjectAnimator.ofFloat(this.locationButton, View.ALPHA, 1.0f)); animatorSet6.start(); this.userLocationMoved = true; } BaiduMap baiduMap = this.mBaiduMap; if (!(baiduMap == null || (bDLocation = this.userLocation) == null)) { bDLocation.setLatitude(baiduMap.getLocationData().latitude); this.userLocation.setLongitude(this.mBaiduMap.getLocationData().longitude); } this.adapter.setCustomLocation(this.userLocation); } } } public /* synthetic */ void lambda$initBaiduMap$13$LocationActivity() { if (this.mMapView != null && getParentActivity() != null) { this.mBaiduMap.setViewPadding(AndroidUtilities.dp(70.0f), 0, AndroidUtilities.dp(70.0f), AndroidUtilities.dp(10.0f)); onMapInit(); this.mapsInitialized = true; if (this.onResumeCalled) { this.mMapView.onResume(); } } } private void initLocationClient() { LocationClient locationClient = new LocationClient(getParentActivity()); this.mLocClient = locationClient; MyLocationListener myLocationListener = new MyLocationListener(); this.mLocationListener = myLocationListener; locationClient.registerLocationListener(myLocationListener); LocationClientOption locationClientOption = new LocationClientOption(); locationClientOption.setOpenGps(true); locationClientOption.setCoorType(CoordinateType.GCJ02); locationClientOption.setScanSpan(1000); locationClientOption.setIgnoreKillProcess(false); locationClientOption.setIsNeedAddress(true); this.mLocClient.setLocOption(locationClientOption); this.mLocClient.start(); } private Bitmap createUserBitmap(LiveLocation liveLocation) { Throwable th; TLRPC.FileLocation fileLocation; Bitmap bitmap = null; try { if (liveLocation.user == null || liveLocation.user.photo == null) { fileLocation = (liveLocation.chat == null || liveLocation.chat.photo == null) ? null : liveLocation.chat.photo.photo_small; } else { fileLocation = liveLocation.user.photo.photo_small; } Bitmap createBitmap = Bitmap.createBitmap(AndroidUtilities.dp(62.0f), AndroidUtilities.dp(76.0f), Bitmap.Config.ARGB_8888); try { createBitmap.eraseColor(0); Canvas canvas = new Canvas(createBitmap); Drawable drawable = ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.livepin); drawable.setBounds(0, 0, AndroidUtilities.dp(62.0f), AndroidUtilities.dp(76.0f)); drawable.draw(canvas); Paint paint = new Paint(1); RectF rectF = new RectF(); canvas.save(); if (fileLocation != null) { Bitmap decodeFile = BitmapFactory.decodeFile(FileLoader.getPathToAttach(fileLocation, true).toString()); if (decodeFile != null) { BitmapShader bitmapShader = new BitmapShader(decodeFile, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); Matrix matrix = new Matrix(); float dp = ((float) AndroidUtilities.dp(52.0f)) / ((float) decodeFile.getWidth()); matrix.postTranslate((float) AndroidUtilities.dp(5.0f), (float) AndroidUtilities.dp(5.0f)); matrix.postScale(dp, dp); paint.setShader(bitmapShader); bitmapShader.setLocalMatrix(matrix); rectF.set((float) AndroidUtilities.dp(5.0f), (float) AndroidUtilities.dp(5.0f), (float) AndroidUtilities.dp(57.0f), (float) AndroidUtilities.dp(57.0f)); canvas.drawRoundRect(rectF, (float) AndroidUtilities.dp(26.0f), (float) AndroidUtilities.dp(26.0f), paint); } } else { AvatarDrawable avatarDrawable2 = new AvatarDrawable(); if (liveLocation.user != null) { avatarDrawable2.setInfo(liveLocation.user); } else if (liveLocation.chat != null) { avatarDrawable2.setInfo(liveLocation.chat); } canvas.translate((float) AndroidUtilities.dp(5.0f), (float) AndroidUtilities.dp(5.0f)); avatarDrawable2.setBounds(0, 0, AndroidUtilities.dp(52.2f), AndroidUtilities.dp(52.2f)); avatarDrawable2.draw(canvas); } canvas.restore(); try { canvas.setBitmap(null); return createBitmap; } catch (Exception unused) { return createBitmap; } } catch (Throwable th2) { th = th2; bitmap = createBitmap; FileLog.e(th); return bitmap; } } catch (Throwable th3) { th = th3; FileLog.e(th); return bitmap; } } private int getMessageId(TLRPC.Message message) { if (message.from_id != 0) { return message.from_id; } return (int) MessageObject.getDialogId(message); } private LiveLocation addUserMarker(TLRPC.Message message) { LatLng latLng = new LatLng(message.media.geo.lat, message.media.geo._long); LiveLocation liveLocation = this.markersMap.get(message.from_id); if (liveLocation == null) { liveLocation = new LiveLocation(); liveLocation.object = message; if (liveLocation.object.from_id != 0) { liveLocation.user = getMessagesController().getUser(Integer.valueOf(liveLocation.object.from_id)); liveLocation.id = liveLocation.object.from_id; } else { int dialogId2 = (int) MessageObject.getDialogId(message); if (dialogId2 > 0) { liveLocation.user = getMessagesController().getUser(Integer.valueOf(dialogId2)); liveLocation.id = dialogId2; } else { liveLocation.chat = getMessagesController().getChat(Integer.valueOf(-dialogId2)); liveLocation.id = dialogId2; } } liveLocation.marker = createUserMarker(latLng, liveLocation); this.markers.add(liveLocation); this.markersMap.put(liveLocation.id, liveLocation); LocationController.SharingLocationInfo sharingLocationInfo = getLocationController().getSharingLocationInfo(this.dialogId); if (liveLocation.id == getUserConfig().getClientUserId() && sharingLocationInfo != null && liveLocation.object.id == sharingLocationInfo.mid && this.myLocation != null) { liveLocation.marker.setPosition(new LatLng(this.myLocation.getLatitude(), this.myLocation.getLongitude())); } } else { liveLocation.object = message; liveLocation.marker.setPosition(latLng); } return liveLocation; } private LiveLocation addUserMarker(TLRPC.TL_channelLocation tL_channelLocation) { LatLng latLng = new LatLng(tL_channelLocation.geo_point.lat, tL_channelLocation.geo_point._long); LiveLocation liveLocation = new LiveLocation(); int i = (int) this.dialogId; if (i > 0) { liveLocation.user = getMessagesController().getUser(Integer.valueOf(i)); liveLocation.id = i; } else { liveLocation.chat = getMessagesController().getChat(Integer.valueOf(-i)); liveLocation.id = i; } liveLocation.marker = createUserMarker(latLng, liveLocation); this.markers.add(liveLocation); this.markersMap.put(liveLocation.id, liveLocation); return liveLocation; } private Marker addLocMarker(LatLng latLng) { return new Marker(this.mBaiduMap.addOverlay(new MarkerOptions().position(latLng).icon(BitmapDescriptorFactory.fromResource(R.drawable.map_pin2)).draggable(false).flat(false)), latLng); } private Marker createUserMarker(LatLng latLng, LiveLocation liveLocation) { return new Marker(this.mBaiduMap.addOverlay(new MarkerOptions().position(latLng).icon(BitmapDescriptorFactory.fromBitmap(createUserBitmap(liveLocation))).draggable(false).flat(false).anchor(0.5f, 0.907f)), latLng); } public class MyLocationListener extends BDAbstractLocationListener { public MyLocationListener() { } @Override // com.baidu.location.BDAbstractLocationListener public void onReceiveLocation(BDLocation bDLocation) { LocationActivity.this.positionMarker(bDLocation); LocationActivity.this.getLocationController().setBaiduMapLocation(bDLocation, LocationActivity.this.isFirstLocation); LocationActivity.this.isFirstLocation = false; } } private void onMapInit() { if (this.mBaiduMap != null) { TLRPC.TL_channelLocation tL_channelLocation = this.chatLocation; if (tL_channelLocation != null) { LiveLocation addUserMarker = addUserMarker(tL_channelLocation); MapStatus.Builder builder = new MapStatus.Builder(); builder.target(addUserMarker.marker.getPosition()).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f); this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); } else { MessageObject messageObject2 = this.messageObject; if (messageObject2 == null) { BDLocation bDLocation = new BDLocation("network"); this.userLocation = bDLocation; TLRPC.TL_channelLocation tL_channelLocation2 = this.initialLocation; if (tL_channelLocation2 != null) { LatLng latLng = new LatLng(tL_channelLocation2.geo_point.lat, this.initialLocation.geo_point._long); MapStatus.Builder builder2 = new MapStatus.Builder(); builder2.target(latLng).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f); this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder2.build())); this.userLocation.setLatitude(this.initialLocation.geo_point.lat); this.userLocation.setLongitude(this.initialLocation.geo_point._long); this.adapter.setCustomLocation(this.userLocation); } else { bDLocation.setLatitude(20.659322d); this.userLocation.setLongitude(-11.40625d); } } else if (messageObject2.isLiveLocation()) { LiveLocation addUserMarker2 = addUserMarker(this.messageObject.messageOwner); if (!getRecentLocations()) { MapStatus.Builder builder3 = new MapStatus.Builder(); builder3.target(addUserMarker2.marker.getPosition()).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f); this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder3.build())); } } else { LatLng latLng2 = new LatLng(this.userLocation.getLatitude(), this.userLocation.getLongitude()); try { addLocMarker(latLng2); } catch (Exception e) { FileLog.e(e); } MapStatus.Builder builder4 = new MapStatus.Builder(); builder4.target(latLng2).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f); this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder4.build())); this.firstFocus = false; getRecentLocations(); } } BDLocation lastLocation = getLastLocation(); this.myLocation = lastLocation; positionMarker(lastLocation); if (this.checkGpsEnabled && getParentActivity() != null) { this.checkGpsEnabled = false; if (getParentActivity().getPackageManager().hasSystemFeature("android.hardware.location.gps")) { try { if (!((LocationManager) ApplicationLoader.applicationContext.getSystemService("location")).isProviderEnabled("gps")) { AlertDialog.Builder builder5 = new AlertDialog.Builder(getParentActivity()); builder5.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder5.setMessage(LocaleController.getString("GpsDisabledAlert", R.string.GpsDisabledAlert)); builder5.setPositiveButton(LocaleController.getString("ConnectingToProxyEnable", R.string.ConnectingToProxyEnable), new DialogInterface.OnClickListener() { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$JbsdxCDZN_OPOwi8F0M6z5i6zYk */ public final void onClick(DialogInterface dialogInterface, int i) { LocationActivity.this.lambda$onMapInit$14$LocationActivity(dialogInterface, i); } }); builder5.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder5.create()); } } catch (Exception e2) { FileLog.e(e2); } } } } } public /* synthetic */ void lambda$onMapInit$14$LocationActivity(DialogInterface dialogInterface, int i) { if (getParentActivity() != null) { try { getParentActivity().startActivity(new Intent("android.settings.LOCATION_SOURCE_SETTINGS")); } catch (Exception unused) { } } } private void showPermissionAlert(boolean z) { if (getParentActivity() != null) { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); if (z) { builder.setMessage(LocaleController.getString("PermissionNoLocationPosition", R.string.PermissionNoLocationPosition)); } else { builder.setMessage(LocaleController.getString("PermissionNoLocation", R.string.PermissionNoLocation)); } builder.setNegativeButton(LocaleController.getString("PermissionOpenSettings", R.string.PermissionOpenSettings), new DialogInterface.OnClickListener() { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$pmYHQQoabFIHyPHLqz7c91F8bt0 */ public final void onClick(DialogInterface dialogInterface, int i) { LocationActivity.this.lambda$showPermissionAlert$15$LocationActivity(dialogInterface, i); } }); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); showDialog(builder.create()); } } public /* synthetic */ void lambda$showPermissionAlert$15$LocationActivity(DialogInterface dialogInterface, int i) { if (getParentActivity() != null) { try { Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS"); intent.setData(Uri.parse("package:" + ApplicationLoader.applicationContext.getPackageName())); getParentActivity().startActivity(intent); } catch (Exception e) { FileLog.e(e); } } } @Override // im.guobwnxjuc.ui.actionbar.BaseFragment public void onTransitionAnimationEnd(boolean z, boolean z2) { if (z) { try { if (this.mMapView.getParent() instanceof ViewGroup) { ((ViewGroup) this.mMapView.getParent()).removeView(this.mMapView); } } catch (Exception e) { FileLog.e(e); } FrameLayout frameLayout = this.mapViewClip; if (frameLayout != null) { frameLayout.addView(this.mMapView, 0, LayoutHelper.createFrame(-1, this.overScrollHeight + AndroidUtilities.dp(10.0f), 51)); updateClipView(this.layoutManager.findFirstVisibleItemPosition()); } else if (this.fragmentView != null) { ((FrameLayout) this.fragmentView).addView(this.mMapView, 0, LayoutHelper.createFrame(-1, -1, 51)); } } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void updateClipView(int i) { View childAt; int i2; int i3; if (i != -1 && (childAt = this.listView.getChildAt(0)) != null) { if (i == 0) { i2 = childAt.getTop(); i3 = this.overScrollHeight + (i2 < 0 ? i2 : 0); } else { i2 = 0; i3 = 0; } if (((FrameLayout.LayoutParams) this.mapViewClip.getLayoutParams()) != null) { if (i3 <= 0) { if (this.mMapView.getVisibility() == 0) { this.mMapView.setVisibility(4); this.mapViewClip.setVisibility(4); } } else if (this.mMapView.getVisibility() == 4) { this.mMapView.setVisibility(0); this.mapViewClip.setVisibility(0); } this.mapViewClip.setTranslationY((float) Math.min(0, i2)); int i4 = -i2; this.mMapView.setTranslationY((float) Math.max(0, i4 / 2)); View view = this.markerImageView; if (view != null) { int dp = (i4 - AndroidUtilities.dp(view.getTag() == null ? 48.0f : 69.0f)) + (i3 / 2); this.markerTop = dp; view.setTranslationY((float) dp); } ImageView imageView = this.routeButton; if (imageView != null) { imageView.setTranslationY((float) i2); } FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.mMapView.getLayoutParams(); if (layoutParams != null && layoutParams.height != this.overScrollHeight + AndroidUtilities.dp(10.0f)) { layoutParams.height = this.overScrollHeight + AndroidUtilities.dp(10.0f); BaiduMap baiduMap = this.mBaiduMap; if (baiduMap != null) { baiduMap.setPadding(AndroidUtilities.dp(70.0f), 0, AndroidUtilities.dp(70.0f), AndroidUtilities.dp(10.0f)); } this.mMapView.setLayoutParams(layoutParams); } } } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void fixLayoutInternal(boolean z) { if (this.listView != null) { int currentActionBarHeight = (this.actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight(); int measuredHeight = this.fragmentView.getMeasuredHeight(); if (measuredHeight != 0) { this.overScrollHeight = (measuredHeight - AndroidUtilities.dp(66.0f)) - currentActionBarHeight; FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.listView.getLayoutParams(); layoutParams.topMargin = currentActionBarHeight; this.listView.setLayoutParams(layoutParams); FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) this.mapViewClip.getLayoutParams(); layoutParams2.topMargin = currentActionBarHeight; layoutParams2.height = this.overScrollHeight; this.mapViewClip.setLayoutParams(layoutParams2); RecyclerListView recyclerListView = this.searchListView; if (recyclerListView != null) { FrameLayout.LayoutParams layoutParams3 = (FrameLayout.LayoutParams) recyclerListView.getLayoutParams(); layoutParams3.topMargin = currentActionBarHeight; this.searchListView.setLayoutParams(layoutParams3); } this.adapter.setOverScrollHeight(this.overScrollHeight); FrameLayout.LayoutParams layoutParams4 = (FrameLayout.LayoutParams) this.mMapView.getLayoutParams(); if (layoutParams4 != null) { layoutParams4.height = this.overScrollHeight + AndroidUtilities.dp(10.0f); BaiduMap baiduMap = this.mBaiduMap; if (baiduMap != null) { baiduMap.setPadding(AndroidUtilities.dp(70.0f), 0, AndroidUtilities.dp(70.0f), AndroidUtilities.dp(10.0f)); } this.mMapView.setLayoutParams(layoutParams4); } this.adapter.notifyDataSetChanged(); if (z) { LinearLayoutManager linearLayoutManager = this.layoutManager; int i = this.locationType; linearLayoutManager.scrollToPositionWithOffset(0, -AndroidUtilities.dp((float) (32 + ((i == 1 || i == 2) ? 66 : 0)))); updateClipView(this.layoutManager.findFirstVisibleItemPosition()); this.listView.post(new Runnable() { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$pnlvykkxAYTF6i32IwdT5_cHgmk */ public final void run() { LocationActivity.this.lambda$fixLayoutInternal$16$LocationActivity(); } }); return; } updateClipView(this.layoutManager.findFirstVisibleItemPosition()); } } } public /* synthetic */ void lambda$fixLayoutInternal$16$LocationActivity() { LinearLayoutManager linearLayoutManager = this.layoutManager; int i = this.locationType; linearLayoutManager.scrollToPositionWithOffset(0, -AndroidUtilities.dp((float) (32 + ((i == 1 || i == 2) ? 66 : 0)))); updateClipView(this.layoutManager.findFirstVisibleItemPosition()); } private BDLocation getLastLocation() { return this.mLocClient.getLastKnownLocation(); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void positionMarker(BDLocation bDLocation) { if (bDLocation != null) { this.myLocation = new BDLocation(bDLocation); LiveLocation liveLocation = this.markersMap.get(getUserConfig().getClientUserId()); LocationController.SharingLocationInfo sharingLocationInfo = getLocationController().getSharingLocationInfo(this.dialogId); if (!(liveLocation == null || sharingLocationInfo == null || liveLocation.object.id != sharingLocationInfo.mid)) { liveLocation.marker.setPosition(new LatLng(bDLocation.getLatitude(), bDLocation.getLongitude())); } if (this.messageObject == null && this.chatLocation == null && this.mBaiduMap != null) { LatLng latLng = new LatLng(bDLocation.getLatitude(), bDLocation.getLongitude()); LocationActivityAdapter locationActivityAdapter = this.adapter; if (locationActivityAdapter != null) { if (locationActivityAdapter.isPulledUp()) { this.adapter.searchPlacesWithQuery(null, this.myLocation, true); } this.adapter.setGpsLocation(this.myLocation); } if (!this.userLocationMoved) { this.userLocation = new BDLocation(bDLocation); if (this.firstWas) { MapStatus.Builder builder = new MapStatus.Builder(); builder.target(latLng).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f); this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); return; } this.firstWas = true; MapStatus.Builder builder2 = new MapStatus.Builder(); builder2.target(latLng).zoom(this.mBaiduMap.getMaxZoomLevel() - 4.0f); this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder2.build())); return; } return; } this.adapter.setGpsLocation(this.myLocation); } } public void setMessageObject(MessageObject messageObject2) { this.messageObject = messageObject2; this.dialogId = messageObject2.getDialogId(); } public void setChatLocation(int i, TLRPC.TL_channelLocation tL_channelLocation) { this.dialogId = (long) (-i); this.chatLocation = tL_channelLocation; } public void setDialogId(long j) { this.dialogId = j; } public void setInitialLocation(TLRPC.TL_channelLocation tL_channelLocation) { this.initialLocation = tL_channelLocation; } private void fetchRecentLocations(ArrayList<TLRPC.Message> arrayList) { LatLngBounds.Builder builder = this.firstFocus ? new LatLngBounds.Builder() : null; int currentTime = getConnectionsManager().getCurrentTime(); for (int i = 0; i < arrayList.size(); i++) { TLRPC.Message message = arrayList.get(i); if (message.date + message.media.period > currentTime) { if (builder != null) { builder.include(new LatLng(message.media.geo.lat, message.media.geo._long)); } addUserMarker(message); } } if (builder != null) { this.firstFocus = false; this.adapter.setLiveLocations(this.markers); if (this.messageObject.isLiveLocation()) { try { LatLngBounds build = builder.build(); if (arrayList.size() > 1) { try { this.mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newLatLngBounds(build, AndroidUtilities.dp(60.0f), AndroidUtilities.dp(60.0f))); } catch (Exception e) { FileLog.e(e); } } } catch (Exception unused) { } } } } private boolean getRecentLocations() { ArrayList<TLRPC.Message> arrayList = getLocationController().locationsCache.get(this.messageObject.getDialogId()); if (arrayList == null || arrayList.isEmpty()) { arrayList = null; } else { fetchRecentLocations(arrayList); } int i = (int) this.dialogId; if (i < 0) { TLRPC.Chat chat = getMessagesController().getChat(Integer.valueOf(-i)); if (ChatObject.isChannel(chat) && !chat.megagroup) { return false; } } TLRPC.TL_messages_getRecentLocations tL_messages_getRecentLocations = new TLRPC.TL_messages_getRecentLocations(); long dialogId2 = this.messageObject.getDialogId(); tL_messages_getRecentLocations.peer = getMessagesController().getInputPeer((int) dialogId2); tL_messages_getRecentLocations.limit = 100; getConnectionsManager().sendRequest(tL_messages_getRecentLocations, new RequestDelegate(dialogId2) { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$pTpES5syByffLzIxh030ggFAfC4 */ private final /* synthetic */ long f$1; { this.f$1 = r2; } @Override // im.guobwnxjuc.tgnet.RequestDelegate public final void run(TLObject tLObject, TLRPC.TL_error tL_error) { LocationActivity.this.lambda$getRecentLocations$18$LocationActivity(this.f$1, tLObject, tL_error); } }); if (arrayList != null) { return true; } return false; } public /* synthetic */ void lambda$getRecentLocations$18$LocationActivity(long j, TLObject tLObject, TLRPC.TL_error tL_error) { if (tLObject != null) { AndroidUtilities.runOnUIThread(new Runnable(tLObject, j) { /* class im.guobwnxjuc.ui.$$Lambda$LocationActivity$uvIjw8yOIgC4wpYcB01jXiuhiXc */ private final /* synthetic */ TLObject f$1; private final /* synthetic */ long f$2; { this.f$1 = r2; this.f$2 = r3; } public final void run() { LocationActivity.this.lambda$null$17$LocationActivity(this.f$1, this.f$2); } }); } } public /* synthetic */ void lambda$null$17$LocationActivity(TLObject tLObject, long j) { if (this.mBaiduMap != null) { TLRPC.messages_Messages messages_messages = (TLRPC.messages_Messages) tLObject; int i = 0; while (i < messages_messages.messages.size()) { if (!(messages_messages.messages.get(i).media instanceof TLRPC.TL_messageMediaGeoLive)) { messages_messages.messages.remove(i); i--; } i++; } getMessagesStorage().putUsersAndChats(messages_messages.users, messages_messages.chats, true, true); getMessagesController().putUsers(messages_messages.users, false); getMessagesController().putChats(messages_messages.chats, false); getLocationController().locationsCache.put(j, messages_messages.messages); getNotificationCenter().postNotificationName(NotificationCenter.liveLocationsCacheChanged, Long.valueOf(j)); fetchRecentLocations(messages_messages.messages); } } @Override // im.guobwnxjuc.messenger.NotificationCenter.NotificationCenterDelegate public void didReceivedNotification(int i, int i2, Object... objArr) { LocationActivityAdapter locationActivityAdapter; LiveLocation liveLocation; LocationActivityAdapter locationActivityAdapter2; if (i == NotificationCenter.closeChats) { removeSelfFromStack(); } else if (i == NotificationCenter.locationPermissionGranted) { BaiduMap baiduMap = this.mBaiduMap; if (baiduMap != null) { try { baiduMap.setMyLocationEnabled(true); } catch (Exception e) { FileLog.e(e); } } } else { int i3 = 0; if (i == NotificationCenter.didReceiveNewMessages) { if (!((Boolean) objArr[2]).booleanValue() && ((Long) objArr[0]).longValue() == this.dialogId && this.messageObject != null) { ArrayList arrayList = (ArrayList) objArr[1]; boolean z = false; while (i3 < arrayList.size()) { MessageObject messageObject2 = (MessageObject) arrayList.get(i3); if (messageObject2.isLiveLocation()) { addUserMarker(messageObject2.messageOwner); z = true; } i3++; } if (z && (locationActivityAdapter2 = this.adapter) != null) { locationActivityAdapter2.setLiveLocations(this.markers); } } } else if (i == NotificationCenter.replaceMessagesObjects) { long longValue = ((Long) objArr[0]).longValue(); if (longValue == this.dialogId && this.messageObject != null) { ArrayList arrayList2 = (ArrayList) objArr[1]; boolean z2 = false; while (i3 < arrayList2.size()) { MessageObject messageObject3 = (MessageObject) arrayList2.get(i3); if (messageObject3.isLiveLocation() && (liveLocation = this.markersMap.get(getMessageId(messageObject3.messageOwner))) != null) { LocationController.SharingLocationInfo sharingLocationInfo = getLocationController().getSharingLocationInfo(longValue); if (sharingLocationInfo == null || sharingLocationInfo.mid != messageObject3.getId()) { liveLocation.marker.setPosition(new LatLng(messageObject3.messageOwner.media.geo.lat, messageObject3.messageOwner.media.geo._long)); } z2 = true; } i3++; } if (z2 && (locationActivityAdapter = this.adapter) != null) { locationActivityAdapter.updateLiveLocations(); } } } } } @Override // im.guobwnxjuc.ui.actionbar.BaseFragment public void onPause() { super.onPause(); MapView mapView = this.mMapView; if (mapView != null && this.mapsInitialized) { try { mapView.onPause(); } catch (Exception e) { FileLog.e(e); } } this.onResumeCalled = false; } @Override // im.guobwnxjuc.ui.actionbar.BaseFragment public void onResume() { FragmentActivity parentActivity; super.onResume(); AndroidUtilities.requestAdjustResize(getParentActivity(), this.classGuid); AndroidUtilities.removeAdjustResize(getParentActivity(), this.classGuid); MapView mapView = this.mMapView; if (mapView != null && this.mapsInitialized) { try { mapView.onResume(); } catch (Throwable th) { FileLog.e(th); } } this.onResumeCalled = true; BaiduMap baiduMap = this.mBaiduMap; if (baiduMap != null) { try { baiduMap.setMyLocationEnabled(true); } catch (Exception e) { FileLog.e(e); } } fixLayoutInternal(true); if (this.checkPermission && Build.VERSION.SDK_INT >= 23 && (parentActivity = getParentActivity()) != null) { this.checkPermission = false; if (parentActivity.checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) { parentActivity.requestPermissions(new String[]{"android.permission.ACCESS_COARSE_LOCATION", PermissionUtils.FINE_LOCATION}, 2); } } } public void setDelegate(LocationActivityDelegate locationActivityDelegate) { this.delegate = locationActivityDelegate; } public void setChatActivity(ChatActivity chatActivity) { this.parentFragment = chatActivity; } private void updateSearchInterface() { LocationActivityAdapter locationActivityAdapter = this.adapter; if (locationActivityAdapter != null) { locationActivityAdapter.notifyDataSetChanged(); } } @Override // im.guobwnxjuc.ui.actionbar.BaseFragment public ThemeDescription[] getThemeDescriptions() { $$Lambda$LocationActivity$peuPau_82mduF3cvqxXuBG2t7Fg r9 = $$Lambda$LocationActivity$peuPau_82mduF3cvqxXuBG2t7Fg.INSTANCE; return new ThemeDescription[]{new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault), new ThemeDescription(this.listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultSearch), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, null, null, null, null, Theme.key_actionBarDefaultSearchPlaceholder), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SUBMENUBACKGROUND, null, null, null, null, Theme.key_actionBarDefaultSubmenuBackground), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM, null, null, null, null, Theme.key_actionBarDefaultSubmenuItem), new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM | ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_actionBarDefaultSubmenuItemIcon), new ThemeDescription(this.listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector), new ThemeDescription(this.listView, 0, new Class[]{View.class}, Theme.dividerPaint, null, null, Theme.key_divider), new ThemeDescription(this.emptyView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_emptyListPlaceholder), new ThemeDescription(this.emptyView, ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_progressCircle), new ThemeDescription(this.locationButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_profile_actionIcon), new ThemeDescription(this.locationButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_profile_actionBackground), new ThemeDescription(this.locationButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_profile_actionPressedBackground), new ThemeDescription(this.routeButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionIcon), new ThemeDescription(this.routeButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chats_actionBackground), new ThemeDescription(this.routeButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_chats_actionPressedBackground), new ThemeDescription(this.listView, 0, new Class[]{GraySectionCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_graySectionText), new ThemeDescription(this.listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{GraySectionCell.class}, null, null, null, Theme.key_graySection), new ThemeDescription(null, 0, null, null, new Drawable[]{Theme.avatar_savedDrawable}, r9, Theme.key_avatar_text), new ThemeDescription(null, 0, null, null, null, r9, Theme.key_avatar_backgroundRed), new ThemeDescription(null, 0, null, null, null, r9, Theme.key_avatar_backgroundOrange), new ThemeDescription(null, 0, null, null, null, r9, Theme.key_avatar_backgroundViolet), new ThemeDescription(null, 0, null, null, null, r9, Theme.key_avatar_backgroundGreen), new ThemeDescription(null, 0, null, null, null, r9, Theme.key_avatar_backgroundCyan), new ThemeDescription(null, 0, null, null, null, r9, Theme.key_avatar_backgroundBlue), new ThemeDescription(null, 0, null, null, null, r9, Theme.key_avatar_backgroundPink), new ThemeDescription(null, 0, null, null, null, null, Theme.key_location_liveLocationProgress), new ThemeDescription(null, 0, null, null, null, null, Theme.key_location_placeLocationBackground), new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialog_liveLocationProgress), new ThemeDescription(this.listView, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_CHECKTAG, new Class[]{SendLocationCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_location_sendLocationIcon), new ThemeDescription(this.listView, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_CHECKTAG, new Class[]{SendLocationCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_location_sendLiveLocationIcon), new ThemeDescription(this.listView, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_CHECKTAG, new Class[]{SendLocationCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_location_sendLocationBackground), new ThemeDescription(this.listView, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_CHECKTAG, new Class[]{SendLocationCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_location_sendLiveLocationBackground), new ThemeDescription(this.listView, 0, new Class[]{SendLocationCell.class}, new String[]{"accurateTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{SendLocationCell.class}, new String[]{"titleTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteRedText2), new ThemeDescription(this.listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{SendLocationCell.class}, new String[]{"titleTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlueText7), new ThemeDescription(this.listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{LocationCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.listView, 0, new Class[]{LocationCell.class}, new String[]{"nameTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlackText), new ThemeDescription(this.listView, 0, new Class[]{LocationCell.class}, new String[]{"addressTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.searchListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{LocationCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.searchListView, 0, new Class[]{LocationCell.class}, new String[]{"nameTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlackText), new ThemeDescription(this.searchListView, 0, new Class[]{LocationCell.class}, new String[]{"addressTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.listView, 0, new Class[]{LocationLoadingCell.class}, new String[]{"progressBar"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_progressCircle), new ThemeDescription(this.listView, 0, new Class[]{LocationLoadingCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.listView, 0, new Class[]{LocationPoweredCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.listView, 0, new Class[]{LocationPoweredCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3), new ThemeDescription(this.listView, 0, new Class[]{LocationPoweredCell.class}, new String[]{"textView2"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3)}; } }