机器人Im消息
This commit is contained in:
parent
20916313dd
commit
5b4912815a
@ -923,6 +923,7 @@
|
|||||||
<string name="cannot_yourself">無法@自己</string>
|
<string name="cannot_yourself">無法@自己</string>
|
||||||
<string name="total_star_value">總星值</string>
|
<string name="total_star_value">總星值</string>
|
||||||
<string name="number_of_people_assisted">助力人數</string>
|
<string name="number_of_people_assisted">助力人數</string>
|
||||||
|
<string name="star_change">星级挑战%s</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -108,7 +108,7 @@ public class LiveTextRender {
|
|||||||
spannableStringBuilder.append(" ");
|
spannableStringBuilder.append(" ");
|
||||||
spannableStringBuilder.append(content);
|
spannableStringBuilder.append(content);
|
||||||
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor(nameColor)),
|
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor(nameColor)),
|
||||||
4, 4+aiName.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
4, 4 + aiName.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
if (!TextUtils.isEmpty(userName) && !userName.contains(",")) {
|
if (!TextUtils.isEmpty(userName) && !userName.contains(",")) {
|
||||||
String mContext = content;
|
String mContext = content;
|
||||||
userName = "@" + userName;
|
userName = "@" + userName;
|
||||||
@ -122,13 +122,29 @@ public class LiveTextRender {
|
|||||||
mContext = mContext.substring(end + 1, mContext.length());
|
mContext = mContext.substring(end + 1, mContext.length());
|
||||||
startIndex = startIndex + end + 1;
|
startIndex = startIndex + end + 1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
String[] userNames = userName.split(",");
|
||||||
|
int startIndex = 6 + aiName.length();
|
||||||
|
String mContext = content;
|
||||||
|
for (String name : userNames) {
|
||||||
|
name = "@" + name;
|
||||||
|
while (mContext.contains(name)&&!TextUtils.isEmpty(mContext)) {
|
||||||
|
int index = mContext.indexOf(name);
|
||||||
|
int end = index + name.length();
|
||||||
|
int endIndex = startIndex + name.length();
|
||||||
|
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor("#fffe9b")),
|
||||||
|
startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
mContext = mContext.substring(end + 1, mContext.length());
|
||||||
|
startIndex = startIndex + end + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
drawable.setBounds(0, 0, DpUtil.dp2px(39), DpUtil.dp2px(15));
|
|
||||||
//用这个drawable对象代替字符串easy
|
|
||||||
ImageSpan span = new ImageSpan(drawable, ImageSpan.ALIGN_BASELINE);
|
|
||||||
spannableStringBuilder.setSpan(span, 0, 3, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
|
|
||||||
textView.setText(spannableStringBuilder);
|
|
||||||
}
|
}
|
||||||
|
drawable.setBounds(0, 0, DpUtil.dp2px(39), DpUtil.dp2px(15));
|
||||||
|
//用这个drawable对象代替字符串easy
|
||||||
|
ImageSpan span = new ImageSpan(drawable, ImageSpan.ALIGN_BASELINE);
|
||||||
|
spannableStringBuilder.setSpan(span, 0, 3, Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
|
||||||
|
textView.setText(spannableStringBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,6 +35,7 @@ public class CustomViewHolder implements BannerViewHolder<BannerBean> {
|
|||||||
TextView numberOfPeopleAssisted = contextView.findViewById(R.id.number_of_people_assisted);
|
TextView numberOfPeopleAssisted = contextView.findViewById(R.id.number_of_people_assisted);
|
||||||
TextView targetAssist = contextView.findViewById(R.id.target_assist_num);
|
TextView targetAssist = contextView.findViewById(R.id.target_assist_num);
|
||||||
TextView currentAssist = contextView.findViewById(R.id.current_assist_num);
|
TextView currentAssist = contextView.findViewById(R.id.current_assist_num);
|
||||||
|
TextView title = contextView.findViewById(R.id.title);
|
||||||
if (data.isStart()) {
|
if (data.isStart()) {
|
||||||
startContext.setVisibility(View.VISIBLE);
|
startContext.setVisibility(View.VISIBLE);
|
||||||
Glide.with(context).load(R.mipmap.start_level).into(bannerBack);
|
Glide.with(context).load(R.mipmap.start_level).into(bannerBack);
|
||||||
@ -60,6 +61,7 @@ public class CustomViewHolder implements BannerViewHolder<BannerBean> {
|
|||||||
numberOfPeopleAssisted.setText(TextUtils.isEmpty(data.getModel().getTaskName2()) ? context.getString(R.string.total_star_value) : data.getModel().getTaskName2());
|
numberOfPeopleAssisted.setText(TextUtils.isEmpty(data.getModel().getTaskName2()) ? context.getString(R.string.total_star_value) : data.getModel().getTaskName2());
|
||||||
targetAssist.setText("/" + targetAssistNum);
|
targetAssist.setText("/" + targetAssistNum);
|
||||||
currentAssist.setText(String.valueOf(currentAssistNum));
|
currentAssist.setText(String.valueOf(currentAssistNum));
|
||||||
|
title.setText(String.format(context.getString(R.string.star_change),data.getModel().getTaskNum()));
|
||||||
} else {
|
} else {
|
||||||
String imagerUrl = data.getImageUrl().replace("qny", "downs");
|
String imagerUrl = data.getImageUrl().replace("qny", "downs");
|
||||||
Glide.with(context).load(imagerUrl).into(bannerBack);
|
Glide.with(context).load(imagerUrl).into(bannerBack);
|
||||||
|
@ -17,13 +17,14 @@
|
|||||||
android:layout_marginBottom="10dp">
|
android:layout_marginBottom="10dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="18.33dp"
|
android:layout_marginTop="18.33dp"
|
||||||
android:text="星级挑战"
|
android:text="星级挑战"
|
||||||
android:textColor="#C53F4E"
|
android:textColor="#C53F4E"
|
||||||
android:textSize="6sp" />
|
android:textSize="7sp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -51,7 +52,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/total_star_value"
|
android:text="@string/total_star_value"
|
||||||
android:textColor="#C53F4E"
|
android:textColor="#C53F4E"
|
||||||
android:textSize="5.33sp" />
|
android:textSize="6.5sp" />
|
||||||
|
|
||||||
<com.yunbao.common.views.weight.ProgressView
|
<com.yunbao.common.views.weight.ProgressView
|
||||||
android:id="@+id/total_star_progress"
|
android:id="@+id/total_star_progress"
|
||||||
@ -69,7 +70,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="0"
|
android:text="0"
|
||||||
android:textColor="#FE762A"
|
android:textColor="#FE762A"
|
||||||
android:textSize="5.33dp" />
|
android:textSize="6.5dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/target_start"
|
android:id="@+id/target_start"
|
||||||
@ -77,7 +78,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="/100"
|
android:text="/100"
|
||||||
android:textColor="#7A0002"
|
android:textColor="#7A0002"
|
||||||
android:textSize="5.33dp" />
|
android:textSize="6.5dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -110,7 +111,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/number_of_people_assisted"
|
android:text="@string/number_of_people_assisted"
|
||||||
android:textColor="#C53F4E"
|
android:textColor="#C53F4E"
|
||||||
android:textSize="5.33sp" />
|
android:textSize="6.5sp" />
|
||||||
|
|
||||||
<com.yunbao.common.views.weight.ProgressView
|
<com.yunbao.common.views.weight.ProgressView
|
||||||
android:id="@+id/assist_progress"
|
android:id="@+id/assist_progress"
|
||||||
@ -129,7 +130,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="0"
|
android:text="0"
|
||||||
android:textColor="#FE762A"
|
android:textColor="#FE762A"
|
||||||
android:textSize="5.33dp" />
|
android:textSize="6.5dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/target_assist_num"
|
android:id="@+id/target_assist_num"
|
||||||
@ -137,7 +138,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="/100"
|
android:text="/100"
|
||||||
android:textColor="#7A0002"
|
android:textColor="#7A0002"
|
||||||
android:textSize="5.33dp" />
|
android:textSize="6.5dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user