Skip to content
Open
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ app/build
.idea/gradle.xml
.idea/misc.xml
*.iml
obj/
bin/
gen/
libs/
2 changes: 1 addition & 1 deletion AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="9" />
android:targetSdkVersion="23" />


<uses-permission android:name="android.permission.READ_USER_DICTIONARY"></uses-permission>
Expand Down
2 changes: 2 additions & 0 deletions ant.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
java.target=1.7
java.source=1.7
91 changes: 91 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="smartkbd" default="help">

<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />

<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:

source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.

For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml

Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.

This file is an integral part of the build system for your
application and should be checked into Version Control Systems.

-->
<property file="ant.properties" />

<!-- if sdk.dir was not set from one of the property file, then
get it from the ANDROID_HOME env var.
This must be done before we load project.properties since
the proguard config can use sdk.dir -->
<property environment="env" />
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
<isset property="env.ANDROID_HOME" />
</condition>

<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.

This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).

This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />

<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
unless="sdk.dir"
/>

<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir})
-post-package
-post-build
-pre-clean
-->
<import file="custom_rules.xml" optional="true" />

<!-- Import the actual build file.

To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.

***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>
1 change: 1 addition & 0 deletions jni/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include $(call all-subdir-makefiles)
2 changes: 2 additions & 0 deletions jni/Application.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
APP_ABI := x86 armeabi-v7a-hard armeabi
APP_MODULES := wnn_smartkbd pinyin_smartkbd smartkbddict
20 changes: 20 additions & 0 deletions jni/libwnnDictionary/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := wnn_smartkbd


LOCAL_SRC_FILES := OpenWnnDictionaryImplJni.c \
engine/ndapi.c \
engine/ndbdic.c \
engine/ndcommon.c \
engine/ndfdic.c \
engine/ndldic.c \
engine/ndrdic.c \
engine/neapi.c \
engine/necode.c \
engine/nj_str.c

include $(BUILD_SHARED_LIBRARY)

24 changes: 24 additions & 0 deletions jni/pinyin/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := pinyin_smartkbd

LOCAL_SRC_FILES := \
share/dictbuilder.cpp \
share/dictlist.cpp \
share/dicttrie.cpp \
share/lpicache.cpp \
share/matrixsearch.cpp \
share/mystdlib.cpp \
share/ngram.cpp \
share/pinyinime.cpp \
share/searchutility.cpp \
share/spellingtable.cpp \
share/spellingtrie.cpp \
share/splparser.cpp \
share/utf16char.cpp \
share/utf16reader.cpp \
android/com_android_inputmethod_pinyin_PinyinDecoderService.cpp

include $(BUILD_SHARED_LIBRARY)
12 changes: 12 additions & 0 deletions jni/smartkbd/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := smartkbddict

LOCAL_SRC_FILES := \
com_dexilog_smartkeyboard_BinaryDictionary.cpp \
dictionary.cpp \
expandable_dic.cpp

include $(BUILD_SHARED_LIBRARY)
16 changes: 16 additions & 0 deletions project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-23
#android.library.reference.2=libs/market_licensing

4 changes: 2 additions & 2 deletions res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

<declare-styleable name="KeyboardView">
<!-- Default KeyboardView style. -->
<attr name="android:keyboardViewStyle" />
<!-- <attr name="android:keyboardViewStyle" /> -->
<!--
Image for the key. This image needs to be a StateListDrawable, with
the following possible states: normal, pressed, checkable,
Expand Down Expand Up @@ -173,4 +173,4 @@
<attr name="android:keyboardMode" />
</declare-styleable>

</resources>
</resources>
9 changes: 8 additions & 1 deletion src/com/dexilog/openskin/OpenSkin.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,17 @@ private void load(String path) {
mLabelFont = loadFont(fonts, "label");
}
mIsValid = true;

} catch (Throwable e) {
// Something bad happened, isValid() will return false
e.printStackTrace();
}

try {
mZipFile.close(); // should be closed
} catch( IOException e ) {
e.printStackTrace();
}
}

private Drawable loadBackground(Element root, String nodeName) throws IOException {
Expand Down Expand Up @@ -438,4 +445,4 @@ private Drawable createDrawable(InputStream is, int density) {
}
}

}
}
2 changes: 1 addition & 1 deletion src/com/dexilog/smartkeyboard/Calibration.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void onCreate(Bundle savedInstanceState) {
// Vibrator
mVibrateOn = sp.getBoolean(KeyboardPreferences.PREF_VIBRATE_ON, true);
if (mVibrateOn) {
mVibrateDuration = new VibratorSettings(sp).getDurationMs();
mVibrateDuration = (int)new VibratorSettings(sp).getDurationMs();
}

// Load the current skin
Expand Down
2 changes: 1 addition & 1 deletion src/com/dexilog/smartkeyboard/SmartKeyboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public void onInitializeInterface() {
keyboardPreferences.initialize(sp);
mVibrateOn = sp.getBoolean(KeyboardPreferences.PREF_VIBRATE_ON, false);
if (mVibrateOn) {
mVibrateDuration = new VibratorSettings(sp).getDurationMs();
mVibrateDuration = (int)(new VibratorSettings(sp).getDurationMs());
mSpaceAlert = sp.getBoolean(KeyboardPreferences.PREF_SPACE_ALERT, false);
}
mSoundOn = sp.getBoolean(KeyboardPreferences.PREF_SOUND_ON, false);
Expand Down
10 changes: 5 additions & 5 deletions src/com/dexilog/smartkeyboard/settings/VibratorSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,30 @@ public class VibratorSettings {
static final int DEFAULT_LEGACY_DURATION = 1;

SharedPreferences prefs;
int vibratorDurationMs;
float vibratorDurationMs;

public VibratorSettings(SharedPreferences prefs) {
this.prefs = prefs;
vibratorDurationMs = prefs.getInt(PREF_VIBRATE_DURATION_MS, -1);
vibratorDurationMs = prefs.getFloat(PREF_VIBRATE_DURATION_MS, -1);
if (vibratorDurationMs == -1) {
convertLegacyPreference();
}
}

public int getDurationMs() {
public float getDurationMs() {
return vibratorDurationMs;
}

private void convertLegacyPreference() {
Integer legacyDuration = prefs.getInt(PREF_VIBRATE_DURATION, -1);
float legacyDuration = prefs.getFloat(PREF_VIBRATE_DURATION, -1.f);
SharedPreferences.Editor editor = prefs.edit();
if (legacyDuration != -1) {
editor.remove(PREF_VIBRATE_DURATION);
} else {
legacyDuration = DEFAULT_LEGACY_DURATION;
}
vibratorDurationMs = 10 + 5 * legacyDuration;
editor.putInt(PREF_VIBRATE_DURATION_MS, vibratorDurationMs);
editor.putFloat(PREF_VIBRATE_DURATION_MS, vibratorDurationMs);
editor.commit();
}

Expand Down
2 changes: 1 addition & 1 deletion src/com/dexilog/smartkeyboard/ui/KeyboardView.java
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ public boolean setShifted(boolean shifted, boolean forceDraw) {
return false;
}

@Override
//@Override
public void setCustomSmileys(boolean customSmileys) {
this.customSmileys = customSmileys;
}
Expand Down