本文整理匯總了Java中android.transition.TransitionManager.beginDelayedTransition方法的典型用法代碼示例。如果您正苦於以下問題:Java TransitionManager.beginDelayedTransition方法的具體用法?Java TransitionManager.beginDelayedTransition怎麽用?Java TransitionManager.beginDelayedTransition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.transition.TransitionManager
的用法示例。
在下文中一共展示了TransitionManager.beginDelayedTransition方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: 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));
}
示例4: 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);
}
}
示例5: 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);
}
}
}
}
示例6: 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()");
}
示例7: selectScene
import android.transition.TransitionManager; //導入方法依賴的package包/類
public void selectScene(View view) {
switch (view.getId()) {
case R.id.scene1:
mTransitionManager.transitionTo(mScene1);
break;
case R.id.scene2:
mTransitionManager.transitionTo(mScene2);
break;
case R.id.scene3:
mTransitionManager.transitionTo(mScene3);
break;
case R.id.scene4:
// scene4 is not an actual 'Scene', but rather a dynamic change in the UI,
// transitioned to using beginDelayedTransition() to tell the TransitionManager
// to get ready to run a transition at the next frame
TransitionManager.beginDelayedTransition(mSceneRoot);
setNewSize(R.id.view1, 150, 25);
setNewSize(R.id.view2, 150, 25);
setNewSize(R.id.view3, 150, 25);
setNewSize(R.id.view4, 150, 25);
break;
}
}
示例8: animatePostsArrival
import android.transition.TransitionManager; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void animatePostsArrival() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
postsAdapter.hide = true;
postsAdapter.firstLoad = true;
postsAdapter.notifyDataSetChanged();
TransitionManager.beginDelayedTransition(postsView, new Slide(Gravity.BOTTOM));
postsAdapter.hide = false;
postsAdapter.firstLoad = false;
postsAdapter.notifyDataSetChanged();
// Unreliable, often leads to https://code.google.com/p/android/issues/detail?id=77846
//postsAdapter.notifyItemChanged(0);
//postsAdapter.notifyItemRangeInserted(1, posts.size()-1);
} else {
postsAdapter.notifyDataSetChanged();
}
}
示例9: tryDelayed
import android.transition.TransitionManager; //導入方法依賴的package包/類
/**
* {@link TransitionManager#beginDelayedTransition(ViewGroup) Begin a delayed transition} if
* one is not already running.
*/
@UiThread
public static void tryDelayed(ViewGroup sceneRoot) {
if (!sceneRoot.isLaidOut()) { // transition won't run
return;
}
if (sDelayedTransition == null) {
sDelayedTransition = new AutoTransition().addListener(new SimpleTransitionListener() {
@Override
public void onTransitionEnd(Transition transition) {
super.onTransitionEnd(transition);
sDelayedTransitionRunning = false;
}
});
}
if (!sDelayedTransitionRunning) {
sDelayedTransitionRunning = true;
TransitionManager.beginDelayedTransition(sceneRoot, sDelayedTransition);
}
}
示例10: switchToFragment
import android.transition.TransitionManager; //導入方法依賴的package包/類
/**
* Switch to a specific Fragment with taking care of validation, Title and BackStack
*/
private Fragment switchToFragment(String fragmentName, Bundle args, boolean validate,
boolean addToBackStack, int titleResId, CharSequence title,
boolean withTransition) {
if (validate && !isValidFragment(fragmentName)) {
String message = "Invalid fragment for this activity: " + fragmentName;
throw new IllegalArgumentException(message);
}
Fragment f = Fragment.instantiate(this, fragmentName, args);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(android.R.id.content, f);
if (withTransition && Device.hasKitKatApi())
TransitionManager.beginDelayedTransition(mContent);
if (addToBackStack) transaction.addToBackStack(SettingsActivity.BACK_STACK_PREFS);
if (titleResId > 0) {
transaction.setBreadCrumbTitle(titleResId);
} else if (title != null) {
transaction.setBreadCrumbTitle(title);
}
transaction.commitAllowingStateLoss();
getFragmentManager().executePendingTransactions();
return f;
}
示例11: populateMetadata
import android.transition.TransitionManager; //導入方法依賴的package包/類
/**
* Updates the content of the view to latest metadata
* provided by {@link com.achep.acdisplay.services.media.MediaController2#getMetadata()}.
*/
private void populateMetadata() {
if (mIdle) {
ViewGroup vg = getView();
if (Device.hasKitKatApi() && vg.isLaidOut() && getFragment().isAnimatable()) {
TransitionManager.beginDelayedTransition(vg);
}
}
Metadata metadata = mMediaController.getMetadata();
ViewUtils.safelySetText(mTitleView, metadata.title);
ViewUtils.safelySetText(mSubtitleView, metadata.subtitle);
mDurationText.setText(formatTime(metadata.duration));
mSeekUiAtomic.stop();
mSeekBar.setMax(Math.min(100, (int) (metadata.duration / 1000L)));
if (mArtworkView != null) {
mArtworkView.setImageBitmap(metadata.bitmap);
}
}
示例12: setPitchBarPosition
import android.transition.TransitionManager; //導入方法依賴的package包/類
private void setPitchBarPosition(double frequency) {
View pitchBar = (View)findViewById(R.id.tune_view_current_pitch);
int margin = 20;
double leftDP = NoteCalculator.getPitchBarPosition(frequency, 560);
Transition moveTransition = new ChangeBounds();
moveTransition.setDuration(300);
moveTransition.setInterpolator(new LinearInterpolator());
TransitionManager.beginDelayedTransition((ViewGroup) pitchBar.getRootView(), moveTransition);
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams)(pitchBar.getLayoutParams());
Log.d(TAG, String.format("Current: %d New: %f", params.leftMargin, leftDP));
params.setMargins((int)leftDP,0,0,0);
pitchBar.setLayoutParams(params);
}
示例13: switchToFragment
import android.transition.TransitionManager; //導入方法依賴的package包/類
/**
* Switch to a specific Fragment with taking care of validation, Title and BackStack
*/
private Fragment switchToFragment(String fragmentName, Bundle args, boolean validate,
boolean addToBackStack, int titleResId, CharSequence title,
boolean withTransition) {
if (validate && !isValidFragment(fragmentName)) {
String message = "Invalid fragment for this activity: " + fragmentName;
throw new IllegalArgumentException(message);
}
Fragment f = Fragment.instantiate(this, fragmentName, args);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.main_content, f);
if (withTransition && Device.hasKitKatApi())
TransitionManager.beginDelayedTransition(mContent);
if (addToBackStack) transaction.addToBackStack(SettingsActivity.BACK_STACK_PREFS);
if (titleResId > 0) {
transaction.setBreadCrumbTitle(titleResId);
} else if (title != null) {
transaction.setBreadCrumbTitle(title);
}
transaction.commitAllowingStateLoss();
getFragmentManager().executePendingTransactions();
return f;
}
示例14: onTextClick
import android.transition.TransitionManager; //導入方法依賴的package包/類
@OnClick({ R.id.text1 })
public void onTextClick() {
// Create a TransitionSet that will animated ChangeBounds and Fade
TransitionSet transitionSet = new TransitionSet();
transitionSet.addTransition(new ChangeBounds());
transitionSet.addTransition(new Fade());
TransitionManager.beginDelayedTransition(mLayout, transitionSet);
// Remove text1 from the Layout
mLayout.removeView(mText1);
// Increase the height of Text1 and set a top margin
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mText1.getLayoutParams();
params.height *= 2;
params.topMargin = 100;
mText1.setLayoutParams(params);
// Add text1 back to the layout
// TransitionManager will automagically apply animations
mLayout.addView(mText1, 1);
}
示例15: showBuildSheet
import android.transition.TransitionManager; //導入方法依賴的package包/類
/** Show the "build" popup sheet for the given {@link Design}. */
public void showBuildSheet(Design design) {
final Colony colony = checkNotNull(colonies.get(viewPager.getCurrentItem()));
bottomPaneContentView = new BuildBottomPane(
getContext(), star, colony, design, (designType, count) -> {
StarManager.i.updateStar(star, new StarModification.Builder()
.type(StarModification.MODIFICATION_TYPE.ADD_BUILD_REQUEST)
.colony_id(colony.id)
.design_type(designType)
.count(count));
hideBottomSheet();
});
TransitionManager.beginDelayedTransition(bottomPane);
bottomPane.getLayoutParams().height = ViewGroup.LayoutParams.WRAP_CONTENT;
bottomPane.removeAllViews();
bottomPane.addView((View) bottomPaneContentView);
}