|
|
@@ -3,13 +3,19 @@ package com.usai.redant.raimage;
|
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
import android.graphics.Bitmap;
|
|
|
+import android.graphics.Color;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
|
import android.os.Message;
|
|
|
import android.support.annotation.NonNull;
|
|
|
import android.support.annotation.Nullable;
|
|
|
import android.support.v7.app.AppCompatActivity;
|
|
|
+import android.text.Spannable;
|
|
|
+import android.text.SpannableString;
|
|
|
+import android.text.Spanned;
|
|
|
import android.text.TextUtils;
|
|
|
+import android.text.style.AbsoluteSizeSpan;
|
|
|
+import android.text.style.ForegroundColorSpan;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.Menu;
|
|
|
import android.view.MenuItem;
|
|
|
@@ -230,7 +236,30 @@ public class ModeActivity extends AppCompatActivity {
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- holder.mode.setText(mode.getString("name").toString());
|
|
|
+
|
|
|
+ String name = mode.getString("name").toString();
|
|
|
+ String desc = mode.optString("description",null).toString();
|
|
|
+ desc = "dfhajkdhfadfjagdjfgajkdgajdgjafgdsjgajkdfakdadaljlflaalsallsadf44566";
|
|
|
+ if (name != null && name.length() > 0 && desc != null && desc.length() > 0) {
|
|
|
+ String str = name + " -- " + desc;
|
|
|
+ Spannable span = new SpannableString(str);
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * Spanned.SPAN_EXCLUSIVE_EXCLUSIVE --- 不包含两端start和end所在的端点 (a,b)
|
|
|
+ * Spanned.SPAN_EXCLUSIVE_INCLUSIVE --- 不包含端start,但包含end所在的端点 (a,b]
|
|
|
+ * Spanned.SPAN_INCLUSIVE_EXCLUSIVE --- 包含两端start,但不包含end所在的端点 [a,b)
|
|
|
+ * Spanned.SPAN_INCLUSIVE_INCLUSIVE--- 包含两端start和end所在的端点 [a,b]
|
|
|
+ * */
|
|
|
+ span.setSpan(new AbsoluteSizeSpan(15,true), name.length() + 1, str.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
|
+ span.setSpan(new ForegroundColorSpan(Color.RED),name.length() + 1,str.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
|
+ span.setSpan(new AbsoluteSizeSpan(17,true), 0, name.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
|
+ span.setSpan(new ForegroundColorSpan(Color.BLACK),0,name.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
|
|
+ holder.mode.setText(span);
|
|
|
+ } else {
|
|
|
+ holder.mode.setText(name);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
int enable = mode.getInt("enable");
|
|
|
|
|
|
if (enable == 0) {
|