mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-20 22:29:10 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
2916e91b6d
11 changed files with 45 additions and 21 deletions
|
@ -27,7 +27,7 @@ You can use [this tool](https://github.com/remi0s/aosp-dictionary-tools) to crea
|
|||
|
||||
Install java:
|
||||
```sh
|
||||
sudo pacman -S jdk8-openjdk jre8-openjdk jre8-openjdk-headless
|
||||
sudo pacman -S jdk11-openjdk jre11-openjdk jre11-openjdk-headless
|
||||
```
|
||||
|
||||
Install Android SDK:
|
||||
|
@ -41,11 +41,6 @@ Configure your SDK location in your `~/.bash_profile` or `~/.bashrc`:
|
|||
export ANDROID_SDK_ROOT=~/snap/androidsdk/current/AndroidSDK/
|
||||
```
|
||||
|
||||
Install the platform tools for your target android version:
|
||||
```sh
|
||||
androidsdk "platform-tools" "platforms;android-29"
|
||||
```
|
||||
|
||||
Compile the project. This will install all dependencies, make sure to accept
|
||||
licenses when prompted.
|
||||
|
||||
|
|
|
@ -16,4 +16,13 @@ public class ClipboardManagerCompat {
|
|||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.O)
|
||||
public static Long getClipTimestamp(ClipData cd) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
return cd.getDescription().getTimestamp();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1082,7 +1082,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element,
|
|||
return;
|
||||
}
|
||||
final int code = key.getCode();
|
||||
if (code == Constants.CODE_SPACE || code == Constants.CODE_LANGUAGE_SWITCH) {
|
||||
if (code == Constants.CODE_SPACE&&Settings.getInstance().getCurrent().mSpaceForLangChange || code == Constants.CODE_LANGUAGE_SWITCH) {
|
||||
// Long pressing the space key invokes IME switcher dialog.
|
||||
if (sListener.onCustomRequest(Constants.CUSTOM_CODE_SHOW_INPUT_METHOD_PICKER)) {
|
||||
cancelKeyTracking();
|
||||
|
|
|
@ -2,9 +2,11 @@ package org.dslul.openboard.inputmethod.latin
|
|||
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.text.TextUtils
|
||||
import android.util.Base64
|
||||
import android.util.Log
|
||||
import androidx.annotation.RequiresApi
|
||||
import org.dslul.openboard.inputmethod.compat.ClipboardManagerCompat
|
||||
import org.dslul.openboard.inputmethod.latin.utils.JsonUtils
|
||||
import java.io.File
|
||||
|
@ -45,25 +47,31 @@ class ClipboardHistoryManager(
|
|||
override fun onPrimaryClipChanged() = fetchPrimaryClip()
|
||||
|
||||
private fun fetchPrimaryClip() {
|
||||
if (!clipboardManager.hasPrimaryClip()) return
|
||||
val clipData = clipboardManager.primaryClip
|
||||
if (clipData != null && clipData.itemCount > 0 && clipData.getItemAt(0) != null) {
|
||||
val content = clipData.getItemAt(0).coerceToText(latinIME)
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
val id = System.nanoTime()
|
||||
val entry = ClipboardHistoryEntry(id, content)
|
||||
historyEntries.add(entry)
|
||||
sortHistoryEntries()
|
||||
val at = historyEntries.indexOf(entry)
|
||||
onHistoryChangeListener?.onClipboardHistoryEntryAdded(at)
|
||||
}
|
||||
val clipData = clipboardManager.primaryClip ?: return
|
||||
if (clipData.itemCount == 0) return
|
||||
clipData.getItemAt(0)?.let { clipItem ->
|
||||
// Starting from API 30, onPrimaryClipChanged() can be called multiple times
|
||||
// for the same clip. We can identify clips with their timestamps since API 26.
|
||||
// We use that to prevent unwanted duplicates.
|
||||
val id = ClipboardManagerCompat.getClipTimestamp(clipData)?.also { stamp ->
|
||||
if (historyEntries.any { it.id == stamp }) return
|
||||
} ?: System.currentTimeMillis()
|
||||
|
||||
val content = clipItem.coerceToText(latinIME)
|
||||
if (TextUtils.isEmpty(content)) return
|
||||
|
||||
val entry = ClipboardHistoryEntry(id, content)
|
||||
historyEntries.add(entry)
|
||||
sortHistoryEntries()
|
||||
val at = historyEntries.indexOf(entry)
|
||||
onHistoryChangeListener?.onClipboardHistoryEntryAdded(at)
|
||||
}
|
||||
}
|
||||
|
||||
fun toggleClipPinned(clipId: Long) {
|
||||
val from = historyEntries.indexOfFirst { it.id == clipId }
|
||||
val historyEntry = historyEntries[from].apply {
|
||||
id = System.nanoTime()
|
||||
id = System.currentTimeMillis()
|
||||
isPinned = !isPinned
|
||||
}
|
||||
sortHistoryEntries()
|
||||
|
|
|
@ -111,6 +111,8 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
|
||||
public static final String PREF_SHOW_HINTS = "pref_show_hints";
|
||||
|
||||
public static final String PREF_SPACE_TO_CHANGE_LANG = "prefs_long_press_keyboard_to_change_lang";
|
||||
|
||||
// This preference key is deprecated. Use {@link #PREF_SHOW_LANGUAGE_SWITCH_KEY} instead.
|
||||
// This is being used only for the backward compatibility.
|
||||
private static final String PREF_SUPPRESS_LANGUAGE_SWITCH_KEY =
|
||||
|
|
|
@ -71,6 +71,7 @@ public class SettingsValues {
|
|||
public final boolean mIncludesOtherImesInLanguageSwitchList;
|
||||
public final boolean mShowsNumberRow;
|
||||
public final boolean mShowsHints;
|
||||
public final boolean mSpaceForLangChange;
|
||||
public final boolean mShowsLanguageSwitchKey;
|
||||
public final boolean mShowsEmojiKey;
|
||||
public final boolean mShowsClipboardKey;
|
||||
|
@ -148,6 +149,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);
|
||||
mShowsHints = prefs.getBoolean(Settings.PREF_SHOW_HINTS, true);
|
||||
mSpaceForLangChange = prefs.getBoolean(Settings.PREF_SPACE_TO_CHANGE_LANG, true);
|
||||
mShowsLanguageSwitchKey = prefs.getBoolean(Settings.PREF_SHOW_LANGUAGE_SWITCH_KEY, false);
|
||||
mShowsEmojiKey = prefs.getBoolean(Settings.PREF_SHOW_EMOJI_KEY, false);
|
||||
mShowsClipboardKey = prefs.getBoolean(Settings.PREF_SHOW_CLIPBOARD_KEY, false);
|
||||
|
|
Binary file not shown.
|
@ -217,6 +217,9 @@
|
|||
<!-- Description of the settings to show hints -->
|
||||
<string name="show_hints_summary">Show long-press hints</string>
|
||||
|
||||
<!-- Title of the settings to disable long press space to change language -->
|
||||
<string name="prefs_long_press_keyboard_to_change_lang">Long press to change lang</string>
|
||||
|
||||
<!-- Title of the settings to enable keyboard resizing -->
|
||||
<string name="prefs_resize_keyboard">Enable keyboard resizing</string>
|
||||
<!-- Title of the settings for setting keyboard height -->
|
||||
|
|
|
@ -34,6 +34,11 @@
|
|||
android:summary="@string/show_hints_summary"
|
||||
android:defaultValue="true"
|
||||
android:persistent="true" />
|
||||
<CheckBoxPreference
|
||||
android:key="prefs_long_press_keyboard_to_change_lang"
|
||||
android:title="@string/prefs_long_press_keyboard_to_change_lang"
|
||||
android:persistent="true"
|
||||
android:defaultValue="true" />
|
||||
<CheckBoxPreference
|
||||
android:key="pref_show_language_switch_key"
|
||||
android:title="@string/show_language_switch_key"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.4.30'
|
||||
ext.kotlin_version = '1.5.31'
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
|
|
BIN
dictionaries/de_wordlist.combined.gz
Normal file → Executable file
BIN
dictionaries/de_wordlist.combined.gz
Normal file → Executable file
Binary file not shown.
Loading…
Add table
Reference in a new issue