当前位置: 首页>>代码示例>>Java>>正文


Java ChromePreferenceManager.getNewTabPageFirstCardAnimationRunCount方法代码示例

本文整理汇总了Java中org.chromium.chrome.browser.preferences.ChromePreferenceManager.getNewTabPageFirstCardAnimationRunCount方法的典型用法代码示例。如果您正苦于以下问题:Java ChromePreferenceManager.getNewTabPageFirstCardAnimationRunCount方法的具体用法?Java ChromePreferenceManager.getNewTabPageFirstCardAnimationRunCount怎么用?Java ChromePreferenceManager.getNewTabPageFirstCardAnimationRunCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.chromium.chrome.browser.preferences.ChromePreferenceManager的用法示例。


在下文中一共展示了ChromePreferenceManager.getNewTabPageFirstCardAnimationRunCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSnippetBound

import org.chromium.chrome.browser.preferences.ChromePreferenceManager; //导入方法依赖的package包/类
/**
 * To be triggered when a snippet is bound to a ViewHolder.
 */
public void onSnippetBound(View cardView) {
    // We only run if the feature is enabled and once per NTP.
    if (!SnippetsConfig.isIncreasedCardVisibilityEnabled() || mFirstCardAnimationRun) return;
    mFirstCardAnimationRun = true;

    // We only want an animation to run if we are not scrolled.
    if (computeVerticalScrollOffset() != 0) return;

    // We only show the animation a certain number of times to a user.
    ChromePreferenceManager manager = ChromePreferenceManager.getInstance(getContext());
    int animCount = manager.getNewTabPageFirstCardAnimationRunCount();
    if (animCount > CardsVariationParameters.getFirstCardAnimationMaxRuns()) return;
    manager.setNewTabPageFirstCardAnimationRunCount(animCount + 1);

    // We do not show the animation if the user has previously seen it then scrolled.
    if (manager.getCardsImpressionAfterAnimation()) return;

    // The peeking card bounces up twice from its position.
    ObjectAnimator animator = ObjectAnimator.ofFloat(cardView, View.TRANSLATION_Y,
            0f, -mPeekingCardBounceDistance, 0f, -mPeekingCardBounceDistance, 0f);
    animator.setStartDelay(PEEKING_CARD_ANIMATION_START_DELAY_MS);
    animator.setDuration(PEEKING_CARD_ANIMATION_TIME_MS);
    animator.setInterpolator(PEEKING_CARD_INTERPOLATOR);
    animator.start();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:29,代码来源:NewTabPageRecyclerView.java

示例2: onCardBound

import org.chromium.chrome.browser.preferences.ChromePreferenceManager; //导入方法依赖的package包/类
@Override
public void onCardBound(CardViewHolder cardViewHolder) {
    if (cardViewHolder.getAdapterPosition() == getNewTabPageAdapter().getFirstCardPosition()) {
        updatePeekingCard(cardViewHolder);
    } else {
        cardViewHolder.setNotPeeking();
    }

    // Animate the peeking card.
    // We only run if the feature is enabled and once per NTP.
    if (!shouldAnimateFirstCard()) return;
    mFirstCardAnimationRun = true;

    // We only want an animation to run if we are not scrolled.
    if (computeVerticalScrollOffset() != 0) return;

    // We only show the animation a certain number of times to a user.
    ChromePreferenceManager manager = ChromePreferenceManager.getInstance();
    int animCount = manager.getNewTabPageFirstCardAnimationRunCount();
    if (animCount > CardsVariationParameters.getFirstCardAnimationMaxRuns()) return;
    manager.setNewTabPageFirstCardAnimationRunCount(animCount + 1);

    // We do not show the animation if the user has previously seen it then scrolled.
    if (manager.getCardsImpressionAfterAnimation()) return;

    // The peeking card bounces up twice from its position.
    ObjectAnimator animator =
            ObjectAnimator.ofFloat(cardViewHolder.itemView, View.TRANSLATION_Y, 0f,
                    -mPeekingCardBounceDistance, 0f, -mPeekingCardBounceDistance, 0f);
    animator.setStartDelay(PEEKING_CARD_ANIMATION_START_DELAY_MS);
    animator.setDuration(PEEKING_CARD_ANIMATION_TIME_MS);
    animator.setInterpolator(PEEKING_CARD_INTERPOLATOR);
    animator.start();
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:35,代码来源:NewTabPageRecyclerView.java


注:本文中的org.chromium.chrome.browser.preferences.ChromePreferenceManager.getNewTabPageFirstCardAnimationRunCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。