[Modify]金币明细布局适配
This commit is contained in:
@@ -361,7 +361,7 @@ public class XChatApplication extends BaseApp {
|
||||
// 如果第三方 APP 需要缓存清理功能, 清理这个目录下面个子目录的内容即可。
|
||||
String sdkPath = null;
|
||||
try {
|
||||
sdkPath = FileHelper.getRootCacheDir().getPath() + "/nim";
|
||||
sdkPath = FileHelper.getRootCacheDir().getAbsolutePath() + "/nim";
|
||||
// sdkPath = Environment.getExternalStorageDirectory() + "/" + BasicConfig.INSTANCE.getAppContext().getPackageName() + "/nim";
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
|
||||
|
@@ -12,12 +12,12 @@ class GoldDetailAdapter :
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: HallMemberGoldFlowInfo) {
|
||||
helper.setText(R.id.tv_user_name, item.nick ?: "--")
|
||||
.setText(R.id.tv_have_exchange, FormatUtils.formatToShortDownW(item.exchangeGolds))
|
||||
.setText(R.id.tv_settlement, FormatUtils.formatToShortDownW(item.remainGolds))
|
||||
.setText(R.id.tv_diamond_pay_record, FormatUtils.formatToShortDownW(item.giftDiamonds))
|
||||
.setText(R.id.tv_have_exchange, FormatUtils.formatToShortDown(item.giftGolds))
|
||||
.setText(R.id.tv_settlement, FormatUtils.formatToShortDown(item.remainGolds))
|
||||
.setText(R.id.tv_diamond_pay_record, FormatUtils.formatToShortDown(item.giftDiamonds))
|
||||
.setText(
|
||||
R.id.tv_have_change,
|
||||
mContext.getString(R.string.have_converted, item.giftGolds.toString())
|
||||
mContext.getString(R.string.have_converted, FormatUtils.formatToShortDown(item.exchangeGolds))
|
||||
)
|
||||
ImageLoadUtilsV2.loadAvatar(helper.getView(R.id.iv_user_avatar), item.avatar)
|
||||
}
|
||||
|
@@ -12,12 +12,12 @@ class GoldRecordAdapter :
|
||||
|
||||
override fun convert(helper: BaseViewHolder, item: HallMemberGoldFlowInfo) {
|
||||
helper.setText(R.id.tv_user_name, item.nick ?: "--")
|
||||
.setText(R.id.tv_have_exchange, FormatUtils.formatToShortDownW(item.giftGolds))
|
||||
.setText(R.id.tv_settlement, FormatUtils.formatToShortDownW(item.remainGolds))
|
||||
.setText(R.id.tv_diamond_pay_record, FormatUtils.formatToShortDownW(item.giftDiamonds))
|
||||
.setText(R.id.tv_have_exchange, FormatUtils.formatToShortDown(item.giftGolds))
|
||||
.setText(R.id.tv_settlement, FormatUtils.formatToShortDown(item.remainGolds))
|
||||
.setText(R.id.tv_diamond_pay_record, FormatUtils.formatToShortDown(item.giftDiamonds))
|
||||
.setText(
|
||||
R.id.tv_have_change,
|
||||
mContext.getString(R.string.have_converted, item.exchangeGolds.toString())
|
||||
mContext.getString(R.string.have_converted, FormatUtils.formatToShortDown(item.exchangeGolds))
|
||||
)
|
||||
.setText(R.id.tv_pos, (helper.layoutPosition + 1).toString())
|
||||
ImageLoadUtilsV2.loadAvatar(helper.getView(R.id.iv_user_avatar), item.avatar)
|
||||
|
@@ -209,52 +209,50 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/mRecyclerViewRoom"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1.8"
|
||||
android:background="@color/color_F0F5F6"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintEnd_toStartOf="@+id/mRecyclerView"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/mRecyclerView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="8.2">
|
||||
android:layout_height="0dp"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_bottom_message"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/mRecyclerViewRoom"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/mRecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_bottom_message"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<TextView
|
||||
android:id="@+id/tv_bottom_message"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_50"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:layout_marginEnd="@dimen/dp_50"
|
||||
android:layout_marginBottom="@dimen/dp_40"
|
||||
android:gravity="center"
|
||||
android:text="@string/room_diamond_message"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/mRecyclerViewRoom"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mRecyclerView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_bottom_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_50"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:layout_marginEnd="@dimen/dp_50"
|
||||
android:layout_marginBottom="@dimen/dp_40"
|
||||
android:text="@string/room_diamond_message"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mRecyclerView" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
@@ -19,10 +19,10 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_user_name"
|
||||
android:layout_width="60dp"
|
||||
android:layout_width="@dimen/dp_40"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_5"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginStart="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:lines="1"
|
||||
|
@@ -2,10 +2,12 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/dp_12"
|
||||
android:paddingBottom="@dimen/dp_12"
|
||||
android:paddingStart="@dimen/dp_12"
|
||||
android:paddingEnd="@dimen/dp_12"
|
||||
android:gravity="center"
|
||||
android:background="@color/color_selector_white_false_f0f5f6"
|
||||
android:orientation="vertical">
|
||||
@@ -23,11 +25,12 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="@dimen/dp_40"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:maxEms="4"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/color_1F1A4E"
|
||||
|
@@ -41,53 +41,6 @@ public class FormatUtils {
|
||||
* @return
|
||||
*/
|
||||
public static String formatToShortDown(double num) {
|
||||
return formatToShortW(num, RoundingMode.DOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 把过长的金额类数字,转换成两位小数带万,亿,兆 缩写
|
||||
* 10000.00 -> 1.00万 四舍五入两位小数后面的小数
|
||||
*
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
public static String formatToShortHalfUp(double num) {
|
||||
return formatToShortW(num, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 把过长的金额类数字,转换成两位小数带万,亿,兆 缩写
|
||||
* 10000.00 -> 1.00万
|
||||
*
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
public static String formatToShortW(double num, RoundingMode roundingMode) {
|
||||
try {
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#,##0.00");
|
||||
decimalFormat.setRoundingMode(roundingMode);
|
||||
double wan = Math.pow(10.0f, 4);
|
||||
double res = num;
|
||||
if (Math.abs(num / wan) < 1) {
|
||||
res = num;
|
||||
return decimalFormat.format(res);
|
||||
} else {
|
||||
res = num / wan;
|
||||
return decimalFormat.format(res) + ResUtil.getString(R.string.number_w);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ResUtil.getString(R.string.xchat_android_library_utils_formatutils_04);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 把过长的金额类数字,转换成两位小数带万,亿,兆 缩写
|
||||
* 10000.00 -> 1.00万 丢掉两位小数后面的小数
|
||||
*
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
public static String formatToShortDownW(double num) {
|
||||
return formatToShort(num, RoundingMode.DOWN);
|
||||
}
|
||||
|
||||
@@ -98,7 +51,7 @@ public class FormatUtils {
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
public static String formatToShortHalfUpW(double num) {
|
||||
public static String formatToShortHalfUp(double num) {
|
||||
return formatToShort(num, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user