Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 293f062c authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka Committed by Android (Google) Code Review
Browse files

Merge "Add advanced options to turn on/off the gesture trail and text preview" into jb-mr1-dev

parents 75fb3ce1 47e2bf32
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -111,10 +111,16 @@
    <!-- Description for "next word suggestion" option. This displays suggestions even when there is no input, based on the previous word. -->
    <string name="bigram_prediction_summary">Based on previous word</string>

    <!-- Option to enable gesture input. The user can input a word by tracing the letters of a word without releasing the finger from the screen. [CHAR LIMIT=20]-->
    <!-- Option to enable gesture input. The user can input a word by tracing the letters of a word without releasing the finger from the screen. [CHAR LIMIT=30]-->
    <string name="gesture_input">Gesture input</string>
    <!-- Description for "gesture_input" option. The user can input a word by tracing the letters of a word without releasing the finger from the screen. [CHAR LIMIT=65]-->
    <string name="gesture_input_summary">Input a word by tracing the letters of a word</string>
    <!-- Option to enable gesture trail preview. The user can see a trail of the gesture during gesture input. [CHAR LIMIT=30]-->
    <string name="gesture_preview_trail">Show gesture trail</string>
    <!-- Option to enable gesture floating text preview. The user can see a suggested word floating under the moving finger during a gesture input. [CHAR LIMIT=30]-->
    <string name="gesture_floating_preview_text">Show gesture word</string>
    <!-- Description for "gesture_floating_preview_text" option. The user can see a suggested word floating under the moving finger during a gesture input. [CHAR LIMIT=65]-->
    <string name="gesture_floating_preview_text_summary">Show floating preview word with gesture</string>

    <!-- Indicates that a word has been added to the dictionary -->
    <string name="added_word"><xliff:g id="word">%s</xliff:g> : Saved</string>
+17 −6
Original line number Diff line number Diff line
@@ -101,6 +101,12 @@
            android:key="pref_advanced_settings"
            android:title="@string/advanced_settings"
            android:summary="@string/advanced_settings_summary">
            <CheckBoxPreference
                android:key="pref_key_use_contacts_dict"
                android:title="@string/use_contacts_dict"
                android:summary="@string/use_contacts_dict_summary"
                android:persistent="true"
                android:defaultValue="true" />
            <CheckBoxPreference
                android:key="pref_suppress_language_switch_key"
                android:title="@string/suppress_language_switch_key"
@@ -120,18 +126,23 @@
            <ListPreference
                android:key="pref_key_preview_popup_dismiss_delay"
                android:title="@string/key_preview_popup_dismiss_delay" />
            <CheckBoxPreference
                android:key="pref_key_use_contacts_dict"
                android:title="@string/use_contacts_dict"
                android:summary="@string/use_contacts_dict_summary"
                android:persistent="true"
                android:defaultValue="true" />
            <PreferenceScreen
                android:key="pref_vibration_duration_settings"
                android:title="@string/prefs_keypress_vibration_duration_settings"/>
            <PreferenceScreen
                android:key="pref_keypress_sound_volume"
                android:title="@string/prefs_keypress_sound_volume_settings" />
            <CheckBoxPreference
                android:key="pref_gesture_preview_trail"
                android:title="@string/gesture_preview_trail"
                android:persistent="true"
                android:defaultValue="true" />
            <CheckBoxPreference
                android:key="pref_gesture_floating_preview_text"
                android:title="@string/gesture_floating_preview_text"
                android:summary="@string/gesture_floating_preview_text_summary"
                android:persistent="true"
                android:defaultValue="true" />
        </PreferenceScreen>
    </PreferenceCategory>
</PreferenceScreen>
+4 −4
Original line number Diff line number Diff line
@@ -432,8 +432,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
        return mShowKeyPreviewPopup;
    }

    public void setGestureHandlingMode(boolean shouldHandleGesture) {
    public void setGestureHandlingMode(boolean shouldHandleGesture,
            boolean drawsGesturePreviewTrail, boolean drawsGestureFloatingPreviewText) {
        mShouldHandleGesture = shouldHandleGesture;
        mPreviewPlacerView.setGesturePreviewMode(
                drawsGesturePreviewTrail, drawsGestureFloatingPreviewText);
    }

    @Override
@@ -896,15 +899,12 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
    }

    public void showGesturePreviewText(String gesturePreviewText) {
        // TDOD: Add user settings option to control drawing gesture trail.
        locatePreviewPlacerView();
        mPreviewPlacerView.setGesturePreviewText(gesturePreviewText);
        mPreviewPlacerView.invalidate();
    }

    @Override
    public void showGestureTrail(PointerTracker tracker) {
        // TDOD: Add user settings option to control drawing gesture trail.
        locatePreviewPlacerView();
        mPreviewPlacerView.invalidatePointer(tracker);
    }
+4 −2
Original line number Diff line number Diff line
@@ -481,8 +481,10 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
    }

    @Override
    public void setGestureHandlingMode(final boolean shouldHandleGesture) {
        super.setGestureHandlingMode(shouldHandleGesture);
    public void setGestureHandlingMode(final boolean shouldHandleGesture,
            boolean drawsGesturePreviewTrail, boolean drawsGestureFloatingPreviewText) {
        super.setGestureHandlingMode(shouldHandleGesture, drawsGesturePreviewTrail,
                drawsGestureFloatingPreviewText);
        PointerTracker.setKeyDetector(mKeyDetector, shouldHandleGesture);
    }

+14 −5
Original line number Diff line number Diff line
@@ -51,6 +51,8 @@ public class PreviewPlacerView extends RelativeLayout {
    private final SparseArray<PointerTracker> mPointers = new SparseArray<PointerTracker>();

    private String mGesturePreviewText;
    private boolean mDrawsGesturePreviewTrail;
    private boolean mDrawsGestureFloatingPreviewText;

    public PreviewPlacerView(Context context) {
        super(context);
@@ -89,6 +91,12 @@ public class PreviewPlacerView extends RelativeLayout {
        mYOrigin = y;
    }

    public void setGesturePreviewMode(boolean drawsGesturePreviewTrail,
            boolean drawsGestureFloatingPreviewText) {
        mDrawsGesturePreviewTrail = drawsGesturePreviewTrail;
        mDrawsGestureFloatingPreviewText = drawsGestureFloatingPreviewText;
    }

    public void invalidatePointer(PointerTracker tracker) {
        synchronized (mPointers) {
            mPointers.put(tracker.mPointerId, tracker);
@@ -100,18 +108,19 @@ public class PreviewPlacerView extends RelativeLayout {
    @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;
            boolean hasDrawnFloatingPreviewText = false;
            for (int index = 0; index < trackerCount; index++) {
                final PointerTracker tracker = mPointers.valueAt(index);
                if (mDrawsGesturePreviewTrail) {
                    tracker.drawGestureTrail(canvas, mGesturePaint);
                }
                // TODO: Figure out more cleaner way to draw gesture preview text.
                if (!floatingPreviewHasDrawn) {
                if (mDrawsGestureFloatingPreviewText && !hasDrawnFloatingPreviewText) {
                    drawGesturePreviewText(canvas, tracker, mGesturePreviewText);
                    floatingPreviewHasDrawn = true;
                    hasDrawnFloatingPreviewText = true;
                }
            }
            canvas.translate(-mXOrigin, -mYOrigin);
Loading