コード例 #1
0
  public void setNavigationIconHints(int hints, boolean force) {
    if (!force && hints == mNavigationIconHints) return;

    if (DEBUG) {
      android.widget.Toast.makeText(mContext, "Navigation icon hints = " + hints, 500).show();
    }

    mNavigationIconHints = hints;

    View button = mCurrentView.findViewWithTag(NavbarEditor.NAVBAR_HOME);
    if (button != null) {
      button.setAlpha((0 != (hints & StatusBarManager.NAVIGATION_HINT_HOME_NOP)) ? 0.5f : 1.0f);
    }
    button = mCurrentView.findViewWithTag(NavbarEditor.NAVBAR_RECENT);
    if (button != null) {
      button.setAlpha((0 != (hints & StatusBarManager.NAVIGATION_HINT_RECENT_NOP)) ? 0.5f : 1.0f);
    }
    button = mCurrentView.findViewWithTag(NavbarEditor.NAVBAR_BACK);
    if (button != null) {
      button.setAlpha((0 != (hints & StatusBarManager.NAVIGATION_HINT_BACK_NOP)) ? 0.5f : 1.0f);
      ((ImageView) button)
          .setImageDrawable(
              (0 != (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT))
                  ? (mVertical ? mBackAltLandIcon : mBackAltIcon)
                  : (mVertical ? mBackLandIcon : mBackIcon));
    }
    setDisabledFlags(mDisabledFlags, true);
  }
コード例 #2
0
  public void transformPage(View view, float position) {
    int pageWidth = view.getWidth();

    if (position < -1) { // [-Infinity,-1)
      // This page is way off-screen to the left.
      view.setAlpha(0);

    } else if (position <= 0) { // [-1,0]
      // Use the default slide transition when moving to the left page
      view.setAlpha(1);
      view.setTranslationX(0);
      view.setScaleX(1);
      view.setScaleY(1);

    } else if (position <= 1) { // (0,1]
      // Fade the page out.
      view.setAlpha(1 - position);

      // Counteract the default slide transition
      view.setTranslationX(pageWidth * -position);

      // Scale the page down (between MIN_SCALE and 1)
      float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
      view.setScaleX(scaleFactor);
      view.setScaleY(scaleFactor);

    } else { // (1,+Infinity]
      // This page is way off-screen to the right.
      view.setAlpha(0);
    }
  }
コード例 #3
0
  /** Draw the view into a bitmap. */
  Bitmap getViewBitmap(View v) {
    v.clearFocus();
    v.setPressed(false);

    boolean willNotCache = v.willNotCacheDrawing();
    v.setWillNotCacheDrawing(false);

    // Reset the drawing cache background color to fully transparent
    // for the duration of this operation
    int color = v.getDrawingCacheBackgroundColor();
    v.setDrawingCacheBackgroundColor(0);
    float alpha = v.getAlpha();
    v.setAlpha(1.0f);

    if (color != 0) {
      v.destroyDrawingCache();
    }
    v.buildDrawingCache();
    Bitmap cacheBitmap = v.getDrawingCache();
    if (cacheBitmap == null) {
      Log.e(TAG, "failed getViewBitmap(" + v + ")", new RuntimeException());
      return null;
    }

    Bitmap bitmap = Bitmap.createBitmap(cacheBitmap);

    // Restore the view
    v.destroyDrawingCache();
    v.setAlpha(alpha);
    v.setWillNotCacheDrawing(willNotCache);
    v.setDrawingCacheBackgroundColor(color);

    return bitmap;
  }
コード例 #4
0
  public void transformPage(View view, float position) {
    int pageWidth = view.getWidth();
    int pageHeight = view.getHeight();

    if (position < -1) { // [-Infinity,-1)
      // This page is way off-screen to the left.
      view.setAlpha(0);

    } else if (position <= 1) { // [-1,1]
      // Modify the default slide transition to shrink the page as well
      float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
      float vertMargin = pageHeight * (1 - scaleFactor) / 2;
      float horzMargin = pageWidth * (1 - scaleFactor) / 2;
      if (position < 0) {
        view.setTranslationX(horzMargin - vertMargin / 2);
      } else {
        view.setTranslationX(-horzMargin + vertMargin / 2);
      }

      // Scale the page down (between MIN_SCALE and 1)
      view.setScaleX(scaleFactor);
      view.setScaleY(scaleFactor);

      // Fade the page relative to its size.
      view.setAlpha(MIN_ALPHA + (scaleFactor - MIN_SCALE) / (1 - MIN_SCALE) * (1 - MIN_ALPHA));

    } else { // (1,+Infinity]
      // This page is way off-screen to the right.
      view.setAlpha(0);
    }
  }
コード例 #5
0
 public boolean onTouch(View paramView, MotionEvent paramMotionEvent) {
   if (paramMotionEvent.getAction() == 0) {
     paramView.setAlpha(0.2F);
   }
   while (paramMotionEvent.getAction() != 1) {
     return false;
   }
   paramView.setAlpha(1.0F);
   paramView.performClick();
   return true;
 }
コード例 #6
0
ファイル: DBCafeFragment.java プロジェクト: abrysov/lj-menu
  private void createView(View v) {
    vh.ll_top = (LinearLayout) v.findViewById(R.id.ll_top);
    vh.ll_bottom = (LinearLayout) v.findViewById(R.id.ll_bottom);
    vh.ll_parent = (LinearLayout) v.findViewById(R.id.ll_parent);
    int d0 = getResources().getDimensionPixelSize(R.dimen.mosaic_layout_spacing);
    int d1 =
        getResources().getDimensionPixelSize(R.dimen.fragment_grand_height)
            + getResources().getDimensionPixelSize(R.dimen.fragment_grand_padding);
    vh.ll_parent.setPadding(d0, d0 + d1, d0, d0);

    final View child = vh.ll_top;
    child.setAlpha(0);
    child
        .getViewTreeObserver()
        .addOnGlobalLayoutListener(
            new ViewTreeObserver.OnGlobalLayoutListener() {

              @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
              @SuppressWarnings("deprecation")
              @Override
              public void onGlobalLayout() {
                // Funs.getToast(getActivity(), "onGlobalLayout() " + child.getHeight());
                animTop(child);
                if (android.os.Build.VERSION.SDK_INT
                    >= 16) { // android.os.Build.VERSION_CODES.JELLY_BEAN){
                  child.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                } else child.getViewTreeObserver().removeGlobalOnLayoutListener(this);
              }
            });
    final View child2 = vh.ll_bottom;
    child.setAlpha(0);
    child
        .getViewTreeObserver()
        .addOnGlobalLayoutListener(
            new ViewTreeObserver.OnGlobalLayoutListener() {

              @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
              @SuppressWarnings("deprecation")
              @Override
              public void onGlobalLayout() {
                // Funs.getToast(getActivity(), "onGlobalLayout() " + child.getHeight());
                animBottom(child2);
                if (android.os.Build.VERSION.SDK_INT
                    >= 16) { // android.os.Build.VERSION_CODES.JELLY_BEAN){
                  child2.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                } else child2.getViewTreeObserver().removeGlobalOnLayoutListener(this);
              }
            });
  }
コード例 #7
0
  @Override
  protected void onFinishInflate() {
    LogUtil.d(TAG, "onFInishInflate");
    mHeaderView = (ImageView) findViewById(R.id.view_header);
    mContentView = findViewById(R.id.view_content);
    mBgView = new View(getContext());
    mBgView.setBackgroundResource(R.color.translucent);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      mBgView.setAlpha(0.0f);
    }
    mBgView.setVisibility(View.GONE);
    mBgView.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            maximize();
          }
        });
    addView(mBgView, 0);

    if (isUnderEnterprise) {
      mHeaderView.setImageResource(R.drawable.flag);
    }
  }
コード例 #8
0
  @Override
  protected void onFinishInflate() {
    super.onFinishInflate();

    // Get the individual components
    mDropTargetBar = findViewById(R.id.drag_target_bar);
    mInfoDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.info_target_text);
    mDeleteDropTarget = (ButtonDropTarget) mDropTargetBar.findViewById(R.id.delete_target_text);

    mInfoDropTarget.setSearchDropTargetBar(this);
    mDeleteDropTarget.setSearchDropTargetBar(this);

    mEnableDropDownDropTargets =
        getResources().getBoolean(R.bool.config_useDropTargetDownTransition);

    // Create the various fade animations
    if (mEnableDropDownDropTargets) {
      LauncherAppState app = LauncherAppState.getInstance();
      DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
      mBarHeight = grid.searchBarSpaceHeightPx;
      mDropTargetBar.setTranslationY(-mBarHeight);
      mDropTargetBarAnim =
          LauncherAnimUtils.ofFloat(mDropTargetBar, "translationY", -mBarHeight, 0f);

    } else {
      mDropTargetBar.setAlpha(0f);
      mDropTargetBarAnim = LauncherAnimUtils.ofFloat(mDropTargetBar, "alpha", 0f, 1f);
    }
    setupAnimation(mDropTargetBarAnim, mDropTargetBar);
  }
コード例 #9
0
ファイル: MainActivity.java プロジェクト: tolga-k/FlipIt
  // Layout showing effect(using CircularReveal)
  private void showLayout(int viewId, int viewId2) {
    final View myView = findViewById(viewId);
    View myView2 = findViewById(viewId2);

    if (android.os.Build.VERSION.SDK_INT > 20) {

      int finalRadius = Math.max(myView.getWidth(), myView.getHeight());

      int cx = (myView2.getLeft() + myView2.getRight()) / 2;
      int cy = (myView2.getTop() + myView2.getBottom()) / 2;

      Animator anim = ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
      anim.setDuration(500);

      anim.addListener(
          new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
              super.onAnimationEnd(animation);
              if (gameStatus == GAME_GOGAME) {
                gameStatus = GAME_WAITING;
              }
            }
          });

      myView.setVisibility(View.VISIBLE);
      myView.setAlpha(1);
      anim.start();
    } else {
      myView.setVisibility(View.VISIBLE);
      if (gameStatus == GAME_GOGAME) {
        gameStatus = GAME_WAITING;
      }
    }
  }
コード例 #10
0
 private void fadeIn(View v) {
   v.setAlpha(0f);
   ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(v, "alpha", 1f);
   alphaAnimator.setDuration(
       v.getContext().getResources().getInteger(android.R.integer.config_mediumAnimTime));
   alphaAnimator.start();
 }
コード例 #11
0
  /**
   * Prepares this task view for the enter-recents animations. This is called earlier in the first
   * layout because the actual animation into recents may take a long time.
   */
  void prepareEnterRecentsAnimation(
      boolean isTaskViewLaunchTargetTask, boolean occludesLaunchTarget, int offscreenY) {
    int initialDim = getDim();
    if (mConfig.launchedHasConfigurationChanged) {
      // Just load the views as-is
    } else if (mConfig.launchedFromAppWithThumbnail) {
      if (isTaskViewLaunchTargetTask) {
        // Set the dim to 0 so we can animate it in
        initialDim = 0;
        // Hide the action button
        mActionButtonView.setAlpha(0f);
      } else if (occludesLaunchTarget) {
        // Move the task view off screen (below) so we can animate it in
        setTranslationY(offscreenY);
      }

    } else if (mConfig.launchedFromHome) {
      // Move the task view off screen (below) so we can animate it in
      setTranslationY(offscreenY);
      setTranslationZ(0);
      setScaleX(1f);
      setScaleY(1f);
    }
    // Apply the current dim
    setDim(initialDim);
    // Prepare the thumbnail view alpha
    mThumbnailView.prepareEnterRecentsAnimation(isTaskViewLaunchTargetTask);
  }
コード例 #12
0
  /** Add animations to fade a view from the specified start alpha value to end value. */
  public static void addFadeAnimators(
      List<Animator> animators,
      final View view,
      float startAlpha,
      final float endAlpha,
      int animationDelay) {
    if (startAlpha == endAlpha) {
      return;
    }

    view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    view.setAlpha(startAlpha);

    final ObjectAnimator fadeAnimator =
        ObjectAnimator.ofFloat(view, View.ALPHA, view.getAlpha(), endAlpha);
    fadeAnimator.setInterpolator(sDecelerateQuintInterpolator);
    fadeAnimator.setDuration(sAnimationDuration);
    fadeAnimator.setStartDelay(animationDelay);
    fadeAnimator.addListener(
        new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            view.setAlpha(endAlpha);
            view.setLayerType(View.LAYER_TYPE_NONE, null);
          }
        });
    animators.add(fadeAnimator);
  }
  private void animateFadeOutFadeIn(final View src, final View dst) {
    if (dst.getVisibility() != View.VISIBLE || dst.getAlpha() != 1f) {
      AnimatorSet set = new AnimatorSet();
      set.playSequentially(
          ObjectAnimator.ofFloat(src, "alpha", 0f), ObjectAnimator.ofFloat(dst, "alpha", 1f));
      set.setInterpolator(new LinearInterpolator());
      set.addListener(
          new AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {
              src.setAlpha(1f);
              dst.setAlpha(0f);
              src.setVisibility(View.VISIBLE);
              dst.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationRepeat(Animator animation) {}

            @Override
            public void onAnimationEnd(Animator animation) {
              src.setVisibility(View.GONE);
            }

            @Override
            public void onAnimationCancel(Animator animation) {}
          });
      set.setDuration(250);
      set.start();
    } else {
      src.setAlpha(1f);
      src.setVisibility(View.GONE);
    }
  }
コード例 #14
0
 @Override
 @TargetApi(Build.VERSION_CODES.HONEYCOMB)
 public void onStickyHeaderOffsetChanged(StickyListHeadersListView l, View header, int offset) {
   if (fadeHeader && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
     header.setAlpha(1 - (offset / (float) header.getMeasuredHeight()));
   }
 }
コード例 #15
0
 public void setContentAlpha(float alpha) {
   mContentAlpha = alpha;
   View content = getContent();
   if (content != null) {
     content.setAlpha(alpha);
   }
 }
コード例 #16
0
  public void showSearchBar() {
    mSearchViewContainer.animate().cancel();
    mSearchViewContainer.setAlpha(0);
    mSearchViewContainer.setTranslationY(-mSearchViewContainer.getHeight());
    mSearchViewContainer
        .animate()
        .withLayer()
        .alpha(1)
        .translationY(0)
        .setDuration(200)
        .setListener(
            new AnimatorListenerAdapter() {
              @Override
              public void onAnimationStart(Animator animation) {
                mSearchViewContainer.setVisibility(View.VISIBLE);
                mActionBar.setVisibility(View.VISIBLE);
              }
            });

    mFragmentsFrame.setTranslationY(-mSearchViewContainer.getHeight());
    mFragmentsFrame
        .animate()
        .withLayer()
        .translationY(0)
        .setDuration(200)
        .setListener(
            new AnimatorListenerAdapter() {
              @Override
              public void onAnimationStart(Animator animation) {
                mBottomPaddingView.setVisibility(View.GONE);
              }
            });
  }
  /** Shows a view, and synchronizes the animation with Keyguard exit animations, if applicable. */
  private void animateShow(View v, boolean animate) {
    v.animate().cancel();
    v.setVisibility(View.VISIBLE);
    if (!animate) {
      v.setAlpha(1f);
      return;
    }
    v.animate()
        .alpha(1f)
        .setDuration(320)
        .setInterpolator(PhoneStatusBar.ALPHA_IN)
        .setStartDelay(50)

        // We need to clean up any pending end action from animateHide if we call
        // both hide and show in the same frame before the animation actually gets started.
        // cancel() doesn't really remove the end action.
        .withEndAction(null);

    // Synchronize the motion with the Keyguard fading if necessary.
    if (mPhoneStatusBar.isKeyguardFadingAway()) {
      v.animate()
          .setDuration(mPhoneStatusBar.getKeyguardFadingAwayDuration())
          .setInterpolator(mLinearOutSlowIn)
          .setStartDelay(mPhoneStatusBar.getKeyguardFadingAwayDelay())
          .start();
    }
  }
コード例 #18
0
ファイル: SwipeableRVTL.java プロジェクト: keng42/Keep
  /** 滑动中,设置 view 的位置和透明度 */
  private boolean actionMove(MotionEvent motionEvent) {
    if (mVelocityTracker == null || mPaused) {
      return false;
    }

    // 更新速度
    mVelocityTracker.addMovement(motionEvent);
    // x y 轴的增量
    float deltaX = motionEvent.getRawX() - mDownX;
    float deltaY = motionEvent.getRawY() - mDownY;
    // 不是滑动中并且有横向移动且横向移动大于纵向移动
    if (!mSwiping && Math.abs(deltaX) > mSlop && Math.abs(deltaY) < Math.abs(deltaX) / 2) {
      // 设置为滑动中
      mSwiping = true;
      mSwipingSlop = (deltaX > 0 ? mSlop : -mSlop);
    }

    if (mSwiping) {
      mDownView.setTranslationX(deltaX - mSwipingSlop);
      mDownView.setAlpha(
          Math.max(0f, Math.min(mAlpha, mAlpha * (1f - Math.abs(deltaX) / mViewWidth))));
      return true;
    }
    return false;
  }
コード例 #19
0
  @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
  private void layoutClockSaver() {
    setContentView(R.layout.desk_clock_saver);
    mDigitalClock = findViewById(R.id.digital_clock);
    mAnalogClock = findViewById(R.id.analog_clock);
    setClockStyle();
    mContentView = (View) mSaverView.getParent();
    mContentView.forceLayout();
    mSaverView.forceLayout();
    mSaverView.setAlpha(0);

    mMoveSaverRunnable.registerViews(mContentView, mSaverView);

    if (Build.VERSION.SDK_INT >= 19) {
      mContentView.setSystemUiVisibility(
          View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
              | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
              | View.SYSTEM_UI_FLAG_FULLSCREEN);
    } else {
      mContentView.setSystemUiVisibility(
          View.SYSTEM_UI_FLAG_LOW_PROFILE
              | View.SYSTEM_UI_FLAG_FULLSCREEN
              | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
    }

    Utils.updateDate(mDateFormat, mDateFormatForAccessibility, mContentView);
    Utils.refreshAlarm(ScreensaverActivity.this, mContentView);
  }
コード例 #20
0
  @TargetApi(12)
  public void crossfade() {

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB_MR1) {

      // Set the content view to 0% opacity but visible, so that it is visible
      // (but fully transparent) during the animation.
      contentView.setAlpha(0f);
      contentView.setVisibility(View.VISIBLE);

      // Animate the content view to 100% opacity, and clear any animation
      // listener set on the view.
      contentView.animate().alpha(1f).setDuration(animationDuration).setListener(null);

      // Animate the loading view to 0% opacity. After the animation ends,
      // set its visibility to GONE as an optimization step (it won't
      // participate in layout passes, etc.)
      progressView
          .animate()
          .alpha(0f)
          .setDuration(animationDuration)
          .setListener(
              new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(final Animator animation) {
                  progressView.setVisibility(View.GONE);
                }
              });
    } else {
      progressView.setVisibility(View.GONE);
      contentView.setVisibility(View.VISIBLE);
    }
  }
コード例 #21
0
 /** Set dim and translation to the initial state */
 private void initializeSheetValues() {
   this.sheetTranslation = 0;
   this.contentClipRect.set(0, 0, getWidth(), getHeight());
   getSheetView().setTranslationY(getHeight());
   dimView.setAlpha(0);
   dimView.setVisibility(INVISIBLE);
 }
コード例 #22
0
  private void updateStep() {
    if (stepIndex >= steps.size()) {
      hideSoftInput();

      View finishedView = onCreateFinishedView(getLayoutInflater(), container);
      if (finishedView != null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
          finishedView.setAlpha(0);
          finishedView.setVisibility(View.VISIBLE);
          container.addView(finishedView);
          finishedView
              .animate()
              .alpha(1)
              .setDuration(getResources().getInteger(android.R.integer.config_mediumAnimTime));
        } else {
          finishedView.setVisibility(View.VISIBLE);
          container.addView(finishedView);
        }
      }

      onFormFinished(setupData);
      return;
    }
    updateViews();
    containerScrollView.smoothScrollTo(0, 0);
  }
コード例 #23
0
 private void prepareAndAnimateView(
     final View v, float initTransX, final boolean notifyAnimationFinished) {
   v.setLayerType(View.LAYER_TYPE_HARDWARE, null);
   v.buildLayer();
   v.setAlpha(0);
   v.setTranslationX(initTransX);
   v.animate()
       .alpha(1f)
       .translationX(0)
       .setDuration(ANIMATE_IN_DURATION)
       .setStartDelay(SECONDARY_ANIMATE_DELAY);
   v.animate().setInterpolator(new DecelerateInterpolator(1.0f));
   v.animate()
       .setListener(
           new AnimatorListenerAdapter() {
             @Override
             public void onAnimationEnd(Animator animation) {
               v.setLayerType(View.LAYER_TYPE_NONE, null);
               if (notifyAnimationFinished) {
                 onIntroAnimationFinished();
               }
             }
           });
   v.animate().start();
 }
コード例 #24
0
ファイル: LitterActivity.java プロジェクト: darrenpye/glitter
  /** Some simple animations run on user login */
  private void animateUserWelcome() {
    mUserImage.setImageResource(mCurrentUser.getUserImageResource());

    ViewUtils.setScale(mUserImage, 1);
    ScaleAnimation scale_in =
        new ScaleAnimation(
            0f, 1f, 0f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    scale_in.setDuration(1000);
    scale_in.setFillAfter(true);
    scale_in.setInterpolator(new DecelerateInterpolator());
    mUserImage.startAnimation(scale_in);

    final long button_scale_time = 1000;
    final long button_scale_increment_time = 250;

    // Animate the buttons coming in
    ViewUtils.animateButtonShow(
        mLitterButton, button_scale_time + (button_scale_increment_time * 0));
    ViewUtils.animateButtonShow(
        mSearchButton, button_scale_time + (button_scale_increment_time * 1));
    ViewUtils.animateButtonShow(
        mFollowersButton, button_scale_time + (button_scale_increment_time * 2));
    ViewUtils.animateButtonShow(
        mSettingsButton, button_scale_time + (button_scale_increment_time * 3));

    // Make the background of the button bar visible
    mButtonBar.setAlpha(1);
  }
コード例 #25
0
ファイル: RangeSeekBar.java プロジェクト: Sai-Teja/Carbon
 public void setAlpha(float alpha) {
   if (NEEDS_PROXY) {
     wrap(this).setAlpha(alpha);
   } else {
     super.setAlpha(alpha);
   }
 }
コード例 #26
0
  public void hideSearchBar(boolean shiftView) {
    if (shiftView) {
      mSearchViewContainer.animate().cancel();
      mSearchViewContainer.setAlpha(1);
      mSearchViewContainer.setTranslationY(0);
      mSearchViewContainer
          .animate()
          .withLayer()
          .alpha(0)
          .translationY(-mSearchView.getHeight())
          .setDuration(200)
          .setListener(mHideListener);

      mFragmentsFrame
          .animate()
          .withLayer()
          .translationY(-mSearchViewContainer.getHeight())
          .setDuration(200)
          .setListener(
              new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                  mBottomPaddingView.setVisibility(View.VISIBLE);
                  mFragmentsFrame.setTranslationY(0);
                  mActionBar.setVisibility(View.INVISIBLE);
                }
              });
    } else {
      mSearchViewContainer.setTranslationY(-mSearchView.getHeight());
      mActionBar.setVisibility(View.INVISIBLE);
    }
  }
コード例 #27
0
ファイル: PhotoTable.java プロジェクト: zst123/p201-packages
 /** Move in response to touch. */
 public void move(final View photo, float x, float y, float a) {
   photo.animate().cancel();
   photo.setAlpha(1f);
   photo.setX((int) x);
   photo.setY((int) y);
   photo.setRotation((int) a);
 }
コード例 #28
0
  private void setFragemnt(final Fragment fragment, CharSequence title) {
    if (fragment == null) return;

    toolbarTitle = title.toString();
    getSupportActionBar().setTitle(toolbarTitle);

    // 如果是TabsFragment,显示TabLayout
    if (fragment instanceof ATabsFragment) {
      tabLayout.setVisibility(View.VISIBLE);
    } else {
      tabLayout.setVisibility(View.GONE);
    }
    // 显示AppBarLayout
    appBarLayout.setExpanded(true, true);

    // .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
    View view = findViewById(R.id.content_frame);
    view.setAlpha(0.0f);
    ObjectAnimator anim = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), 1.0f);
    anim.setDuration(600);
    anim.start();
    getFragmentManager()
        .beginTransaction()
        .replace(R.id.content_frame, fragment, "MainFragment")
        .commit();
  }
コード例 #29
0
  private void bindViews() {
    if (mRootView == null) {
      return;
    }

    TextView titleView = (TextView) mRootView.findViewById(R.id.article_title);
    TextView bylineView = (TextView) mRootView.findViewById(R.id.article_byline);
    bylineView.setMovementMethod(new LinkMovementMethod());
    TextView bodyView = (TextView) mRootView.findViewById(R.id.article_body);
    bodyView.setTypeface(
        Typeface.createFromAsset(getResources().getAssets(), "Rosario-Regular.ttf"));

    if (mCursor != null) {
      mRootView.setAlpha(0);
      mRootView.setVisibility(View.VISIBLE);
      mRootView.animate().alpha(1);
      titleView.setText(mCursor.getString(ArticleLoader.Query.TITLE));
      bylineView.setText(
          Html.fromHtml(
              DateUtils.getRelativeTimeSpanString(
                          mCursor.getLong(ArticleLoader.Query.PUBLISHED_DATE),
                          System.currentTimeMillis(),
                          DateUtils.HOUR_IN_MILLIS,
                          DateUtils.FORMAT_ABBREV_ALL)
                      .toString()
                  + " by <font color='#ffffff'>"
                  + mCursor.getString(ArticleLoader.Query.AUTHOR)
                  + "</font>"));
      bodyView.setText(Html.fromHtml(mCursor.getString(ArticleLoader.Query.BODY)));
      ImageLoaderHelper.getInstance(getActivity())
          .getImageLoader()
          .get(
              mCursor.getString(ArticleLoader.Query.PHOTO_URL),
              new ImageLoader.ImageListener() {
                @Override
                public void onResponse(ImageLoader.ImageContainer imageContainer, boolean b) {
                  Bitmap bitmap = imageContainer.getBitmap();
                  if (bitmap != null) {
                    Palette p = Palette.generate(bitmap, 12);
                    mMutedColor = p.getDarkMutedColor(0xFF333333);
                    mPhotoView.setImageBitmap(imageContainer.getBitmap());
                    mRootView.findViewById(R.id.meta_bar).setBackgroundColor(mMutedColor);
                    updateStatusBar();
                  }
                }

                @Override
                public void onErrorResponse(VolleyError volleyError) {}
              });
    } else {
      mRootView.setVisibility(View.GONE);
      titleView.setText("N/A");
      bylineView.setText("N/A");
      bodyView.setText("N/A");
    }

    //        if (collapsingToolbar != null)
    //            collapsingToolbar.setTitle("");
  }
コード例 #30
0
ファイル: WebActivity.java プロジェクト: zhl3391/face
  private void initUi() {

    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    mMarkLayout.setAlpha(0);
    Utils.setColorStatusBar(this, R.color.colorPrimary, mRootView);
  }