Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,9 @@ public void setEmojiKeyboard() {
// @see LatinIME#onComputeInset(android.inputmethodservice.InputMethodService.Insets)
mKeyboardView.setVisibility(View.GONE);
mSuggestionStripView.setVisibility(View.GONE);
mStripContainer.setVisibility(getSecondaryStripVisibility());
// the strip container always shows the emoji category tab strip in emoji view,
// independent of toolbar settings
mStripContainer.setVisibility(View.VISIBLE);
mClipboardStripScrollView.setVisibility(View.GONE);
mEmojiTabStripView.setVisibility(View.VISIBLE);
mClipboardHistoryView.setVisibility(View.GONE);
Expand All @@ -380,7 +382,7 @@ public void setClipboardKeyboard() {
mKeyboardView.setVisibility(View.GONE);
mEmojiTabStripView.setVisibility(View.GONE);
mSuggestionStripView.setVisibility(View.GONE);
mStripContainer.setVisibility(getSecondaryStripVisibility());
mStripContainer.setVisibility(getClipboardStripVisibility());
mClipboardStripScrollView.post(() -> mClipboardStripScrollView.fullScroll(HorizontalScrollView.FOCUS_RIGHT));
mClipboardStripScrollView.setVisibility(View.VISIBLE);
mEmojiPalettesView.setVisibility(View.GONE);
Expand Down Expand Up @@ -586,8 +588,8 @@ public void showToast(final String text, final boolean briefToast){
}
}

private static int getSecondaryStripVisibility() {
return Settings.getValues().mSecondaryStripVisible? View.VISIBLE : View.GONE;
private static int getClipboardStripVisibility() {
return Settings.getValues().mClipboardStripVisible? View.VISIBLE : View.GONE;
}

// Displays a toast-like message with the provided text for a specified duration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ClipboardHistoryView @JvmOverloads constructor(
val keyboardViewAttr = context.obtainStyledAttributes(attrs, R.styleable.KeyboardView, defStyle, R.style.KeyboardView)
keyBackgroundId = keyboardViewAttr.getResourceId(R.styleable.KeyboardView_keyBackground, 0)
keyboardViewAttr.recycle()
if (Settings.getValues().mSecondaryStripVisible) {
if (Settings.getValues().mClipboardStripVisible) {
getEnabledClipboardToolbarKeys(context.prefs())
.forEach { toolbarKeys.add(createToolbarKey(context, it)) }
}
Expand All @@ -82,7 +82,7 @@ class ClipboardHistoryView @JvmOverloads constructor(
val res = context.resources
// The main keyboard expands to the entire this {@link KeyboardView}.
val width = ResourceUtils.getKeyboardWidth(context, Settings.getValues()) + paddingLeft + paddingRight
val height = ResourceUtils.getSecondaryKeyboardHeight(res, Settings.getValues()) + paddingTop + paddingBottom
val height = ResourceUtils.getKeyboardHeight(res, Settings.getValues()) + paddingTop + paddingBottom
setMeasuredDimension(width, height)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ClipboardLayoutParams(ctx: Context) {
init {
val res = ctx.resources
val sv = Settings.getValues()
val defaultKeyboardHeight = ResourceUtils.getSecondaryKeyboardHeight(res, sv)
val defaultKeyboardHeight = ResourceUtils.getKeyboardHeight(res, sv)
val defaultKeyboardWidth = ResourceUtils.getKeyboardWidth(ctx, sv)

keyVerticalGap = (res.getFraction(R.fraction.config_key_vertical_gap_holo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal class EmojiLayoutParams(res: Resources) {

init {
val sv = Settings.getValues()
val defaultKeyboardHeight = ResourceUtils.getSecondaryKeyboardHeight(res, sv)
val defaultKeyboardHeight = ResourceUtils.getKeyboardHeight(res, sv)

val keyVerticalGap = (res.getFraction(R.fraction.config_key_vertical_gap_holo,
defaultKeyboardHeight, defaultKeyboardHeight) * sv.mKeyGapScale).toInt()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec
// The main keyboard expands to the entire this {@link KeyboardView}.
final int width = ResourceUtils.getKeyboardWidth(getContext(), Settings.getValues())
+ getPaddingLeft() + getPaddingRight();
final int height = ResourceUtils.getSecondaryKeyboardHeight(res, Settings.getValues())
final int height = ResourceUtils.getKeyboardHeight(res, Settings.getValues())
+ getPaddingTop() + getPaddingBottom();
mEmojiCategoryPageIndicatorView.mWidth = width;
setMeasuredDimension(width, height);
Expand All @@ -253,10 +253,8 @@ public void initialize() { // needs to be delayed for access to EmojiTabStrip, w
if (initialized) return;
mEmojiCategory.initialize();
mTabStrip = (LinearLayout) KeyboardSwitcher.getInstance().getEmojiTabStrip();
if (Settings.getValues().mSecondaryStripVisible) {
for (EmojiCategory.CategoryProperties properties : mEmojiCategory.getShownCategories()) {
addTab(mTabStrip, properties.getCategory());
}
for (EmojiCategory.CategoryProperties properties : mEmojiCategory.getShownCategories()) {
addTab(mTabStrip, properties.getCategory());
}

mPager = findViewById(R.id.emoji_pager);
Expand Down Expand Up @@ -430,15 +428,13 @@ private void setCurrentCategory(EmojiCategory.Category category, boolean initial
mEmojiCategory.getCurrentCategory()), ! initial && ! isAnimationsDisabled());
}

if (Settings.getValues().mSecondaryStripVisible) {
View old = mTabStrip.findViewWithTag(oldCategory);
View current = mTabStrip.findViewWithTag(category);
View old = mTabStrip.findViewWithTag(oldCategory);
View current = mTabStrip.findViewWithTag(category);

if (old instanceof ImageView)
Settings.getValues().mColors.setColor((ImageView) old, ColorType.EMOJI_CATEGORY);
if (current instanceof ImageView)
Settings.getValues().mColors.setColor((ImageView) current, ColorType.EMOJI_CATEGORY_SELECTED);
}
if (old instanceof ImageView)
Settings.getValues().mColors.setColor((ImageView) old, ColorType.EMOJI_CATEGORY);
if (current instanceof ImageView)
Settings.getValues().mColors.setColor((ImageView) current, ColorType.EMOJI_CATEGORY_SELECTED);
}
}

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/helium314/keyboard/latin/AppUpgrade.kt
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,9 @@ private object AppUpgrade {
remove("narrow_key_gaps")
}
}
if (oldVersion <= 4003) {
prefs.edit { remove("toolbar_hiding_global") }
}
upgradeToolbarPrefs(prefs)
LayoutUtilsCustom.onLayoutFileChanged() // just to be sure
prefs.edit { putInt(Settings.PREF_VERSION_CODE, BuildConfig.VERSION_CODE) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ object Defaults {
const val PREF_URL_DETECTION = false
const val PREF_DONT_SHOW_MISSING_DICTIONARY_DIALOG = false
const val PREF_TOOLBAR_MODE = "EXPANDABLE"
const val PREF_TOOLBAR_HIDING_GLOBAL = true
const val PREF_TOOLBAR_SWIPE_DOWN_TO_HIDE = false
const val PREF_QUICK_PIN_TOOLBAR_KEYS = false
val PREF_PINNED_TOOLBAR_KEYS = defaultPinnedToolbarPref
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static final String PREF_SPACE_BAR_TEXT = "space_bar_text";
public static final String PREF_TIMESTAMP_FORMAT = "timestamp_format";
public static final String PREF_TOOLBAR_MODE = "toolbar_mode";
public static final String PREF_TOOLBAR_HIDING_GLOBAL = "toolbar_hiding_global";
public static final String PREF_TOOLBAR_SWIPE_DOWN_TO_HIDE = "toolbar_swipe_down_to_hide";
public static final String PREF_SPELLCHECK_SUGGEST = "spellcheck_suggest";
public static final String PREF_SHOW_ONLY_TOOLBAR_WITH_HARDWARE_KEYBOARD = "only_toolbar_with_hw_keyboard";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ public class SettingsValues {
public final float mSidePaddingScale;
public final ToolbarMode mToolbarMode;
public final boolean mToolbarSwipeDownToHide;
public final boolean mToolbarHidingGlobal;
public final boolean mAutoShowToolbar;
public final boolean mAutoHideToolbar;
public final boolean mAlphaAfterEmojiInEmojiView;
Expand All @@ -152,7 +151,7 @@ public class SettingsValues {

// Deduced settings
public final boolean mSuggestionStripHiddenPerUserSettings;
public final boolean mSecondaryStripVisible;
public final boolean mClipboardStripVisible;
public final int mKeypressVibrationDuration;
public final float mKeypressSoundVolume;
public final boolean mAutoCorrectionEnabledPerUserSettings;
Expand Down Expand Up @@ -188,7 +187,6 @@ public SettingsValues(final Context context, final SharedPreferences prefs, fina
// we want to hide the toolbar / suggestion strip entirely if device is locked
mToolbarMode = mIsLocked ? ToolbarMode.HIDDEN : Settings.readToolbarMode(prefs);
mToolbarSwipeDownToHide = prefs.getBoolean(Settings.PREF_TOOLBAR_SWIPE_DOWN_TO_HIDE, Defaults.PREF_TOOLBAR_SWIPE_DOWN_TO_HIDE);
mToolbarHidingGlobal = mIsLocked || prefs.getBoolean(Settings.PREF_TOOLBAR_HIDING_GLOBAL, Defaults.PREF_TOOLBAR_HIDING_GLOBAL);
mAutoCap = prefs.getBoolean(Settings.PREF_AUTO_CAP, Defaults.PREF_AUTO_CAP) && ScriptUtils.scriptSupportsUppercase(mLocale);
mVibrateOn = Settings.readVibrationEnabled(prefs);
mVibrateInDndMode = prefs.getBoolean(Settings.PREF_VIBRATE_IN_DND_MODE, Defaults.PREF_VIBRATE_IN_DND_MODE);
Expand Down Expand Up @@ -268,7 +266,7 @@ public SettingsValues(final Context context, final SharedPreferences prefs, fina
|| !prefs.getBoolean(Settings.PREF_ALWAYS_SHOW_SUGGESTIONS_EXCEPT_WEB_TEXT, Defaults.PREF_ALWAYS_SHOW_SUGGESTIONS_EXCEPT_WEB_TEXT));
mSuggestionsEnabled = prefs.getBoolean(Settings.PREF_SHOW_SUGGESTIONS, Defaults.PREF_SHOW_SUGGESTIONS)
&& (mInputAttributes.mShouldShowSuggestions || mOverrideShowingSuggestions) && !mSuggestionStripHiddenPerUserSettings;
mSecondaryStripVisible = mToolbarMode != ToolbarMode.HIDDEN || ! mToolbarHidingGlobal;
mClipboardStripVisible = mToolbarMode != ToolbarMode.HIDDEN;
mIncognitoModeEnabled = prefs.getBoolean(Settings.PREF_ALWAYS_INCOGNITO_MODE, Defaults.PREF_ALWAYS_INCOGNITO_MODE) || mInputAttributes.mNoLearning
|| mInputAttributes.mIsPasswordField;
mBottomRowScale = Settings.readBottomRowScale(prefs, isLandscape, isFolded);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@ public static int getDefaultKeyboardWidth(final Context ctx) {
return windowBounds.width() - insets.left - insets.right;
}

public static int getSecondaryKeyboardHeight(final Resources res, final SettingsValues settingsValues) {
final int keyboardHeight = getKeyboardHeight(res, settingsValues);
if (settingsValues.mToolbarMode == ToolbarMode.HIDDEN && ! settingsValues.mToolbarHidingGlobal) {
// Small adjustment to match the height of the main keyboard which has a hidden strip container.
return keyboardHeight - (int) res.getDimension(R.dimen.config_suggestions_strip_height);
}
return keyboardHeight;
}

public static int getKeyboardHeight(Resources res, SettingsValues settingsValues) {
if (settingsValues.mIsFloatingKeyboard) {
return settingsValues.mFloatingHeight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ fun ToolbarScreen(
Log.v("irrelevant", "stupid way to trigger recomposition on preference change")
val toolbarMode = Settings.readToolbarMode(prefs)
val clipboardToolbarVisible = toolbarMode != ToolbarMode.HIDDEN
|| !prefs.getBoolean(Settings.PREF_TOOLBAR_HIDING_GLOBAL, Defaults.PREF_TOOLBAR_HIDING_GLOBAL)
val items = listOf(
Settings.PREF_TOOLBAR_MODE,
if (toolbarMode == ToolbarMode.HIDDEN) Settings.PREF_TOOLBAR_HIDING_GLOBAL else null,
if (toolbarMode != ToolbarMode.HIDDEN) Settings.PREF_TOOLBAR_SWIPE_DOWN_TO_HIDE else null,
when (toolbarMode) {
ToolbarMode.EXPANDABLE, ToolbarMode.TOOLBAR_KEYS -> Settings.PREF_TOOLBAR_KEYS
Expand Down Expand Up @@ -85,11 +83,6 @@ fun createToolbarSettings(context: Context) = listOf(
KeyboardSwitcher.getInstance().setThemeNeedsReload()
}
},
Setting(context, Settings.PREF_TOOLBAR_HIDING_GLOBAL, R.string.toolbar_hiding_global) {
SwitchPreference(it, Defaults.PREF_TOOLBAR_HIDING_GLOBAL) {
KeyboardSwitcher.getInstance().setThemeNeedsReload()
}
},
Setting(context, Settings.PREF_TOOLBAR_SWIPE_DOWN_TO_HIDE, R.string.toolbar_swipe_down_to_hide, R.string.toolbar_swipe_down_to_hide_summary) {
SwitchPreference(it, Defaults.PREF_TOOLBAR_SWIPE_DOWN_TO_HIDE)
},
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@
<string name="toolbar_mode_toolbar_keys">مفاتيح شريط الأدوات فقط</string>
<string name="toolbar_mode_suggestion_strip">اقتراحات فقط</string>
<string name="toolbar_mode_hidden">مخفي</string>
<string name="toolbar_hiding_global">أخفِ أشرطة أدوات الحافظة والرموز التعبيرية أيضًا</string>
<string name="popup_order_and_hint_source">ترتيب مفاتيح النوافذ المنبثقة ومصدر التلميحات</string>
<string name="landscape">أفقي</string>
<string name="show_emoji_descriptions">أظهر وصف الرموز التعبيرية عند الضغط مطولاً</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@
<string name="toolbar_mode_suggestion_strip">Само предложения</string>
<string name="toolbar_mode_hidden">Скрито</string>
<string name="toolbar_mode_expandable">Клавиши и предложения в лентата с инструменти</string>
<string name="toolbar_hiding_global">Скриване и на лентите с инструменти за клипборда и емотиконите</string>
<string name="landscape">Пейзаж</string>
<string name="popup_order_and_hint_source">Ред на изскачащите клавиши и източник на съвети</string>
<string name="show_emoji_descriptions">Показване на описание на емотикони при продължително натискане</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-bn/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@
<string name="subtype_with_layout_generic">%1$s (%2$s)</string>
<string name="toolbar_mode_expandable">টুলবার বোতাম ও পরামর্শ</string>
<string name="toolbar_mode">টুলবার মোড</string>
<string name="toolbar_hiding_global">ক্লিপবোর্ড ও ইমোজি টুলবার আড়ালকরণ</string>
<string name="toolbar_mode_toolbar_keys">কেবল টুলবার বোতাম</string>
<string name="toolbar_mode_suggestion_strip">কেবল পরামর্শ</string>
<string name="toolbar_mode_hidden">প্রচ্ছন্ন</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-ca/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@
<string name="prefs_emoji_skin_tone_neutral">Neutre</string>
<string name="subtype_with_layout_generic">%1$s (%2$s)</string>
<string name="toolbar_mode_suggestion_strip">Només suggeriments</string>
<string name="toolbar_hiding_global">Amagar també el porta-retalls i les barres d\'eines d\'emojis</string>
<string name="toolbar_mode">Mode barra d\'eines</string>
<string name="toolbar_mode_expandable">Tecles de la barra d\'eines i suggeriments</string>
<string name="toolbar_mode_toolbar_keys">Només tecles de la barra d\'eines</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@
<string name="toolbar_mode_toolbar_keys">Pouze klávesy panelu nástrojů</string>
<string name="toolbar_mode_suggestion_strip">Pouze návrhy</string>
<string name="toolbar_mode_hidden">Skryté</string>
<string name="toolbar_hiding_global">Skrýt také panely schránky a emoji</string>
<string name="toolbar_mode">Režim panelu nástrojů</string>
<string name="popup_order_and_hint_source">Pořadí vyskakovacích kláves a zdroj tipů</string>
<string name="landscape">Na šířku</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@
<string name="toolbar_mode_toolbar_keys">Symbolleiste nur Tasten</string>
<string name="popup_order_and_hint_source">Popup Tasten Reihenfolge und Vorschlag Quelle</string>
<string name="toolbar_mode_hidden">Versteckt</string>
<string name="toolbar_hiding_global">Auch Zwischenablage und Emoji Symbolleisten verstecken</string>
<string name="subtype_with_layout_generic">%1$s (%2$s)</string>
<string name="landscape">Querformat</string>
<string name="toolbar_mode_suggestion_strip">Nur Vorschläge</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@
<string name="landscape">Horizontal</string>
<string name="toolbar_mode_suggestion_strip" tools:keep="@string/toolbar_mode_suggestion_strip">Solo sugerencias</string>
<string name="toolbar_mode_hidden" tools:keep="@string/toolbar_mode_hidden">Oculto</string>
<string name="toolbar_hiding_global">Oculta también las barras del portapapeles y los emojis</string>
<string name="prefs_emoji_key_fit">Escala el tamaño de las teclas de emoticono al tamaño de la fuente</string>
<string name="prefs_emoji_skin_tone">Tono de piel de emoticonos por defecto</string>
<string name="prefs_emoji_skin_tone_neutral">Neutral</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-et/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@
<string name="toolbar_mode_expandable">Tööriistariba nupud ja soovitused</string>
<string name="toolbar_mode_toolbar_keys">Ainult tööriistariba nupud</string>
<string name="toolbar_mode_hidden">Peidetud</string>
<string name="toolbar_hiding_global">Peida ka lõikelaud ja emojide rida</string>
<string name="popup_order_and_hint_source">Klahvide järjestus hüpikaknas ja vihjete allikas</string>
<string name="landscape">Rõhtvaade</string>
<string name="show_emoji_descriptions">Näita emojide kirjeldusi pika vajutusega</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-eu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@
<string name="show_emoji_descriptions">Erakutsi emojiaren deskribapena luze sakatzean</string>
<string name="suggest_emojis_summary">Erabili emoji hiztegia iradokizun normaletan</string>
<string name="suggest_emojis">Iradokitako emojiak</string>
<string name="toolbar_hiding_global">Ezkutatu arbela eta emojien tresna-barrak ere</string>
<string name="toolbar_mode_toolbar_keys">Tresna-barrako gakoak bakarrik</string>
<string name="toolbar_mode_expandable">Tresna-barrako gakoak eta iradokizunak</string>
<string name="toolbar_mode_hidden">Ezkutuan</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@
<string name="toolbar_mode_toolbar_keys" tools:keep="@string/toolbar_mode_toolbar_keys">فقط کلیدهای نوار ابزار</string>
<string name="toolbar_mode_suggestion_strip" tools:keep="@string/toolbar_mode_suggestion_strip">فقط پیشنهادها</string>
<string name="toolbar_mode_hidden" tools:keep="@string/toolbar_mode_hidden">پنهان</string>
<string name="toolbar_hiding_global">پنهان کردن نوار ابزارهای کلیپ‌بورد و ایموجی</string>
<string name="toolbar_keys">انتخاب کلیدهای نوار ابزار</string>
<string name="clipboard" tools:keep="@string/clipboard">کلیپ‌بورد</string>
<string name="clear_clipboard" tools:keep="@string/clear_clipboard">پاک کردن کلیپ‌بورد</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-fi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@
<string name="save_subtype_per_app">Muista kieli sovelluskohtaisesti</string>
<string name="toolbar_mode_suggestion_strip" tools:keep="@string/toolbar_mode_suggestion_strip">Vain ehdotukset</string>
<string name="toolbar_mode_hidden" tools:keep="@string/toolbar_mode_hidden">Piilotettu</string>
<string name="toolbar_hiding_global">Piilota myös leikepöytä- ja emojipalkit</string>
<string name="prefs_font_scale">Näppäimistön fontin skaalaus</string>
<string name="prefs_emoji_font_scale">Emojinäkymän fontin skaalaus</string>
<string name="prefs_emoji_skin_tone_neutral">Neutraali</string>
Expand Down
Loading