默认样式修改

This commit is contained in:
ningwenqiang 2024-09-21 15:55:16 +08:00
parent f30144c42c
commit b3c962c03b
8 changed files with 119 additions and 53 deletions

View File

@ -7,6 +7,7 @@ import android.text.TextUtils;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import io.rong.common.RLog;
import io.rong.imkit.utils.language.LangUtils;
@ -50,8 +51,31 @@ public class DateFormatUtil {
return formattedDate;
}
public static String getDiffInMilliseconds(String time1, String time2) {
return String.valueOf((Long.parseLong(time2) - Long.parseLong(time1)) / (60 * 1000));
public static String getDiffInMilliseconds(String time1, String time2, String day, String hour, String minute) {
return getTime(Long.parseLong(time1), Long.parseLong(time2), day, hour, minute);
}
//根据时间计算出 分钟,小时
private static String getTime(Long startTime, Long endTime, String day, String hour, String minute) {
if (startTime == null || endTime == null || startTime >= endTime) {
return "Invalid time range";
}
long diff = endTime - startTime;
long days = TimeUnit.MILLISECONDS.toDays(diff);
long hours = TimeUnit.MILLISECONDS.toHours(diff) - (days * 24);
long minutes = TimeUnit.MILLISECONDS.toMinutes(diff) - (TimeUnit.MILLISECONDS.toHours(diff) * 60);
StringBuilder stringBuilder = new StringBuilder();
if (days > 0) {
stringBuilder.append(days).append(day).append(" ");
} else if (hours > 0) {
stringBuilder.append(hours).append(hour).append(" ");
} else if (minutes > 0) {
stringBuilder.append(minutes).append(minute);
}
return stringBuilder.toString();
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white" />
<corners
android:radius="5dp"/>
</shape>

View File

@ -66,11 +66,12 @@ public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter<LiveAnchorSa
public ItemsViewHolder(@NonNull View itemView) {
super(itemView);
textView = itemView.findViewById(R.id.contentTv);
icon = itemView.findViewById(R.id.anchorSayBg);
itemView.setOnClickListener(v -> click());
textView.setOnClickListener(v -> click());
icon.setOnClickListener(v -> click());
// textView = itemView.findViewById(R.id.contentTv);
// icon = itemView.findViewById(R.id.anchorSayBg);
// itemView.setOnClickListener(v -> click());
// textView.setOnClickListener(v -> click());
// icon.setOnClickListener(v -> click());
}
@ -91,16 +92,16 @@ public class LiveAnchorSayItemsAdapter extends RecyclerView.Adapter<LiveAnchorSa
public void setData(String text, int position) {
// textView.setText("已输入的\n内容已输\n入的内容\n已输入的");
if (TextUtils.isEmpty(text)) {
icon.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.bg_live_room_say));
} else {
ImgLoader.display(mContext, text, icon);
}
if (position == click) {
itemView.setBackgroundResource(R.drawable.bg_anchor_say_select);
} else {
itemView.setBackgroundResource(R.drawable.bg_anchor_say);
}
// if (TextUtils.isEmpty(text)) {
// icon.setImageDrawable(ContextCompat.getDrawable(mContext, R.drawable.bg_live_room_say));
// } else {
// ImgLoader.display(mContext, text, icon);
// }
// if (position == click) {
// itemView.setBackgroundResource(R.drawable.bg_anchor_say_select);
// } else {
// itemView.setBackgroundResource(R.drawable.bg_anchor_say);
// }
}
}
}

View File

@ -366,7 +366,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
if (liveDurationAnchor != null) {
String timeStr = DateFormatUtil.getTimeLiveEndString(Long.parseLong(starttime))+
" - "+DateFormatUtil.getTimeLiveEndString(Long.parseLong(endtime))
+" "+mContext.getResources().getString(R.string.live_end_total)+" "+DateFormatUtil.getDiffInMilliseconds(starttime,endtime)+" "+mContext.getResources().getString(R.string.live_end_minute);
+" "+mContext.getResources().getString(R.string.live_end_total)+" "+DateFormatUtil.getDiffInMilliseconds(starttime,endtime,mContext.getResources().getString(R.string.live_end_day),mContext.getResources().getString(R.string.live_end_hour),mContext.getResources().getString(R.string.live_end_minute));
liveDurationAnchor.setText(timeStr);
}
if (liveVotes != null) {

View File

@ -1,33 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="106dp"
android:layout_height="128dp"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:background="@drawable/bg_anchor_say"
android:layout_marginTop="10dp">
android:background="@drawable/bg_anchor_say_select">
<include
android:id="@+id/room_anchor_say"
layout="@layout/sim_live_room_anchor_say1"
android:layout_width="67dp"
android:layout_height="88dp"
app:layout_constraintBottom_toBottomOf="parent"
<View
android:id="@+id/view1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="6dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="6dp"
android:background="@drawable/background_white_5"
app:layout_constraintDimensionRatio="3.7"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.2" />
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/view2"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:layout_marginTop="6dp"
android:background="@drawable/background_white_5"
app:layout_constraintDimensionRatio="1.34"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view1" />
<TextView
app:layout_constraintTop_toBottomOf="@+id/view2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/room_anchor_say"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:text="默認樣式"
android:layout_marginTop="8dp"
android:layout_marginBottom="3dp"
android:textColor="@color/white"
android:textSize="12sp"
android:text="默認樣式" />
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -454,7 +454,7 @@
android:layout_weight="1"
android:text="主播等级Lv.1 | 差600經驗升級"
android:textColor="#898989"
android:textSize="11sp" />
android:textSize="10sp" />
<TextView
android:id="@+id/my_level"
@ -838,7 +838,7 @@
</LinearLayout>
<RelativeLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="37dp"
android:layout_marginStart="16dp"
@ -850,41 +850,53 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="10dp"
android:src="@mipmap/icon_live_end_tips" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="23dp"
android:text="@string/live_end_strategy"
android:textColor="#CCCCCC"
android:textSize="14sp" />
<ImageView
android:id="@+id/right2Img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_gravity="center"
android:layout_marginEnd="10dp"
android:src="@mipmap/right_live_end" />
<TextView
android:id="@+id/right2Tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/right2Img"
android:layout_marginEnd="8dp"
android:text="@string/live_end_strategy"
android:textColor="#CCCCCC"
android:textSize="14sp" />
<ViewFlipper
android:id="@+id/live_end_vf"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_centerVertical="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="35dp"
android:layout_marginEnd="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/right2Tv"
android:flipInterval="5000"
android:inAnimation="@anim/anim_marquee_in"
android:outAnimation="@anim/anim_marquee_out" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"

View File

@ -159,6 +159,8 @@
<string name="live_end_strategy">直播攻略</string>
<string name="live_end_level">我的等级</string>
<string name="live_end_total"></string>
<string name="live_end_day"></string>
<string name="live_end_hour">小時</string>
<string name="live_end_minute">分鐘</string>
<string name="live_data_now_bottom_zs">本場總計鑽石:</string>
<string name="live_data_now_bottom_person">打賞人數:</string>

View File

@ -162,6 +162,8 @@
<string name="live_end_strategy">Live strategy</string>
<string name="live_end_level">My level</string>
<string name="live_end_total">total</string>
<string name="live_end_day">day</string>
<string name="live_end_hour">hour</string>
<string name="live_end_minute">minute</string>
<string name="live_data_now_bottom_zs">Get diamonds:</string>
<string name="live_data_now_bottom_person">Gift givers:</string>