电量记录表里添加换行显示功能。
This commit is contained in:
		| @@ -1,8 +1,8 @@ | ||||
| #Created by .winboll/winboll_app_build.gradle | ||||
| #Sun Aug 31 06:21:48 CST 2025 | ||||
| #Wed Sep 03 12:53:17 GMT 2025 | ||||
| stageCount=12 | ||||
| libraryProject= | ||||
| baseVersion=15.4 | ||||
| publishVersion=15.4.11 | ||||
| buildCount=0 | ||||
| buildCount=11 | ||||
| baseBetaVersion=15.4.12 | ||||
|   | ||||
| @@ -16,6 +16,7 @@ import cc.winboll.studio.powerbell.receivers.ControlCenterServiceReceiver; | ||||
| import cc.winboll.studio.powerbell.utils.AppCacheUtils; | ||||
| import cc.winboll.studio.powerbell.utils.StringUtils; | ||||
| import java.util.ArrayList; | ||||
| import android.widget.Switch; | ||||
|  | ||||
| public class ClearRecordActivity extends Activity { | ||||
|  | ||||
| @@ -24,6 +25,7 @@ public class ClearRecordActivity extends Activity { | ||||
|     AToolbar mAToolbar; | ||||
|     TextView mtvRecordText; | ||||
|     App mApplication; | ||||
| 	boolean mIsShowRecordWithEnter = false; | ||||
|  | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
| @@ -47,7 +49,7 @@ public class ClearRecordActivity extends Activity { | ||||
|                     finish(); | ||||
|                 } | ||||
|             }); | ||||
|              | ||||
|  | ||||
|         // 设置滑动清理控件 | ||||
|         // | ||||
|         // 初始化发送拉动控件 | ||||
| @@ -79,7 +81,18 @@ public class ClearRecordActivity extends Activity { | ||||
|  | ||||
|     void initRecordText() { | ||||
|         ArrayList<BatteryInfoBean> listBatteryInfo = AppCacheUtils.getInstance(this).getArrayListBatteryInfo(); | ||||
|         String szRecordText = StringUtils.formatPCMListString(listBatteryInfo); | ||||
|         mtvRecordText.setText(szRecordText); | ||||
| 		if (mIsShowRecordWithEnter) { | ||||
| 			String szRecordText = StringUtils.formatPCMListStringWithEnter(listBatteryInfo); | ||||
| 			mtvRecordText.setText(szRecordText); | ||||
| 		} else { | ||||
| 			String szRecordText = StringUtils.formatPCMListString(listBatteryInfo); | ||||
| 			mtvRecordText.setText(szRecordText); | ||||
| 		} | ||||
|     } | ||||
|  | ||||
| 	public void onShowRecordWithEnter(View view) { | ||||
| 		Switch swShowRecordWithEnter = (Switch)view; | ||||
| 		mIsShowRecordWithEnter = swShowRecordWithEnter.isChecked(); | ||||
| 		initRecordText(); | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -37,6 +37,15 @@ public class StringUtils { | ||||
|         } | ||||
|         return sz; | ||||
|     } | ||||
| 	 | ||||
| 	public static String formatPCMListStringWithEnter(ArrayList<BatteryInfoBean> arrayListBatteryInfo) { | ||||
|         String sz = ""; | ||||
|         for (int i = 0; i < arrayListBatteryInfo.size() - 1; i++) { | ||||
|             //LogUtils.d(TAG, "arrayListBatteryInfo.get(i).getBattetyValue() is "+ Integer.toString(arrayListBatteryInfo.get(i).getBattetyValue())); | ||||
|             sz = "\n" + arrayListBatteryInfo.get(i).getBattetyValue() + "%\n        " + getTimespanDifference(arrayListBatteryInfo.get(i).getTimeStamp(), arrayListBatteryInfo.get(i + 1).getTimeStamp()) + " " + sz; | ||||
|         } | ||||
|         return sz; | ||||
|     } | ||||
|  | ||||
|     // 获取时间之间的时间跨度字符串。 | ||||
|     // Get timespan string between times. | ||||
|   | ||||
| @@ -47,12 +47,32 @@ | ||||
| 		android:layout_weight="1.0" | ||||
| 		android:background="@drawable/bg_frame"> | ||||
|  | ||||
| 		<TextView | ||||
| 		<LinearLayout | ||||
| 			android:orientation="horizontal" | ||||
| 			android:layout_width="match_parent" | ||||
| 			android:layout_height="wrap_content" | ||||
| 			android:text="Record Text" | ||||
| 			android:textStyle="bold" | ||||
| 			android:gravity="center_horizontal"/> | ||||
| 			android:gravity="center_horizontal"> | ||||
|  | ||||
| 			<TextView | ||||
| 				android:layout_width="0dp" | ||||
| 				android:layout_height="wrap_content" | ||||
| 				android:text="Record Text" | ||||
| 				android:textStyle="bold" | ||||
| 				android:gravity="center_horizontal" | ||||
| 				android:layout_weight="1.0" | ||||
| 				android:layout_marginLeft="10dp" | ||||
| 				android:background="#FFD5D5D5"/> | ||||
|  | ||||
| 			<Switch | ||||
| 				android:layout_width="wrap_content" | ||||
| 				android:layout_height="wrap_content" | ||||
| 				android:text="<↲>" | ||||
| 				android:id="@+id/activityclearrecordSwitch1" | ||||
| 				android:onClick="onShowRecordWithEnter" | ||||
| 				android:layout_marginLeft="10dp" | ||||
| 				android:layout_marginRight="10dp"/> | ||||
|  | ||||
| 		</LinearLayout> | ||||
|  | ||||
| 		<ScrollView | ||||
| 			android:layout_width="match_parent" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ZhanGSKen
					ZhanGSKen