diff --git a/numtable/build.properties b/numtable/build.properties
index 74c80932..9a70cd12 100644
--- a/numtable/build.properties
+++ b/numtable/build.properties
@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
-#Sun Jun 08 21:21:11 HKT 2025
-stageCount=1
+#Thu Jul 24 10:16:27 HKT 2025
+stageCount=2
libraryProject=
baseVersion=15.1
-publishVersion=15.1.0
+publishVersion=15.1.1
buildCount=0
-baseBetaVersion=15.1.1
+baseBetaVersion=15.1.2
diff --git a/numtable/src/main/AndroidManifest.xml b/numtable/src/main/AndroidManifest.xml
index 284eb50a..d8825937 100644
--- a/numtable/src/main/AndroidManifest.xml
+++ b/numtable/src/main/AndroidManifest.xml
@@ -3,6 +3,11 @@
xmlns:android="http://schemas.android.com/apk/res/android"
package="cc.winboll.studio.numtable">
+
+
+
+
+
-
-
-
+
diff --git a/numtable/src/main/java/cc/winboll/studio/numtable/MainActivity.java b/numtable/src/main/java/cc/winboll/studio/numtable/MainActivity.java
index b16fbca5..013d454c 100644
--- a/numtable/src/main/java/cc/winboll/studio/numtable/MainActivity.java
+++ b/numtable/src/main/java/cc/winboll/studio/numtable/MainActivity.java
@@ -1,10 +1,20 @@
package cc.winboll.studio.numtable;
+import android.content.Intent;
+import android.content.pm.ShortcutInfo;
+import android.content.pm.ShortcutManager;
+import android.graphics.drawable.Icon;
+import android.os.Build;
import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.RadioButton;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libappbase.LogView;
+import cc.winboll.studio.numtable.R;
import com.hjq.toast.ToastUtils;
+import java.util.UUID;
public class MainActivity extends AppCompatActivity {
@@ -19,10 +29,99 @@ public class MainActivity extends AppCompatActivity {
setSupportActionBar(toolbar);
mLogView = findViewById(R.id.logview);
-
- ToastUtils.show("onCreate");
+
+ // 初始化创建快捷方式按钮
+ Button btnCreateShortcut = findViewById(R.id.btn_create_shortcut);
+ btnCreateShortcut.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ createDesktopShortcut();
+ }
+ });
+
+
+ ((RadioButton)findViewById(R.id.rb_right)).setChecked(true);
+ ((RadioButton)findViewById(R.id.rb_left)).setChecked(false);
}
+ public void onDirectionClick(View view) {
+ switch (view.getId()) {
+ case R.id.rb_right:
+ {
+ ((RadioButton)findViewById(R.id.rb_left)).setChecked(false);
+ break;
+ }
+ case R.id.rb_left:
+ {
+ ((RadioButton)findViewById(R.id.rb_right)).setChecked(false);
+ break;
+ }
+ }
+ }
+
+ /**
+ * 创建桌面快捷方式
+ */
+ private void createDesktopShortcut() {
+ // 1. 创建启动目标Activity的Intent(通常是你的主Activity)
+ Intent targetIntent = new Intent(this, MainActivity.class); // 替换为你的主Activity
+ targetIntent.setAction(Intent.ACTION_MAIN);
+ targetIntent.addCategory(Intent.CATEGORY_LAUNCHER);
+ targetIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
+
+ // 2. 创建快捷方式的Intent
+ Intent shortcutIntent = new Intent();
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ // 生成随机UUID
+ UUID uuid = UUID.randomUUID();
+ // 转换为字符串
+ String uuidStr = uuid.toString();
+ // Android 8.0及以上:使用ShortcutManager
+ ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
+ if (shortcutManager.isRequestPinShortcutSupported()) {
+ if (((RadioButton)findViewById(R.id.rb_right)).isChecked()) {
+ // 创建快捷方式信息
+ ShortcutInfo shortcutInfo = new ShortcutInfo.Builder(this, uuidStr) // 唯一ID
+ .setShortLabel(">>") // 短标签(显示在桌面)
+ .setLongLabel("在右边 >>") // 长标签(长按显示)
+ .setIcon(Icon.createWithResource(this, R.drawable.ic_point_right)) // 图标
+ .setIntent(targetIntent)
+ .build();
+ // 发送创建请求
+ shortcutManager.requestPinShortcut(shortcutInfo, null);
+ } else {
+ ShortcutInfo shortcutInfo = new ShortcutInfo.Builder(this, uuidStr) // 唯一ID
+ .setShortLabel("<<") // 短标签(显示在桌面)
+ .setLongLabel("在左边 <<") // 长标签(长按显示)
+ .setIcon(Icon.createWithResource(this, R.drawable.ic_point_left)) // 图标
+ .setIntent(targetIntent)
+ .build();
+ // 发送创建请求
+ shortcutManager.requestPinShortcut(shortcutInfo, null);
+ }
+ ToastUtils.show("已请求创建快捷方式");
+ } else {
+ ToastUtils.show("当前设备不支持创建快捷方式");
+ }
+ } else {
+ // Android 7.1及以下:使用旧版广播方式
+ shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, targetIntent);
+ shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "应用快捷方式"); // 快捷方式名称
+ // 设置图标(使用应用图标)
+ shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
+ Intent.ShortcutIconResource.fromContext(this, R.mipmap.ic_launcher));
+ // 标记为创建快捷方式
+ shortcutIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
+ // 防止重复创建
+ shortcutIntent.putExtra("duplicate", false);
+
+ // 发送广播创建快捷方式
+ sendBroadcast(shortcutIntent);
+ ToastUtils.show("快捷方式已创建");
+ }
+ }
+
+
@Override
protected void onResume() {
super.onResume();
diff --git a/numtable/src/main/res/drawable/ic_point_left.xml b/numtable/src/main/res/drawable/ic_point_left.xml
new file mode 100644
index 00000000..4fd5a739
--- /dev/null
+++ b/numtable/src/main/res/drawable/ic_point_left.xml
@@ -0,0 +1,20 @@
+
+
+
+
diff --git a/numtable/src/main/res/drawable/ic_point_right.xml b/numtable/src/main/res/drawable/ic_point_right.xml
new file mode 100644
index 00000000..ca6f6339
--- /dev/null
+++ b/numtable/src/main/res/drawable/ic_point_right.xml
@@ -0,0 +1,20 @@
+
+
+
+
diff --git a/numtable/src/main/res/layout/activity_main.xml b/numtable/src/main/res/layout/activity_main.xml
index 1c213685..57985d8d 100644
--- a/numtable/src/main/res/layout/activity_main.xml
+++ b/numtable/src/main/res/layout/activity_main.xml
@@ -23,14 +23,44 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
- android:layout_weight="1.0"
- android:gravity="center_vertical|center_horizontal">
+ android:layout_weight="1.0">
-
+ android:gravity="right|center_vertical"
+ android:layout_gravity="center_vertical">
+
+
+
+
+
+
+
+
+
+
+
+