本文整理汇总了Java中org.chromium.chrome.browser.preferences.ChromePreferenceManager.getContextualSearchTapCount方法的典型用法代码示例。如果您正苦于以下问题:Java ChromePreferenceManager.getContextualSearchTapCount方法的具体用法?Java ChromePreferenceManager.getContextualSearchTapCount怎么用?Java ChromePreferenceManager.getContextualSearchTapCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.chromium.chrome.browser.preferences.ChromePreferenceManager
的用法示例。
在下文中一共展示了ChromePreferenceManager.getContextualSearchTapCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleShouldSuppressTap
import org.chromium.chrome.browser.preferences.ChromePreferenceManager; //导入方法依赖的package包/类
/**
* Handles Tap suppression by making a callback to either the handler's #handleSuppressedTap()
* or #handleNonSuppressedTap() after a possible delay.
* This should be called when the context is fully built (by gathering surrounding text
* if needed, etc) but before showing any UX.
*/
void handleShouldSuppressTap() {
int x = (int) mX;
int y = (int) mY;
// TODO(donnd): add a policy method to get adjusted tap count.
ChromePreferenceManager prefs = ChromePreferenceManager.getInstance();
int adjustedTapsSinceOpen = prefs.getContextualSearchTapCount()
- prefs.getContextualSearchTapQuickAnswerCount();
TapSuppressionHeuristics tapHeuristics =
new TapSuppressionHeuristics(this, mLastTapState, x, y, adjustedTapsSinceOpen);
// TODO(donnd): Move to be called when the panel closes to work with states that change.
tapHeuristics.logConditionState();
// Tell the manager what it needs in order to log metrics on whether the tap would have
// been suppressed if each of the heuristics were satisfied.
mHandler.handleMetricsForWouldSuppressTap(tapHeuristics);
boolean shouldSuppressTap = tapHeuristics.shouldSuppressTap();
if (mTapTimeNanoseconds != 0) {
// Remember the tap state for subsequent tap evaluation.
mLastTapState =
new ContextualSearchTapState(x, y, mTapTimeNanoseconds, shouldSuppressTap);
} else {
mLastTapState = null;
}
if (shouldSuppressTap) {
mHandler.handleSuppressedTap();
} else {
mHandler.handleNonSuppressedTap();
}
}
示例2: handleShowUnhandledTapUIIfNeeded
import org.chromium.chrome.browser.preferences.ChromePreferenceManager; //导入方法依赖的package包/类
/**
* Handles an unhandled tap gesture.
*/
void handleShowUnhandledTapUIIfNeeded(int x, int y) {
mWasTapGestureDetected = false;
// TODO(donnd): shouldn't we check == TAP here instead of LONG_PRESS?
// TODO(donnd): refactor to avoid needing a new handler API method as suggested by Pedro.
if (mSelectionType != SelectionType.LONG_PRESS) {
mWasTapGestureDetected = true;
long tapTimeNanoseconds = System.nanoTime();
// TODO(donnd): add a policy method to get adjusted tap count.
ChromePreferenceManager prefs = ChromePreferenceManager.getInstance(mActivity);
int adjustedTapsSinceOpen = prefs.getContextualSearchTapCount()
- prefs.getContextualSearchTapQuickAnswerCount();
// Explicitly destroy the old heuristics so native code can dispose data.
if (mTapHeuristics != null) mTapHeuristics.destroy();
mTapHeuristics =
new TapSuppressionHeuristics(this, mLastTapState, x, y, adjustedTapsSinceOpen);
// TODO(donnd): Move to be called when the panel closes to work with states that change.
mTapHeuristics.logConditionState();
// Tell the manager what it needs in order to log metrics on whether the tap would have
// been suppressed if each of the heuristics were satisfied.
mHandler.handleMetricsForWouldSuppressTap(mTapHeuristics);
mX = x;
mY = y;
boolean shouldSuppressTap = mTapHeuristics.shouldSuppressTap();
if (shouldSuppressTap) {
mHandler.handleSuppressedTap();
} else {
// TODO(donnd): Find a better way to determine that a navigation will be triggered
// by the tap, or merge with other time-consuming actions like gathering surrounding
// text or detecting page mutations.
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mHandler.handleValidTap();
}
}, TAP_NAVIGATION_DETECTION_DELAY);
}
// Remember the tap state for subsequent tap evaluation.
mLastTapState =
new ContextualSearchTapState(x, y, tapTimeNanoseconds, shouldSuppressTap);
} else {
// Long press; reset last tap state.
mLastTapState = null;
mHandler.handleInvalidTap();
}
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:49,代码来源:ContextualSearchSelectionController.java