Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dslul committed Dec 31, 2019
0 parents commit 797ee4f
Show file tree
Hide file tree
Showing 2,784 changed files with 343,578 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.iml
.idea
.gradle
local.properties
.DS_Store
build
app/build
app/release
app/.cxx
39 changes: 39 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 29

defaultConfig {
applicationId "org.dslul.openboard.inputmethod.latin"
minSdkVersion 14
targetSdkVersion 29
versionCode 1
versionName "1.0"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

aaptOptions {
noCompress 'dict'
}

externalNativeBuild {
ndkBuild {
path 'src/main/native/jni/Android.mk'
}
}

lintOptions {
checkReleaseBuilds false
}
}

dependencies {
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}
17 changes: 17 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/iwo/android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
192 changes: 192 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
coreApp="true"
package="org.dslul.openboard.inputmethod.latin">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.READ_SYNC_STATS" />
<uses-permission android:name="android.permission.READ_USER_DICTIONARY" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" />

<!-- A signature-protected permission to ask AOSP Keyboard to close the software keyboard.
To use this, add the following line into calling application's AndroidManifest.xml
<pre>
{@code
<uses-permission android:name="org.dslul.openboard.inputmethod.latin.HIDE_SOFT_INPUT"/>
}
</pre>
then call {@link android.content.Context#sendBroadcast(Intent)} as follows:
<pre>
{@code
sendBroadcast(new Intent("org.dslul.openboard.inputmethod.latin.HIDE_SOFT_INPUT")
.setPackage("org.dslul.openboard.inputmethod.latin"));
}
</pre> -->
<permission android:name="org.dslul.openboard.inputmethod.latin.HIDE_SOFT_INPUT"
android:protectionLevel="signature" />

<application android:label="@string/english_ime_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:allowBackup="true"
android:defaultToDeviceProtectedStorage="true"
android:directBootAware="true">

<!-- Services -->
<service android:name="LatinIME"
android:label="@string/english_ime_name"
android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter>
<action android:name="android.view.InputMethod" />
</intent-filter>
<meta-data android:name="android.view.im" android:resource="@xml/method" />
</service>

<service android:name=".spellcheck.AndroidSpellCheckerService"
android:label="@string/spell_checker_service_name"
android:permission="android.permission.BIND_TEXT_SERVICE">
<intent-filter>
<action android:name="android.service.textservice.SpellCheckerService" />
</intent-filter>
<meta-data android:name="android.view.textservice.scs"
android:resource="@xml/spellchecker" />
</service>

<service android:name="org.dslul.openboard.inputmethod.dictionarypack.DictionaryService"
android:label="@string/dictionary_service_name">
</service>

<!-- Activities -->
<activity android:name=".setup.SetupActivity"
android:theme="@style/platformActivityTheme"
android:label="@string/english_ime_name"
android:icon="@mipmap/ic_launcher"
android:launchMode="singleTask"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name=".permissions.PermissionsActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="false"
android:taskAffinity="" >
</activity>

<activity android:name=".setup.SetupWizardActivity"
android:theme="@style/platformActivityTheme"
android:label="@string/english_ime_name"
android:clearTaskOnLaunch="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>

<activity android:name=".settings.SettingsActivity"
android:theme="@style/platformSettingsTheme"
android:label="@string/english_ime_settings">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>

<activity android:name=".spellcheck.SpellCheckerSettingsActivity"
android:theme="@style/platformSettingsTheme"
android:label="@string/android_spell_checker_settings">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>

<activity android:name="org.dslul.openboard.inputmethod.dictionarypack.DictionarySettingsActivity"
android:theme="@style/platformSettingsTheme"
android:label="@string/dictionary_settings_title"
android:uiOptions="splitActionBarWhenNarrow">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>

<activity android:name="org.dslul.openboard.inputmethod.dictionarypack.DownloadOverMeteredDialog"
android:theme="@style/platformActivityTheme"
android:label="@string/dictionary_install_over_metered_network_prompt">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>

<!-- Unexported activity used for tests. -->
<activity android:name=".settings.TestFragmentActivity"
android:exported="false" />

<!-- Broadcast receivers -->
<receiver android:name="SystemBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_INITIALIZE" />
<action android:name="android.intent.action.LOCALE_CHANGED" />
</intent-filter>
</receiver>

<receiver android:name="DictionaryPackInstallBroadcastReceiver" android:exported="false">
<intent-filter>
<action android:name="org.dslul.openboard.inputmethod.dictionarypack.aosp.UNKNOWN_CLIENT" />
</intent-filter>
</receiver>

<receiver android:name="org.dslul.openboard.inputmethod.dictionarypack.EventHandler">
<intent-filter>
<action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
<action android:name="android.intent.action.DATE_CHANGED" />
<action android:name="org.dslul.openboard.inputmethod.dictionarypack.aosp.UPDATE_NOW" />
<action android:name="org.dslul.openboard.inputmethod.dictionarypack.aosp.INIT_AND_UPDATE_NOW" />
</intent-filter>
</receiver>

<!-- Broadcast receiver for AccountManager#LOGIN_ACCOUNTS_CHANGED_ACTION. -->
<receiver android:name=".accounts.AccountsChangedReceiver">
<intent-filter>
<action android:name="android.accounts.LOGIN_ACCOUNTS_CHANGED" />
</intent-filter>
</receiver>

<!-- Content providers -->
<provider android:name="org.dslul.openboard.inputmethod.dictionarypack.DictionaryProvider"
android:grantUriPermissions="true"
android:exported="false"
android:authorities="@string/authority"
android:multiprocess="false"
android:label="@string/dictionary_provider_name">
</provider>
</application>
</manifest>
Binary file added app/src/main/dictionaries/bg_wordlist.combined.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added app/src/main/dictionaries/de_wordlist.combined.gz
Binary file not shown.
Binary file added app/src/main/dictionaries/el_wordlist.combined.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added app/src/main/dictionaries/en_emoji.combined.gz
Binary file not shown.
Binary file not shown.
Binary file added app/src/main/dictionaries/es_wordlist.combined.gz
Binary file not shown.
Binary file added app/src/main/dictionaries/fi_wordlist.combined.gz
Binary file not shown.
Binary file added app/src/main/dictionaries/fr_emoji.combined.gz
Binary file not shown.
Binary file added app/src/main/dictionaries/fr_wordlist.combined.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added app/src/main/dictionaries/nl_wordlist.combined.gz
Binary file not shown.
Binary file added app/src/main/dictionaries/pl_wordlist.combined.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added app/src/main/dictionaries/ro_wordlist.combined.gz
Binary file not shown.
Binary file added app/src/main/dictionaries/ru_wordlist.combined.gz
Binary file not shown.
38 changes: 38 additions & 0 deletions app/src/main/dictionaries/sample.combined
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This is a sample wordlist that can be converted to a binary dictionary
# for use by the Latin IME.
# The file is essentially a CSV file, with indent level denoting nesting.
#
# The file starts with a single CSV line with the header attributes. Whatever
# the content, these are included as is in the binary file. The first attribute
# of the file should be `dictionary'. Usual fields are `locale', `description',
# `date', `version', `options'.
#
# Each word has a `word' entry and at least a `f' argument denoting its
# probability, as an integer between 0 and 255 on a logarithmic scale, with
# 255 meaning 1 and each decrement in 1 dividing probability by 1.15.
# As a special case, a weight of 0 is taken to mean profanity - words that
# should not be considered a typo, but that should never be suggested
# explicitly. An entry may be made not a word by adding a `not_a_word'
# field with a value of `true'. The main reason for putting such entries
# into the dictionary is to add shortcut targets and maybe a whitelist
# replacement.
#
# Each word may or may not have any number of shortcut target lines
# starting with a `shortcut' entry and having at least a `f' frequency
# value between 0 and 14, or the special value `whitelist' which becomes
# 15, which is then taken to be the whitelist target of this word.
#
# Each word may also have any number of bigram lines starting with a
# `bigram' entry containing the following word whose frequency should
# override the unigram frequency when following the word this bigram is
# for.
#
dictionary=main:en,locale=en,description=Sample wordlist,date=1351495318,version=1
word=sample,f=200
bigram=wordlist,f=243
word=wordlist,f=180
word=shortcut,f=176
shortcut=target,f=10
word=witelisted,f=10,not_a_word=true
shortcut=whitelisted,f=whitelist
word=profanity,f=0
Binary file not shown.
Binary file not shown.
Binary file added app/src/main/dictionaries/sv_wordlist.combined.gz
Binary file not shown.
Binary file not shown.
Binary file added app/src/main/dictionaries/uk_wordlist.combined.gz
Binary file not shown.
Binary file added app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* 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.accessibility;

import android.content.Context;
import android.os.Handler;
import android.os.Message;

import org.dslul.openboard.inputmethod.keyboard.Key;
import org.dslul.openboard.inputmethod.latin.R;

// Handling long press timer to show a more keys keyboard.
final class AccessibilityLongPressTimer extends Handler {
public interface LongPressTimerCallback {
public void performLongClickOn(Key key);
}

private static final int MSG_LONG_PRESS = 1;

private final LongPressTimerCallback mCallback;
private final long mConfigAccessibilityLongPressTimeout;

public AccessibilityLongPressTimer(final LongPressTimerCallback callback,
final Context context) {
super();
mCallback = callback;
mConfigAccessibilityLongPressTimeout = context.getResources().getInteger(
R.integer.config_accessibility_long_press_key_timeout);
}

@Override
public void handleMessage(final Message msg) {
switch (msg.what) {
case MSG_LONG_PRESS:
cancelLongPress();
mCallback.performLongClickOn((Key)msg.obj);
return;
default:
super.handleMessage(msg);
return;
}
}

public void startLongPress(final Key key) {
cancelLongPress();
final Message longPressMessage = obtainMessage(MSG_LONG_PRESS, key);
sendMessageDelayed(longPressMessage, mConfigAccessibilityLongPressTimeout);
}

public void cancelLongPress() {
removeMessages(MSG_LONG_PRESS);
}
}
Loading

0 comments on commit 797ee4f

Please sign in to comment.