Skip to content

Commit

Permalink
Hide settings in lock screen
Browse files Browse the repository at this point in the history
  • Loading branch information
rkkr committed May 1, 2024
1 parent e696386 commit 89e89c4
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 16 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
compileSdk 34
minSdkVersion 19
targetSdkVersion 34
versionCode 102
versionName "5.16"
versionCode 103
versionName "5.17"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public final class KeyboardId {
public final int mMode;
public final int mElementId;
public final EditorInfo mEditorInfo;
public final boolean mClobberSettingsKey;
public final boolean mLanguageSwitchKeyEnabled;
public final String mCustomActionLabel;
public final boolean mShowMoreKeys;
Expand All @@ -73,6 +74,7 @@ public KeyboardId(final int elementId, final KeyboardLayoutSet.Params params) {
mMode = params.mMode;
mElementId = elementId;
mEditorInfo = params.mEditorInfo;
mClobberSettingsKey = params.mNoSettingsKey;
mLanguageSwitchKeyEnabled = params.mLanguageSwitchKeyEnabled;
mCustomActionLabel = (mEditorInfo.actionLabel != null)
? mEditorInfo.actionLabel.toString() : null;
Expand All @@ -89,6 +91,7 @@ private static int computeHashCode(final KeyboardId id) {
id.mWidth,
id.mHeight,
id.passwordInput(),
id.mClobberSettingsKey,
id.mLanguageSwitchKeyEnabled,
id.isMultiLine(),
id.imeAction(),
Expand All @@ -108,6 +111,7 @@ private boolean equals(final KeyboardId other) {
&& other.mWidth == mWidth
&& other.mHeight == mHeight
&& other.passwordInput() == passwordInput()
&& other.mClobberSettingsKey == mClobberSettingsKey
&& other.mLanguageSwitchKeyEnabled == mLanguageSwitchKeyEnabled
&& other.isMultiLine() == isMultiLine()
&& other.imeAction() == imeAction()
Expand Down Expand Up @@ -175,6 +179,7 @@ public String toString() {
actionName(imeAction()),
(navigateNext() ? " navigateNext" : ""),
(navigatePrevious() ? " navigatePrevious" : ""),
(mClobberSettingsKey ? " clobberSettingsKey" : ""),
(passwordInput() ? " passwordInput" : ""),
(mLanguageSwitchKeyEnabled ? " languageSwitchKeyEnabled" : ""),
(isMultiLine() ? " isMultiLine" : ""),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package rkr.simplekeyboard.inputmethod.keyboard;

import android.app.KeyguardManager;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
Expand Down Expand Up @@ -93,6 +94,7 @@ public static final class Params {
int mMode;
// TODO: Use {@link InputAttributes} instead of these variables.
EditorInfo mEditorInfo;
boolean mNoSettingsKey;
boolean mLanguageSwitchKeyEnabled;
Subtype mSubtype;
int mKeyboardThemeId;
Expand Down Expand Up @@ -212,6 +214,9 @@ public Builder(final Context context, final EditorInfo ei) {
params.mMode = getKeyboardMode(editorInfo);
// TODO: Consolidate those with {@link InputAttributes}.
params.mEditorInfo = editorInfo;

final KeyguardManager kgMgr = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
params.mNoSettingsKey = kgMgr.isKeyguardLocked();
}

public Builder setKeyboardTheme(final int themeId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ private boolean parseCaseCondition(final XmlPullParser parser) {
R.styleable.Keyboard_Case_navigatePrevious, id.navigatePrevious());
final boolean passwordInputMatched = matchBoolean(caseAttr,
R.styleable.Keyboard_Case_passwordInput, id.passwordInput());
final boolean clobberSettingsKeyMatched = matchBoolean(caseAttr,
R.styleable.Keyboard_Case_clobberSettingsKey, id.mClobberSettingsKey);
final boolean languageSwitchKeyEnabledMatched = matchBoolean(caseAttr,
R.styleable.Keyboard_Case_languageSwitchKeyEnabled,
id.mLanguageSwitchKeyEnabled);
Expand All @@ -610,7 +612,7 @@ private boolean parseCaseCondition(final XmlPullParser parser) {
final boolean selected = keyboardLayoutSetMatched && keyboardLayoutSetElementMatched
&& keyboardThemeMatched && modeMatched && navigateNextMatched
&& navigatePreviousMatched && passwordInputMatched
&& languageSwitchKeyEnabledMatched
&& languageSwitchKeyEnabledMatched && clobberSettingsKeyMatched
&& isMultiLineMatched && imeActionMatched && isIconDefinedMatched
&& localeCodeMatched && languageCodeMatched && countryCodeMatched
&& showMoreKeysMatched && showNumberRowMatched;
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@
<attr name="navigateNext" format="boolean" />
<attr name="navigatePrevious" format="boolean" />
<attr name="passwordInput" format="boolean" />
<attr name="clobberSettingsKey" format="boolean" />
<attr name="languageSwitchKeyEnabled" format="boolean" />
<attr name="isMultiLine" format="boolean" />
<attr name="imeAction" format="enum">
Expand Down
12 changes: 9 additions & 3 deletions app/src/main/res/xml-sw600dp/row_pcqwerty5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@
<Row
latin:keyWidth="7.0%p"
>
<Key
latin:keyWidth="9.0%p"
latin:keyStyle="settingsKeyStyle" />
<switch>
<case
latin:clobberSettingsKey="false"
>
<Key
latin:keyStyle="settingsKeyStyle"
latin:keyWidth="11.538%p" />
</case>
</switch>
<switch>
<case
latin:languageSwitchKeyEnabled="true"
Expand Down
22 changes: 17 additions & 5 deletions app/src/main/res/xml/key_styles_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,21 @@
<merge
xmlns:latin="http://schemas.android.com/apk/res-auto"
>
<key-style
latin:styleName="settingsMoreKeysStyle"
latin:keyLabelFlags="hasPopupHint"
latin:additionalMoreKeys="!text/keyspec_settings"
latin:backgroundType="functional" />
<switch>
<case
latin:clobberSettingsKey="true"
>
<key-style
latin:styleName="settingsMoreKeysStyle"
latin:backgroundType="functional" />
</case>
<!-- clobberSettingsKey="false" -->
<default>
<key-style
latin:styleName="settingsMoreKeysStyle"
latin:keyLabelFlags="hasPopupHint"
latin:additionalMoreKeys="!text/keyspec_settings"
latin:backgroundType="functional" />
</default>
</switch>
</merge>
12 changes: 9 additions & 3 deletions app/src/main/res/xml/row_pcqwerty5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@
<Row
latin:keyWidth="7.692%p"
>
<Key
latin:keyStyle="settingsKeyStyle"
latin:keyWidth="11.538%p" />
<switch>
<case
latin:clobberSettingsKey="false"
>
<Key
latin:keyStyle="settingsKeyStyle"
latin:keyWidth="11.538%p" />
</case>
</switch>
<switch>
<case
latin:languageSwitchKeyEnabled="true"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.3'
classpath 'com.android.tools.build:gradle:8.4.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip

0 comments on commit 89e89c4

Please sign in to comment.