List of usage examples for android.animation AnimatorInflater loadAnimator
public static Animator loadAnimator(Context context, @AnimatorRes int id) throws NotFoundException
From source file:ti.modules.titanium.ui.widget.collectionview.TiCollectionView.java
@Override public void propertySet(String key, Object newValue, Object oldValue, boolean changedProperty) { switch (key) { case "fastScroller": HashMap args = TiConvert.toHashMap(newValue); if (args != null) { mRecyclerView.setFastScrollEnabled(true); mRecyclerView.setVerticalScrollBarEnabled(false); // if (mFastScroller == null) { // mFastScroller = new DragScrollBar(getContext(), // mRecyclerView, false); // mFastScroller.addIndicator(new CustomIndicator(getContext()), // true); // mFastScroller.setZ(100); // mFastScroller.setBackgroundColor(Color.RED);; // }//from w w w.java 2 s . co m // mFastScroller.setVisibility(View.VISIBLE); if (args.containsKey("color")) { int color = TiConvert.toColor(args, "color"); mRecyclerView.setThumbColor(color); mRecyclerView.setPopupBgColor(color); } // if (args.containsKey("barColor")) { // mFastScroller.setBarColour(TiConvert.toColor(args, // "barColor")); // } // if (args.containsKey("textColour")) { // mFastScroller.setTextColour(TiConvert.toColor(args, // "textColour")); // } } else { mRecyclerView.setFastScrollEnabled(false); mRecyclerView.setVerticalScrollBarEnabled( TiConvert.toBoolean(proxy.getProperty(TiC.PROPERTY_SHOW_VERTICAL_SCROLL_INDICATOR), true)); // if (mFastScroller != null) { // mFastScroller.setVisibility(View.GONE); // } } break; case TiC.PROPERTY_SCROLLING_ENABLED: layoutManager.setScrollEnabled(TiConvert.toBoolean(newValue)); break; case "appearAnimation": if (newValue instanceof HashMap || newValue instanceof TiAnimation) { mAppearAnimation = newValue; mUseAppearAnimation = mAppearAnimation != null; } else { int id = TiConvert.toInt(newValue); if (id != 0) { mAppearAnimators = AnimatorInflater.loadAnimator(getProxy().getActivity(), id); } else { mAppearAnimators = null; } mUseAppearAnimation = mAppearAnimators != null; } break; case "useAppearAnimation": mUseAppearAnimation = TiConvert.toBoolean(newValue, false); break; case TiC.PROPERTY_COLUMN_WIDTH: mColumnsWidth = TiConvert.toTiDimension(newValue, TiDimension.TYPE_WIDTH); if (layoutManager != null) { if (mColumnsWidth != null) { layoutManager.setColumnWidth(mColumnsWidth.getAsPixels(mRecyclerView)); } } break; case TiC.PROPERTY_NUM_COLUMNS: mColumnsWidth = null; mNumColumns = TiConvert.toInt(newValue); if (layoutManager != null) { layoutManager.setNumColumns(mNumColumns); } break; case TiC.PROPERTY_TEMPLATES: processTemplates((HashMap) newValue); mProcessUpdateFlags |= TIFLAG_NEEDS_DATASET; mProcessUpdateFlags |= TIFLAG_NEEDS_ADAPTER_CHANGE; // if (changedProperty) { // notifyDataSetChanged(); // } break; case TiC.PROPERTY_SEARCH_TEXT: filterBy(TiConvert.toString(newValue)); mProcessUpdateFlags |= TIFLAG_NEEDS_DATASET; break; case TiC.PROPERTY_SEARCH_VIEW: setSearchView(newValue, true); break; case TiC.PROPERTY_SEARCH_VIEW_EXTERNAL: setSearchView(newValue, false); break; case TiC.PROPERTY_SCROLL_HIDES_KEYBOARD: this.hideKeyboardOnScroll = TiConvert.toBoolean(newValue, true); break; case TiC.PROPERTY_STICKY_HEADERS: boolean enabled = TiConvert.toBoolean(newValue, true); mAdapter.setStickySectionHeaders(enabled); break; case TiC.PROPERTY_CASE_INSENSITIVE_SEARCH: this.caseInsensitive = TiConvert.toBoolean(newValue, true); filterBy(TiConvert.toString(this.searchText)); mProcessUpdateFlags |= TIFLAG_NEEDS_DATASET; break; case TiC.PROPERTY_SEARCH_IGNORE_EXACT_MATCH: this.ignoreExactMatch = TiConvert.toBoolean(newValue, true); filterBy(TiConvert.toString(this.searchText)); mProcessUpdateFlags |= TIFLAG_NEEDS_DATASET; break; // case TiC.PROPERTY_SEPARATOR_COLOR: // { // AbsListView internalListView = getInternalListView(); // if (internalListView instanceof ListView) { // int dividerHeight = listView.getDividerHeight(); // ((ListView) internalListView).setDivider(new // ColorDrawable(TiConvert.toColor(newValue))); // ((ListView) internalListView).setDividerHeight(dividerHeight); // } // break; // } // case TiC.PROPERTY_FOOTER_DIVIDERS_ENABLED: // { // AbsListView internalListView = getInternalListView(); // if (internalListView instanceof ListView) { // ((ListView) // internalListView).setFooterDividersEnabled(TiConvert.toBoolean(newValue, // false)); // } // break; // } // case TiC.PROPERTY_HEADER_DIVIDERS_ENABLED: // { // AbsListView internalListView = getInternalListView(); // if (internalListView instanceof ListView) { // ((ListView) // internalListView).setHeaderDividersEnabled(TiConvert.toBoolean(newValue, // false)); // } // break; // } case TiC.PROPERTY_SHOW_VERTICAL_SCROLL_INDICATOR: mRecyclerView.setVerticalScrollBarEnabled(TiConvert.toBoolean(newValue, true)); break; case TiC.PROPERTY_DEFAULT_ITEM_TEMPLATE: defaultTemplateBinding = TiConvert.toString(newValue); if (changedProperty) { notifyDataSetChanged(); } break; case TiC.PROPERTY_SCROLL_DIRECTION: { final String direction = TiConvert.toString(newValue); if (direction.equalsIgnoreCase("horizontal")) { layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); } else { layoutManager.setOrientation(LinearLayoutManager.VERTICAL); } break; } case TiC.PROPERTY_SECTIONS: if (changedProperty) { // mProcessUpdateFlags &= ~TIFLAG_NEEDS_DATASET; processSectionsAndNotify((Object[]) newValue); } else { // if user didn't append/modify/delete sections before this is // called, we process sections // as usual. Otherwise, we process the preloadSections, which // should also contain the section(s) // from this dictionary as well as other sections that user // append/insert/deleted prior to this. AbsListViewProxy listProxy = (AbsListViewProxy) proxy; if (!listProxy.getPreload()) { // mProcessUpdateFlags &= ~TIFLAG_NEEDS_DATASET; processSectionsAndNotify((Object[]) newValue); } } break; case TiC.PROPERTY_SEPARATOR_STYLE: int height = (int) TiUIHelper.getInPixels(newValue); if (height == 0) { // if (mDividerDecoration != null) { // mRecyclerView.removeItemDecoration(mDividerDecoration); // } if (mDividerDecoration != null) { mDividerDecoration.setDividerHeight(height); mProcessUpdateFlags |= TIFLAG_NEEDS_DATASET; } } else { if (mDividerDecoration == null) { mDividerDecoration = new DividerItemDecoration(getContext()); mRecyclerView.addItemDecoration(mDividerDecoration); } mDividerDecoration.setDividerHeight(height); mProcessUpdateFlags |= TIFLAG_NEEDS_DATASET; } break; case TiC.PROPERTY_OVER_SCROLL_MODE: // if (Build.VERSION.SDK_INT >= 9) { mRecyclerView.setOverScrollMode(TiConvert.toInt(newValue, View.OVER_SCROLL_ALWAYS)); // } break; case TiC.PROPERTY_HEADER_VIEW: setHeaderOrFooterView(newValue, true); mProcessUpdateFlags |= TIFLAG_NEEDS_DATASET; break; case TiC.PROPERTY_HEADER_TITLE: setHeaderTitle(TiConvert.toString(newValue)); mProcessUpdateFlags |= TIFLAG_NEEDS_DATASET; break; case TiC.PROPERTY_FOOTER_VIEW: setHeaderOrFooterView(newValue, false); mProcessUpdateFlags |= TIFLAG_NEEDS_DATASET; break; case TiC.PROPERTY_FOOTER_TITLE: setFooterTitle(TiConvert.toString(newValue)); mProcessUpdateFlags |= TIFLAG_NEEDS_DATASET; break; case "reverseDrawingOrder": boolean reversed = TiConvert.toBoolean(newValue, false); if (reversed) { mRecyclerView.setChildDrawingOrderCallback(new RecyclerView.ChildDrawingOrderCallback() { @Override public int onGetChildDrawingOrder(int childCount, int i) { return childCount - i - 1; } }); } else { mRecyclerView.setChildDrawingOrderCallback(null); } break; default: super.propertySet(key, newValue, oldValue, changedProperty); break; } }
From source file:android.support.v17.leanback.widget.GuidedActionsStylist.java
private static Animator createAnimator(View v, int attrId) { Context ctx = v.getContext(); TypedValue typedValue = new TypedValue(); ctx.getTheme().resolveAttribute(attrId, typedValue, true); Animator animator = AnimatorInflater.loadAnimator(ctx, typedValue.resourceId); animator.setTarget(v);//from w w w .ja v a 2s . c o m return animator; }
From source file:com.stanleyidesis.quotograph.ui.activity.LWQSettingsActivity.java
void animateAction(final View button) { runOnUiThread(new Runnable() { @Override// w w w .j a va2 s.co m public void run() { final Animator animator = AnimatorInflater.loadAnimator(LWQSettingsActivity.this, R.animator.progress_rotation); animator.setTarget(button); button.setTag(R.id.view_tag_animator, animator); animator.start(); } }); }
From source file:com.stanleyidesis.quotograph.ui.activity.LWQSettingsActivity.java
void animateContainer(final View container, final boolean dismiss) { container.setVisibility(View.VISIBLE); Animator animator = dismiss ? AnimatorInflater.loadAnimator(this, R.animator.exit_to_left) : AnimatorInflater.loadAnimator(this, R.animator.enter_from_right); animator.setTarget(container);/*from w ww .j av a 2 s. com*/ animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (dismiss) { container.setVisibility(View.GONE); UIUtils.dismissKeyboard(LWQSettingsActivity.this); } else { UIUtils.revealKeyboard(container == addEditQuote ? editableQuote : editableQuery); } } }); animator.start(); }