From c5def566076de39be6bbdd8fdd6ebc3c0b4ad0b5 Mon Sep 17 00:00:00 2001 From: guozhen <878631970@qq.com> Date: Fri, 18 Oct 2024 18:09:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Ecash=E5=82=A8=E5=80=BC?= =?UTF-8?q?=E5=88=86=E6=9C=9F=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 23 +++++++--- .../java/com/dskj/rbchat/IMUIKitConfig.java | 3 +- .../rbchat/map/LocationPageActivity1.java | 45 ++++++++++++++----- .../com/dskj/rbchat/wallet/TopUpActivity.java | 6 ++- 4 files changed, 57 insertions(+), 20 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index c98cc21..b31cbfa 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -72,13 +72,19 @@ android { signingConfig = signingConfigs.getByName("release") isDebuggable = false; +// buildConfigField( +// "String", +// "HTTPS_BASE_URL", +// "\"https://api.letschat2023.com/\"" +// ) + buildConfigField( "String", - "HTTPS_BASE_URL", - "\"https://api.letschat2023.com/\"" + "APIKEY", + "\"AIzaSyB7P1o1EIA02eWoNP_7QJ9XwWe3WkSZb9k\"" ) //正式服 - manifestPlaceholders["IMAPPKEY"] = "c38c8bbebf7d12992d2a361bfceb6c6f" //正式 + manifestPlaceholders["IMAPPKEY"] = "c38c8bbebf7d12992d2a361bfceb6c6f" //正式 // manifestPlaceholders["IMAPPKEY"] = "4cb6b0998f9e7af9d7673963e429959a" } @@ -92,13 +98,18 @@ android { signingConfig = signingConfigs.getByName("release") isDebuggable = true +// buildConfigField( +// "String", +// "HTTPS_BASE_URL", +// "\"https://api-test.letschat2023.com/\"" +// ) buildConfigField( "String", - "HTTPS_BASE_URL", - "\"https://api-test.letschat2023.com/\"" + "APIKEY", + "\"AIzaSyB7P1o1EIA02eWoNP_7QJ9XwWe3WkSZb9k\"" ) //测试APPKEY - manifestPlaceholders["IMAPPKEY"] = "4cb6b0998f9e7af9d7673963e429959a" + manifestPlaceholders["IMAPPKEY"] = "4cb6b0998f9e7af9d7673963e429959a" // manifestPlaceholders["IMAPPKEY"] = "c38c8bbebf7d12992d2a361bfceb6c6f" diff --git a/app/src/main/java/com/dskj/rbchat/IMUIKitConfig.java b/app/src/main/java/com/dskj/rbchat/IMUIKitConfig.java index 9ad9a0b..4a5337f 100644 --- a/app/src/main/java/com/dskj/rbchat/IMUIKitConfig.java +++ b/app/src/main/java/com/dskj/rbchat/IMUIKitConfig.java @@ -168,5 +168,6 @@ public class IMUIKitConfig { /** * GoogleMap apikey */ - public static final String API_KEY = "AIzaSyB7P1o1EIA02eWoNP_7QJ9XwWe3WkSZb9k"; +// public static final String API_KEY = "AIzaSyB7P1o1EIA02eWoNP_7QJ9XwWe3WkSZb9k"; + //AIzaSyAAXviskUffLY3KfnrKVPlwcj5Ks5ces_8 } diff --git a/app/src/main/java/com/dskj/rbchat/map/LocationPageActivity1.java b/app/src/main/java/com/dskj/rbchat/map/LocationPageActivity1.java index b311158..6400370 100644 --- a/app/src/main/java/com/dskj/rbchat/map/LocationPageActivity1.java +++ b/app/src/main/java/com/dskj/rbchat/map/LocationPageActivity1.java @@ -42,6 +42,7 @@ import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.LinearLayoutManager; import com.bumptech.glide.Glide; +import com.dskj.rbchat.BuildConfig; import com.dskj.rbchat.IMUIKitConfig; import com.dskj.rbchat.adapter.CommonAdapter; import com.dskj.rbchat.adapter.ViewHolder; @@ -118,7 +119,8 @@ public class LocationPageActivity1 extends BaseActivity implements OnMapReadyCal private IPageMapProvider pageMapProvider; LatLng sydney; LatLng locLatLng; - Marker marker ; + Marker marker; + public static void launch(Context context, int type, IMMessage message) { Intent intent = new Intent(context, LocationPageActivity1.class); intent.putExtra(LAUNCH_TYPE, type); @@ -221,9 +223,9 @@ public class LocationPageActivity1 extends BaseActivity implements OnMapReadyCal holder.setText(R.id.location_title, s.getName()); holder.setText(R.id.location_desc, s.getVicinity()); String desc = s.getVicinity(); - if(locLatLng!=null) { - float distance = gps2m(locLatLng.latitude,locLatLng.longitude,s.getGeometry().getLocation().getLat(),s.getGeometry().getLocation().getLng()); - if (distance > 0&&distance<1000) { + if (locLatLng != null) { + float distance = gps2m(locLatLng.latitude, locLatLng.longitude, s.getGeometry().getLocation().getLat(), s.getGeometry().getLocation().getLng()); + if (distance > 0 && distance < 1000) { desc = getString(R.string.chat_message_location_distance, Math.ceil(distance), desc); holder.setText(R.id.location_desc, desc); @@ -245,15 +247,15 @@ public class LocationPageActivity1 extends BaseActivity implements OnMapReadyCal if (mMap != null) { sydney = new LatLng(s.getGeometry().getLocation().getLat(), s.getGeometry().getLocation().getLng()); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 13)); - if(marker!=null){ + if (marker != null) { marker.remove(); } - Bitmap bitmap = BitmapFactory.decodeResource(getResources(),com.netease.yunxin.kit.locationkit.R.drawable.ic_location_marker).copy(Bitmap.Config.ARGB_8888,true); + Bitmap bitmap = BitmapFactory.decodeResource(getResources(), com.netease.yunxin.kit.locationkit.R.drawable.ic_location_marker).copy(Bitmap.Config.ARGB_8888, true); //ic_location_marker marker = mMap.addMarker(new MarkerOptions() .title(s.getName() + "") .icon(BitmapDescriptorFactory.fromResource(com.netease.yunxin.kit.locationkit.R.drawable.ic_location_marker)) - .snippet(s.getVicinity()+"") + .snippet(s.getVicinity() + "") .position(sydney)); } @@ -265,6 +267,7 @@ public class LocationPageActivity1 extends BaseActivity implements OnMapReadyCal // 计算两点距离 private final double EARTH_RADIUS = 6378137.0; + private float gps2m(double lat_a, double lng_a, double lat_b, double lng_b) { double radLat1 = (lat_a * Math.PI / 180.0); double radLat2 = (lat_b * Math.PI / 180.0); @@ -296,6 +299,16 @@ public class LocationPageActivity1 extends BaseActivity implements OnMapReadyCal mMap = googleMap; mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); buildGoogleApiClient(); + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + // TODO: Consider calling + // ActivityCompat#requestPermissions + // here to request the missing permissions, and then overriding + // public void onRequestPermissionsResult(int requestCode, String[] permissions, + // int[] grantResults) + // to handle the case where the user grants the permission. See the documentation + // for ActivityCompat#requestPermissions for more details. + return; + } mMap.setMyLocationEnabled(true); @@ -309,7 +322,7 @@ public class LocationPageActivity1 extends BaseActivity implements OnMapReadyCal LocationAttachment attachment = (LocationAttachment) message.getAttachment(); sydney = new LatLng(attachment.getLatitude(), attachment.getLongitude()); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 15)); - if(marker!=null){ + if (marker != null) { marker.remove(); } marker = mMap.addMarker(new MarkerOptions() @@ -355,6 +368,16 @@ public class LocationPageActivity1 extends BaseActivity implements OnMapReadyCal LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); boolean enabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); if (enabled) { + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + // TODO: Consider calling + // ActivityCompat#requestPermissions + // here to request the missing permissions, and then overriding + // public void onRequestPermissionsResult(int requestCode, String[] permissions, + // int[] grantResults) + // to handle the case where the user grants the permission. See the documentation + // for ActivityCompat#requestPermissions for more details. + return; + } locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 2000L, 10f, new LocationListener() { @Override public void onLocationChanged(@NonNull Location location) { @@ -363,7 +386,7 @@ public class LocationPageActivity1 extends BaseActivity implements OnMapReadyCal return; } LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); - if(latLng!=null) { + if (latLng != null) { sydney = new LatLng(location.getLatitude(), location.getLongitude()); locLatLng = new LatLng(location.getLatitude(), location.getLongitude()); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 13)); @@ -382,7 +405,7 @@ public class LocationPageActivity1 extends BaseActivity implements OnMapReadyCal } if(TextUtils.isEmpty(s)) { Api.getInstance().nearbysearch(sydney.latitude + "," + sydney.longitude, "10000", "", - "true", IMUIKitConfig.API_KEY) + "true", BuildConfig.APIKEY) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new BaseObserverNew<>() { @@ -399,7 +422,7 @@ public class LocationPageActivity1 extends BaseActivity implements OnMapReadyCal }); }else{ Api.getInstance().nearbysearch(sydney.latitude + "," + sydney.longitude, "10000", "", - "true", IMUIKitConfig.API_KEY,s) + "true", BuildConfig.APIKEY,s) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new BaseObserverNew<>() { diff --git a/app/src/main/java/com/dskj/rbchat/wallet/TopUpActivity.java b/app/src/main/java/com/dskj/rbchat/wallet/TopUpActivity.java index 7fad2f3..a20ce09 100644 --- a/app/src/main/java/com/dskj/rbchat/wallet/TopUpActivity.java +++ b/app/src/main/java/com/dskj/rbchat/wallet/TopUpActivity.java @@ -60,7 +60,7 @@ public class TopUpActivity extends BaseActivity { private List installmentBeans = new ArrayList<>(); CommonAdapter commonAdapter; CommonAdapter installmentAdapter; - int defaultIndex = 0; + int defaultIndex = 0; //输入的金额 private boolean isFenqi = false; private int installmentNum; //分期數 @@ -95,7 +95,9 @@ public class TopUpActivity extends BaseActivity { } else { viewBinding.tvPaytypeCard.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.mipmap.ic_single_selected), null); viewBinding.tvPaytypeFenqi.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(R.mipmap.dialog_gou_ff), null); - + installmentNum = 0; + if (installmentAdapter != null) + installmentAdapter.notifyDataSetChanged(); } }