diff --git a/native/jni/src/dictionary.h b/native/jni/src/dictionary.h index 83676b204..ecdddd771 100644 --- a/native/jni/src/dictionary.h +++ b/native/jni/src/dictionary.h @@ -31,15 +31,15 @@ class UnigramDictionary; class Dictionary { public: // Taken from SuggestedWords.java - const static int KIND_TYPED = 0; // What user typed - const static int KIND_CORRECTION = 1; // Simple correction/suggestion - const static int KIND_COMPLETION = 2; // Completion (suggestion with appended chars) - const static int KIND_WHITELIST = 3; // Whitelisted word - const static int KIND_BLACKLIST = 4; // Blacklisted word - const static int KIND_HARDCODED = 5; // Hardcoded suggestion, e.g. punctuation - const static int KIND_APP_DEFINED = 6; // Suggested by the application - const static int KIND_SHORTCUT = 7; // A shortcut - const static int KIND_PREDICTION = 8; // A prediction (== a suggestion with no input) + static const int KIND_TYPED = 0; // What user typed + static const int KIND_CORRECTION = 1; // Simple correction/suggestion + static const int KIND_COMPLETION = 2; // Completion (suggestion with appended chars) + static const int KIND_WHITELIST = 3; // Whitelisted word + static const int KIND_BLACKLIST = 4; // Blacklisted word + static const int KIND_HARDCODED = 5; // Hardcoded suggestion, e.g. punctuation + static const int KIND_APP_DEFINED = 6; // Suggested by the application + static const int KIND_SHORTCUT = 7; // A shortcut + static const int KIND_PREDICTION = 8; // A prediction (== a suggestion with no input) Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust); diff --git a/native/jni/src/proximity_info.cpp b/native/jni/src/proximity_info.cpp index 3979cfa9a..d812745ca 100644 --- a/native/jni/src/proximity_info.cpp +++ b/native/jni/src/proximity_info.cpp @@ -24,6 +24,7 @@ #include "geometry_utils.h" #include "jni.h" #include "proximity_info.h" +#include "proximity_info_params.h" namespace latinime { @@ -127,17 +128,15 @@ bool ProximityInfo::hasSpaceProximity(const int x, const int y) const { float ProximityInfo::getNormalizedSquaredDistanceFromCenterFloatG( const int keyId, const int x, const int y) const { - const static float verticalSweetSpotScaleForGeometric = 1.1f; const bool correctTouchPosition = hasTouchPositionCorrectionData(); - const float centerX = static_cast(correctTouchPosition - ? getSweetSpotCenterXAt(keyId) + const float centerX = static_cast(correctTouchPosition ? getSweetSpotCenterXAt(keyId) : getKeyCenterXOfKeyIdG(keyId)); const float visualKeyCenterY = static_cast(getKeyCenterYOfKeyIdG(keyId)); float centerY; if (correctTouchPosition) { const float sweetSpotCenterY = static_cast(getSweetSpotCenterYAt(keyId)); const float gapY = sweetSpotCenterY - visualKeyCenterY; - centerY = visualKeyCenterY + gapY * verticalSweetSpotScaleForGeometric; + centerY = visualKeyCenterY + gapY * ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G; } else { centerY = visualKeyCenterY; } diff --git a/native/jni/src/proximity_info_params.cpp b/native/jni/src/proximity_info_params.cpp index 8cdd2b801..1410ab575 100644 --- a/native/jni/src/proximity_info_params.cpp +++ b/native/jni/src/proximity_info_params.cpp @@ -20,6 +20,7 @@ namespace latinime { const float ProximityInfoParams::NOT_A_DISTANCE_FLOAT = -1.0f; const int ProximityInfoParams::MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE = 5; +const float ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G = 1.1f; /* Per method constants */ // Used by ProximityInfoStateUtils::initGeometricDistanceInfos() diff --git a/native/jni/src/proximity_info_params.h b/native/jni/src/proximity_info_params.h index c8e0bf7f7..7c26208a8 100644 --- a/native/jni/src/proximity_info_params.h +++ b/native/jni/src/proximity_info_params.h @@ -25,6 +25,7 @@ class ProximityInfoParams { public: static const float NOT_A_DISTANCE_FLOAT; static const int MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE; + static const float VERTICAL_SWEET_SPOT_SCALE_G; // Used by ProximityInfoStateUtils::initGeometricDistanceInfos() static const float NEAR_KEY_NORMALIZED_SQUARED_THRESHOLD;