Merge "Import translations. DO NOT MERGE"
diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml
index 925eb55..b47897f 100644
--- a/java/res/values/dimens.xml
+++ b/java/res/values/dimens.xml
@@ -93,4 +93,12 @@
     <dimen name="more_suggestions_hint_text_size">27dp</dimen>
     <integer name="suggestions_count_in_strip">3</integer>
     <integer name="center_suggestion_percentile">36</integer>
+
+    <!-- Gesture preview parameters -->
+    <dimen name="gesture_preview_trail_width">2.5dp</dimen>
+    <dimen name="gesture_preview_text_size">35dp</dimen>
+    <dimen name="gesture_preview_text_offset">75dp</dimen>
+    <dimen name="gesture_preview_text_shadow_border">17.5dp</dimen>
+    <dimen name="gesture_preview_text_shading_border">7.5dp</dimen>
+    <dimen name="gesture_preview_text_connector_width">1.0dp</dimen>
 </resources>
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index cb793cb..25d9827 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -181,6 +181,12 @@
     <string name="spoken_description_search">Search</string>
     <!-- Spoken description for the "U+2022" (BULLET) keyboard key. -->
     <string name="spoken_description_dot">Dot</string>
+    <!-- Spoken description for the "Switch language" keyboard key. -->
+    <string name="spoken_description_language_switch">Switch language</string>
+    <!-- Spoken description for the "Next" action keyboard key. -->
+    <string name="spoken_description_action_next">Next</string>
+    <!-- Spoken description for the "Previous" action keyboard key. -->
+    <string name="spoken_description_action_previous">Previous</string>
 
     <!-- Spoken feedback after turning "Shift" mode on. -->
     <string name="spoken_description_shiftmode_on">Shift enabled</string>
diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml
index b1315c0..b448e00 100644
--- a/java/res/xml/method.xml
+++ b/java/res/xml/method.xml
@@ -64,6 +64,7 @@
     sr: Serbian/south_slavic
     (sr-Latn: Serbian/qwerty) # not yet implemented.
     sv: Swedish/nordic
+    sw: Swahili/qwerty
     th: Thai/thai
     tl: Tagalog/spanish
     tr: Turkish/qwerty
@@ -341,6 +342,12 @@
     />
     <subtype android:icon="@drawable/ic_subtype_keyboard"
             android:label="@string/subtype_generic"
+            android:imeSubtypeLocale="sw"
+            android:imeSubtypeMode="keyboard"
+            android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
+    />
+    <subtype android:icon="@drawable/ic_subtype_keyboard"
+            android:label="@string/subtype_generic"
             android:imeSubtypeLocale="th"
             android:imeSubtypeMode="keyboard"
             android:imeSubtypeExtraValue="KeyboardLayoutSet=thai"
diff --git a/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java b/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java
index 5ffd94a..9b74070 100644
--- a/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java
+++ b/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java
@@ -60,10 +60,8 @@
         // Manual label substitutions for key labels with no string resource
         mKeyLabelMap.put(":-)", R.string.spoken_description_smiley);
 
-        // Symbols that most TTS engines can't speak
-        mKeyCodeMap.put(' ', R.string.spoken_description_space);
-
         // Special non-character codes defined in Keyboard
+        mKeyCodeMap.put(Keyboard.CODE_SPACE, R.string.spoken_description_space);
         mKeyCodeMap.put(Keyboard.CODE_DELETE, R.string.spoken_description_delete);
         mKeyCodeMap.put(Keyboard.CODE_ENTER, R.string.spoken_description_return);
         mKeyCodeMap.put(Keyboard.CODE_SETTINGS, R.string.spoken_description_settings);
@@ -71,6 +69,9 @@
         mKeyCodeMap.put(Keyboard.CODE_SHORTCUT, R.string.spoken_description_mic);
         mKeyCodeMap.put(Keyboard.CODE_SWITCH_ALPHA_SYMBOL, R.string.spoken_description_to_symbol);
         mKeyCodeMap.put(Keyboard.CODE_TAB, R.string.spoken_description_tab);
+        mKeyCodeMap.put(Keyboard.CODE_LANGUAGE_SWITCH, R.string.spoken_description_language_switch);
+        mKeyCodeMap.put(Keyboard.CODE_ACTION_NEXT, R.string.spoken_description_action_next);
+        mKeyCodeMap.put(Keyboard.CODE_ACTION_PREVIOUS, R.string.spoken_description_action_previous);
     }
 
     /**
@@ -274,8 +275,7 @@
             return context.getString(OBSCURED_KEY_RES_ID);
         }
 
-        final int resId = mKeyCodeMap.get(code);
-        if (resId != 0) {
+        if (mKeyCodeMap.indexOfKey(code) >= 0) {
             return context.getString(mKeyCodeMap.get(code));
         } else if (isDefinedNonCtrl) {
             return Character.toString((char) code);
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index b9c591d..f1f942c 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -35,9 +35,9 @@
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.RelativeLayout;
 import android.widget.TextView;
 
+import com.android.inputmethod.keyboard.internal.PreviewPlacerView;
 import com.android.inputmethod.latin.Constants;
 import com.android.inputmethod.latin.LatinImeLogger;
 import com.android.inputmethod.latin.R;
@@ -97,9 +97,6 @@
     // The maximum key label width in the proportion to the key width.
     private static final float MAX_LABEL_RATIO = 0.90f;
 
-    private final static int GESTURE_DRAWING_WIDTH = 5;
-    private final static int GESTURE_DRAWING_COLOR = 0xff33b5e5;
-
     // Main keyboard
     private Keyboard mKeyboard;
     protected final KeyDrawParams mKeyDrawParams;
@@ -109,7 +106,7 @@
     protected final KeyPreviewDrawParams mKeyPreviewDrawParams;
     private boolean mShowKeyPreviewPopup = true;
     private int mDelayAfterPreview;
-    private ViewGroup mPreviewPlacer;
+    private PreviewPlacerView mPreviewPlacer;
 
     /** True if {@link KeyboardView} should handle gesture events. */
     protected boolean mShouldHandleGesture;
@@ -125,14 +122,11 @@
     private final HashSet<Key> mInvalidatedKeys = new HashSet<Key>();
     /** The region of invalidated keys */
     private final Rect mInvalidatedKeysRect = new Rect();
-    /** The region of invalidated gestures */
-    private final Rect mInvalidatedGesturesRect = new Rect();
     /** The keyboard bitmap buffer for faster updates */
     private Bitmap mBuffer;
     /** The canvas for the above mutable keyboard bitmap */
     private Canvas mCanvas;
     private final Paint mPaint = new Paint();
-    private final Paint mGesturePaint = new Paint();
     private final Paint.FontMetrics mFontMetrics = new Paint.FontMetrics();
     // This sparse array caches key label text height in pixel indexed by key label text size.
     private static final SparseArray<Float> sTextHeightCache = new SparseArray<Float>();
@@ -382,13 +376,6 @@
         mDelayAfterPreview = mKeyPreviewDrawParams.mLingerTimeout;
 
         mPaint.setAntiAlias(true);
-
-        // TODO: These paint parameters should be specified via attribute of the view and styleable.
-        mGesturePaint.setAntiAlias(true);
-        mGesturePaint.setStyle(Paint.Style.STROKE);
-        mGesturePaint.setStrokeJoin(Paint.Join.ROUND);
-        mGesturePaint.setColor(GESTURE_DRAWING_COLOR);
-        mGesturePaint.setStrokeWidth(GESTURE_DRAWING_WIDTH);
     }
 
     // Read fraction value in TypedArray as float.
@@ -888,29 +875,6 @@
         mDrawingHandler.dismissKeyPreview(mDelayAfterPreview, tracker);
     }
 
-    private static class PreviewPlacerView extends RelativeLayout {
-        private final Paint mGesturePaint;
-        final int mCoordinateX;
-        final int mCoordinateY;
-
-        public PreviewPlacerView(Context context, int coordinateX, int coordinateY,
-                Paint gesturePaint) {
-            super(context);
-            setWillNotDraw(false);
-            mGesturePaint = gesturePaint;
-            mCoordinateX = coordinateX;
-            mCoordinateY = coordinateY;
-        }
-
-        @Override
-        public void onDraw(Canvas canvas) {
-            super.onDraw(canvas);
-            canvas.translate(mCoordinateX, mCoordinateY);
-            PointerTracker.drawGestureTrailForAllPointerTrackers(canvas, mGesturePaint);
-            canvas.translate(-mCoordinateX, -mCoordinateY);
-        }
-    }
-
     private void addKeyPreview(TextView keyPreview) {
         if (mPreviewPlacer == null) {
             createPreviewPlacer();
@@ -920,31 +884,31 @@
     }
 
     private void createPreviewPlacer() {
-        getLocationInWindow(mKeyPreviewDrawParams.mCoordinates);
-        mPreviewPlacer = new PreviewPlacerView(getContext(), mKeyPreviewDrawParams.mCoordinates[0],
-                mKeyPreviewDrawParams.mCoordinates[1], mGesturePaint);
+        mPreviewPlacer = new PreviewPlacerView(getContext());
+        final int[] viewOrigin = new int[2];
+        getLocationInWindow(viewOrigin);
+        mPreviewPlacer.setOrigin(viewOrigin[0], viewOrigin[1]);
         final ViewGroup windowContentView =
                 (ViewGroup)getRootView().findViewById(android.R.id.content);
         windowContentView.addView(mPreviewPlacer);
     }
 
-    @Override
-    public void showGestureTrail(PointerTracker tracker) {
+    public void showGesturePreviewText(String gesturePreviewText) {
+        // TDOD: Add user settings option to control drawing gesture trail.
         if (mPreviewPlacer == null) {
             createPreviewPlacer();
         }
-        final Rect r = tracker.getBoundingBox();
-        if (!r.isEmpty()) {
-            // Invalidate the rectangular region encompassing the gesture. This is needed because
-            // past points along the gesture will fade and gradually disappear.
-            final KeyPreviewDrawParams params = mKeyPreviewDrawParams;
-            mInvalidatedGesturesRect.set(r);
-            mInvalidatedGesturesRect.offset(params.mCoordinates[0], params.mCoordinates[1]);
-            mInvalidatedGesturesRect.inset(-GESTURE_DRAWING_WIDTH, -GESTURE_DRAWING_WIDTH);
-            mPreviewPlacer.invalidate(mInvalidatedGesturesRect);
-        } else {
-            mPreviewPlacer.invalidate();
+        mPreviewPlacer.setGesturePreviewText(gesturePreviewText);
+        mPreviewPlacer.invalidate();
+    }
+
+    @Override
+    public void showGestureTrail(PointerTracker tracker) {
+        // TDOD: Add user settings option to control drawing gesture trail.
+        if (mPreviewPlacer == null) {
+            createPreviewPlacer();
         }
+        mPreviewPlacer.invalidatePointer(tracker);
     }
 
     @SuppressWarnings("deprecation") // setBackgroundDrawable is replaced by setBackground in API16
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index 56c3d46..67857d1 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -18,7 +18,6 @@
 
 import android.graphics.Canvas;
 import android.graphics.Paint;
-import android.graphics.Rect;
 import android.os.SystemClock;
 import android.util.Log;
 import android.view.MotionEvent;
@@ -296,17 +295,6 @@
         sAggregratedPointers.reset();
     }
 
-    // TODO: To handle multi-touch gestures we may want to move this method to
-    // {@link PointerTrackerQueue}.
-    public static void drawGestureTrailForAllPointerTrackers(Canvas canvas, Paint paint) {
-        final int trackersSize = sTrackers.size();
-        for (int i = 0; i < trackersSize; ++i) {
-            final PointerTracker tracker = sTrackers.get(i);
-            tracker.mGestureStroke.drawGestureTrail(canvas, paint, tracker.getLastX(),
-                    tracker.getLastY());
-        }
-    }
-
     private PointerTracker(int id, KeyEventHandler handler) {
         if (handler == null)
             throw new NullPointerException();
@@ -524,6 +512,12 @@
         mDrawingProxy.invalidateKey(key);
     }
 
+    public void drawGestureTrail(Canvas canvas, Paint paint) {
+        if (mInGesture) {
+            mGestureStroke.drawGestureTrail(canvas, paint, mLastX, mLastY);
+        }
+    }
+
     public int getLastX() {
         return mLastX;
     }
@@ -535,9 +529,6 @@
     public long getDownTime() {
         return mDownTime;
     }
-    public Rect getBoundingBox() {
-        return mGestureStroke.getBoundingBox();
-    }
 
     private Key onDownKey(int x, int y, long eventTime) {
         mDownTime = eventTime;
diff --git a/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java b/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java
index c16b70e..28d6c1d 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java
@@ -16,7 +16,6 @@
 
 import android.graphics.Canvas;
 import android.graphics.Paint;
-import android.graphics.Rect;
 import android.util.FloatMath;
 
 import com.android.inputmethod.latin.Constants;
@@ -41,7 +40,6 @@
     private int mMinGestureLength;
     private int mMinGestureLengthWhileInGesture;
     private int mMinGestureSampleLength;
-    private final Rect mDrawingRect = new Rect();
 
     // TODO: Move some of these to resource.
     private static final float MIN_GESTURE_LENGTH_RATIO_TO_KEY_WIDTH = 1.0f;
@@ -90,7 +88,6 @@
         mEventTimes.setLength(0);
         mXCoordinates.setLength(0);
         mYCoordinates.setLength(0);
-        mDrawingRect.setEmpty();
     }
 
     private void updateLastPoint(final int x, final int y, final int time) {
@@ -198,8 +195,4 @@
             }
         }
     }
-
-    public Rect getBoundingBox() {
-        return mDrawingRect;
-    }
 }
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
index fc8939b..308e241 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
@@ -2188,6 +2188,56 @@
         /* 24 */ "\u00E6",
     };
 
+    /* Language sw: Swahili */
+    private static final String[] LANGUAGE_sw = {
+        // U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
+        // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
+        // U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
+        // U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
+        // U+00E6: "æ" LATIN SMALL LETTER AE
+        // U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
+        // U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
+        // U+0101: "ā" LATIN SMALL LETTER A WITH MACRON
+        /* 0 */ "\u00E0,\u00E1,\u00E2,\u00E4,\u00E6,\u00E3,\u00E5,\u0101",
+        // U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
+        // U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
+        // U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
+        // U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
+        // U+0113: "ē" LATIN SMALL LETTER E WITH MACRON
+        /* 1 */ "\u00E8,\u00E9,\u00EA,\u00EB,\u0113",
+        // U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
+        // U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
+        // U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
+        // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
+        // U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE
+        /* 2 */ "\u00EE,\u00EF,\u00ED,\u012B,\u00EC",
+        // U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
+        // U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
+        // U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
+        // U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
+        // U+0153: "œ" LATIN SMALL LIGATURE OE
+        // U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
+        // U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
+        // U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE
+        /* 3 */ "\u00F4,\u00F6,\u00F2,\u00F3,\u0153,\u00F8,\u014D,\u00F5",
+        // U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
+        // U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
+        // U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
+        // U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
+        // U+016B: "ū" LATIN SMALL LETTER U WITH MACRON
+        /* 4 */ "\u00FB,\u00FC,\u00F9,\u00FA,\u016B",
+        // U+00DF: "ß" LATIN SMALL LETTER SHARP S
+        /* 5 */ "\u00DF",
+        // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE
+        /* 6 */ "\u00F1",
+        // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA
+        /* 7 */ "\u00E7",
+        /* 8~ */
+        null, null, null, null, null, null, null,
+        /* ~14 */
+        /* 15 */ "g\'",
+    };
+
     /* Language tl: Tagalog */
     private static final String[] LANGUAGE_tl = {
         // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
@@ -2550,6 +2600,7 @@
         "sl", LANGUAGE_sl, /* Slovenian */
         "sr", LANGUAGE_sr, /* Serbian */
         "sv", LANGUAGE_sv, /* Swedish */
+        "sw", LANGUAGE_sw, /* Swahili */
         "tl", LANGUAGE_tl, /* Tagalog */
         "tr", LANGUAGE_tr, /* Turkish */
         "uk", LANGUAGE_uk, /* Ukrainian */
diff --git a/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java b/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java
new file mode 100644
index 0000000..2a53c59
--- /dev/null
+++ b/java/src/com/android/inputmethod/keyboard/internal/PreviewPlacerView.java
@@ -0,0 +1,172 @@
+/*
+ * 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 com.android.inputmethod.keyboard.internal;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Paint.Align;
+import android.text.TextUtils;
+import android.util.SparseArray;
+import android.widget.RelativeLayout;
+
+import com.android.inputmethod.keyboard.PointerTracker;
+import com.android.inputmethod.latin.R;
+
+public class PreviewPlacerView extends RelativeLayout {
+    // TODO: Move these parameters to attributes of {@link KeyboardView}.
+    private final static int GESTURE_DRAWING_COLOR = 0xff33b5e5;
+    private static final int GESTURE_PREVIEW_TEXT_COLOR = Color.WHITE;
+    private static final int GESTURE_PREVIEW_TEXT_SHADING_COLOR = 0xff33b5e5;
+    private static final int GESTURE_PREVIEW_TEXT_SHADOW_COLOR = 0xff252525;
+    private static final int GESTURE_PREVIEW_CONNECTOR_COLOR = Color.WHITE;
+
+    private final Paint mGesturePaint;
+    private final int mGesturePreviewTraileWidth;
+    private final Paint mTextPaint;
+    private final int mGesturePreviewTextOffset;
+    private final int mGesturePreviewTextShadowBorder;
+    private final int mGesturePreviewTextShadingBorder;
+    private final int mGesturePreviewTextConnectorWidth;
+
+    private int mXOrigin;
+    private int mYOrigin;
+
+    private final SparseArray<PointerTracker> mPointers = new SparseArray<PointerTracker>();
+
+    private String mGesturePreviewText;
+
+    public PreviewPlacerView(Context context) {
+        super(context);
+        setWillNotDraw(false);
+
+        final Resources res = getResources();
+        // TODO: Move these parameters to attributes of {@link KeyboardView}.
+        mGesturePreviewTraileWidth = res.getDimensionPixelSize(
+                R.dimen.gesture_preview_trail_width);
+        final int textSize = res.getDimensionPixelSize(R.dimen.gesture_preview_text_size);
+        mGesturePreviewTextOffset = res.getDimensionPixelSize(
+                R.dimen.gesture_preview_text_offset);
+        mGesturePreviewTextShadowBorder = res.getDimensionPixelOffset(
+                R.dimen.gesture_preview_text_shadow_border);
+        mGesturePreviewTextShadingBorder = res.getDimensionPixelOffset(
+                R.dimen.gesture_preview_text_shading_border);
+        mGesturePreviewTextConnectorWidth = res.getDimensionPixelOffset(
+                R.dimen.gesture_preview_text_connector_width);
+
+        mGesturePaint = new Paint();
+        mGesturePaint.setAntiAlias(true);
+        mGesturePaint.setStyle(Paint.Style.STROKE);
+        mGesturePaint.setStrokeJoin(Paint.Join.ROUND);
+        mGesturePaint.setColor(GESTURE_DRAWING_COLOR);
+        mGesturePaint.setStrokeWidth(mGesturePreviewTraileWidth);
+
+        mTextPaint = new Paint();
+        mTextPaint.setAntiAlias(true);
+        mTextPaint.setStrokeJoin(Paint.Join.ROUND);
+        mTextPaint.setTextAlign(Align.CENTER);
+        mTextPaint.setTextSize(textSize);
+    }
+
+    public void setOrigin(int x, int y) {
+        mXOrigin = x;
+        mYOrigin = y;
+    }
+
+    public void invalidatePointer(PointerTracker tracker) {
+        synchronized (mPointers) {
+            mPointers.put(tracker.mPointerId, tracker);
+            // TODO: Should narrow the invalidate region.
+            invalidate();
+        }
+    }
+
+    @Override
+    public void onDraw(Canvas canvas) {
+        super.onDraw(canvas);
+        // TDOD: Add user settings option to control drawing gesture trail and gesture preview.
+        synchronized (mPointers) {
+            canvas.translate(mXOrigin, mYOrigin);
+            final int trackerCount = mPointers.size();
+            boolean floatingPreviewHasDrawn = false;
+            for (int index = 0; index < trackerCount; index++) {
+                final PointerTracker tracker = mPointers.valueAt(index);
+                tracker.drawGestureTrail(canvas, mGesturePaint);
+                // TODO: Figure out more cleaner way to draw gesture preview text.
+                if (!floatingPreviewHasDrawn) {
+                    drawGesturePreviewText(canvas, tracker, mGesturePreviewText);
+                    floatingPreviewHasDrawn = true;
+                }
+            }
+            canvas.translate(-mXOrigin, -mYOrigin);
+        }
+    }
+
+    public void setGesturePreviewText(String gesturePreviewText) {
+        mGesturePreviewText = gesturePreviewText;
+        invalidate();
+    }
+
+    private void drawGesturePreviewText(Canvas canvas, PointerTracker tracker,
+            String gesturePreviewText) {
+        if (TextUtils.isEmpty(gesturePreviewText)) {
+            return;
+        }
+
+        final Paint paint = mTextPaint;
+        final int lastX = tracker.getLastX();
+        final int lastY = tracker.getLastY();
+        final int textSize = (int)paint.getTextSize();
+        final int canvasWidth = canvas.getWidth();
+
+        final int halfTextWidth = (int)paint.measureText(gesturePreviewText) / 2 + textSize;
+        final int textX = Math.min(Math.max(lastX, halfTextWidth), canvasWidth - halfTextWidth);
+
+        int textY = Math.max(-textSize, lastY - mGesturePreviewTextOffset);
+        if (textY < 0) {
+            // Paint black text shadow if preview extends above keyboard region.
+            paint.setStyle(Paint.Style.FILL_AND_STROKE);
+            paint.setColor(GESTURE_PREVIEW_TEXT_SHADOW_COLOR);
+            paint.setStrokeWidth(mGesturePreviewTextShadowBorder);
+            canvas.drawText(gesturePreviewText, textX, textY, paint);
+        }
+
+        // Paint the vertical line connecting the touch point to the preview text.
+        paint.setStyle(Paint.Style.STROKE);
+        paint.setColor(GESTURE_PREVIEW_CONNECTOR_COLOR);
+        paint.setStrokeWidth(mGesturePreviewTextConnectorWidth);
+        final int lineTopY = textY - textSize / 4;
+        canvas.drawLine(lastX, lastY, lastX, lineTopY, paint);
+        if (lastX != textX) {
+            // Paint the horizontal line connection the touch point to the preview text.
+            canvas.drawLine(lastX, lineTopY, textX, lineTopY, paint);
+        }
+
+        // Paint the shading for the text preview
+        paint.setStyle(Paint.Style.FILL_AND_STROKE);
+        paint.setColor(GESTURE_PREVIEW_TEXT_SHADING_COLOR);
+        paint.setStrokeWidth(mGesturePreviewTextShadingBorder);
+        canvas.drawText(gesturePreviewText, textX, textY, paint);
+
+        // Paint the text preview
+        paint.setColor(GESTURE_PREVIEW_TEXT_COLOR);
+        paint.setStyle(Paint.Style.FILL);
+        canvas.drawText(gesturePreviewText, textX, textY, paint);
+    }
+}
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 7d79886..9f9d07b 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1343,6 +1343,9 @@
         mWordComposer.setBatchInputPointers(batchPointers);
         final SuggestedWords suggestedWords = getSuggestedWords();
         showSuggestionStrip(suggestedWords, null);
+        final String gesturePreviewText = (suggestedWords.size() > 0)
+                ? suggestedWords.getWord(0) : null;
+        mKeyboardSwitcher.getKeyboardView().showGesturePreviewText(gesturePreviewText);
     }
 
     @Override
@@ -1350,6 +1353,7 @@
         mWordComposer.setBatchInputPointers(batchPointers);
         final SuggestedWords suggestedWords = getSuggestedWords();
         showSuggestionStrip(suggestedWords, null);
+        mKeyboardSwitcher.getKeyboardView().showGesturePreviewText(null);
         if (suggestedWords == null || suggestedWords.size() == 0) {
             return;
         }
diff --git a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
index 9eb437c..0a8aabf 100644
--- a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
+++ b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.cpp
@@ -1,19 +1,19 @@
 /*
-**
-** Copyright 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.
-*/
+ *
+ * Copyright 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.
+ */
 
 #define LOG_TAG "LatinIME: jni: ProximityInfo"
 
@@ -85,5 +85,4 @@
     return registerNativeMethods(env, kClassPathName, sKeyboardMethods,
             sizeof(sKeyboardMethods) / sizeof(sKeyboardMethods[0]));
 }
-
 } // namespace latinime
diff --git a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h
index 4a1e83b..f5ccf20 100644
--- a/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h
+++ b/native/jni/com_android_inputmethod_keyboard_ProximityInfo.h
@@ -1,19 +1,19 @@
 /*
-**
-** Copyright 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.
-*/
+ *
+ * Copyright 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.
+ */
 
 #ifndef _COM_ANDROID_INPUTMETHOD_KEYBOARD_PROXIMITYINFO_H
 #define _COM_ANDROID_INPUTMETHOD_KEYBOARD_PROXIMITYINFO_H
@@ -24,6 +24,5 @@
 
 int register_ProximityInfo(JNIEnv *env);
 
-}
-
+} // namespace latinime
 #endif // _COM_ANDROID_INPUTMETHOD_KEYBOARD_PROXIMITYINFO_H
diff --git a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
index 0a282b8..8725b0c 100644
--- a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
+++ b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
@@ -1,19 +1,19 @@
 /*
-**
-** Copyright 2009, 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.
-*/
+ *
+ * Copyright 2009, 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.
+ */
 
 #define LOG_TAG "LatinIME: jni: BinaryDictionary"
 
@@ -42,7 +42,7 @@
 
 namespace latinime {
 
-void releaseDictBuf(void* dictBuf, const size_t length, int fd);
+void releaseDictBuf(void *dictBuf, const size_t length, int fd);
 
 static jlong latinime_BinaryDictionary_open(JNIEnv *env, jobject object,
         jstring sourceDir, jlong dictOffset, jlong dictSize,
@@ -235,7 +235,7 @@
     delete dictionary;
 }
 
-void releaseDictBuf(void* dictBuf, const size_t length, int fd) {
+void releaseDictBuf(void *dictBuf, const size_t length, int fd) {
 #ifdef USE_MMAP_FOR_DICTIONARY
     int ret = munmap(dictBuf, length);
     if (ret != 0) {
@@ -263,9 +263,8 @@
 };
 
 int register_BinaryDictionary(JNIEnv *env) {
-    const char* const kClassPathName = "com/android/inputmethod/latin/BinaryDictionary";
+    const char *const kClassPathName = "com/android/inputmethod/latin/BinaryDictionary";
     return registerNativeMethods(env, kClassPathName, sMethods,
             sizeof(sMethods) / sizeof(sMethods[0]));
 }
-
 } // namespace latinime
diff --git a/native/jni/com_android_inputmethod_latin_BinaryDictionary.h b/native/jni/com_android_inputmethod_latin_BinaryDictionary.h
index 1b1ba7f..0b67e6b 100644
--- a/native/jni/com_android_inputmethod_latin_BinaryDictionary.h
+++ b/native/jni/com_android_inputmethod_latin_BinaryDictionary.h
@@ -1,19 +1,19 @@
 /*
-**
-** Copyright 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.
-*/
+ *
+ * Copyright 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.
+ */
 
 #ifndef _COM_ANDROID_INPUTMETHOD_LATIN_BINARYDICTIONARY_H
 #define _COM_ANDROID_INPUTMETHOD_LATIN_BINARYDICTIONARY_H
@@ -24,6 +24,5 @@
 
 int register_BinaryDictionary(JNIEnv *env);
 
-}
-
+} // namespace latinime
 #endif // _COM_ANDROID_INPUTMETHOD_LATIN_BINARYDICTIONARY_H
diff --git a/native/jni/com_android_inputmethod_latin_NativeUtils.cpp b/native/jni/com_android_inputmethod_latin_NativeUtils.cpp
index c1e586a..32d8954 100644
--- a/native/jni/com_android_inputmethod_latin_NativeUtils.cpp
+++ b/native/jni/com_android_inputmethod_latin_NativeUtils.cpp
@@ -1,19 +1,19 @@
 /*
-**
-** Copyright 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.
-*/
+ *
+ * Copyright 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.
+ */
 
 #include "com_android_inputmethod_latin_NativeUtils.h"
 #include "jni.h"
@@ -32,9 +32,8 @@
 };
 
 int register_NativeUtils(JNIEnv *env) {
-    const char* const kClassPathName = "com/android/inputmethod/latin/NativeUtils";
+    const char *const kClassPathName = "com/android/inputmethod/latin/NativeUtils";
     return registerNativeMethods(env, kClassPathName, sMethods,
             sizeof(sMethods) / sizeof(sMethods[0]));
 }
-
 } // namespace latinime
diff --git a/native/jni/com_android_inputmethod_latin_NativeUtils.h b/native/jni/com_android_inputmethod_latin_NativeUtils.h
index 13a348a..4d29d7d 100644
--- a/native/jni/com_android_inputmethod_latin_NativeUtils.h
+++ b/native/jni/com_android_inputmethod_latin_NativeUtils.h
@@ -1,19 +1,19 @@
 /*
-**
-** Copyright 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.
-*/
+ *
+ * Copyright 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.
+ */
 
 #ifndef _COM_ANDROID_INPUTMETHOD_LATIN_NATIVEUTILS_H
 #define _COM_ANDROID_INPUTMETHOD_LATIN_NATIVEUTILS_H
@@ -24,6 +24,5 @@
 
 int register_NativeUtils(JNIEnv *env);
 
-}
-
+} // namespace latinime
 #endif // _COM_ANDROID_INPUTMETHOD_LATIN_NATIVEUTILS_H
diff --git a/native/jni/jni_common.cpp b/native/jni/jni_common.cpp
index 1314bab..8d7bce7 100644
--- a/native/jni/jni_common.cpp
+++ b/native/jni/jni_common.cpp
@@ -1,19 +1,19 @@
 /*
-**
-** Copyright 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.
-*/
+ *
+ * Copyright 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.
+ */
 
 #define LOG_TAG "LatinIME: jni"
 
@@ -33,8 +33,8 @@
 /*
  * Returns the JNI version on success, -1 on failure.
  */
-jint JNI_OnLoad(JavaVM* vm, void* reserved) {
-    JNIEnv* env = 0;
+jint JNI_OnLoad(JavaVM *vm, void *reserved) {
+    JNIEnv *env = 0;
     jint result = -1;
 
     if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
@@ -67,7 +67,7 @@
 
 namespace latinime {
 
-int registerNativeMethods(JNIEnv* env, const char* className, JNINativeMethod* methods,
+int registerNativeMethods(JNIEnv *env, const char *className, JNINativeMethod *methods,
         int numMethods) {
     jclass clazz = env->FindClass(className);
     if (clazz == 0) {
@@ -82,5 +82,4 @@
     env->DeleteLocalRef(clazz);
     return JNI_TRUE;
 }
-
 } // namespace latinime
diff --git a/native/jni/jni_common.h b/native/jni/jni_common.h
index 6741443..32f9fa9 100644
--- a/native/jni/jni_common.h
+++ b/native/jni/jni_common.h
@@ -1,19 +1,19 @@
 /*
-**
-** Copyright 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.
-*/
+ *
+ * Copyright 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.
+ */
 
 #ifndef LATINIME_JNI_COMMON_H
 #define LATINIME_JNI_COMMON_H
@@ -54,7 +54,5 @@
         env->ReleaseFloatArrayElements(jArray, cArray, 0);
     }
 }
-
 } // namespace latinime
-
 #endif // LATINIME_JNI_COMMON_H
diff --git a/native/jni/src/additional_proximity_chars.cpp b/native/jni/src/additional_proximity_chars.cpp
index 224f020..de87646 100644
--- a/native/jni/src/additional_proximity_chars.cpp
+++ b/native/jni/src/additional_proximity_chars.cpp
@@ -38,4 +38,4 @@
 const int32_t AdditionalProximityChars::EN_US_ADDITIONAL_U[EN_US_ADDITIONAL_U_SIZE] = {
     'a', 'e', 'i', 'o'
 };
-}
+} // namespace latinime
diff --git a/native/jni/src/additional_proximity_chars.h b/native/jni/src/additional_proximity_chars.h
index 82c31f8..ba76cfc 100644
--- a/native/jni/src/additional_proximity_chars.h
+++ b/native/jni/src/additional_proximity_chars.h
@@ -45,7 +45,7 @@
     }
 
  public:
-    static int getAdditionalCharsSize(const std::string* locale_str, const int32_t c) {
+    static int getAdditionalCharsSize(const std::string *locale_str, const int32_t c) {
         if (!isEnLocale(locale_str)) {
             return 0;
         }
@@ -65,7 +65,7 @@
         }
     }
 
-    static const int32_t* getAdditionalChars(const std::string *locale_str, const int32_t c) {
+    static const int32_t *getAdditionalChars(const std::string *locale_str, const int32_t c) {
         if (!isEnLocale(locale_str)) {
             return 0;
         }
@@ -89,7 +89,5 @@
         return getAdditionalCharsSize(locale_str, c) > 0;
     }
 };
-
-}
-
+} // namespace latinime
 #endif // LATINIME_ADDITIONAL_PROXIMITY_CHARS_H
diff --git a/native/jni/src/basechars.cpp b/native/jni/src/basechars.cpp
index 31f1e18..c91e5f7 100644
--- a/native/jni/src/basechars.cpp
+++ b/native/jni/src/basechars.cpp
@@ -18,7 +18,7 @@
 
 namespace latinime {
 
-/**
+/*
  * Table mapping most combined Latin, Greek, and Cyrillic characters
  * to their base characters.  If c is in range, BASE_CHARS[c] == c
  * if c is not a combined character, or the base character if it
@@ -187,8 +187,6 @@
     0x0423, 0x0443, 0x0423, 0x0443, 0x0427, 0x0447, 0x04f6, 0x04f7,
     0x042b, 0x044b, 0x04fa, 0x04fb, 0x04fc, 0x04fd, 0x04fe, 0x04ff,
 };
-
 // generated with:
 // cat UnicodeData.txt | perl -e 'while (<>) { @foo = split(/;/); $foo[5] =~ s/<.*> //; $base[hex($foo[0])] = hex($foo[5]);} for ($i = 0; $i < 0x500; $i += 8) { for ($j = $i; $j < $i + 8; $j++) { printf("0x%04x, ", $base[$j] ? $base[$j] : $j)}; print "\n"; }'
-
 } // namespace latinime
diff --git a/native/jni/src/bigram_dictionary.cpp b/native/jni/src/bigram_dictionary.cpp
index 8057e41..4f5493a 100644
--- a/native/jni/src/bigram_dictionary.cpp
+++ b/native/jni/src/bigram_dictionary.cpp
@@ -1,19 +1,19 @@
 /*
-**
-** Copyright 2010, 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.
-*/
+ *
+ * Copyright 2010, 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.
+ */
 
 #include <string.h>
 
@@ -103,7 +103,7 @@
     // TODO: remove unused arguments, and refrain from storing stuff in members of this class
     // TODO: have "in" arguments before "out" ones, and make out args explicit in the name
 
-    const uint8_t* const root = DICT;
+    const uint8_t *const root = DICT;
     int pos = getBigramListPositionForWord(prevWord, prevWordLength,
             false /* forceLowerCaseSearch */);
     // getBigramListPositionForWord returns 0 if this word isn't in the dictionary or has no bigrams
@@ -149,7 +149,7 @@
 int BigramDictionary::getBigramListPositionForWord(const int32_t *prevWord,
         const int prevWordLength, const bool forceLowerCaseSearch) const {
     if (0 >= prevWordLength) return 0;
-    const uint8_t* const root = DICT;
+    const uint8_t *const root = DICT;
     int pos = BinaryFormat::getTerminalPosition(root, prevWord, prevWordLength,
             forceLowerCaseSearch);
 
@@ -170,7 +170,7 @@
 void BigramDictionary::fillBigramAddressToFrequencyMapAndFilter(const int32_t *prevWord,
         const int prevWordLength, std::map<int, int> *map, uint8_t *filter) const {
     memset(filter, 0, BIGRAM_FILTER_BYTE_SIZE);
-    const uint8_t* const root = DICT;
+    const uint8_t *const root = DICT;
     int pos = getBigramListPositionForWord(prevWord, prevWordLength,
             false /* forceLowerCaseSearch */);
     if (0 == pos) {
@@ -209,7 +209,7 @@
 
 bool BigramDictionary::isValidBigram(const int32_t *word1, int length1, const int32_t *word2,
         int length2) const {
-    const uint8_t* const root = DICT;
+    const uint8_t *const root = DICT;
     int pos = getBigramListPositionForWord(word1, length1, false /* forceLowerCaseSearch */);
     // getBigramListPositionForWord returns 0 if this word isn't in the dictionary or has no bigrams
     if (0 == pos) return false;
diff --git a/native/jni/src/bigram_dictionary.h b/native/jni/src/bigram_dictionary.h
index 0b3577a..f66e27b 100644
--- a/native/jni/src/bigram_dictionary.h
+++ b/native/jni/src/bigram_dictionary.h
@@ -53,7 +53,5 @@
     // TODO: Re-implement proximity correction for bigram correction
     static const int MAX_ALTERNATIVES = 1;
 };
-
 } // namespace latinime
-
 #endif // LATINIME_BIGRAM_DICTIONARY_H
diff --git a/native/jni/src/binary_format.h b/native/jni/src/binary_format.h
index 474c854..4155ef4 100644
--- a/native/jni/src/binary_format.h
+++ b/native/jni/src/binary_format.h
@@ -46,29 +46,29 @@
     const static int CHARACTER_ARRAY_TERMINATOR_SIZE = 1;
     const static int SHORTCUT_LIST_SIZE_SIZE = 2;
 
-    static int detectFormat(const uint8_t* const dict);
-    static unsigned int getHeaderSize(const uint8_t* const dict);
-    static unsigned int getFlags(const uint8_t* const dict);
-    static int getGroupCountAndForwardPointer(const uint8_t* const dict, int* pos);
-    static uint8_t getFlagsAndForwardPointer(const uint8_t* const dict, int* pos);
-    static int32_t getCharCodeAndForwardPointer(const uint8_t* const dict, int* pos);
-    static int readFrequencyWithoutMovingPointer(const uint8_t* const dict, const int pos);
-    static int skipOtherCharacters(const uint8_t* const dict, const int pos);
+    static int detectFormat(const uint8_t *const dict);
+    static unsigned int getHeaderSize(const uint8_t *const dict);
+    static unsigned int getFlags(const uint8_t *const dict);
+    static int getGroupCountAndForwardPointer(const uint8_t *const dict, int *pos);
+    static uint8_t getFlagsAndForwardPointer(const uint8_t *const dict, int *pos);
+    static int32_t getCharCodeAndForwardPointer(const uint8_t *const dict, int *pos);
+    static int readFrequencyWithoutMovingPointer(const uint8_t *const dict, const int pos);
+    static int skipOtherCharacters(const uint8_t *const dict, const int pos);
     static int skipChildrenPosition(const uint8_t flags, const int pos);
     static int skipFrequency(const uint8_t flags, const int pos);
-    static int skipShortcuts(const uint8_t* const dict, const uint8_t flags, const int pos);
-    static int skipBigrams(const uint8_t* const dict, const uint8_t flags, const int pos);
-    static int skipAllAttributes(const uint8_t* const dict, const uint8_t flags, const int pos);
-    static int skipChildrenPosAndAttributes(const uint8_t* const dict, const uint8_t flags,
+    static int skipShortcuts(const uint8_t *const dict, const uint8_t flags, const int pos);
+    static int skipBigrams(const uint8_t *const dict, const uint8_t flags, const int pos);
+    static int skipAllAttributes(const uint8_t *const dict, const uint8_t flags, const int pos);
+    static int skipChildrenPosAndAttributes(const uint8_t *const dict, const uint8_t flags,
             const int pos);
-    static int readChildrenPosition(const uint8_t* const dict, const uint8_t flags, const int pos);
+    static int readChildrenPosition(const uint8_t *const dict, const uint8_t flags, const int pos);
     static bool hasChildrenInFlags(const uint8_t flags);
-    static int getAttributeAddressAndForwardPointer(const uint8_t* const dict, const uint8_t flags,
+    static int getAttributeAddressAndForwardPointer(const uint8_t *const dict, const uint8_t flags,
             int *pos);
-    static int getTerminalPosition(const uint8_t* const root, const int32_t* const inWord,
+    static int getTerminalPosition(const uint8_t *const root, const int32_t *const inWord,
             const int length, const bool forceLowerCaseSearch);
-    static int getWordAtAddress(const uint8_t* const root, const int address, const int maxDepth,
-            uint16_t* outWord, int* outUnigramFrequency);
+    static int getWordAtAddress(const uint8_t *const root, const int address, const int maxDepth,
+            uint16_t *outWord, int *outUnigramFrequency);
     static int computeFrequencyForBigram(const int unigramFreq, const int bigramFreq);
     static int getProbability(const int position, const std::map<int, int> *bigramMap,
             const uint8_t *bigramFilter, const int unigramFreq);
@@ -83,7 +83,7 @@
     const static unsigned int NO_FLAGS = 0;
 };
 
-inline int BinaryFormat::detectFormat(const uint8_t* const dict) {
+inline int BinaryFormat::detectFormat(const uint8_t *const dict) {
     // The magic number is stored big-endian.
     const uint32_t magicNumber = (dict[0] << 24) + (dict[1] << 16) + (dict[2] << 8) + dict[3];
     switch (magicNumber) {
@@ -105,7 +105,7 @@
     }
 }
 
-inline unsigned int BinaryFormat::getFlags(const uint8_t* const dict) {
+inline unsigned int BinaryFormat::getFlags(const uint8_t *const dict) {
     switch (detectFormat(dict)) {
     case 1:
         return NO_FLAGS;
@@ -114,7 +114,7 @@
     }
 }
 
-inline unsigned int BinaryFormat::getHeaderSize(const uint8_t* const dict) {
+inline unsigned int BinaryFormat::getHeaderSize(const uint8_t *const dict) {
     switch (detectFormat(dict)) {
     case 1:
         return FORMAT_VERSION_1_HEADER_SIZE;
@@ -126,17 +126,17 @@
     }
 }
 
-inline int BinaryFormat::getGroupCountAndForwardPointer(const uint8_t* const dict, int* pos) {
+inline int BinaryFormat::getGroupCountAndForwardPointer(const uint8_t *const dict, int *pos) {
     const int msb = dict[(*pos)++];
     if (msb < 0x80) return msb;
     return ((msb & 0x7F) << 8) | dict[(*pos)++];
 }
 
-inline uint8_t BinaryFormat::getFlagsAndForwardPointer(const uint8_t* const dict, int* pos) {
+inline uint8_t BinaryFormat::getFlagsAndForwardPointer(const uint8_t *const dict, int *pos) {
     return dict[(*pos)++];
 }
 
-inline int32_t BinaryFormat::getCharCodeAndForwardPointer(const uint8_t* const dict, int* pos) {
+inline int32_t BinaryFormat::getCharCodeAndForwardPointer(const uint8_t *const dict, int *pos) {
     const int origin = *pos;
     const int32_t character = dict[origin];
     if (character < MINIMAL_ONE_BYTE_CHARACTER_VALUE) {
@@ -155,12 +155,12 @@
     }
 }
 
-inline int BinaryFormat::readFrequencyWithoutMovingPointer(const uint8_t* const dict,
+inline int BinaryFormat::readFrequencyWithoutMovingPointer(const uint8_t *const dict,
         const int pos) {
     return dict[pos];
 }
 
-inline int BinaryFormat::skipOtherCharacters(const uint8_t* const dict, const int pos) {
+inline int BinaryFormat::skipOtherCharacters(const uint8_t *const dict, const int pos) {
     int currentPos = pos;
     int32_t character = dict[currentPos++];
     while (CHARACTER_ARRAY_TERMINATOR != character) {
@@ -186,7 +186,7 @@
     */
 }
 
-static inline int skipExistingBigrams(const uint8_t* const dict, const int pos) {
+static inline int skipExistingBigrams(const uint8_t *const dict, const int pos) {
     int currentPos = pos;
     uint8_t flags = BinaryFormat::getFlagsAndForwardPointer(dict, &currentPos);
     while (flags & UnigramDictionary::FLAG_ATTRIBUTE_HAS_NEXT) {
@@ -203,7 +203,7 @@
     /* See the note in attributeAddressSize. The same applies here */
 }
 
-static inline int shortcutByteSize(const uint8_t* const dict, const int pos) {
+static inline int shortcutByteSize(const uint8_t *const dict, const int pos) {
     return ((int)(dict[pos] << 8)) + (dict[pos + 1]);
 }
 
@@ -215,7 +215,7 @@
     return UnigramDictionary::FLAG_IS_TERMINAL & flags ? pos + 1 : pos;
 }
 
-inline int BinaryFormat::skipShortcuts(const uint8_t* const dict, const uint8_t flags,
+inline int BinaryFormat::skipShortcuts(const uint8_t *const dict, const uint8_t flags,
         const int pos) {
     if (UnigramDictionary::FLAG_HAS_SHORTCUT_TARGETS & flags) {
         return pos + shortcutByteSize(dict, pos);
@@ -224,7 +224,7 @@
     }
 }
 
-inline int BinaryFormat::skipBigrams(const uint8_t* const dict, const uint8_t flags,
+inline int BinaryFormat::skipBigrams(const uint8_t *const dict, const uint8_t flags,
         const int pos) {
     if (UnigramDictionary::FLAG_HAS_BIGRAMS & flags) {
         return skipExistingBigrams(dict, pos);
@@ -233,7 +233,7 @@
     }
 }
 
-inline int BinaryFormat::skipAllAttributes(const uint8_t* const dict, const uint8_t flags,
+inline int BinaryFormat::skipAllAttributes(const uint8_t *const dict, const uint8_t flags,
         const int pos) {
     // This function skips all attributes: shortcuts and bigrams.
     int newPos = pos;
@@ -242,7 +242,7 @@
     return newPos;
 }
 
-inline int BinaryFormat::skipChildrenPosAndAttributes(const uint8_t* const dict,
+inline int BinaryFormat::skipChildrenPosAndAttributes(const uint8_t *const dict,
         const uint8_t flags, const int pos) {
     int currentPos = pos;
     currentPos = skipChildrenPosition(flags, currentPos);
@@ -250,7 +250,7 @@
     return currentPos;
 }
 
-inline int BinaryFormat::readChildrenPosition(const uint8_t* const dict, const uint8_t flags,
+inline int BinaryFormat::readChildrenPosition(const uint8_t *const dict, const uint8_t flags,
         const int pos) {
     int offset = 0;
     switch (UnigramDictionary::MASK_GROUP_ADDRESS_TYPE & flags) {
@@ -279,7 +279,7 @@
             != (UnigramDictionary::MASK_GROUP_ADDRESS_TYPE & flags));
 }
 
-inline int BinaryFormat::getAttributeAddressAndForwardPointer(const uint8_t* const dict,
+inline int BinaryFormat::getAttributeAddressAndForwardPointer(const uint8_t *const dict,
         const uint8_t flags, int *pos) {
     int offset = 0;
     const int origin = *pos;
@@ -309,8 +309,8 @@
 
 // This function gets the byte position of the last chargroup of the exact matching word in the
 // dictionary. If no match is found, it returns NOT_VALID_WORD.
-inline int BinaryFormat::getTerminalPosition(const uint8_t* const root,
-        const int32_t* const inWord, const int length, const bool forceLowerCaseSearch) {
+inline int BinaryFormat::getTerminalPosition(const uint8_t *const root,
+        const int32_t *const inWord, const int length, const bool forceLowerCaseSearch) {
     int pos = 0;
     int wordPos = 0;
 
@@ -396,8 +396,8 @@
  * outUnigramFrequency: a pointer to an int to write the frequency into.
  * Return value : the length of the word, of 0 if the word was not found.
  */
-inline int BinaryFormat::getWordAtAddress(const uint8_t* const root, const int address,
-        const int maxDepth, uint16_t* outWord, int* outUnigramFrequency) {
+inline int BinaryFormat::getWordAtAddress(const uint8_t *const root, const int address,
+        const int maxDepth, uint16_t *outWord, int *outUnigramFrequency) {
     int pos = 0;
     int wordPos = 0;
 
@@ -557,7 +557,5 @@
         return backoff(unigramFreq);
     }
 }
-
 } // namespace latinime
-
 #endif // LATINIME_BINARY_FORMAT_H
diff --git a/native/jni/src/bloom_filter.h b/native/jni/src/bloom_filter.h
index 7ae6a1f..47177dc 100644
--- a/native/jni/src/bloom_filter.h
+++ b/native/jni/src/bloom_filter.h
@@ -32,7 +32,5 @@
     const unsigned int bucket = position % BIGRAM_FILTER_MODULO;
     return filter[bucket >> 3] & (1 << (bucket & 0x7));
 }
-
 } // namespace latinime
-
 #endif // LATINIME_BLOOM_FILTER_H
diff --git a/native/jni/src/char_utils.cpp b/native/jni/src/char_utils.cpp
index a31a063..9d2bc85 100644
--- a/native/jni/src/char_utils.cpp
+++ b/native/jni/src/char_utils.cpp
@@ -895,5 +895,4 @@
                     compare_pair_capital);
     return p ? p->small : c;
 }
-
 } // namespace latinime
diff --git a/native/jni/src/char_utils.h b/native/jni/src/char_utils.h
index 21dca9a..edd96bb 100644
--- a/native/jni/src/char_utils.h
+++ b/native/jni/src/char_utils.h
@@ -62,7 +62,5 @@
 inline static unsigned short toBaseLowerCase(const unsigned short c) {
     return toLowerCase(toBaseChar(c));
 }
-
 } // namespace latinime
-
 #endif // LATINIME_CHAR_UTILS_H
diff --git a/native/jni/src/correction.cpp b/native/jni/src/correction.cpp
index 827067b..74e256f 100644
--- a/native/jni/src/correction.cpp
+++ b/native/jni/src/correction.cpp
@@ -633,7 +633,7 @@
 Correction::~Correction() {
 }
 
-inline static int getQuoteCount(const unsigned short* word, const int length) {
+inline static int getQuoteCount(const unsigned short *word, const int length) {
     int quoteCount = 0;
     for (int i = 0; i < length; ++i) {
         if(word[i] == '\'') {
@@ -653,7 +653,7 @@
 
 /* static */
 int Correction::RankingAlgorithm::calculateFinalProbability(const int inputIndex,
-        const int outputIndex, const int freq, int* editDistanceTable, const Correction* correction,
+        const int outputIndex, const int freq, int *editDistanceTable, const Correction *correction,
         const int inputLength) {
     const int excessivePos = correction->getExcessivePos();
     const int typedLetterMultiplier = correction->TYPED_LETTER_MULTIPLIER;
@@ -677,7 +677,7 @@
     // TODO: use mExcessiveCount
     const int matchCount = inputLength - correction->mProximityCount - excessiveCount;
 
-    const unsigned short* word = correction->mWord;
+    const unsigned short *word = correction->mWord;
     const bool skipped = skippedCount > 0;
 
     const int quoteDiffCount = max(0, getQuoteCount(word, outputLength)
@@ -916,7 +916,7 @@
 /* static */
 int Correction::RankingAlgorithm::calcFreqForSplitMultipleWords(
         const int *freqArray, const int *wordLengthArray, const int wordCount,
-        const Correction* correction, const bool isSpaceProximity, const unsigned short *word) {
+        const Correction *correction, const bool isSpaceProximity, const unsigned short *word) {
     const int typedLetterMultiplier = correction->TYPED_LETTER_MULTIPLIER;
 
     bool firstCapitalizedWordDemotion = false;
@@ -1046,10 +1046,10 @@
 
 /* Damerau-Levenshtein distance */
 inline static int editDistanceInternal(
-        int* editDistanceTable, const unsigned short* before,
-        const int beforeLength, const unsigned short* after, const int afterLength) {
+        int *editDistanceTable, const unsigned short *before,
+        const int beforeLength, const unsigned short *after, const int afterLength) {
     // dp[li][lo] dp[a][b] = dp[ a * lo + b]
-    int* dp = editDistanceTable;
+    int *dp = editDistanceTable;
     const int li = beforeLength + 1;
     const int lo = afterLength + 1;
     for (int i = 0; i < li; ++i) {
@@ -1085,8 +1085,8 @@
     return dp[li * lo - 1];
 }
 
-int Correction::RankingAlgorithm::editDistance(const unsigned short* before,
-        const int beforeLength, const unsigned short* after, const int afterLength) {
+int Correction::RankingAlgorithm::editDistance(const unsigned short *before,
+        const int beforeLength, const unsigned short *after, const int afterLength) {
     int table[(beforeLength + 1) * (afterLength + 1)];
     return editDistanceInternal(table, before, beforeLength, after, afterLength);
 }
@@ -1114,8 +1114,8 @@
 // So, we can normalize original score by dividing pow(2, min(b.l(),a.l())) * 255 * 2.
 
 /* static */
-float Correction::RankingAlgorithm::calcNormalizedScore(const unsigned short* before,
-        const int beforeLength, const unsigned short* after, const int afterLength,
+float Correction::RankingAlgorithm::calcNormalizedScore(const unsigned short *before,
+        const int beforeLength, const unsigned short *after, const int afterLength,
         const int score) {
     if (0 == beforeLength || 0 == afterLength) {
         return 0;
diff --git a/native/jni/src/correction.h b/native/jni/src/correction.h
index ae7b3a5..13f951a 100644
--- a/native/jni/src/correction.h
+++ b/native/jni/src/correction.h
@@ -138,9 +138,9 @@
     int getFreqForSplitMultipleWords(
             const int *freqArray, const int *wordLengthArray, const int wordCount,
             const bool isSpaceProximity, const unsigned short *word);
-    int getFinalProbability(const int probability, unsigned short **word, int* wordLength);
+    int getFinalProbability(const int probability, unsigned short **word, int *wordLength);
     int getFinalProbabilityForSubQueue(const int probability, unsigned short **word,
-            int* wordLength, const int inputLength);
+            int *wordLength, const int inputLength);
 
     CorrectionType processCharAndCalcState(const int32_t c, const bool isTerminal);
 
@@ -163,15 +163,15 @@
     class RankingAlgorithm {
      public:
         static int calculateFinalProbability(const int inputIndex, const int depth,
-                const int probability, int *editDistanceTable, const Correction* correction,
+                const int probability, int *editDistanceTable, const Correction *correction,
                 const int inputLength);
         static int calcFreqForSplitMultipleWords(const int *freqArray, const int *wordLengthArray,
-                const int wordCount, const Correction* correction, const bool isSpaceProximity,
+                const int wordCount, const Correction *correction, const bool isSpaceProximity,
                 const unsigned short *word);
-        static float calcNormalizedScore(const unsigned short* before, const int beforeLength,
-                const unsigned short* after, const int afterLength, const int score);
-        static int editDistance(const unsigned short* before,
-                const int beforeLength, const unsigned short* after, const int afterLength);
+        static float calcNormalizedScore(const unsigned short *before, const int beforeLength,
+                const unsigned short *after, const int afterLength, const int score);
+        static int editDistance(const unsigned short *before,
+                const int beforeLength, const unsigned short *after, const int afterLength);
      private:
         static const int CODE_SPACE = ' ';
         static const int MAX_INITIAL_SCORE = 255;
@@ -184,7 +184,7 @@
                 proximityInfo, inputCodes, inputLength, xCoordinates, yCoordinates);
     }
 
-    const unsigned short* getPrimaryInputWord() const {
+    const unsigned short *getPrimaryInputWord() const {
         return mProximityInfoState.getPrimaryInputWord();
     }
 
@@ -203,7 +203,7 @@
     inline CorrectionType processUnrelatedCorrectionType();
     inline void addCharToCurrentWord(const int32_t c);
     inline int getFinalProbabilityInternal(const int probability, unsigned short **word,
-            int* wordLength, const int inputLength);
+            int *wordLength, const int inputLength);
 
     static const int TYPED_LETTER_MULTIPLIER = 2;
     static const int FULL_WORD_MULTIPLIER = 2;
diff --git a/native/jni/src/correction_state.h b/native/jni/src/correction_state.h
index 5b2cbd3..a63d4aa 100644
--- a/native/jni/src/correction_state.h
+++ b/native/jni/src/correction_state.h
@@ -79,6 +79,5 @@
     state->mSkipping = false;
     state->mAdditionalProximityMatching = false;
 }
-
 } // namespace latinime
 #endif // LATINIME_CORRECTION_STATE_H
diff --git a/native/jni/src/debug.h b/native/jni/src/debug.h
index 376ba59..2fee6e8 100644
--- a/native/jni/src/debug.h
+++ b/native/jni/src/debug.h
@@ -1,26 +1,26 @@
 /*
-**
-** Copyright 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.
-*/
+ *
+ * Copyright 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.
+ */
 
 #ifndef LATINIME_DEBUG_H
 #define LATINIME_DEBUG_H
 
 #include "defines.h"
 
-static inline unsigned char* convertToUnibyteString(unsigned short* input, unsigned char* output,
+static inline unsigned char *convertToUnibyteString(unsigned short *input, unsigned char *output,
         const unsigned int length) {
     unsigned int i = 0;
     for (; i <= length && input[i] != 0; ++i)
@@ -29,8 +29,8 @@
     return output;
 }
 
-static inline unsigned char* convertToUnibyteStringAndReplaceLastChar(unsigned short* input,
-        unsigned char* output, const unsigned int length, unsigned char c) {
+static inline unsigned char *convertToUnibyteStringAndReplaceLastChar(unsigned short *input,
+        unsigned char *output, const unsigned int length, unsigned char c) {
     unsigned int i = 0;
     for (; i <= length && input[i] != 0; ++i)
         output[i] = input[i] & 0xFF;
@@ -39,7 +39,7 @@
     return output;
 }
 
-static inline void LOGI_S16(unsigned short* string, const unsigned int length) {
+static inline void LOGI_S16(unsigned short *string, const unsigned int length) {
     unsigned char tmp_buffer[length];
     convertToUnibyteString(string, tmp_buffer, length);
     AKLOGI(">> %s", tmp_buffer);
@@ -49,7 +49,7 @@
     // usleep(10);
 }
 
-static inline void LOGI_S16_PLUS(unsigned short* string, const unsigned int length,
+static inline void LOGI_S16_PLUS(unsigned short *string, const unsigned int length,
         unsigned char c) {
     unsigned char tmp_buffer[length+1];
     convertToUnibyteStringAndReplaceLastChar(string, tmp_buffer, length, c);
@@ -58,7 +58,7 @@
     // usleep(10);
 }
 
-static inline void printDebug(const char* tag, int* codes, int codesSize, int MAX_PROXIMITY_CHARS) {
+static inline void printDebug(const char *tag, int *codes, int codesSize, int MAX_PROXIMITY_CHARS) {
     unsigned char *buf = (unsigned char*)malloc((1 + codesSize) * sizeof(*buf));
 
     buf[codesSize] = 0;
@@ -68,5 +68,4 @@
 
     free(buf);
 }
-
 #endif // LATINIME_DEBUG_H
diff --git a/native/jni/src/defines.h b/native/jni/src/defines.h
index c7d3bf3..a4086f5 100644
--- a/native/jni/src/defines.h
+++ b/native/jni/src/defines.h
@@ -1,19 +1,19 @@
 /*
-**
-** Copyright 2010, 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.
-*/
+ *
+ * Copyright 2010, 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.
+ */
 
 #ifndef LATINIME_DEFINES_H
 #define LATINIME_DEFINES_H
@@ -26,7 +26,7 @@
 #define DUMP_WORD(word, length) do { dumpWord(word, length); } while(0)
 #define DUMP_WORD_INT(word, length) do { dumpWordInt(word, length); } while(0)
 
-static inline void dumpWord(const unsigned short* word, const int length) {
+static inline void dumpWord(const unsigned short *word, const int length) {
     static char charBuf[50];
 
     for (int i = 0; i < length; ++i) {
@@ -36,7 +36,7 @@
     AKLOGI("[ %s ]", charBuf);
 }
 
-static inline void dumpWordInt(const int* word, const int length) {
+static inline void dumpWordInt(const int *word, const int length) {
     static char charBuf[50];
 
     for (int i = 0; i < length; ++i) {
@@ -313,5 +313,4 @@
     // Additional proximity char which can differ by language.
     ADDITIONAL_PROXIMITY_CHAR
 } ProximityType;
-
 #endif // LATINIME_DEFINES_H
diff --git a/native/jni/src/dictionary.cpp b/native/jni/src/dictionary.cpp
index f3166e7..4703a38 100644
--- a/native/jni/src/dictionary.cpp
+++ b/native/jni/src/dictionary.cpp
@@ -1,19 +1,19 @@
 /*
-**
-** Copyright 2009, 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.
-*/
+ *
+ * Copyright (C) 2009, 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.
+ */
 
 #include <stdio.h>
 
@@ -63,5 +63,4 @@
         int length2) const {
     return mBigramDictionary->isValidBigram(word1, length1, word2, length2);
 }
-
 } // namespace latinime
diff --git a/native/jni/src/dictionary.h b/native/jni/src/dictionary.h
index 7911403..f625813 100644
--- a/native/jni/src/dictionary.h
+++ b/native/jni/src/dictionary.h
@@ -113,5 +113,4 @@
     return end - str;
 }
 } // namespace latinime
-
 #endif // LATINIME_DICTIONARY_H
diff --git a/native/jni/src/proximity_info.cpp b/native/jni/src/proximity_info.cpp
index a4a6411..393791f 100644
--- a/native/jni/src/proximity_info.cpp
+++ b/native/jni/src/proximity_info.cpp
@@ -110,7 +110,7 @@
     if (DEBUG_PROXIMITY_INFO) {
         AKLOGI("hasSpaceProximity: index %d, %d, %d", startIndex, x, y);
     }
-    int32_t* proximityCharsArray = mProximityCharsArray;
+    int32_t *proximityCharsArray = mProximityCharsArray;
     for (int i = 0; i < MAX_PROXIMITY_CHARS_SIZE; ++i) {
         if (DEBUG_PROXIMITY_INFO) {
             AKLOGI("Index: %d", mProximityCharsArray[startIndex + i]);
@@ -171,7 +171,7 @@
                 return;
             }
 
-            const int32_t* additionalProximityChars =
+            const int32_t *additionalProximityChars =
                     AdditionalProximityChars::getAdditionalChars(&mLocaleStr, primaryKey);
             for (int j = 0; j < additionalProximitySize; ++j) {
                 const int32_t ac = additionalProximityChars[j];
diff --git a/native/jni/src/proximity_info.h b/native/jni/src/proximity_info.h
index d58935c..abd07dd 100644
--- a/native/jni/src/proximity_info.h
+++ b/native/jni/src/proximity_info.h
@@ -141,7 +141,5 @@
     int mCodeToKeyIndex[MAX_CHAR_CODE + 1];
     // TODO: move to correction.h
 };
-
 } // namespace latinime
-
 #endif // LATINIME_PROXIMITY_INFO_H
diff --git a/native/jni/src/proximity_info_state.cpp b/native/jni/src/proximity_info_state.cpp
index 149299e..d481a3b 100644
--- a/native/jni/src/proximity_info_state.cpp
+++ b/native/jni/src/proximity_info_state.cpp
@@ -28,8 +28,8 @@
 
 namespace latinime {
 void ProximityInfoState::initInputParams(
-        const ProximityInfo* proximityInfo, const int32_t* inputCodes, const int inputLength,
-        const int* xCoordinates, const int* yCoordinates) {
+        const ProximityInfo *proximityInfo, const int32_t *inputCodes, const int inputLength,
+        const int *xCoordinates, const int *yCoordinates) {
     mProximityInfo = proximityInfo;
     mHasTouchPositionCorrectionData = proximityInfo->hasTouchPositionCorrectionData();
     mMostCommonKeyWidthSquare = proximityInfo->getMostCommonKeyWidthSquare();
diff --git a/native/jni/src/proximity_info_state.h b/native/jni/src/proximity_info_state.h
index 717871c..a5fe528 100644
--- a/native/jni/src/proximity_info_state.h
+++ b/native/jni/src/proximity_info_state.h
@@ -43,14 +43,14 @@
     // Defined in proximity_info_state.cpp //
     /////////////////////////////////////////
     void initInputParams(
-            const ProximityInfo* proximityInfo, const int32_t* inputCodes, const int inputLength,
-            const int* xCoordinates, const int* yCoordinates);
+            const ProximityInfo *proximityInfo, const int32_t *inputCodes, const int inputLength,
+            const int *xCoordinates, const int *yCoordinates);
 
     /////////////////////////////////////////
     // Defined here                        //
     /////////////////////////////////////////
     ProximityInfoState() {};
-    inline const int* getProximityCharsAt(const int index) const {
+    inline const int *getProximityCharsAt(const int index) const {
         return mInputCodes + (index * MAX_PROXIMITY_CHARS_SIZE_INTERNAL);
     }
 
@@ -154,7 +154,7 @@
                 inputIndex * MAX_PROXIMITY_CHARS_SIZE_INTERNAL + proximityIndex];
     }
 
-    inline const unsigned short* getPrimaryInputWord() const {
+    inline const unsigned short *getPrimaryInputWord() const {
         return mPrimaryInputWord;
     }
 
@@ -215,7 +215,5 @@
     int mInputLength;
     unsigned short mPrimaryInputWord[MAX_WORD_LENGTH_INTERNAL];
 };
-
 } // namespace latinime
-
 #endif // LATINIME_PROXIMITY_INFO_STATE_H
diff --git a/native/jni/src/terminal_attributes.h b/native/jni/src/terminal_attributes.h
index c712f50..755635f 100644
--- a/native/jni/src/terminal_attributes.h
+++ b/native/jni/src/terminal_attributes.h
@@ -29,12 +29,12 @@
 class TerminalAttributes {
  public:
     class ShortcutIterator {
-        const uint8_t* const mDict;
+        const uint8_t *const mDict;
         bool mHasNextShortcutTarget;
         int mPos;
 
      public:
-        ShortcutIterator(const uint8_t* dict, const int pos, const uint8_t flags) : mDict(dict),
+        ShortcutIterator(const uint8_t *dict, const int pos, const uint8_t flags) : mDict(dict),
                 mPos(pos) {
             mHasNextShortcutTarget = (0 != (flags & UnigramDictionary::FLAG_HAS_SHORTCUT_TARGETS));
         }
@@ -46,7 +46,7 @@
         // Gets the shortcut target itself as a uint16_t string. For parameters and return value
         // see BinaryFormat::getWordAtAddress.
         // TODO: make the output an uint32_t* to handle the whole unicode range.
-        inline int getNextShortcutTarget(const int maxDepth, uint16_t* outWord) {
+        inline int getNextShortcutTarget(const int maxDepth, uint16_t *outWord) {
             const int shortcutFlags = BinaryFormat::getFlagsAndForwardPointer(mDict, &mPos);
             mHasNextShortcutTarget =
                     0 != (shortcutFlags & UnigramDictionary::FLAG_ATTRIBUTE_HAS_NEXT);
@@ -63,12 +63,12 @@
 
  private:
     DISALLOW_IMPLICIT_CONSTRUCTORS(TerminalAttributes);
-    const uint8_t* const mDict;
+    const uint8_t *const mDict;
     const uint8_t mFlags;
     const int mStartPos;
 
  public:
-    TerminalAttributes(const uint8_t* const dict, const uint8_t flags, const int pos) :
+    TerminalAttributes(const uint8_t *const dict, const uint8_t flags, const int pos) :
             mDict(dict), mFlags(flags), mStartPos(pos) {
     }
 
@@ -79,5 +79,4 @@
     }
 };
 } // namespace latinime
-
 #endif // LATINIME_TERMINAL_ATTRIBUTES_H
diff --git a/native/jni/src/unigram_dictionary.cpp b/native/jni/src/unigram_dictionary.cpp
index 0ffb3eb..b121d08 100644
--- a/native/jni/src/unigram_dictionary.cpp
+++ b/native/jni/src/unigram_dictionary.cpp
@@ -1,19 +1,19 @@
 /*
-**
-** Copyright 2010, 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.
-*/
+ *
+ * Copyright 2010, 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.
+ */
 
 #include <assert.h>
 #include <string.h>
@@ -40,7 +40,7 @@
         { 'o', 'e', 0x0153 } }; // U+0153 : LATIN SMALL LIGATURE OE
 
 // TODO: check the header
-UnigramDictionary::UnigramDictionary(const uint8_t* const streamStart, int typedLetterMultiplier,
+UnigramDictionary::UnigramDictionary(const uint8_t *const streamStart, int typedLetterMultiplier,
         int fullWordMultiplier, int maxWordLength, int maxWords, const unsigned int flags)
     : DICT_ROOT(streamStart), MAX_WORD_LENGTH(maxWordLength), MAX_WORDS(maxWords),
     TYPED_LETTER_MULTIPLIER(typedLetterMultiplier), FULL_WORD_MULTIPLIER(fullWordMultiplier),
@@ -68,7 +68,7 @@
 
 // Return the replacement code point for a digraph, or 0 if none.
 int UnigramDictionary::getDigraphReplacement(const int *codes, const int i, const int codesSize,
-        const digraph_t* const digraphs, const unsigned int digraphsSize) const {
+        const digraph_t *const digraphs, const unsigned int digraphsSize) const {
 
     // There can't be a digraph if we don't have at least 2 characters to examine
     if (i + 2 > codesSize) return false;
@@ -103,7 +103,7 @@
         const bool useFullEditDistance, const int *codesSrc,
         const int codesRemain, const int currentDepth, int *codesDest, Correction *correction,
         WordsPriorityQueuePool *queuePool,
-        const digraph_t* const digraphs, const unsigned int digraphsSize) const {
+        const digraph_t *const digraphs, const unsigned int digraphsSize) const {
 
     const int startIndex = codesDest - codesBuffer;
     if (currentDepth < MAX_DIGRAPH_SEARCH_DEPTH) {
@@ -222,7 +222,7 @@
         AKLOGI("Returning %d words", suggestedWordsCount);
         /// Print the returned words
         for (int j = 0; j < suggestedWordsCount; ++j) {
-            short unsigned int* w = outWords + j * MAX_WORD_LENGTH;
+            short unsigned int *w = outWords + j * MAX_WORD_LENGTH;
             char s[MAX_WORD_LENGTH];
             for (int i = 0; i <= MAX_WORD_LENGTH; i++) s[i] = w[i];
             (void)s;
@@ -259,7 +259,7 @@
 
     PROF_START(4);
     bool hasAutoCorrectionCandidate = false;
-    WordsPriorityQueue* masterQueue = queuePool->getMasterQueue();
+    WordsPriorityQueue *masterQueue = queuePool->getMasterQueue();
     if (masterQueue->size() > 0) {
         float nsForMaster = masterQueue->getHighestNormalizedScore(
                 correction->getPrimaryInputWord(), inputLength, 0, 0, 0);
@@ -284,11 +284,11 @@
     if (DEBUG_DICT) {
         queuePool->dumpSubQueue1TopSuggestions();
         for (int i = 0; i < SUB_QUEUE_MAX_COUNT; ++i) {
-            WordsPriorityQueue* queue = queuePool->getSubQueue(FIRST_WORD_INDEX, i);
+            WordsPriorityQueue *queue = queuePool->getSubQueue(FIRST_WORD_INDEX, i);
             if (queue->size() > 0) {
-                WordsPriorityQueue::SuggestedWord* sw = queue->top();
+                WordsPriorityQueue::SuggestedWord *sw = queue->top();
                 const int score = sw->mScore;
-                const unsigned short* word = sw->mWord;
+                const unsigned short *word = sw->mWord;
                 const int wordLength = sw->mWordLength;
                 float ns = Correction::RankingAlgorithm::calcNormalizedScore(
                         correction->getPrimaryInputWord(), i, word, wordLength, score);
@@ -383,7 +383,7 @@
     const bool addToSubQueue = inputIndex < SUB_QUEUE_MAX_COUNT;
 
     int wordLength;
-    unsigned short* wordPointer;
+    unsigned short *wordPointer;
 
     if ((currentWordIndex == FIRST_WORD_INDEX) && addToMasterQueue) {
         WordsPriorityQueue *masterQueue = queuePool->getMasterQueue();
@@ -430,11 +430,11 @@
 int UnigramDictionary::getSubStringSuggestion(
         ProximityInfo *proximityInfo, const int *xcoordinates, const int *ycoordinates,
         const int *codes, const bool useFullEditDistance, Correction *correction,
-        WordsPriorityQueuePool* queuePool, const int inputLength,
+        WordsPriorityQueuePool *queuePool, const int inputLength,
         const bool hasAutoCorrectionCandidate, const int currentWordIndex,
         const int inputWordStartPos, const int inputWordLength,
         const int outputWordStartPos, const bool isSpaceProximity, int *freqArray,
-        int*wordLengthArray, unsigned short* outputWord, int *outputWordLength) const {
+        int*wordLengthArray, unsigned short *outputWord, int *outputWordLength) const {
     if (inputWordLength > MULTIPLE_WORDS_SUGGESTION_MAX_WORD_LENGTH) {
         return FLAG_MULTIPLE_SUGGEST_ABORT;
     }
@@ -477,7 +477,7 @@
     // TODO: Remove the safety net above        //
     //////////////////////////////////////////////
 
-    unsigned short* tempOutputWord = 0;
+    unsigned short *tempOutputWord = 0;
     int nextWordLength = 0;
     // TODO: Optimize init suggestion
     initSuggestions(proximityInfo, xcoordinates, ycoordinates, codes,
@@ -508,7 +508,7 @@
                 }
             }
         }
-        WordsPriorityQueue* queue = queuePool->getSubQueue(currentWordIndex, inputWordLength);
+        WordsPriorityQueue *queue = queuePool->getSubQueue(currentWordIndex, inputWordLength);
         // TODO: Return the correct value depending on doAutoCompletion
         if (!queue || queue->size() <= 0) {
             return FLAG_MULTIPLE_SUGGEST_ABORT;
@@ -579,10 +579,10 @@
 void UnigramDictionary::getMultiWordsSuggestionRec(ProximityInfo *proximityInfo,
         const int *xcoordinates, const int *ycoordinates, const int *codes,
         const bool useFullEditDistance, const int inputLength,
-        Correction *correction, WordsPriorityQueuePool* queuePool,
+        Correction *correction, WordsPriorityQueuePool *queuePool,
         const bool hasAutoCorrectionCandidate, const int startInputPos, const int startWordIndex,
-        const int outputWordLength, int *freqArray, int* wordLengthArray,
-        unsigned short* outputWord) const {
+        const int outputWordLength, int *freqArray, int *wordLengthArray,
+        unsigned short *outputWord) const {
     if (startWordIndex >= (MULTIPLE_WORDS_SUGGESTION_MAX_WORDS - 1)) {
         // Return if the last word index
         return;
@@ -660,7 +660,7 @@
 void UnigramDictionary::getSplitMultipleWordsSuggestions(ProximityInfo *proximityInfo,
         const int *xcoordinates, const int *ycoordinates, const int *codes,
         const bool useFullEditDistance, const int inputLength,
-        Correction *correction, WordsPriorityQueuePool* queuePool,
+        Correction *correction, WordsPriorityQueuePool *queuePool,
         const bool hasAutoCorrectionCandidate) const {
     if (inputLength >= MAX_WORD_LENGTH) return;
     if (DEBUG_DICT) {
@@ -705,9 +705,9 @@
 // In and out parameters may point to the same location. This function takes care
 // not to use any input parameters after it wrote into its outputs.
 static inline bool testCharGroupForContinuedLikeness(const uint8_t flags,
-        const uint8_t* const root, const int startPos,
-        const uint16_t* const inWord, const int startInputIndex,
-        int32_t* outNewWord, int* outInputIndex, int* outPos) {
+        const uint8_t *const root, const int startPos,
+        const uint16_t *const inWord, const int startInputIndex,
+        int32_t *outNewWord, int *outInputIndex, int *outPos) {
     const bool hasMultipleChars = (0 != (UnigramDictionary::FLAG_HAS_MULTIPLE_CHARS & flags));
     int pos = startPos;
     int32_t character = BinaryFormat::getCharCodeAndForwardPointer(root, &pos);
@@ -743,8 +743,8 @@
 // It will compare the frequency to the max frequency, and if greater, will
 // copy the word into the output buffer. In output value maxFreq, it will
 // write the new maximum frequency if it changed.
-static inline void onTerminalWordLike(const int freq, int32_t* newWord, const int length,
-        short unsigned int* outWord, int* maxFreq) {
+static inline void onTerminalWordLike(const int freq, int32_t *newWord, const int length,
+        short unsigned int *outWord, int *maxFreq) {
     if (freq > *maxFreq) {
         for (int q = 0; q < length; ++q)
             outWord[q] = newWord[q];
@@ -755,12 +755,12 @@
 
 // Will find the highest frequency of the words like the one passed as an argument,
 // that is, everything that only differs by case/accents.
-int UnigramDictionary::getMostFrequentWordLikeInner(const uint16_t * const inWord,
-        const int length, short unsigned int* outWord) const {
+int UnigramDictionary::getMostFrequentWordLikeInner(const uint16_t *const inWord,
+        const int length, short unsigned int *outWord) const {
     int32_t newWord[MAX_WORD_LENGTH_INTERNAL];
     int depth = 0;
     int maxFreq = -1;
-    const uint8_t* const root = DICT_ROOT;
+    const uint8_t *const root = DICT_ROOT;
     int stackChildCount[MAX_WORD_LENGTH_INTERNAL];
     int stackInputIndex[MAX_WORD_LENGTH_INTERNAL];
     int stackSiblingPos[MAX_WORD_LENGTH_INTERNAL];
@@ -816,8 +816,8 @@
     return maxFreq;
 }
 
-int UnigramDictionary::getFrequency(const int32_t* const inWord, const int length) const {
-    const uint8_t* const root = DICT_ROOT;
+int UnigramDictionary::getFrequency(const int32_t *const inWord, const int length) const {
+    const uint8_t *const root = DICT_ROOT;
     int pos = BinaryFormat::getTerminalPosition(root, inWord, length,
             false /* forceLowerCaseSearch */);
     if (NOT_VALID_WORD == pos) {
@@ -991,5 +991,4 @@
     *newChildrenPosition = childrenPos;
     return true;
 }
-
 } // namespace latinime
diff --git a/native/jni/src/unigram_dictionary.h b/native/jni/src/unigram_dictionary.h
index ac14fc0..f6aef2b 100644
--- a/native/jni/src/unigram_dictionary.h
+++ b/native/jni/src/unigram_dictionary.h
@@ -73,9 +73,9 @@
     static const int FLAG_MULTIPLE_SUGGEST_ABORT = 0;
     static const int FLAG_MULTIPLE_SUGGEST_SKIP = 1;
     static const int FLAG_MULTIPLE_SUGGEST_CONTINUE = 2;
-    UnigramDictionary(const uint8_t* const streamStart, int typedLetterMultipler,
+    UnigramDictionary(const uint8_t *const streamStart, int typedLetterMultipler,
             int fullWordMultiplier, int maxWordLength, int maxWords, const unsigned int flags);
-    int getFrequency(const int32_t* const inWord, const int length) const;
+    int getFrequency(const int32_t *const inWord, const int length) const;
     int getBigramPosition(int pos, unsigned short *word, int offset, int length) const;
     int getSuggestions(
             ProximityInfo *proximityInfo, const int *xcoordinates, const int *ycoordinates,
@@ -92,14 +92,14 @@
             const bool useFullEditDistance, Correction *correction,
             WordsPriorityQueuePool *queuePool) const;
     int getDigraphReplacement(const int *codes, const int i, const int codesSize,
-            const digraph_t* const digraphs, const unsigned int digraphsSize) const;
+            const digraph_t *const digraphs, const unsigned int digraphsSize) const;
     void getWordWithDigraphSuggestionsRec(ProximityInfo *proximityInfo,
-        const int *xcoordinates, const int* ycoordinates, const int *codesBuffer,
+        const int *xcoordinates, const int *ycoordinates, const int *codesBuffer,
         int *xCoordinatesBuffer, int *yCoordinatesBuffer, const int codesBufferSize,
         const std::map<int, int> *bigramMap, const uint8_t *bigramFilter,
-        const bool useFullEditDistance, const int* codesSrc, const int codesRemain,
-        const int currentDepth, int* codesDest, Correction *correction,
-        WordsPriorityQueuePool* queuePool, const digraph_t* const digraphs,
+        const bool useFullEditDistance, const int *codesSrc, const int codesRemain,
+        const int currentDepth, int *codesDest, Correction *correction,
+        WordsPriorityQueuePool *queuePool, const digraph_t *const digraphs,
         const unsigned int digraphsSize) const;
     void initSuggestions(ProximityInfo *proximityInfo, const int *xcoordinates,
             const int *ycoordinates, const int *codes, const int codesSize,
@@ -107,16 +107,16 @@
     void getOneWordSuggestions(ProximityInfo *proximityInfo, const int *xcoordinates,
             const int *ycoordinates, const int *codes, const std::map<int, int> *bigramMap,
             const uint8_t *bigramFilter, const bool useFullEditDistance, const int inputLength,
-            Correction *correction, WordsPriorityQueuePool* queuePool) const;
+            Correction *correction, WordsPriorityQueuePool *queuePool) const;
     void getSuggestionCandidates(
             const bool useFullEditDistance, const int inputLength,
             const std::map<int, int> *bigramMap, const uint8_t *bigramFilter,
-            Correction *correction, WordsPriorityQueuePool* queuePool, const bool doAutoCompletion,
+            Correction *correction, WordsPriorityQueuePool *queuePool, const bool doAutoCompletion,
             const int maxErrors, const int currentWordIndex) const;
     void getSplitMultipleWordsSuggestions(ProximityInfo *proximityInfo,
             const int *xcoordinates, const int *ycoordinates, const int *codes,
             const bool useFullEditDistance, const int inputLength,
-            Correction *correction, WordsPriorityQueuePool* queuePool,
+            Correction *correction, WordsPriorityQueuePool *queuePool,
             const bool hasAutoCorrectionCandidate) const;
     void onTerminal(const int freq, const TerminalAttributes& terminalAttributes,
             Correction *correction, WordsPriorityQueuePool *queuePool, const bool addToMasterQueue,
@@ -128,25 +128,25 @@
             const int currentWordIndex) const;
     int getMostFrequentWordLike(const int startInputIndex, const int inputLength,
             Correction *correction, unsigned short *word) const;
-    int getMostFrequentWordLikeInner(const uint16_t* const inWord, const int length,
+    int getMostFrequentWordLikeInner(const uint16_t *const inWord, const int length,
             short unsigned int *outWord) const;
     int getSubStringSuggestion(
             ProximityInfo *proximityInfo, const int *xcoordinates, const int *ycoordinates,
             const int *codes, const bool useFullEditDistance, Correction *correction,
-            WordsPriorityQueuePool* queuePool, const int inputLength,
+            WordsPriorityQueuePool *queuePool, const int inputLength,
             const bool hasAutoCorrectionCandidate, const int currentWordIndex,
             const int inputWordStartPos, const int inputWordLength,
             const int outputWordStartPos, const bool isSpaceProximity, int *freqArray,
-            int *wordLengthArray, unsigned short* outputWord, int *outputWordLength) const;
+            int *wordLengthArray, unsigned short *outputWord, int *outputWordLength) const;
     void getMultiWordsSuggestionRec(ProximityInfo *proximityInfo,
             const int *xcoordinates, const int *ycoordinates, const int *codes,
             const bool useFullEditDistance, const int inputLength,
-            Correction *correction, WordsPriorityQueuePool* queuePool,
+            Correction *correction, WordsPriorityQueuePool *queuePool,
             const bool hasAutoCorrectionCandidate, const int startPos, const int startWordIndex,
-            const int outputWordLength, int *freqArray, int* wordLengthArray,
-            unsigned short* outputWord) const;
+            const int outputWordLength, int *freqArray, int *wordLengthArray,
+            unsigned short *outputWord) const;
 
-    const uint8_t* const DICT_ROOT;
+    const uint8_t *const DICT_ROOT;
     const int MAX_WORD_LENGTH;
     const int MAX_WORDS;
     const int TYPED_LETTER_MULTIPLIER;
@@ -160,5 +160,4 @@
     static const digraph_t FRENCH_LIGATURES_DIGRAPHS[];
 };
 } // namespace latinime
-
 #endif // LATINIME_UNIGRAM_DICTIONARY_H
diff --git a/native/jni/src/words_priority_queue.h b/native/jni/src/words_priority_queue.h
index 9c6d28d..fc9c55e 100644
--- a/native/jni/src/words_priority_queue.h
+++ b/native/jni/src/words_priority_queue.h
@@ -33,7 +33,7 @@
         int mWordLength;
         bool mUsed;
 
-        void setParams(int score, unsigned short* word, int wordLength) {
+        void setParams(int score, unsigned short *word, int wordLength) {
             mScore = score;
             mWordLength = wordLength;
             memcpy(mWord, word, sizeof(unsigned short) * wordLength);
@@ -55,8 +55,8 @@
         delete[] mSuggestedWords;
     }
 
-    void push(int score, unsigned short* word, int wordLength) {
-        SuggestedWord* sw = 0;
+    void push(int score, unsigned short *word, int wordLength) {
+        SuggestedWord *sw = 0;
         if (mSuggestions.size() >= MAX_WORDS) {
             sw = mSuggestions.top();
             const int minScore = sw->mScore;
@@ -86,21 +86,21 @@
         }
     }
 
-    SuggestedWord* top() {
+    SuggestedWord *top() {
         if (mSuggestions.empty()) return 0;
-        SuggestedWord* sw = mSuggestions.top();
+        SuggestedWord *sw = mSuggestions.top();
         return sw;
     }
 
-    int outputSuggestions(const unsigned short* before, const int beforeLength,
+    int outputSuggestions(const unsigned short *before, const int beforeLength,
             int *frequencies, unsigned short *outputChars) {
         mHighestSuggestedWord = 0;
         const unsigned int size = min(
               MAX_WORDS, static_cast<unsigned int>(mSuggestions.size()));
-        SuggestedWord* swBuffer[size];
+        SuggestedWord *swBuffer[size];
         int index = size - 1;
         while (!mSuggestions.empty() && index >= 0) {
-            SuggestedWord* sw = mSuggestions.top();
+            SuggestedWord *sw = mSuggestions.top();
             if (DEBUG_WORDS_PRIORITY_QUEUE) {
                 AKLOGI("dump word. %d", sw->mScore);
                 DUMP_WORD(sw->mWord, sw->mWordLength);
@@ -110,11 +110,11 @@
             --index;
         }
         if (size >= 2) {
-            SuggestedWord* nsMaxSw = 0;
+            SuggestedWord *nsMaxSw = 0;
             unsigned int maxIndex = 0;
             float maxNs = 0;
             for (unsigned int i = 0; i < size; ++i) {
-                SuggestedWord* tempSw = swBuffer[i];
+                SuggestedWord *tempSw = swBuffer[i];
                 if (!tempSw) {
                     continue;
                 }
@@ -131,13 +131,13 @@
             }
         }
         for (unsigned int i = 0; i < size; ++i) {
-            SuggestedWord* sw = swBuffer[i];
+            SuggestedWord *sw = swBuffer[i];
             if (!sw) {
                 AKLOGE("SuggestedWord is null %d", i);
                 continue;
             }
             const unsigned int wordLength = sw->mWordLength;
-            char* targetAdr = (char*) outputChars + i * MAX_WORD_LENGTH * sizeof(short);
+            char *targetAdr = (char*) outputChars + i * MAX_WORD_LENGTH * sizeof(short);
             frequencies[i] = sw->mScore;
             memcpy(targetAdr, sw->mWord, (wordLength) * sizeof(short));
             if (wordLength < MAX_WORD_LENGTH) {
@@ -155,7 +155,7 @@
     void clear() {
         mHighestSuggestedWord = 0;
         while (!mSuggestions.empty()) {
-            SuggestedWord* sw = mSuggestions.top();
+            SuggestedWord *sw = mSuggestions.top();
             if (DEBUG_WORDS_PRIORITY_QUEUE) {
                 AKLOGI("Clear word. %d", sw->mScore);
                 DUMP_WORD(sw->mWord, sw->mWordLength);
@@ -172,8 +172,8 @@
         DUMP_WORD(mHighestSuggestedWord->mWord, mHighestSuggestedWord->mWordLength);
     }
 
-    float getHighestNormalizedScore(const unsigned short* before, const int beforeLength,
-            unsigned short** outWord, int *outScore, int *outLength) {
+    float getHighestNormalizedScore(const unsigned short *before, const int beforeLength,
+            unsigned short **outWord, int *outScore, int *outLength) {
         if (!mHighestSuggestedWord) {
             return 0.0;
         }
@@ -189,7 +189,7 @@
         }
     };
 
-    SuggestedWord* getFreeSuggestedWord(int score, unsigned short* word,
+    SuggestedWord *getFreeSuggestedWord(int score, unsigned short *word,
             int wordLength) {
         for (unsigned int i = 0; i < MAX_WORD_LENGTH; ++i) {
             if (!mSuggestedWords[i].mUsed) {
@@ -200,10 +200,10 @@
         return 0;
     }
 
-    static float getNormalizedScore(SuggestedWord* sw, const unsigned short* before,
-            const int beforeLength, unsigned short** outWord, int *outScore, int *outLength) {
+    static float getNormalizedScore(SuggestedWord *sw, const unsigned short *before,
+            const int beforeLength, unsigned short **outWord, int *outScore, int *outLength) {
         const int score = sw->mScore;
-        unsigned short* word = sw->mWord;
+        unsigned short *word = sw->mWord;
         const int wordLength = sw->mWordLength;
         if (outScore) {
             *outScore = score;
@@ -223,9 +223,8 @@
     Suggestions mSuggestions;
     const unsigned int MAX_WORDS;
     const unsigned int MAX_WORD_LENGTH;
-    SuggestedWord* mSuggestedWords;
-    SuggestedWord* mHighestSuggestedWord;
+    SuggestedWord *mSuggestedWords;
+    SuggestedWord *mHighestSuggestedWord;
 };
-}
-
+} // namespace latinime
 #endif // LATINIME_WORDS_PRIORITY_QUEUE_H
diff --git a/native/jni/src/words_priority_queue_pool.h b/native/jni/src/words_priority_queue_pool.h
index b4e2bed..aff3074 100644
--- a/native/jni/src/words_priority_queue_pool.h
+++ b/native/jni/src/words_priority_queue_pool.h
@@ -44,11 +44,11 @@
         }
     }
 
-    WordsPriorityQueue* getMasterQueue() {
+    WordsPriorityQueue *getMasterQueue() {
         return mMasterQueue;
     }
 
-    WordsPriorityQueue* getSubQueue(const int wordIndex, const int inputWordLength) {
+    WordsPriorityQueue *getSubQueue(const int wordIndex, const int inputWordLength) {
         if (wordIndex >= MULTIPLE_WORDS_SUGGESTION_MAX_WORDS) {
             return 0;
         }
@@ -70,7 +70,7 @@
 
     inline void clearSubQueue(const int wordIndex) {
         for (int i = 0; i < SUB_QUEUE_MAX_COUNT; ++i) {
-            WordsPriorityQueue* queue = getSubQueue(wordIndex, i);
+            WordsPriorityQueue *queue = getSubQueue(wordIndex, i);
             if (queue) {
                 queue->clear();
             }
@@ -86,12 +86,11 @@
 
  private:
     DISALLOW_IMPLICIT_CONSTRUCTORS(WordsPriorityQueuePool);
-    WordsPriorityQueue* mMasterQueue;
-    WordsPriorityQueue* mSubQueues[SUB_QUEUE_MAX_COUNT * MULTIPLE_WORDS_SUGGESTION_MAX_WORDS];
+    WordsPriorityQueue *mMasterQueue;
+    WordsPriorityQueue *mSubQueues[SUB_QUEUE_MAX_COUNT * MULTIPLE_WORDS_SUGGESTION_MAX_WORDS];
     char mMasterQueueBuf[sizeof(WordsPriorityQueue)];
     char mSubQueueBuf[MULTIPLE_WORDS_SUGGESTION_MAX_WORDS
                       * SUB_QUEUE_MAX_COUNT * sizeof(WordsPriorityQueue)];
 };
-}
-
+} // namespace latinime
 #endif // LATINIME_WORDS_PRIORITY_QUEUE_POOL_H
diff --git a/tools/maketext/res/values-sw/donottranslate-more-keys.xml b/tools/maketext/res/values-sw/donottranslate-more-keys.xml
new file mode 100644
index 0000000..968a80c
--- /dev/null
+++ b/tools/maketext/res/values-sw/donottranslate-more-keys.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 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.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- This is the same as English except more_keys_for_g. -->
+    <!-- U+00E0: "à" LATIN SMALL LETTER A WITH GRAVE
+         U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE
+         U+00E2: "â" LATIN SMALL LETTER A WITH CIRCUMFLEX
+         U+00E4: "ä" LATIN SMALL LETTER A WITH DIAERESIS
+         U+00E6: "æ" LATIN SMALL LETTER AE
+         U+00E3: "ã" LATIN SMALL LETTER A WITH TILDE
+         U+00E5: "å" LATIN SMALL LETTER A WITH RING ABOVE
+         U+0101: "ā" LATIN SMALL LETTER A WITH MACRON -->
+    <string name="more_keys_for_a">&#x00E0;,&#x00E1;,&#x00E2;,&#x00E4;,&#x00E6;,&#x00E3;,&#x00E5;,&#x0101;</string>
+    <!-- U+00E8: "è" LATIN SMALL LETTER E WITH GRAVE
+         U+00E9: "é" LATIN SMALL LETTER E WITH ACUTE
+         U+00EA: "ê" LATIN SMALL LETTER E WITH CIRCUMFLEX
+         U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS
+         U+0113: "ē" LATIN SMALL LETTER E WITH MACRON -->
+    <string name="more_keys_for_e">&#x00E8;,&#x00E9;,&#x00EA;,&#x00EB;,&#x0113;</string>
+    <!-- U+00EE: "î" LATIN SMALL LETTER I WITH CIRCUMFLEX
+         U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS
+         U+00ED: "í" LATIN SMALL LETTER I WITH ACUTE
+         U+012B: "ī" LATIN SMALL LETTER I WITH MACRON
+         U+00EC: "ì" LATIN SMALL LETTER I WITH GRAVE -->
+    <string name="more_keys_for_i">&#x00EE;,&#x00EF;,&#x00ED;,&#x012B;,&#x00EC;</string>
+    <!-- U+00F4: "ô" LATIN SMALL LETTER O WITH CIRCUMFLEX
+         U+00F6: "ö" LATIN SMALL LETTER O WITH DIAERESIS
+         U+00F2: "ò" LATIN SMALL LETTER O WITH GRAVE
+         U+00F3: "ó" LATIN SMALL LETTER O WITH ACUTE
+         U+0153: "œ" LATIN SMALL LIGATURE OE
+         U+00F8: "ø" LATIN SMALL LETTER O WITH STROKE
+         U+014D: "ō" LATIN SMALL LETTER O WITH MACRON
+         U+00F5: "õ" LATIN SMALL LETTER O WITH TILDE -->
+    <string name="more_keys_for_o">&#x00F4;,&#x00F6;,&#x00F2;,&#x00F3;,&#x0153;,&#x00F8;,&#x014D;,&#x00F5;</string>
+    <!-- U+00FB: "û" LATIN SMALL LETTER U WITH CIRCUMFLEX
+         U+00FC: "ü" LATIN SMALL LETTER U WITH DIAERESIS
+         U+00F9: "ù" LATIN SMALL LETTER U WITH GRAVE
+         U+00FA: "ú" LATIN SMALL LETTER U WITH ACUTE
+         U+016B: "ū" LATIN SMALL LETTER U WITH MACRON -->
+    <string name="more_keys_for_u">&#x00FB;,&#x00FC;,&#x00F9;,&#x00FA;,&#x016B;</string>
+    <!-- U+00DF: "ß" LATIN SMALL LETTER SHARP S -->
+    <string name="more_keys_for_s">&#x00DF;</string>
+    <!-- U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE -->
+    <string name="more_keys_for_n">&#x00F1;</string>
+    <!-- U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA -->
+    <string name="more_keys_for_c">&#x00E7;</string>
+    <string name="more_keys_for_g">g\'</string>
+</resources>