am ee456af9: Cleanup in ProximityInfoParams

# Via Ken Wakasa
* commit 'ee456af9d4c7ce4fe2dc0513a8b2cf08c21b5f21':
  Cleanup in ProximityInfoParams
main
Ken Wakasa 2013-02-01 03:23:14 -08:00 committed by Android Git Automerger
commit fbd3cedc65
4 changed files with 14 additions and 13 deletions

View File

@ -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);

View File

@ -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<float>(correctTouchPosition
? getSweetSpotCenterXAt(keyId)
const float centerX = static_cast<float>(correctTouchPosition ? getSweetSpotCenterXAt(keyId)
: getKeyCenterXOfKeyIdG(keyId));
const float visualKeyCenterY = static_cast<float>(getKeyCenterYOfKeyIdG(keyId));
float centerY;
if (correctTouchPosition) {
const float sweetSpotCenterY = static_cast<float>(getSweetSpotCenterYAt(keyId));
const float gapY = sweetSpotCenterY - visualKeyCenterY;
centerY = visualKeyCenterY + gapY * verticalSweetSpotScaleForGeometric;
centerY = visualKeyCenterY + gapY * ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G;
} else {
centerY = visualKeyCenterY;
}

View File

@ -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()

View File

@ -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;