Merge remote-tracking branch 'origin/timestamp' into appbase

This commit is contained in:
ZhanGSKen 2025-05-07 19:23:19 +08:00
commit bb9f46373a
27 changed files with 60 additions and 63 deletions

View File

@ -29,7 +29,7 @@ android {
// versionName // versionName
// .winboll/winbollBuildProps.properties stageCount=0 // .winboll/winbollBuildProps.properties stageCount=0
// Gradle编译环境下合起来的 versionName "${versionName}.0" // Gradle编译环境下合起来的 versionName "${versionName}.0"
versionName "15.0" versionName "15.1"
if(true) { if(true) {
versionName = genVersionName("${versionName}") versionName = genVersionName("${versionName}")
} }

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Wed May 07 13:33:12 HKT 2025 #Wed May 07 15:07:02 HKT 2025
stageCount=12 stageCount=2
libraryProject= libraryProject=
baseVersion=15.0 baseVersion=15.1
publishVersion=15.0.11 publishVersion=15.1.1
buildCount=0 buildCount=0
baseBetaVersion=15.0.12 baseBetaVersion=15.1.2

View File

@ -2,7 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" > xmlns:tools="http://schemas.android.com/tools" >
<application> <application
tools:replace="android:icon,android:roundIcon"
android:icon="@drawable/ic_launcher_beta"
android:roundIcon="@drawable/ic_launcher_beta">
<!-- Put flavor specific code here --> <!-- Put flavor specific code here -->

View File

@ -14,8 +14,8 @@
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher_stage"
android:roundIcon="@drawable/ic_launcher" android:roundIcon="@drawable/ic_launcher_stage"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/MyAppTheme" android:theme="@style/MyAppTheme"
android:resizeableActivity="true" android:resizeableActivity="true"

View File

@ -60,6 +60,10 @@ public class App extends GlobalApplication {
//CrashHandler.getInstance().registerGlobal(this); //CrashHandler.getInstance().registerGlobal(this);
//CrashHandler.getInstance().registerPart(this); //CrashHandler.getInstance().registerPart(this);
} }
public static int getAPPIcon() {
return BuildConfig.DEBUG?R.drawable.ic_launcher_beta:R.drawable.ic_launcher_stage;
}
public static void write(InputStream input, OutputStream output) throws IOException { public static void write(InputStream input, OutputStream output) throws IOException {
byte[] buf = new byte[1024 * 8]; byte[] buf = new byte[1024 * 8];

View File

@ -209,7 +209,7 @@ public class MainService extends Service {
case MSG_UPDATE_TIMESTAMP: case MSG_UPDATE_TIMESTAMP:
{ {
String szTimeStampShowString = TimeStampUtil.getInstance(MainService.this).getTimeStampShowString(); String szTimeStampShowString = TimeStampUtil.getInstance(MainService.this).getTimeStampShowString();
mNotificationHelper.sendForegroundNotification(MainService.this, "时间戳:\n" + szTimeStampShowString + "\n已拷贝到剪贴板"); mNotificationHelper.sendForegroundNotification(MainService.this, "时间戳:\n" + szTimeStampShowString + "\n已截取");
LogUtils.d(TAG, "Hello, World! " + szTimeStampShowString); LogUtils.d(TAG, "Hello, World! " + szTimeStampShowString);
break; break;

View File

@ -10,6 +10,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.widget.Toast; import android.widget.Toast;
import cc.winboll.studio.libappbase.LogUtils; import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.timestamp.BuildConfig;
import cc.winboll.studio.timestamp.MainService; import cc.winboll.studio.timestamp.MainService;
import cc.winboll.studio.timestamp.utils.ClipboardUtil; import cc.winboll.studio.timestamp.utils.ClipboardUtil;
import cc.winboll.studio.timestamp.utils.TimeStampUtil; import cc.winboll.studio.timestamp.utils.TimeStampUtil;
@ -18,7 +19,7 @@ public class ButtonClickReceiver extends BroadcastReceiver {
public static final String TAG = "ButtonClickReceiver"; public static final String TAG = "ButtonClickReceiver";
public static final String BUTTON_COPYTIMESTAMP_ACTION = "cc.winboll.studio.timestamp.receivers.ButtonClickReceiver.BUTTON_COPYTIMESTAMP_ACTION"; public static final String BUTTON_COPYTIMESTAMP_ACTION = ButtonClickReceiver.class.getName() + (BuildConfig.DEBUG ?".DEBUG_": ".") + "BUTTON_COPYTIMESTAMP_ACTION";
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {

View File

@ -16,6 +16,7 @@ import android.graphics.Color;
import android.media.RingtoneManager; import android.media.RingtoneManager;
import android.net.Uri; import android.net.Uri;
import android.widget.RemoteViews; import android.widget.RemoteViews;
import cc.winboll.studio.timestamp.App;
import cc.winboll.studio.timestamp.MainActivity; import cc.winboll.studio.timestamp.MainActivity;
import cc.winboll.studio.timestamp.MainService; import cc.winboll.studio.timestamp.MainService;
import cc.winboll.studio.timestamp.R; import cc.winboll.studio.timestamp.R;
@ -89,10 +90,10 @@ public class NotificationHelper {
//.setContentText(nessageNotificationBean.getContent()) //.setContentText(nessageNotificationBean.getContent())
//.setContent(remoteviews) //.setContent(remoteviews)
.setWhen(System.currentTimeMillis()) .setWhen(System.currentTimeMillis())
.setSmallIcon(R.drawable.ic_launcher) .setSmallIcon(App.getAPPIcon())
//设置红色 //设置红色
.setColor(Color.parseColor("#F00606")) .setColor(Color.parseColor("#F00606"))
.setLargeIcon(BitmapFactory.decodeResource(service.getResources(), R.drawable.ic_launcher)) .setLargeIcon(BitmapFactory.decodeResource(service.getResources(), App.getAPPIcon()))
.setContentIntent(mForegroundPendingIntent) .setContentIntent(mForegroundPendingIntent)
.build(); .build();
@ -105,6 +106,8 @@ public class NotificationHelper {
remoteViews.setTextColor(R.id.tv_timestamp, mContext.getResources().getColor(R.color.colorAccent, null)); remoteViews.setTextColor(R.id.tv_timestamp, mContext.getResources().getColor(R.color.colorAccent, null));
// 这里虽然不能直接设置字体大小但可以通过反射等方式尝试不推荐且有兼容性问题 // 这里虽然不能直接设置字体大小但可以通过反射等方式尝试不推荐且有兼容性问题
// 设置按钮图片
remoteViews.setImageViewResource(R.id.iv_copytimestamp, App.getAPPIcon());
// 创建点击通知后的意图 // 创建点击通知后的意图
Intent intentMain = new Intent(mContext, MainActivity.class); Intent intentMain = new Intent(mContext, MainActivity.class);
PendingIntent pendingMainIntent = PendingIntent.getActivity(mContext, 0, intentMain, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent pendingMainIntent = PendingIntent.getActivity(mContext, 0, intentMain, PendingIntent.FLAG_UPDATE_CURRENT);
@ -121,7 +124,7 @@ public class NotificationHelper {
); );
// 为按钮设置点击事件 // 为按钮设置点击事件
remoteViews.setOnClickPendingIntent(R.id.btn_copytimestamp, pendingIntent); remoteViews.setOnClickPendingIntent(R.id.iv_copytimestamp, pendingIntent);
mForegroundNotification.contentView = remoteViews; mForegroundNotification.contentView = remoteViews;
mForegroundNotification.bigContentView = remoteViews; mForegroundNotification.bigContentView = remoteViews;
@ -137,6 +140,8 @@ public class NotificationHelper {
Uri soundUri = Uri.parse("android.resource://" + service.getPackageName() + "/" + R.raw.diweiyi); Uri soundUri = Uri.parse("android.resource://" + service.getPackageName() + "/" + R.raw.diweiyi);
AudioPlayerUriUtil.playAudio(service, soundUri); AudioPlayerUriUtil.playAudio(service, soundUri);
} }
// public void sendSMSNotification(Context context, MessageNotificationBean messageNotificationBean) { // public void sendSMSNotification(Context context, MessageNotificationBean messageNotificationBean) {
// NotificationManager notificationManager = (NotificationManager) context.getSystemService( // NotificationManager notificationManager = (NotificationManager) context.getSystemService(

View File

@ -22,6 +22,7 @@ public class TimeStampUtil {
TimeStampUtil(Context context) { TimeStampUtil(Context context) {
mContext = context; mContext = context;
mTimeStamp = System.currentTimeMillis();
} }
public synchronized static TimeStampUtil getInstance(Context context) { public synchronized static TimeStampUtil getInstance(Context context) {
@ -39,7 +40,7 @@ public class TimeStampUtil {
long currentMillis = mTimeStamp; long currentMillis = mTimeStamp;
Instant instant = Instant.ofEpochMilli(currentMillis); Instant instant = Instant.ofEpochMilli(currentMillis);
LocalDateTime ldt = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); LocalDateTime ldt = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
String szTimeStampFormatString = AppConfigsUtil.getInstance(mContext).getAppConfigsModel().getTimeStampCopyFormatString(); String szTimeStampFormatString = AppConfigsUtil.getInstance(mContext).getAppConfigsModel().getTimeStampFormatString();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(szTimeStampFormatString); DateTimeFormatter formatter = DateTimeFormatter.ofPattern(szTimeStampFormatString);
String formattedDateTime = ldt.format(formatter); String formattedDateTime = ldt.format(formatter);
return formattedDateTime; return formattedDateTime;

View File

@ -1,34 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeColor="#00000000"
android:strokeWidth="1">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeColor="#00000000"
android:strokeWidth="1" />
</vector>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:left="1dp"
android:top="1dp"
android:right="1dp"
android:bottom="1dp"
android:drawable="@drawable/ic_launcher_background"/>
<item
android:left="1dp"
android:top="1dp"
android:right="1dp"
android:bottom="1dp"
android:drawable="@drawable/ic_timestamp"/>
</layer-list>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!--<item android:drawable="@drawable/ic_launcher_background"/>-->
<item
android:left="1dp"
android:top="1dp"
android:right="1dp"
android:bottom="1dp"
android:drawable="@drawable/ic_timestamp"/>
</layer-list>

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -16,11 +16,10 @@
android:textSize="14sp" android:textSize="14sp"
android:layout_weight="1.0"/> android:layout_weight="1.0"/>
<Button <ImageView
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" android:layout_height="60dp"
android:id="@+id/btn_copytimestamp" android:id="@+id/iv_copytimestamp"/>
android:background="@drawable/ic_launcher"/>
</LinearLayout> </LinearLayout>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@ -2,7 +2,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" > xmlns:tools="http://schemas.android.com/tools" >
<application> <application
tools:replace="android:icon,android:roundIcon"
android:icon="@drawable/ic_launcher_stage"
android:roundIcon="@drawable/ic_launcher_stage">
<!-- Put flavor specific code here --> <!-- Put flavor specific code here -->