// Path: app/src/main/java/com/vlath/keyboard/latin/settings/SettingsValues.java
// public class SettingsValues {
//     public static final float DEFAULT_SIZE_SCALE = 1.0f; // 100%
// 
//     // From resources:
//     public final SpacingAndPunctuations mSpacingAndPunctuations;
//     // From configuration:
//     public final Locale mLocale;
//     public final boolean mHasHardwareKeyboard;
//     public final int mDisplayOrientation;
//     // From preferences, in the same order as xml/prefs.xml:
//     public final boolean mAutoCap;
//     public final boolean mVibrateOn;
//     public final boolean mSoundOn;
//     public final boolean mKeyPreviewPopupOn;
//     public final boolean mShowsLanguageSwitchKey;
//     public final int mKeyLongpressTimeout;
//     //public final boolean mShouldShowLxxSuggestionUi;
//     public final boolean mHideSpecialChars;
//     public final boolean mShowNumberRow;
//     public final boolean mSpaceSwipeEnabled;
// 
//     // From the input box
//     @NonNull
//     public final InputAttributes mInputAttributes;
// 
//     // Deduced settings
//     public final int mKeypressVibrationDuration;
//     public final float mKeypressSoundVolume;
//     public final int mKeyPreviewPopupDismissDelay;
// 
//     // Debug settings
//     public final boolean mHasKeyboardResize;
//     public final float mKeyboardHeightScale;
//     public final int mKeyPreviewShowUpDuration;
//     public final int mKeyPreviewDismissDuration;
//     public final float mKeyPreviewShowUpStartXScale;
//     public final float mKeyPreviewShowUpStartYScale;
//     public final float mKeyPreviewDismissEndXScale;
//     public final float mKeyPreviewDismissEndYScale;
// 
//     public SettingsValues(final SharedPreferences prefs, final Resources res,
//             @NonNull final InputAttributes inputAttributes) {
//         mLocale = res.getConfiguration().locale;
//         // Get the resources
//         mSpacingAndPunctuations = new SpacingAndPunctuations(res);
// 
//         // Store the input attributes
//         mInputAttributes = inputAttributes;
// 
//         // Get the settings preferences
//         mAutoCap = prefs.getBoolean(Settings.PREF_AUTO_CAP, true);
//         mVibrateOn = false;
//         mSoundOn = Settings.readKeypressSoundEnabled(prefs, res);
//         mKeyPreviewPopupOn = Settings.readKeyPreviewPopupEnabled(prefs, res);
//         mShowsLanguageSwitchKey = false;
//         mHasHardwareKeyboard = Settings.readHasHardwareKeyboard(res.getConfiguration());
// 
//         // Compute other readable settings
//         mKeyLongpressTimeout = Settings.readKeyLongpressTimeout(prefs, res);
//         mKeypressVibrationDuration = Settings.readKeypressVibrationDuration(prefs, res);
//         mKeypressSoundVolume = Settings.readKeypressSoundVolume(prefs, res);
//         mKeyPreviewPopupDismissDelay = Settings.readKeyPreviewPopupDismissDelay(prefs, res);
//         mHasKeyboardResize = true;
//         mKeyboardHeightScale = Settings.readKeyboardHeight(prefs, DEFAULT_SIZE_SCALE);
//         mKeyPreviewShowUpDuration = res.getInteger(R.integer.config_key_preview_show_up_duration);
//         mKeyPreviewDismissDuration = res.getInteger(R.integer.config_key_preview_dismiss_duration);
//         final float defaultKeyPreviewShowUpStartScale = ResourceUtils.getFloatFromFraction(
//                 res, R.fraction.config_key_preview_show_up_start_scale);
//         final float defaultKeyPreviewDismissEndScale = ResourceUtils.getFloatFromFraction(
//                 res, R.fraction.config_key_preview_dismiss_end_scale);
//         mKeyPreviewShowUpStartXScale = defaultKeyPreviewShowUpStartScale;
//         mKeyPreviewShowUpStartYScale = defaultKeyPreviewShowUpStartScale;
//         mKeyPreviewDismissEndXScale = defaultKeyPreviewDismissEndScale;
//         mKeyPreviewDismissEndYScale = defaultKeyPreviewDismissEndScale;
//         mDisplayOrientation = res.getConfiguration().orientation;
//         mHideSpecialChars = Settings.readHideSpecialChars(prefs);
//         mShowNumberRow = Settings.readShowNumberRow(prefs);
//         mSpaceSwipeEnabled = Settings.readSpaceSwipeEnabled(prefs);
//     }
// 
//     public boolean isWordSeparator(final int code) {
//         return mSpacingAndPunctuations.isWordSeparator(code);
//     }
// 
//     public boolean isLanguageSwitchKeyEnabled() {
//         if (!mShowsLanguageSwitchKey) {
//             return false;
//         }
//         final RichInputMethodManager imm = RichInputMethodManager.getInstance();
//         return imm.hasMultipleEnabledIMEsOrSubtypes(false /* include aux subtypes */);
//     }
// 
//     public boolean isSameInputType(final EditorInfo editorInfo) {
//         return mInputAttributes.isSameInputType(editorInfo);
//     }
// 
//     public boolean hasSameOrientation(final Configuration configuration) {
//         return mDisplayOrientation == configuration.orientation;
//     }
// }


import com.vlath.keyboard.latin.settings.SettingsValues;
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.vlath.keyboard.event;


/**
 * An object encapsulating a single transaction for input.
 */
public class InputTransaction {
    // UPDATE_LATER is stronger than UPDATE_NOW. The reason for this is, if we have to update later,
    // it's because something will change that we can't evaluate now, which means that even if we
    // re-evaluate now we'll have to do it again later. The only case where that wouldn't apply
    // would be if we needed to update now to find out the new state right away, but then we
    // can't do it with this deferred mechanism anyway.
    public static final int SHIFT_NO_UPDATE = 0;
    public static final int SHIFT_UPDATE_NOW = 1;
    public static final int SHIFT_UPDATE_LATER = 2;

    // Initial conditions
// Path: app/src/main/java/com/vlath/keyboard/latin/settings/SettingsValues.java
// public class SettingsValues {
//     public static final float DEFAULT_SIZE_SCALE = 1.0f; // 100%
// 
//     // From resources:
//     public final SpacingAndPunctuations mSpacingAndPunctuations;
//     // From configuration:
//     public final Locale mLocale;
//     public final boolean mHasHardwareKeyboard;
//     public final int mDisplayOrientation;
//     // From preferences, in the same order as xml/prefs.xml:
//     public final boolean mAutoCap;
//     public final boolean mVibrateOn;
//     public final boolean mSoundOn;
//     public final boolean mKeyPreviewPopupOn;
//     public final boolean mShowsLanguageSwitchKey;
//     public final int mKeyLongpressTimeout;
//     //public final boolean mShouldShowLxxSuggestionUi;
//     public final boolean mHideSpecialChars;
//     public final boolean mShowNumberRow;
//     public final boolean mSpaceSwipeEnabled;
// 
//     // From the input box
//     @NonNull
//     public final InputAttributes mInputAttributes;
// 
//     // Deduced settings
//     public final int mKeypressVibrationDuration;
//     public final float mKeypressSoundVolume;
//     public final int mKeyPreviewPopupDismissDelay;
// 
//     // Debug settings
//     public final boolean mHasKeyboardResize;
//     public final float mKeyboardHeightScale;
//     public final int mKeyPreviewShowUpDuration;
//     public final int mKeyPreviewDismissDuration;
//     public final float mKeyPreviewShowUpStartXScale;
//     public final float mKeyPreviewShowUpStartYScale;
//     public final float mKeyPreviewDismissEndXScale;
//     public final float mKeyPreviewDismissEndYScale;
// 
//     public SettingsValues(final SharedPreferences prefs, final Resources res,
//             @NonNull final InputAttributes inputAttributes) {
//         mLocale = res.getConfiguration().locale;
//         // Get the resources
//         mSpacingAndPunctuations = new SpacingAndPunctuations(res);
// 
//         // Store the input attributes
//         mInputAttributes = inputAttributes;
// 
//         // Get the settings preferences
//         mAutoCap = prefs.getBoolean(Settings.PREF_AUTO_CAP, true);
//         mVibrateOn = false;
//         mSoundOn = Settings.readKeypressSoundEnabled(prefs, res);
//         mKeyPreviewPopupOn = Settings.readKeyPreviewPopupEnabled(prefs, res);
//         mShowsLanguageSwitchKey = false;
//         mHasHardwareKeyboard = Settings.readHasHardwareKeyboard(res.getConfiguration());
// 
//         // Compute other readable settings
//         mKeyLongpressTimeout = Settings.readKeyLongpressTimeout(prefs, res);
//         mKeypressVibrationDuration = Settings.readKeypressVibrationDuration(prefs, res);
//         mKeypressSoundVolume = Settings.readKeypressSoundVolume(prefs, res);
//         mKeyPreviewPopupDismissDelay = Settings.readKeyPreviewPopupDismissDelay(prefs, res);
//         mHasKeyboardResize = true;
//         mKeyboardHeightScale = Settings.readKeyboardHeight(prefs, DEFAULT_SIZE_SCALE);
//         mKeyPreviewShowUpDuration = res.getInteger(R.integer.config_key_preview_show_up_duration);
//         mKeyPreviewDismissDuration = res.getInteger(R.integer.config_key_preview_dismiss_duration);
//         final float defaultKeyPreviewShowUpStartScale = ResourceUtils.getFloatFromFraction(
//                 res, R.fraction.config_key_preview_show_up_start_scale);
//         final float defaultKeyPreviewDismissEndScale = ResourceUtils.getFloatFromFraction(
//                 res, R.fraction.config_key_preview_dismiss_end_scale);
//         mKeyPreviewShowUpStartXScale = defaultKeyPreviewShowUpStartScale;
//         mKeyPreviewShowUpStartYScale = defaultKeyPreviewShowUpStartScale;
//         mKeyPreviewDismissEndXScale = defaultKeyPreviewDismissEndScale;
//         mKeyPreviewDismissEndYScale = defaultKeyPreviewDismissEndScale;
//         mDisplayOrientation = res.getConfiguration().orientation;
//         mHideSpecialChars = Settings.readHideSpecialChars(prefs);
//         mShowNumberRow = Settings.readShowNumberRow(prefs);
//         mSpaceSwipeEnabled = Settings.readSpaceSwipeEnabled(prefs);
//     }
// 
//     public boolean isWordSeparator(final int code) {
//         return mSpacingAndPunctuations.isWordSeparator(code);
//     }
// 
//     public boolean isLanguageSwitchKeyEnabled() {
//         if (!mShowsLanguageSwitchKey) {
//             return false;
//         }
//         final RichInputMethodManager imm = RichInputMethodManager.getInstance();
//         return imm.hasMultipleEnabledIMEsOrSubtypes(false /* include aux subtypes */);
//     }
// 
//     public boolean isSameInputType(final EditorInfo editorInfo) {
//         return mInputAttributes.isSameInputType(editorInfo);
//     }
// 
//     public boolean hasSameOrientation(final Configuration configuration) {
//         return mDisplayOrientation == configuration.orientation;
//     }
// }


// Path: app/src/main/java/com/vlath/keyboard/event/InputTransaction.java
import com.vlath.keyboard.latin.settings.SettingsValues;

/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.vlath.keyboard.event;


/**
 * An object encapsulating a single transaction for input.
 */
public class InputTransaction {
    // UPDATE_LATER is stronger than UPDATE_NOW. The reason for this is, if we have to update later,
    // it's because something will change that we can't evaluate now, which means that even if we
    // re-evaluate now we'll have to do it again later. The only case where that wouldn't apply
    // would be if we needed to update now to find out the new state right away, but then we
    // can't do it with this deferred mechanism anyway.
    public static final int SHIFT_NO_UPDATE = 0;
    public static final int SHIFT_UPDATE_NOW = 1;
    public static final int SHIFT_UPDATE_LATER = 2;

    // Initial conditions
    public final SettingsValues mSettingsValues;