正在查看: Hyouka private v5.8.9 应用的 ScreenMap.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Hyouka private v5.8.9 应用的 ScreenMap.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.beint.project.screens.sms;
import android.R;
import android.annotation.SuppressLint;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.beint.project.MainApplication;
import com.beint.project.core.services.impl.SignalingService;
import com.beint.project.core.utils.ZangiPermissionUtils;
import com.beint.project.huawei.map.ZMap;
import com.beint.project.huawei.map.ZMapKitDelegate;
import com.beint.project.huawei.map.ZMarkerOptions;
import com.beint.project.huawei.map.ZOnMapClickListener;
import com.beint.project.screens.utils.UiUtilKt;
import com.beint.project.utils.ProjectUtils;
import com.fasterxml.jackson.core.util.MinimalPrettyPrinter;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
public class ScreenMap extends AppModeNotifierActivity implements ZMapKitDelegate {
public String addres;
private TextView addresLocation;
private TextView awaylocation;
private Location currentLocation;
private String latLng;
private float latitude;
private float longitude;
private ZMap mMap;
private float myLatitude;
private Location myLocation;
private FloatingActionButton myLocationButton;
private LocationManager myLocationManager;
private float myLongitude;
private LatLng userLatLng;
private String title = "";
private View.OnClickListener myLocationButtonListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
if (ScreenMap.this.mMap != null) {
if (view.getId() != 2131362924) {
if (ScreenMap.this.myLocation == null) {
ScreenMap screenMap = ScreenMap.this;
screenMap.myLocation = screenMap.loadMyLocation();
}
if (ScreenMap.this.myLocation != null) {
ScreenMap screenMap2 = ScreenMap.this;
screenMap2.myLatitude = (float) screenMap2.myLocation.getLatitude();
ScreenMap screenMap3 = ScreenMap.this;
screenMap3.myLongitude = (float) screenMap3.myLocation.getLongitude();
}
ScreenMap.this.mMap.animateCamera(ScreenMap.this.myLatitude, ScreenMap.this.myLongitude, ScreenMap.this.mMap.getMaxZoomLevel() - 4.0f);
} else {
ScreenMap.this.mMap.animateCamera(ScreenMap.this.latitude, ScreenMap.this.longitude, ScreenMap.this.mMap.getMaxZoomLevel() - 4.0f);
}
try {
if (SignalingService.INSTANCE.isRegistered()) {
List<Address> fromLocation = new Geocoder(ScreenMap.this, Locale.getDefault()).getFromLocation(ScreenMap.this.latitude, ScreenMap.this.longitude, 1);
if (fromLocation == null || fromLocation.size() <= 0) {
ScreenMap.this.addresLocation.setText(ScreenMap.this.getString(2131886483));
} else {
Address address = fromLocation.get(0);
StringBuilder sb = new StringBuilder("");
ScreenMap screenMap4 = ScreenMap.this;
sb.append(address.getAddressLine(0));
sb.append(MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR);
screenMap4.addres = sb.toString();
ScreenMap screenMap5 = ScreenMap.this;
screenMap5.title = screenMap5.addres;
ScreenMap.this.addresLocation.setText(ScreenMap.this.addres);
}
} else {
ScreenMap.this.addresLocation.setText(ScreenMap.this.getString(2131886483));
}
} catch (IOException e) {
e.printStackTrace();
ScreenMap.this.addresLocation.setText(ScreenMap.this.getString(2131886483));
}
}
}
};
private MarkerOptions getMarkerOptions(LatLng latLng) {
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.D0(this.title);
markerOptions.C0(latLng);
markerOptions.y0(e5.c.a(Bitmap.createScaledBitmap(UiUtilKt.getBitmapFromVectorDrawable(MainApplication.Companion.getMainContext(), 2131231594), ProjectUtils.dpToPx(40), ProjectUtils.dpToPx(40), false)));
return markerOptions;
}
@SuppressLint({"MissingPermission"})
private void init() {
this.myLocationManager = (LocationManager) getSystemService("location");
this.latitude = getIntent().getFloatExtra("latitude", 0.0f);
this.longitude = getIntent().getFloatExtra("longitude", 0.0f);
ZMap zMap = new ZMap(this, 2131362883);
this.mMap = zMap;
zMap.getMapAsync(this);
this.myLocationButton.setOnClickListener(this.myLocationButtonListener);
}
public void lambda$onCreate$0(View view) {
openMapWith();
}
public void lambda$onCreate$1(ArrayList arrayList, boolean z) {
if (z) {
init();
} else {
finish();
}
}
public void lambda$onMapReady$2(double d, double d7) {
ZMap zMap = this.mMap;
zMap.animateCamera(d, d7, zMap.getMaxZoomLevel() - 4.0f);
}
@SuppressLint({"MissingPermission"})
public Location loadMyLocation() {
List<String> providers = this.myLocationManager.getProviders(true);
if (providers == null) {
return null;
}
Location location = this.currentLocation;
long time = location == null ? 0L : location.getTime();
Iterator<String> it = providers.iterator();
while (it.hasNext()) {
Location lastKnownLocation = this.myLocationManager.getLastKnownLocation(it.next());
if (lastKnownLocation != null && lastKnownLocation.getTime() > time) {
this.currentLocation = lastKnownLocation;
time = lastKnownLocation.getTime();
}
}
return this.currentLocation;
}
private void moveToLocation() {
}
private void openMapWith() {
startActivity(Intent.createChooser(new Intent("android.intent.action.VIEW", Uri.parse(String.format(Locale.ENGLISH, "geo:%f,%f?z=17&q=%f,%f", Float.valueOf(this.latitude), Float.valueOf(this.longitude), Float.valueOf(this.latitude), Float.valueOf(this.longitude)))), ""));
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(2131558718);
setSupportActionBar(findViewById(2131363848));
getSupportActionBar().v(false);
getSupportActionBar().q(true);
getSupportActionBar().r(true);
getSupportActionBar().x("");
this.myLocationButton = (FloatingActionButton) findViewById(2131363090);
getSupportActionBar().w(2131886804);
this.awaylocation = (TextView) findViewById(2131363781);
this.addresLocation = (TextView) findViewById(2131363600);
((LinearLayout) findViewById(2131362924)).setOnClickListener(this.myLocationButtonListener);
this.myLocationButton.setOnClickListener(this.myLocationButtonListener);
findViewById(2131363176).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ScreenMap.this.lambda$onCreate$0(view);
}
});
if (ZangiPermissionUtils.hasPermission(this, 1005, true, new ZangiPermissionUtils.OnPermissionResult() {
public final void onResult(ArrayList arrayList, boolean z) {
ScreenMap.this.lambda$onCreate$1(arrayList, z);
}
})) {
init();
}
}
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(2131689490, menu);
return super/*android.app.Activity*/.onCreateOptionsMenu(menu);
}
public void onLocationChanged(Location location) {
}
public void onMapReady() {
if (this.mMap != null) {
if (this.myLocation == null) {
this.myLocation = loadMyLocation();
}
Location location = this.myLocation;
if (location != null) {
this.myLatitude = (float) location.getLatitude();
this.myLongitude = (float) this.myLocation.getLongitude();
}
this.userLatLng = new LatLng(this.latitude, this.longitude);
this.mMap.addMarker(new ZMarkerOptions(this.latitude, this.longitude, -1, false));
ZMap zMap = this.mMap;
zMap.moveCamera(this.latitude, this.longitude, zMap.getMaxZoomLevel() - 4.0f);
this.mMap.setMyLocationEnabled(true);
this.mMap.setMyLocationButtonEnabled(false);
try {
if (SignalingService.INSTANCE.isRegistered()) {
List<Address> fromLocation = new Geocoder(this, Locale.getDefault()).getFromLocation(this.latitude, this.longitude, 1);
if (fromLocation == null || fromLocation.size() <= 0) {
this.addresLocation.setText(getString(2131886483));
} else {
String str = "" + fromLocation.get(0).getAddressLine(0) + MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR;
this.addres = str;
this.title = str;
this.addresLocation.setText(str);
this.awaylocation.setText(MapHelper.getDistance(this.myLatitude, this.myLongitude, this.latitude, this.longitude));
this.latLng = String.valueOf(this.latitude) + ", " + String.valueOf(this.longitude);
}
} else {
this.addresLocation.setText(getString(2131886483));
}
} catch (IOException e) {
e.printStackTrace();
this.addresLocation.setText(getString(2131886483));
}
}
this.mMap.setOnMapClickListener(new ZOnMapClickListener() {
public final void onMapClick(double d, double d7) {
ScreenMap.this.lambda$onMapReady$2(d, d7);
}
});
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
switch (menuItem.getItemId()) {
case R.id.home:
finish();
break;
case 2131362293:
String str = this.latLng;
if (str != null && !str.isEmpty()) {
ClipboardManager clipboardManager = (ClipboardManager) getSystemService("clipboard");
ClipData newPlainText = ClipData.newPlainText("address", this.latLng);
if (clipboardManager != null) {
clipboardManager.setPrimaryClip(newPlainText);
}
Toast.makeText((Context) this, 2131886144, 0).show();
break;
}
break;
case 2131362652:
this.mMap.setMapType(4);
break;
case 2131362956:
this.mMap.setMapType(1);
break;
case 2131363487:
this.mMap.setMapType(2);
break;
}
return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
}
}