From 380b9694cccf2965f8683769b9049bb944520d80 Mon Sep 17 00:00:00 2001 From: wlh <646507849@qq.com> Date: Tue, 30 Jan 2024 11:02:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E5=BB=BA365-=E4=BA=8C=E6=9C=9F?= =?UTF-8?q?=E5=BC=80=E5=8F=91-=E4=BC=98=E5=8C=96=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/xty/common/util/ImageGetterUtils.java | 6 +++--- common/src/main/java/com/xty/common/util/NumUtils.kt | 7 +++++++ .../main/java/com/xty/network/model/HealthArchiveBean.kt | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/xty/common/util/ImageGetterUtils.java b/common/src/main/java/com/xty/common/util/ImageGetterUtils.java index 320f14d..6339e73 100644 --- a/common/src/main/java/com/xty/common/util/ImageGetterUtils.java +++ b/common/src/main/java/com/xty/common/util/ImageGetterUtils.java @@ -65,14 +65,14 @@ public class ImageGetterUtils { int width = bitmap.getWidth(); int height = bitmap.getHeight(); //设置想要的大小 - int newWidth = width; - int newHeight = height; + int newWidth = textView.getMeasuredWidth(); //width; + int newHeight = textView.getMeasuredHeight(); //height; //计算压缩的比率 float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; //获取想要缩放的matrix Matrix matrix = new Matrix(); - matrix.postScale(scaleWidth, scaleHeight); + matrix.postScale(scaleWidth, scaleWidth); //获取新的bitmap bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true); diff --git a/common/src/main/java/com/xty/common/util/NumUtils.kt b/common/src/main/java/com/xty/common/util/NumUtils.kt index e1bbc1b..01813f1 100644 --- a/common/src/main/java/com/xty/common/util/NumUtils.kt +++ b/common/src/main/java/com/xty/common/util/NumUtils.kt @@ -1,6 +1,7 @@ package com.xty.common.util import java.math.BigDecimal +import java.text.DecimalFormat object NumUtils { @@ -12,4 +13,10 @@ object NumUtils { val b2 = BigDecimal(java.lang.Double.toString(valueTwo.toDouble())) return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).toDouble() } + + fun formatter(value:Double,formatter:String):String{ + + var mFormat = DecimalFormat(formatter) + return mFormat.format(value).toString() + } } \ No newline at end of file diff --git a/network/src/main/java/com/xty/network/model/HealthArchiveBean.kt b/network/src/main/java/com/xty/network/model/HealthArchiveBean.kt index 68edf9d..7986d44 100644 --- a/network/src/main/java/com/xty/network/model/HealthArchiveBean.kt +++ b/network/src/main/java/com/xty/network/model/HealthArchiveBean.kt @@ -1,5 +1,7 @@ package com.xty.network.model +import com.umeng.commonsdk.debug.D + data class HealthArchiveBean( var bmiInfo:BMIInfo, var healData:ArrayList, @@ -7,7 +9,7 @@ data class HealthArchiveBean( var bmi:String, var userSchedule:Int,//完善进度 - var bodyFat:String, //体脂率 + var bodyFat:Double, //体脂率 var surveys:SurveysBean ){