Skip to content

Commit

Permalink
chore: support for hiding icon in the launcher
Browse files Browse the repository at this point in the history
Also did:
- Refactor: move `Trime` service to specified package and make a alias for it
- Clean up: remove old `Pref` activity
  • Loading branch information
WhiredPlanck committed Jun 25, 2021
1 parent 68def36 commit 64720b4
Show file tree
Hide file tree
Showing 20 changed files with 117 additions and 389 deletions.
16 changes: 13 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
android:allowBackup="true"
android:theme="@style/PreferenceTheme">

<service android:name="Trime" android:label="@string/ime_name"
<service android:name=".TrimeImeService" android:label="@string/ime_name"
android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter>
<action android:name="android.view.InputMethod" />
Expand All @@ -50,13 +50,23 @@
</intent-filter>
</activity> -->

<activity android:name=".settings.PrefMainActivity" android:label="@string/ime_name">
<!-- Settings activity -->
<activity android:name=".settings.PrefMainActivity"
android:label="@string/ime_name"
android:launchMode="singleTask"/>

<!-- Using an activity alias to disable/enable the app icon in the launcher -->
<activity-alias
android:name="com.osfans.trime.PrefLauncherAlias"
android:label="@string/ime_name"
android:launchMode="singleTask"
android:targetActivity=".settings.PrefMainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</activity-alias>

<activity android:name=".settings.HelpActivity"
android:label="@string/pref_help" />
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/osfans/trime/Composition.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;

import com.osfans.trime.ime.core.Trime;

import java.util.List;
import java.util.Map;

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/osfans/trime/Effect.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import android.os.Build;

/** 處理按鍵聲音、震動、朗讀等效果 */
class Effect {
public class Effect {
private static final int MAX_VOLUME = 101; //100%音量時只響一下,暫從100改成101
private int duration = 10;
private long durationLong;
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/com/osfans/trime/Function.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
import android.util.Log;
import android.util.SparseArray;
import android.view.KeyEvent;

import com.osfans.trime.settings.PrefMainActivity;

import java.text.FieldPosition;
import java.text.SimpleDateFormat;
import java.util.Date;
Expand Down Expand Up @@ -128,7 +131,7 @@ private static void startIntent(Context context, String action, String arg) {
}

public static void showPrefDialog(Context context) {
Intent intent = new Intent(context, Pref.class);
Intent intent = new Intent(context, PrefMainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY);
context.startActivity(intent);
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/osfans/trime/KeyboardSwitch.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.List;

/** 管理多個{@link Keyboard 鍵盤} */
class KeyboardSwitch {
public class KeyboardSwitch {

private final Context context;

Expand Down
Loading

0 comments on commit 64720b4

Please sign in to comment.