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


Java TransitionManager类代码示例

本文整理汇总了Java中android.transition.TransitionManager的典型用法代码示例。如果您正苦于以下问题:Java TransitionManager类的具体用法?Java TransitionManager怎么用?Java TransitionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setClickListener

import android.transition.TransitionManager; //导入依赖的package包/类
public void setClickListener(final T holder) {
    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            final int position = holder.getAdapterPosition();
            if (position == RecyclerView.NO_POSITION) return;

            TransitionManager.beginDelayedTransition(mRecyclerView, expandCollapse);
            itemAnimator.setAnimateMoves(false);

            if (RecyclerView.NO_POSITION != mExpandedPosition) {
                notifyItemChanged(mExpandedPosition, COLLAPSE);
            }

            if (mExpandedPosition != position) {
                mExpandedPosition = position;
                notifyItemChanged(position, EXPAND);
                holder.itemView.requestFocus();
            } else {
                mExpandedPosition = RecyclerView.NO_POSITION;
            }

        }
    });
}
 
开发者ID:reidzeibel,项目名称:AnimatedListAdapter,代码行数:26,代码来源:BaseAnimatedListAdapter.java

示例2: hideInstructionList

import android.transition.TransitionManager; //导入依赖的package包/类
/**
 * Hide the instruction list and show the sound button.
 * <p>
 * This is based on orientation so the different layouts (for portrait vs. landscape)
 * can be animated appropriately.
 */
public void hideInstructionList() {
  int orientation = getContext().getResources().getConfiguration().orientation;
  if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
    ConstraintSet collapsed = new ConstraintSet();
    collapsed.clone(getContext(), R.layout.instruction_layout);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      TransitionManager.beginDelayedTransition(InstructionView.this);
    }
    collapsed.applyTo(instructionLayout);
    instructionListLayout.setVisibility(INVISIBLE);
  } else {
    Animation slideUp = AnimationUtils.loadAnimation(getContext(), R.anim.slide_up_top);
    slideUp.setInterpolator(new AccelerateInterpolator());
    instructionListLayout.startAnimation(slideUp);
    instructionListLayout.setVisibility(INVISIBLE);
  }
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:24,代码来源:InstructionView.java

示例3: showInstructionList

import android.transition.TransitionManager; //导入依赖的package包/类
/**
 * Show the instruction list and hide the sound button.
 * <p>
 * This is based on orientation so the different layouts (for portrait vs. landscape)
 * can be animated appropriately.
 */
public void showInstructionList() {
  int orientation = getContext().getResources().getConfiguration().orientation;
  if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
    ConstraintSet expanded = new ConstraintSet();
    expanded.clone(getContext(), R.layout.instruction_layout_alt);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      TransitionManager.beginDelayedTransition(InstructionView.this);
    }
    expanded.applyTo(instructionLayout);
    instructionListLayout.setVisibility(VISIBLE);
  } else {
    Animation slideDown = AnimationUtils.loadAnimation(getContext(), R.anim.slide_down_top);
    slideDown.setInterpolator(new DecelerateInterpolator());
    instructionListLayout.setVisibility(VISIBLE);
    instructionListLayout.startAnimation(slideDown);
  }
}
 
开发者ID:mapbox,项目名称:mapbox-navigation-android,代码行数:24,代码来源:InstructionView.java

示例4: onApplyClick

import android.transition.TransitionManager; //导入依赖的package包/类
public void onApplyClick() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        TransitionManager.beginDelayedTransition(constraintLayout);
    }

    applyConstraintSet.setMargin(R.id.btn_1, ConstraintSet.START, 0);
    applyConstraintSet.setMargin(R.id.btn_1, ConstraintSet.END, 0);
    applyConstraintSet.setMargin(R.id.btn_2, ConstraintSet.START, 0);
    applyConstraintSet.setMargin(R.id.btn_2, ConstraintSet.END, 0);
    applyConstraintSet.setMargin(R.id.btn_3, ConstraintSet.START, 0);
    applyConstraintSet.setMargin(R.id.btn_3, ConstraintSet.END, 0);


    applyConstraintSet.centerHorizontally(R.id.btn_1, R.id.activity_constraint_set);
    applyConstraintSet.centerHorizontally(R.id.btn_2, R.id.activity_constraint_set);
    applyConstraintSet.centerHorizontally(R.id.btn_3, R.id.activity_constraint_set);
    applyConstraintSet.applyTo(constraintLayout);
}
 
开发者ID:yushiwo,项目名称:ConstraintDemo,代码行数:19,代码来源:ConstraintSetActivity.java

示例5: startCloneAnimation

import android.transition.TransitionManager; //导入依赖的package包/类
private void startCloneAnimation(View clonedView, View targetView) {
    clonedView.post(() -> {
            TransitionManager.beginDelayedTransition(
                (ViewGroup) binding.getRoot(), selectedViewTransition);

            // Fires the transition
            clonedView.setLayoutParams(SelectedParamsFactory
                .endParams(clonedView, targetView));
    });
}
 
开发者ID:saulmm,项目名称:From-design-to-Android-part1,代码行数:11,代码来源:OrderDialogFragment.java

示例6: refresh

import android.transition.TransitionManager; //导入依赖的package包/类
/**
 * 刷新数据
 */
public void refresh() {
    long _space_free = Environment.getExternalStorageDirectory().getFreeSpace();
    long _fileCount_all = Global.get_fileCount_all();
    long _fileSize_all = Global.get_fileSize_all();
    long _fileCount_rubbish = Global.get_fileCount_rubbish();
    long _fileSize_rubbish = Global.get_fileSize_rubbish();

    TransitionManager.beginDelayedTransition(_line);
    _set_line.setGuidelinePercent(R.id.guideLine_rubbish, (float) NumberUtil.div(_fileSize_rubbish, _space_total, 3));
    _set_line.setGuidelinePercent(R.id.guideLine_file, (float) NumberUtil.div(_fileSize_all, _space_total, 3));
    _set_line.setGuidelinePercent(R.id.guideLine_system, (float) (1 - NumberUtil.div(_space_free, _space_total, 3)));
    _set_line.applyTo(_line);

    _text_system.setText(getContext().getString(R.string.state_fileCount_system, Formatter.formatFileSize(getContext(), _space_total - _space_free - _fileSize_all)));
    _text_blank.setText(getContext().getString(R.string.state_fileCount_blank, Formatter.formatFileSize(getContext(), _space_free)));
    _text_file.setText(getContext().getString(R.string.state_fileCount_file, Formatter.formatFileSize(getContext(), _fileSize_all), _fileCount_all));
    _text_rubbish.setText(getContext().getString(R.string.state_fileCount_rubbish, Formatter.formatFileSize(getContext(), _fileSize_rubbish), _fileCount_rubbish));
}
 
开发者ID:bonepeople,项目名称:SDCardCleaner,代码行数:22,代码来源:SDCardPercent.java

示例7: click

import android.transition.TransitionManager; //导入依赖的package包/类
public void click(View view) {
    /*
     * Slide: this transition tracks changes to the visibility of target views
     *        in the start and end scenes and moves views in or out
     *        from one of the edges of the scene.
     */
    Slide slide = new Slide();
    // Change the edge that Views appear and disappear from.
    slide.setSlideEdge(Gravity.TOP);

    ViewGroup root = (ViewGroup) findViewById(android.R.id.content);
    /*
     * beginDelayedTransition: Convenience method to animate to a new scene
     *                         defined by all changes within the given scene root
     *                         between calling this method and the next rendering frame.
     */
    TransitionManager.beginDelayedTransition(root, slide);
    imageView.setVisibility(View.INVISIBLE);
}
 
开发者ID:george-sp,项目名称:MaterialDesign-Udacity,代码行数:20,代码来源:MainActivity.java

示例8: goToEmptyScene

import android.transition.TransitionManager; //导入依赖的package包/类
public void goToEmptyScene(boolean withAnimation) {
    if (mCurrentScene == mEmptyScene) {
        return;
    }
    initIfNeeded();
    if (withAnimation) {
        mEmptyView.setAlpha(1.0f);
        transitionTo(mEmptyScene);
    } else {
        TransitionManager.go(mEmptyScene, null);
        // When transition is null, transition got stuck without calling endTransitions.
        TransitionManager.endTransitions(mEmptyScene.getSceneRoot());
        // Since Fade.OUT transition doesn't run, we need to set alpha manually.
        mEmptyView.setAlpha(0);
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:17,代码来源:TvTransitionManager.java

示例9: bindViewHolder

import android.transition.TransitionManager; //导入依赖的package包/类
@Override
    public void bindViewHolder(final FlexibleAdapter adapter, ViewHolder holder, int position, List payloads) {
        TransitionManager.beginDelayedTransition((ViewGroup) holder.itemView);
        if (this.status == IDLE) {
            holder.button.setVisibility(View.VISIBLE);
            holder.button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    ((TimetableAdapter) adapter).onLoadMoreListener.onLoadMore();
                }
            });
            holder.progressBar.setVisibility(View.GONE);
        } else if (status == LOADING) {
            holder.progressBar.setVisibility(View.VISIBLE);
            holder.button.setVisibility(View.GONE);
        }


//        LibrusUtils.logError("Progress item .bindViewHolder()");
    }
 
开发者ID:shymmq,项目名称:librus-client,代码行数:21,代码来源:ProgressItem.java

示例10: startToolbarAnimation

import android.transition.TransitionManager; //导入依赖的package包/类
public static void startToolbarAnimation(
    Context context,
    ViewGroup v
) {
    if (new UpdaterOptions(context).disableAnimations()) {
        return;
    }

    if (Build.VERSION.SDK_INT >= 21) {
        TransitionManager.beginDelayedTransition(v, new TransitionSet()
            .addTransition(new Fade(Fade.IN))
            .addTransition(new Slide(Gravity.LEFT))
            .addTransition(new ChangeBounds())
        );

    } else if (Build.VERSION.SDK_INT >= 14){
        android.support.transition.TransitionManager.beginDelayedTransition(v, new AutoTransition().setDuration(250));
    } {
        // No animation
    }
}
 
开发者ID:rumboalla,项目名称:apkupdater,代码行数:22,代码来源:AnimationUtil.java

示例11: onRequestPermissionsResult

import android.transition.TransitionManager; //导入依赖的package包/类
@Override
public void onRequestPermissionsResult(int requestCode,
                                       String[] permissions,
                                       int[] grantResults) {
    if (requestCode == PERMISSIONS_REQUEST_GET_ACCOUNTS) {
        TransitionManager.beginDelayedTransition(container);
        if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            setupAccountAutocomplete();
            username.requestFocus();
            username.showDropDown();
        } else {
            // if permission was denied check if we should ask again in the future (i.e. they
            // did not check 'never ask again')
            if (shouldShowRequestPermissionRationale(Manifest.permission.GET_ACCOUNTS)) {
                setupPermissionPrimer();
            } else {
                // denied & shouldn't ask again. deal with it (•_•) ( •_•)>⌐■-■ (⌐■_■)
                TransitionManager.beginDelayedTransition(container);
                permissionPrimer.setVisibility(View.GONE);
            }
        }
    }
}
 
开发者ID:liulinbo,项目名称:Amumu,代码行数:24,代码来源:DesignerNewsLogin.java

示例12: onResourceReady

import android.transition.TransitionManager; //导入依赖的package包/类
@Override
public void onResourceReady(Bitmap bitmap, GlideAnimation<? super Bitmap> glideAnimation) {
    TextView tv = textView.get();
    if (tv != null) {
        BitmapDrawable bitmapDrawable = new BitmapDrawable(tv.getResources(), bitmap);
        // image span doesn't handle scaling so we manually set bounds
        if (bitmap.getWidth() > tv.getWidth()) {
            float aspectRatio = (float) bitmap.getHeight() / (float) bitmap.getWidth();
            bitmapDrawable.setBounds(0, 0, tv.getWidth(), (int) (aspectRatio * tv.getWidth()));
        } else {
            bitmapDrawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
        }
        ImageSpan span = new ImageSpan(bitmapDrawable);
        // add the image span and remove our marker
        SpannableStringBuilder ssb = new SpannableStringBuilder(tv.getText());
        int start = ssb.getSpanStart(loadingSpan);
        int end = ssb.getSpanEnd(loadingSpan);
        if (start >= 0 && end >= 0) {
            ssb.setSpan(span, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
        ssb.removeSpan(loadingSpan);
        // animate the change
        TransitionManager.beginDelayedTransition((ViewGroup) tv.getParent());
        tv.setText(ssb);
    }
}
 
开发者ID:liulinbo,项目名称:Amumu,代码行数:27,代码来源:ImageSpanTarget.java

示例13: updateSubtitle

import android.transition.TransitionManager; //导入依赖的package包/类
private void updateSubtitle(@Nullable CharSequence newSubtitle) {
    if (ObjectsCompat.equals(newSubtitle, mStepSubtitleTextView.getText())) {
        return;
    }

    //Do not hide the subtitle if error message is empty
    if (!TextUtils.isEmpty(mSubtitle) && TextUtils.isEmpty(newSubtitle)) {
        newSubtitle = mSubtitle;
    }

    mStepSubtitleTextView.setText(newSubtitle);
    mStepSubtitleTextView.setVisibility(!TextUtils.isEmpty(newSubtitle) ? VISIBLE : GONE);
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
        TransitionManager.beginDelayedTransition(this);
    }
}
 
开发者ID:stepstone-tech,项目名称:android-material-stepper,代码行数:17,代码来源:StepTab.java

示例14: onRequestPermissionsResult

import android.transition.TransitionManager; //导入依赖的package包/类
@Override @TargetApi(Build.VERSION_CODES.M)
public void onRequestPermissionsResult(int requestCode,
                                       @NonNull String[] permissions,
                                       @NonNull int[] grantResults) {
    if (requestCode == PERMISSIONS_REQUEST_GET_ACCOUNTS) {
        TransitionManager.beginDelayedTransition(container);
        if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            setupAccountAutocomplete();
            username.requestFocus();
            username.showDropDown();
        } else {
            // if permission was denied check if we should ask again in the future (i.e. they
            // did not check 'never ask again')
            if (shouldShowRequestPermissionRationale(Manifest.permission.GET_ACCOUNTS)) {
                setupPermissionPrimer();
            } else {
                // denied & shouldn't ask again. deal with it (•_•) ( •_•)>⌐■-■ (⌐■_■)
                TransitionManager.beginDelayedTransition(container);
                permissionPrimer.setVisibility(View.GONE);
            }
        }
    }
}
 
开发者ID:yongjhih,项目名称:android-proguards,代码行数:24,代码来源:DesignerNewsLogin.java

示例15: getContentTransitionManager

import android.transition.TransitionManager; //导入依赖的package包/类
public TransitionManager getContentTransitionManager() {
    if (mPlugins.isEmpty()) {
        return getOriginal().super_getContentTransitionManager();
    }

    final ListIterator<ActivityPlugin> iterator = mPlugins.listIterator(mPlugins.size());

    final CallFun0<TransitionManager> superCall = new CallFun0<TransitionManager>(
            "getContentTransitionManager()") {

        @Override
        public TransitionManager call() {
            if (iterator.hasPrevious()) {
                return iterator.previous().getContentTransitionManager(this);
            } else {
                return getOriginal().super_getContentTransitionManager();
            }
        }
    };
    return superCall.call();
}
 
开发者ID:passsy,项目名称:CompositeAndroid,代码行数:22,代码来源:ActivityDelegate.java


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