diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardId.java b/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardId.java index 66789523e..96961a765 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardId.java +++ b/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardId.java @@ -80,6 +80,7 @@ public final class KeyboardId { public final boolean mClobberSettingsKey; public final boolean mNumberRowEnabled; public final boolean mLanguageSwitchKeyEnabled; + public final boolean mEmojiKeyEnabled; public final String mCustomActionLabel; public final boolean mHasShortcutKey; public final boolean mIsSplitLayout; @@ -96,6 +97,7 @@ public final class KeyboardId { mClobberSettingsKey = params.mNoSettingsKey; mNumberRowEnabled = params.mNumberRowEnabled; mLanguageSwitchKeyEnabled = params.mLanguageSwitchKeyEnabled; + mEmojiKeyEnabled = params.mEmojiKeyEnabled; mCustomActionLabel = (mEditorInfo.actionLabel != null) ? mEditorInfo.actionLabel.toString() : null; mHasShortcutKey = params.mVoiceInputKeyEnabled; @@ -115,6 +117,7 @@ public final class KeyboardId { id.mHasShortcutKey, id.mNumberRowEnabled, id.mLanguageSwitchKeyEnabled, + id.mEmojiKeyEnabled, id.isMultiLine(), id.imeAction(), id.mCustomActionLabel, @@ -137,6 +140,7 @@ public final class KeyboardId { && other.mHasShortcutKey == mHasShortcutKey && other.mNumberRowEnabled == mNumberRowEnabled && other.mLanguageSwitchKeyEnabled == mLanguageSwitchKeyEnabled + && other.mEmojiKeyEnabled == mEmojiKeyEnabled && other.isMultiLine() == isMultiLine() && other.imeAction() == imeAction() && TextUtils.equals(other.mCustomActionLabel, mCustomActionLabel) @@ -208,6 +212,7 @@ public final class KeyboardId { (mHasShortcutKey ? " hasShortcutKey" : ""), (mNumberRowEnabled ? " numberRowEnabled" : ""), (mLanguageSwitchKeyEnabled ? " languageSwitchKeyEnabled" : ""), + (mEmojiKeyEnabled ? " emojiKeyEnabled" : ""), (isMultiLine() ? " isMultiLine" : ""), (mIsSplitLayout ? " isSplitLayout" : "") ); diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardLayoutSet.java b/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardLayoutSet.java index 00b947102..5c71497b8 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardLayoutSet.java +++ b/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardLayoutSet.java @@ -121,6 +121,7 @@ public final class KeyboardLayoutSet { boolean mNoSettingsKey; boolean mNumberRowEnabled; boolean mLanguageSwitchKeyEnabled; + boolean mEmojiKeyEnabled; RichInputMethodSubtype mSubtype; boolean mIsSpellChecker; int mKeyboardWidth; @@ -335,6 +336,11 @@ public final class KeyboardLayoutSet { return this; } + public Builder setEmojiKeyEnabled(final boolean enabled) { + mParams.mEmojiKeyEnabled = enabled; + return this; + } + public Builder disableTouchPositionCorrectionData() { mParams.mDisableTouchPositionCorrectionDataForTest = true; return this; diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardSwitcher.java b/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardSwitcher.java index 7ec769e32..2cbdc9bb3 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardSwitcher.java +++ b/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/KeyboardSwitcher.java @@ -117,6 +117,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { builder.setVoiceInputKeyEnabled(settingsValues.mShowsVoiceInputKey); builder.setNumberRowEnabled(settingsValues.mShowsNumberRow); builder.setLanguageSwitchKeyEnabled(mLatinIME.shouldShowLanguageSwitchKey()); + builder.setEmojiKeyEnabled(settingsValues.mShowsEmojiKey); builder.setSplitLayoutEnabledByUser(ProductionFlags.IS_SPLIT_KEYBOARD_SUPPORTED && settingsValues.mIsSplitKeyboardEnabled); mKeyboardLayoutSet = builder.build(); diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/internal/KeyboardBuilder.java b/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/internal/KeyboardBuilder.java index bbd95fc50..6c2437c6d 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/internal/KeyboardBuilder.java +++ b/app/src/main/java/org/dslul/openboard/inputmethod/keyboard/internal/KeyboardBuilder.java @@ -668,6 +668,9 @@ public class KeyboardBuilder { final boolean languageSwitchKeyEnabledMatched = matchBoolean(caseAttr, R.styleable.Keyboard_Case_languageSwitchKeyEnabled, id.mLanguageSwitchKeyEnabled); + final boolean emojiKeyEnabledMatched = matchBoolean(caseAttr, + R.styleable.Keyboard_Case_emojiKeyEnabled, + id.mEmojiKeyEnabled); final boolean isMultiLineMatched = matchBoolean(caseAttr, R.styleable.Keyboard_Case_isMultiLine, id.isMultiLine()); final boolean imeActionMatched = matchInteger(caseAttr, @@ -683,8 +686,8 @@ public class KeyboardBuilder { final boolean selected = keyboardLayoutSetMatched && keyboardLayoutSetElementMatched && keyboardThemeMacthed && modeMatched && navigateNextMatched && navigatePreviousMatched && passwordInputMatched && clobberSettingsKeyMatched - && hasShortcutKeyMatched && languageSwitchKeyEnabledMatched && numberRowEnabledMatched - && isMultiLineMatched && imeActionMatched && isIconDefinedMatched + && hasShortcutKeyMatched && numberRowEnabledMatched && languageSwitchKeyEnabledMatched + && emojiKeyEnabledMatched && isMultiLineMatched && imeActionMatched && isIconDefinedMatched && localeCodeMatched && languageCodeMatched && countryCodeMatched && splitLayoutMatched; @@ -714,6 +717,8 @@ public class KeyboardBuilder { "numberRowEnabled"), booleanAttr(caseAttr, R.styleable.Keyboard_Case_languageSwitchKeyEnabled, "languageSwitchKeyEnabled"), + booleanAttr(caseAttr, R.styleable.Keyboard_Case_emojiKeyEnabled, + "emojiKeyEnabled"), booleanAttr(caseAttr, R.styleable.Keyboard_Case_isMultiLine, "isMultiLine"), booleanAttr(caseAttr, R.styleable.Keyboard_Case_isSplitLayout, diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/DebugFlags.kt b/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/DebugFlags.kt index 9804bd72f..bbad16efe 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/DebugFlags.kt +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/DebugFlags.kt @@ -1,23 +1,9 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package org.dslul.openboard.inputmethod.latin.define import android.content.SharedPreferences object DebugFlags { const val DEBUG_ENABLED = false + @JvmStatic fun init(prefs: SharedPreferences?) {} } \ No newline at end of file diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/DecoderSpecificConstants.kt b/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/DecoderSpecificConstants.kt index fdbf72897..cd1620c24 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/DecoderSpecificConstants.kt +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/DecoderSpecificConstants.kt @@ -1,18 +1,3 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ package org.dslul.openboard.inputmethod.latin.define /** diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/JniLibName.kt b/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/JniLibName.kt index a16270b32..8e5f4769c 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/JniLibName.kt +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/JniLibName.kt @@ -1,20 +1,5 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package org.dslul.openboard.inputmethod.latin.define object JniLibName { - const val JNI_LIB_NAME = "jni_latinime" //public static final String JNI_LIB_NAME2 = "jni_latinimegoogle"; + const val JNI_LIB_NAME = "jni_latinime" } \ No newline at end of file diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/ProductionFlags.kt b/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/ProductionFlags.kt index 1cea2b216..23d904f9b 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/ProductionFlags.kt +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/define/ProductionFlags.kt @@ -1,18 +1,3 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package org.dslul.openboard.inputmethod.latin.define object ProductionFlags { @@ -24,11 +9,6 @@ object ProductionFlags { */ const val INCLUDE_RAW_SUGGESTIONS = false - /** - * When false, the metrics logging is not yet ready to be enabled. - */ - const val IS_METRICS_LOGGING_SUPPORTED = false - /** * When `false`, the split keyboard is not yet ready to be enabled. */ diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/Settings.java b/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/Settings.java index 0941476ac..10e7f8284 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/Settings.java +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/Settings.java @@ -75,6 +75,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; public static final String PREF_SHOW_LANGUAGE_SWITCH_KEY = "pref_show_language_switch_key"; + public static final String PREF_SHOW_EMOJI_KEY = + "pref_show_emoji_key"; public static final String PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST = "pref_include_other_imes_in_language_switch_list"; public static final String PREF_CUSTOM_INPUT_STYLES = "custom_input_styles"; diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/SettingsValues.java b/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/SettingsValues.java index a87b780df..65c4b3365 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/SettingsValues.java +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/settings/SettingsValues.java @@ -71,6 +71,7 @@ public class SettingsValues { public final boolean mIncludesOtherImesInLanguageSwitchList; public final boolean mShowsNumberRow; public final boolean mShowsLanguageSwitchKey; + public final boolean mShowsEmojiKey; public final boolean mUsePersonalizedDicts; public final boolean mUseDoubleSpacePeriod; public final boolean mBlockPotentiallyOffensive; @@ -145,6 +146,7 @@ public class SettingsValues { mIncludesOtherImesInLanguageSwitchList = !Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS || prefs.getBoolean(Settings.PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST, false) /* forcibly */; mShowsNumberRow = prefs.getBoolean(Settings.PREF_SHOW_NUMBER_ROW, false); mShowsLanguageSwitchKey = prefs.getBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, false); + mShowsEmojiKey = prefs.getBoolean(Settings.PREF_SHOW_EMOJI_KEY, false); mUsePersonalizedDicts = prefs.getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true); mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true) && inputAttributes.mIsGeneralTextInput; diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 7df2f1563..eb6874957 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -502,6 +502,7 @@ + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5ea2669ad..7a7e859d9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -570,4 +570,6 @@ mobile devices. [CHAR LIMIT=25] --> More keys Force incognito mode Disable learning of new words + Show emoji key + Show a separate emoji key. When disabled, the emoji keyboard is still accessible by long-pressing the ENTER button. diff --git a/app/src/main/res/xml/key_space_5kw.xml b/app/src/main/res/xml/key_space_5kw.xml index a58701787..c29e3236e 100644 --- a/app/src/main/res/xml/key_space_5kw.xml +++ b/app/src/main/res/xml/key_space_5kw.xml @@ -44,8 +44,10 @@ + @@ -53,6 +55,33 @@ latin:keyStyle="spaceKeyStyle" latin:keyWidth="40%p" /> + + + + + + + + + + + + +