コード例 #1
0
  private void startEnterAnim() {

    ViewCompat.setTranslationY(progressLayout, progressLayout.getHeight());

    final Rect bounds = new Rect();
    revealRootView.getHitRect(bounds);

    SearchActivity.this.rootView.setLayerType(View.LAYER_TYPE_HARDWARE, null);

    revealAnimator =
        ViewAnimationUtils.createCircularReveal(
            revealRootView.getChildAt(0),
            bounds.right - bounds.left,
            0,
            0,
            Utils.pythagorean(bounds.width(), bounds.height()));
    revealAnimator.setDuration(Constants.MILLISECONDS_400);
    revealAnimator.setInterpolator(new AccelerateInterpolator());
    revealAnimator.addListener(
        new SupportAnimator.SimpleAnimatorListener() {
          @Override
          public void onAnimationStart() {

            if (progressLayout != null) {
              ViewCompat.animate(progressLayout)
                  .translationY(0.0f)
                  .setDuration(Constants.MILLISECONDS_400)
                  .withLayer();
            }
          }

          @Override
          public void onAnimationEnd() {

            if (progressLayout != null) {
              SearchActivity.this.rootView.setLayerType(View.LAYER_TYPE_NONE, null);
              SearchActivity.this.loadData();
            }
          }
        });
    revealAnimator.start();
  }
コード例 #2
0
  @Nullable
  @OnClick(R.id.search_layout_btn)
  void onSearchClick() {

    /*关闭键盘*/
    inputMethodManager.hideSoftInputFromWindow(revealRootView.getApplicationWindowToken(), 0);

    if (TextUtils.isEmpty(searchEt.getText().toString())) return;

    ProductKeyListActivity.navigateToProductKeyList(
        SearchActivity.this, searchEt.getText().toString(), searchEt.getText().toString());
    overridePendingTransition(0, 0);
  }