本文整理汇总了Java中android.support.transition.TransitionManager类的典型用法代码示例。如果您正苦于以下问题:Java TransitionManager类的具体用法?Java TransitionManager怎么用?Java TransitionManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TransitionManager类属于android.support.transition包,在下文中一共展示了TransitionManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import android.support.transition.TransitionManager; //导入依赖的package包/类
@Override public void render(MenuViewState menuViewState) {
Timber.d("Render %s", menuViewState);
TransitionManager.beginDelayedTransition(this);
if (menuViewState instanceof MenuViewState.LoadingState) {
loadingView.setVisibility(View.VISIBLE);
recyclerView.setVisibility(View.GONE);
errorView.setVisibility(View.GONE);
} else if (menuViewState instanceof MenuViewState.DataState) {
adapter.setItems(((MenuViewState.DataState) menuViewState).getCategories());
adapter.notifyDataSetChanged();
loadingView.setVisibility(View.GONE);
recyclerView.setVisibility(View.VISIBLE);
errorView.setVisibility(View.GONE);
} else if (menuViewState instanceof MenuViewState.ErrorState) {
loadingView.setVisibility(View.GONE);
recyclerView.setVisibility(View.GONE);
errorView.setVisibility(View.VISIBLE);
} else {
throw new IllegalStateException("Unknown state " + menuViewState);
}
}
示例2: renderData
import android.support.transition.TransitionManager; //导入依赖的package包/类
private void renderData(ProductDetailsViewState.DataState state) {
TransitionManager.beginDelayedTransition(rootView);
errorView.setVisibility(View.GONE);
loadingView.setVisibility(View.GONE);
detailsView.setVisibility(View.VISIBLE);
isProductInshoppingCart = state.getDetail().isInShoppingCart();
product = state.getDetail().getProduct();
price.setText("Price: $" + String.format(Locale.US, "%.2f", product.getPrice()));
description.setText(product.getDescription());
toolbar.setTitle(product.getName());
collapsingToolbarLayout.setTitle(product.getName());
if (isProductInshoppingCart) {
fab.setImageResource(R.drawable.ic_in_shopping_cart);
} else {
fab.setImageResource(R.drawable.ic_add_shopping_cart);
}
Glide.with(this)
.load(DependencyInjection.BASE_IMAGE_URL + product.getImage())
.centerCrop()
.into(backdrop);
}
示例3: updateHabitDetails
import android.support.transition.TransitionManager; //导入依赖的package包/类
final void updateHabitDetails(Date dateClicked) {
List<Event> events = habitCalendarView.getEvents(dateClicked);
StringBuilder habitsToPrint = new StringBuilder();
for(Event event : events) {
habitsToPrint.append(event.getData().toString());
}
// Here prints the habits in the text view.
// I am just to bored to write another adapter.
TransitionManager.beginDelayedTransition(habitDetailContent);
TransitionManager.beginDelayedTransition(fragHabitRootLinearLayout);
TransitionManager.beginDelayedTransition(habitDetailCard);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
habitDetailText.setText(Html.fromHtml(habitsToPrint.toString(), Html.FROM_HTML_MODE_LEGACY));
} else {
habitDetailText.setText(Html.fromHtml(habitsToPrint.toString()));
}
}
示例4: expandHabitCalendarViewOnClick
import android.support.transition.TransitionManager; //导入依赖的package包/类
@OnClick(R.id.expand_habit_calendar_view)
void expandHabitCalendarViewOnClick() {
TransitionManager.beginDelayedTransition(habitCalendarContent);
TransitionManager.beginDelayedTransition(fragHabitRootLinearLayout);
TransitionManager.beginDelayedTransition(habitCalendarCard);
if(habitCalendarContent.getVisibility() == View.VISIBLE) {
habitCalendarContent.setVisibility(View.GONE);
} else {
habitCalendarContent.setVisibility(View.VISIBLE);
}
}
示例5: updateTaskDetails
import android.support.transition.TransitionManager; //导入依赖的package包/类
final void updateTaskDetails(Date dateClicked) {
List<Event> events = taskCalendarView.getEvents(dateClicked);
StringBuilder tasksToPrint = new StringBuilder();
for(Event event : events) {
tasksToPrint.append(event.getData().toString());
}
// Here prints the tasks in the text view.
// I am just to bored to write another adapter.
TransitionManager.beginDelayedTransition(taskDetailContent);
TransitionManager.beginDelayedTransition(fragTaskRootLinearLayout);
TransitionManager.beginDelayedTransition(taskDetailCard);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
taskDetailText.setText(Html.fromHtml(tasksToPrint.toString(), Html.FROM_HTML_MODE_LEGACY));
} else {
taskDetailText.setText(Html.fromHtml(tasksToPrint.toString()));
}
// taskDetailText.setText(tasksToPrint);
}
示例6: transitionToSearch
import android.support.transition.TransitionManager; //导入依赖的package包/类
public void transitionToSearch(){
if (transitioning) {
return;
}
if (supportsTransitions()) {
Transition transition = FadeOutTransition.withAction(navigateToSearchWhenDone());
TransitionManager.beginDelayedTransition(searchView, transition);
expandToolbar();
ViewFader.hideContentOf(searchView);
TransitionManager.beginDelayedTransition(activityContent, new Fade(Fade.OUT));
activityContent.setVisibility(View.GONE);
} else {
TRouter.go(Constants.SEARCH);
}
}
示例7: changePacketSelection
import android.support.transition.TransitionManager; //导入依赖的package包/类
private void changePacketSelection(@NonNull Packet packet) {
final LayoutInflater inflater = getLayoutInflater();
final ViewGroup formContainer = this.formContainer;
TransitionManager.beginDelayedTransition(formContainer, new AutoTransition().setDuration(150));
formContainer.removeAllViews();
final PacketParameter[] parameters = packet.parameters;
final int paramLen = parameters.length;
for (int i = 0; i < paramLen; i++) {
final PacketParameter param = parameters[i];
final TextInputLayout inputLayout = (TextInputLayout) inflater.inflate(R.layout.input_field, formContainer, false);
inputLayout.setTag(param);
inputLayout.setHint(param.id());
final EditText inputField = inputLayout.getEditText();
if (inputField != null) {
inputField.setText(param.value());
}
formContainer.addView(inputLayout);
}
}
示例8: toggleLayerList
import android.support.transition.TransitionManager; //导入依赖的package包/类
/**
* Show/hide the list of map layers
* by adjusting the layout
*/
private void toggleLayerList() {
final LinearLayout transitionsContainer = mRoot;
TransitionManager.beginDelayedTransition(transitionsContainer);
mBookmarkRecyclerView.setVisibility(View.GONE);
if (mLayerRecyclerView.getVisibility() == android.view.View.GONE){
//final ViewGroup.LayoutParams params = mLayerRecyclerView.getLayoutParams();
mLayerRecyclerView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT, 4));
mLayerRecyclerView.requestLayout();
mLayerRecyclerView.setVisibility(android.view.View.VISIBLE);
}else{
mLayerRecyclerView.setVisibility(android.view.View.GONE);
mLayerRecyclerView.setLayoutParams(new LinearLayout.LayoutParams(0,
ViewGroup.LayoutParams.MATCH_PARENT, 4));
mLayerRecyclerView.requestLayout();
}
}
示例9: toggleBookmarkList
import android.support.transition.TransitionManager; //导入依赖的package包/类
/**
* Show/hide the list of bookmarks
* by adjusting the layout
*/
private void toggleBookmarkList() {
final LinearLayout transitionsContainer = mRoot;
TransitionManager.beginDelayedTransition(transitionsContainer);
mLayerRecyclerView.setVisibility(View.GONE);
if (mBookmarkRecyclerView.getVisibility() == android.view.View.GONE){
// final ViewGroup.LayoutParams params = mBookmarkRecyclerView.getLayoutParams();
mBookmarkRecyclerView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT, 4));
mBookmarkRecyclerView.requestLayout();
mBookmarkRecyclerView.setVisibility(android.view.View.VISIBLE);
}else{
mBookmarkRecyclerView.setVisibility(android.view.View.GONE);
mBookmarkRecyclerView.setLayoutParams(new LinearLayout.LayoutParams(0,
ViewGroup.LayoutParams.MATCH_PARENT, 4));
mBookmarkRecyclerView.requestLayout();
}
}
示例10: onReceive
import android.support.transition.TransitionManager; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (intent == null) {
return;
}
String artist = intent.getStringExtra("artist");
String track = intent.getStringExtra("track");
if (mViewGroup != null) {
mViewGroup.setVisibility(View.VISIBLE);
TransitionManager.beginDelayedTransition(mViewGroup);
if (mTitle != null) {
mTitle.setText(track);
}
if (mText != null) {
mText.setText(artist);
}
}
}
示例11: setBadgeText
import android.support.transition.TransitionManager; //导入依赖的package包/类
/**
* @param index of tab where badge should be added
* @param text the text of the badge (null to hide the badge)
*/
public void setBadgeText(int index, @Nullable String text) {
TabLayout.Tab tab = getTabAt(index);
if (tab == null || tab.getCustomView() == null) {
Log.e("BadgedTabLayout", "Tab is null. Not setting custom view");
return;
}
TextView badge = (TextView) tab.getCustomView().findViewById(R.id.textview_tab_badge);
TextView tabText = (TextView) tab.getCustomView().findViewById(R.id.textview_tab_title);
if (text == null) {
badge.setVisibility(View.GONE);
tabText.setMaxWidth(Integer.MAX_VALUE);
} else {
int maxWidth = getResources().getDimensionPixelSize(R.dimen.tab_text_max_width);
badge.setText(text);
tabText.setMaxWidth(maxWidth);
badge.setVisibility(View.VISIBLE);
}
TransitionManager.beginDelayedTransition((ViewGroup) tab.getCustomView());
}
示例12: initForumlistCategoryCard
import android.support.transition.TransitionManager; //导入依赖的package包/类
private BaseForumlistInfos initForumlistCategoryCard(@IdRes final int categoryId, @IdRes final int contentId, @IdRes final int otherContentId, @IdRes final int arrowId) {
final ViewGroup contentView = findViewById(contentId);
final ViewGroup otherContentView = (ViewGroup) (otherContentId == 0 ? null : findViewById(otherContentId));
final ImageView arrowView = findViewById(arrowId);
final BaseForumlistInfos currentForumlist = new BaseForumlistInfos(contentView, otherContentView, arrowView);
View category = findViewById(categoryId);
final int contentChildCount = currentForumlist.getNumberOfContentChildView();
for (int i = 0; i < contentChildCount; ++i) {
View currentContentChild = currentForumlist.getContentChildViewAt(i);
if (currentContentChild instanceof Button) {
currentContentChild.setOnClickListener(baseForumButtonClickedListener);
}
}
category.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
TransitionManager.beginDelayedTransition(baseForumListLayout);
currentForumlist.setOpened(!currentForumlist.isOpened());
}
});
return currentForumlist;
}
示例13: onCheckboxClicked
import android.support.transition.TransitionManager; //导入依赖的package包/类
public void onCheckboxClicked(View view) {
boolean checked = ((CheckBox) view).isChecked();
ViewGroup containerView = (ViewGroup) findViewById(R.id.container);
// Check which checkbox was clicked
switch(view.getId()) {
case R.id.customMaxDamageCheck:
TransitionManager.beginDelayedTransition(containerView);
if (checked) {
etMaxDamage.setVisibility(View.VISIBLE);
bCustomMaxDamage = true;
} else {
etMaxDamage.setVisibility(View.GONE);
bCustomMaxDamage = false;
}
break;
}
}
示例14: removeActivityFromTransitionManager
import android.support.transition.TransitionManager; //导入依赖的package包/类
private void removeActivityFromTransitionManager() {
final Class transitionManagerClass = TransitionManager.class;
try {
final Field runningTransitionsField = transitionManagerClass
.getDeclaredField("sRunningTransitions");
runningTransitionsField.setAccessible(true);
//noinspection unchecked
final ThreadLocal<WeakReference<ArrayMap<ViewGroup, ArrayList<Transition>>>> runningTransitions
= (ThreadLocal<WeakReference<ArrayMap<ViewGroup, ArrayList<Transition>>>>)
runningTransitionsField.get(transitionManagerClass);
if(runningTransitions.get() == null || runningTransitions.get().get() == null) {
return;
}
ArrayMap map = runningTransitions.get().get();
View decorView = getWindow().getDecorView();
if(map.containsKey(decorView)) {
map.remove(decorView);
}
} catch(Exception ignored) {
}
}
示例15: onResume
import android.support.transition.TransitionManager; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
if (mTextView == null)
return;
mTextView.postDelayed(new Runnable() {
@Override
public void run() {
if (mTextView != null) {
TransitionSet transition = (TransitionSet) new TransitionSet().addTransition(new Fade(Fade.OUT)).addTransition(new ChangeBounds()).addTransition(new Fade(Fade.IN)).setDuration(1000);
TransitionManager.beginDelayedTransition(logoContainer, transition);
mTextView.setVisibility(View.VISIBLE);
}
}
}, 1000);
}