android.support.transition.TransitionManager Java Examples
The following examples show how to use
android.support.transition.TransitionManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProductDetailsActivity.java From mosby with Apache License 2.0 | 6 votes |
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); }
Example #2
Source File: BadgedTabLayout.java From badgedtablayout with MIT License | 6 votes |
/** * @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 = tab.getCustomView().findViewById(R.id.textview_tab_badge); TextView tabText = 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()); }
Example #3
Source File: MainMenuLayout.java From mosby with Apache License 2.0 | 6 votes |
@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); } }
Example #4
Source File: ComponentNavigationActivity.java From graphhopper-navigation-android with MIT License | 6 votes |
@OnClick(R.id.startNavigationFab) public void onStartNavigationClick(FloatingActionButton floatingActionButton) { // Transition to navigation state mapState = MapState.NAVIGATION; floatingActionButton.hide(); cancelNavigationFab.show(); // Show the InstructionView TransitionManager.beginDelayedTransition(navigationLayout); instructionView.setVisibility(View.VISIBLE); // Start navigation adjustMapPaddingForNavigation(); navigation.startNavigation(route); // Location updates will be received from ProgressChangeListener removeLocationEngineListener(); }
Example #5
Source File: ComponentNavigationActivity.java From graphhopper-navigation-android with MIT License | 6 votes |
@OnClick(R.id.cancelNavigationFab) public void onCancelNavigationClick(FloatingActionButton floatingActionButton) { // Transition to info state mapState = MapState.INFO; floatingActionButton.hide(); // Hide the InstructionView TransitionManager.beginDelayedTransition(navigationLayout); instructionView.setVisibility(View.INVISIBLE); // Reset map camera and pitch resetMapAfterNavigation(); // Add back regular location listener addLocationEngineListener(); }
Example #6
Source File: CreateThreadDialog.java From demo-firebase-android with The Unlicense | 6 votes |
public void showProgress(boolean show) { if (show) { setCancelable(false); llContentRoot.setVisibility(View.GONE); TransitionManager.beginDelayedTransition(flRoot); llLoadingRoot.setVisibility(View.VISIBLE); } else { new OnFinishTimer(1000, 100) { @Override public void onFinish() { setCancelable(true); llLoadingRoot.setVisibility(View.GONE); TransitionManager.beginDelayedTransition(flRoot); llContentRoot.setVisibility(View.VISIBLE); } }.start(); } }
Example #7
Source File: SearchTransitioner.java From Aurora with Apache License 2.0 | 6 votes |
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); } }
Example #8
Source File: SearchFragment.java From mosby with Apache License 2.0 | 5 votes |
private void renderLoading() { TransitionManager.beginDelayedTransition(container); recyclerView.setVisibility(View.GONE); loadingView.setVisibility(View.VISIBLE); errorView.setVisibility(View.GONE); emptyView.setVisibility(View.GONE); }
Example #9
Source File: HomeFragment.java From mosby with Apache License 2.0 | 5 votes |
private void renderShowData(HomeViewState state) { TransitionManager.beginDelayedTransition((ViewGroup) getView()); loadingView.setVisibility(View.GONE); errorView.setVisibility(View.GONE); swipeRefreshLayout.setVisibility(View.VISIBLE); boolean changed = adapter.setLoadingNextPage(state.isLoadingNextPage()); if (changed && state.isLoadingNextPage()) { // scroll to the end of the list so that the user sees the load more progress bar recyclerView.smoothScrollToPosition(adapter.getItemCount()); } adapter.setItems(state.getData()); // TODO error: this must be done before setLoading() otherwise error will occure. see https://github.com/sockeqwe/mosby/issues/244 boolean pullToRefreshFinished = swipeRefreshLayout.isRefreshing() && !state.isLoadingPullToRefresh() && state.getPullToRefreshError() == null; if (pullToRefreshFinished) { // Swipe to refresh finished successfully so scroll to the top of the list (to see inserted items) recyclerView.smoothScrollToPosition(0); } swipeRefreshLayout.setRefreshing(state.isLoadingPullToRefresh()); if (state.getNextPageError() != null) { Snackbar.make(getView(), R.string.error_unknown, Snackbar.LENGTH_LONG) .show(); // TODO callback } if (state.getPullToRefreshError() != null) { Snackbar.make(getView(), R.string.error_unknown, Snackbar.LENGTH_LONG) .show(); // TODO callback } }
Example #10
Source File: ArtistDetailActivity.java From RetroMusicPlayer with GNU General Public License v3.0 | 5 votes |
@OnClick(R.id.biography) void toggleArtistBiogrphy() { TransitionManager.beginDelayedTransition(rootLayour); if (biographyTextView.getMaxLines() == 4) { biographyTextView.setMaxLines(Integer.MAX_VALUE); } else { biographyTextView.setMaxLines(4); } }
Example #11
Source File: AbsSlidingMusicPanelActivity.java From RetroMusicPlayer with GNU General Public License v3.0 | 5 votes |
public void setBottomBarVisibility(int gone) { if (mBottomNavigationView != null) { TransitionManager.beginDelayedTransition(mBottomNavigationView); mBottomNavigationView.setVisibility(gone); hideBottomBar(false); } }
Example #12
Source File: SearchActivity.java From RetroMusicPlayer with GNU General Public License v3.0 | 5 votes |
@Override public void onEnterAnimationComplete() { super.onEnterAnimationComplete(); TransitionManager.beginDelayedTransition(mContainer); //noinspection ConstantConditions }
Example #13
Source File: SearchFragment.java From mosby with Apache License 2.0 | 5 votes |
private void renderSearchNotStarted() { TransitionManager.beginDelayedTransition(container); recyclerView.setVisibility(View.GONE); loadingView.setVisibility(View.GONE); errorView.setVisibility(View.GONE); emptyView.setVisibility(View.GONE); }
Example #14
Source File: SearchFragment.java From mosby with Apache License 2.0 | 5 votes |
private void renderResult(List<Product> result) { TransitionManager.beginDelayedTransition(container); recyclerView.setVisibility(View.VISIBLE); loadingView.setVisibility(View.GONE); emptyView.setVisibility(View.GONE); errorView.setVisibility(View.GONE); adapter.setProducts(result); adapter.notifyDataSetChanged(); }
Example #15
Source File: StaggeredAnimationGroup.java From StaggeredAnimationGroup with Apache License 2.0 | 5 votes |
public final void show(boolean inReversedOrder) { ConstraintLayout parent = getConstraintLayoutParent(this); if (notNull(parent)) { Transition transition = prepareStaggeredTransition(true, inReversedOrder); TransitionManager.beginDelayedTransition(parent, transition); setVisibility(View.VISIBLE); } }
Example #16
Source File: StaggeredAnimationGroup.java From StaggeredAnimationGroup with Apache License 2.0 | 5 votes |
public final void hide(boolean inReversedOrder) { ConstraintLayout parent = getConstraintLayoutParent(this); if (notNull(parent)) { Transition transition = prepareStaggeredTransition(false, inReversedOrder); TransitionManager.beginDelayedTransition(parent, transition); setVisibility(View.GONE); } }
Example #17
Source File: GuitarTunerActivity.java From Android-Guitar-Tuner with Apache License 2.0 | 5 votes |
private void updateNavBar(final boolean showingPitchPlayer) { showPitchPlayer = showingPitchPlayer; if (toolbar != null) { TransitionManager.beginDelayedTransition(toolbar); } invalidateOptionsMenu(); }
Example #18
Source File: SearchFragment.java From mosby with Apache License 2.0 | 5 votes |
private void renderError() { TransitionManager.beginDelayedTransition(container); recyclerView.setVisibility(View.GONE); loadingView.setVisibility(View.GONE); errorView.setVisibility(View.VISIBLE); emptyView.setVisibility(View.GONE); }
Example #19
Source File: SearchFragment.java From mosby with Apache License 2.0 | 5 votes |
private void renderEmptyResult() { TransitionManager.beginDelayedTransition(container); recyclerView.setVisibility(View.GONE); loadingView.setVisibility(View.GONE); errorView.setVisibility(View.GONE); emptyView.setVisibility(View.VISIBLE); }
Example #20
Source File: LibraryFragment.java From RetroMusicPlayer with GNU General Public License v3.0 | 5 votes |
@NonNull @Override public MaterialCab openCab(int menuRes, MaterialCab.Callback callback) { TransitionManager.beginDelayedTransition(mAppbar); if (cab != null && cab.isActive()) cab.finish(); cab = new MaterialCab(getMainActivity(), R.id.cab_stub) .setMenu(menuRes) .setCloseDrawableRes(R.drawable.ic_close_white_24dp) .setBackgroundColor(RetroMusicColorUtil.shiftBackgroundColorForLightText(ThemeStore.primaryColor(getActivity()))) .start(callback); return cab; }
Example #21
Source File: SearchTransitioner.java From Aurora with Apache License 2.0 | 5 votes |
public void onActivityResumed() { if (supportsTransitions()) { TransitionManager.beginDelayedTransition(searchView, FadeInTransition.createTransition()); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) searchView.getLayoutParams(); layoutParams.setMargins(toolbarMargin, toolbarMargin, toolbarMargin, toolbarMargin); searchView.setLayoutParams(layoutParams); ViewFader.showContent(searchView); TransitionManager.beginDelayedTransition(activityContent, new Fade(Fade.IN)); activityContent.setVisibility(View.VISIBLE); } }
Example #22
Source File: WelcomeViewBinder.java From Synapse with Apache License 2.0 | 5 votes |
@Override protected void onBindViewHolder(@NonNull WelcomeHolder holder, @NonNull WelcomeItem dataSet) { final Resources resources = holder.download.getResources(); TransitionManager.beginDelayedTransition((ViewGroup) holder.itemView); switch (dataSet.state()) { case WelcomeItem.READY: holder.download.setText(R.string.data_ready); holder.download.setTextColor(ResourcesCompat.getColor(resources, R.color.data_ready_text, null)); holder.download.setClickable(false); holder.progress.setVisibility(View.GONE); break; case WelcomeItem.WAITING: holder.download.setTextColor(ResourcesCompat.getColor(resources, R.color.data_waiting_text, null)); holder.download.setText(R.string.data_waiting); holder.download.setClickable(true); holder.progress.setVisibility(View.VISIBLE); break; case WelcomeItem.UNREADY: holder.download.setTextColor(ResourcesCompat.getColor(resources, R.color.data_unready_text, null)); holder.download.setText(R.string.data_unready); holder.download.setClickable(true); holder.progress.setVisibility(View.GONE); break; } }
Example #23
Source File: DualNavigationMapActivity.java From graphhopper-navigation-android with MIT License | 5 votes |
private void expandCollapse() { TransitionManager.beginDelayedTransition(dualNavigationMap); ConstraintSet constraint; if (constraintChanged[0]) { constraint = navigationMapConstraint; } else { constraint = navigationMapExpandedConstraint; } constraint.applyTo(dualNavigationMap); constraintChanged[0] = !constraintChanged[0]; }
Example #24
Source File: CategoryFragment.java From mosby with Apache License 2.0 | 5 votes |
private void renderData(List<Product> products) { adapter.setProducts(products); adapter.notifyDataSetChanged(); TransitionManager.beginDelayedTransition((ViewGroup) getView()); loadingView.setVisibility(View.GONE); errorView.setVisibility(View.GONE); recyclerView.setVisibility(View.VISIBLE); }
Example #25
Source File: CategoryFragment.java From mosby with Apache License 2.0 | 4 votes |
private void renderError() { TransitionManager.beginDelayedTransition((ViewGroup) getView()); loadingView.setVisibility(View.GONE); errorView.setVisibility(View.VISIBLE); recyclerView.setVisibility(View.GONE); }
Example #26
Source File: CategoryFragment.java From mosby with Apache License 2.0 | 4 votes |
private void renderLoading() { TransitionManager.beginDelayedTransition((ViewGroup) getView()); loadingView.setVisibility(View.VISIBLE); errorView.setVisibility(View.GONE); recyclerView.setVisibility(View.GONE); }
Example #27
Source File: ProductDetailsActivity.java From mosby with Apache License 2.0 | 4 votes |
private void renderError() { TransitionManager.beginDelayedTransition(rootView); errorView.setVisibility(View.VISIBLE); loadingView.setVisibility(View.GONE); detailsView.setVisibility(View.GONE); }
Example #28
Source File: HomeFragment.java From mosby with Apache License 2.0 | 4 votes |
private void renderFirstPageError() { TransitionManager.beginDelayedTransition((ViewGroup) getView()); loadingView.setVisibility(View.GONE); swipeRefreshLayout.setVisibility(View.GONE); errorView.setVisibility(View.VISIBLE); }
Example #29
Source File: ProductDetailsActivity.java From mosby with Apache License 2.0 | 4 votes |
private void renderLoading() { TransitionManager.beginDelayedTransition(rootView); errorView.setVisibility(View.GONE); loadingView.setVisibility(View.VISIBLE); detailsView.setVisibility(View.GONE); }
Example #30
Source File: SearchActivity.java From RetroMusicPlayer with GNU General Public License v3.0 | 4 votes |
private void search(@NonNull String query) { this.query = query; TransitionManager.beginDelayedTransition(toolbar); micIcon.setVisibility(query.length() > 0 ? View.GONE : View.VISIBLE); mSearchPresenter.search(query); }