Skip to content

Commit 8104868

Browse files
committed
🎨 Supports local shorthands on Android siyuan-note/siyuan#14414
1 parent e55c0d6 commit 8104868

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

app/src/main/java/org/b3log/siyuan/ShortcutActivity.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,14 @@ public void onNewIntent(final Intent intent) {
8585
private void handleIntent(final Intent intent) {
8686
setupFullScreenInput();
8787

88-
if (Intent.ACTION_VIEW.equals(intent.getAction())) { // 来自桌面快捷方式
88+
if (Intent.ACTION_MAIN.equals(intent.getAction())) { // 来自桌面快捷方式
89+
final EditText input = findViewById(R.id.full_screen_input);
90+
input.postDelayed(() -> {
91+
input.requestFocus();
92+
KeyboardUtils.showSoftInput(input);
93+
}, 500);
94+
return;
95+
} else if (Intent.ACTION_VIEW.equals(intent.getAction())) { // 来自菜单快捷方式
8996
final String data = intent.getDataString();
9097
if (StringUtils.equals(data, "shorthand")) {
9198
final EditText input = findViewById(R.id.full_screen_input);

app/src/main/res/layout/activity_shortcut.xml

+2-5
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,19 @@
66
android:padding="16dp">
77

88
<LinearLayout
9-
style="?android:attr/buttonBarStyle"
109
android:layout_width="match_parent"
1110
android:layout_height="wrap_content"
1211
android:orientation="horizontal">
1312

1413
<Button
1514
android:id="@+id/submit_button"
16-
style="?android:attr/buttonBarButtonStyle"
1715
android:layout_width="0dp"
1816
android:layout_height="wrap_content"
1917
android:layout_weight="1"
2018
android:text="@string/submit" />
2119

2220
<Button
2321
android:id="@+id/add_to_home_button"
24-
style="?android:attr/buttonBarButtonStyle"
2522
android:layout_width="0dp"
2623
android:layout_height="wrap_content"
2724
android:layout_weight="1"
@@ -33,11 +30,11 @@
3330
android:layout_width="match_parent"
3431
android:layout_height="0dp"
3532
android:layout_weight="1"
33+
android:background="@null"
3634
android:focusable="true"
3735
android:focusableInTouchMode="true"
3836
android:gravity="top"
3937
android:hint="@string/enter_your_text"
4038
android:inputType="textMultiLine"
41-
android:padding="16dp"
42-
android:background="@null" />
39+
android:padding="16dp" />
4340
</LinearLayout>

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
33
ext {
4-
siyuanVersionCode = 268
4+
siyuanVersionCode = 269
55
siyuanVersionName = "3.1.26"
66
}
77
repositories {

0 commit comments

Comments
 (0)