Java Code Examples for android.view.View#hashCode()
The following examples show how to use
android.view.View#hashCode() .
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: XRadioGroup.java From InteractiveChart with Apache License 2.0 | 6 votes |
/** * 设置监听 */ private void setListener(View child) { if (child instanceof RadioButton) { int id = child.getId(); // generates an id if it's missing if (id == View.NO_ID) { id = child.hashCode(); child.setId(id); } ((RadioButton) child).setOnCheckedChangeListener( mChildOnCheckedChangeListener); } else if (child instanceof ViewGroup) { ViewGroup view = (ViewGroup) child; for (int i = 0; i < view.getChildCount(); i++) { setListener(view.getChildAt(i)); } } }
Example 2
Source File: ToggleGroup.java From ToggleButtons with MIT License | 6 votes |
/** * {@inheritDoc} */ public void onChildViewAdded(View parent, View child) { if (parent == ToggleGroup.this && child instanceof CompoundButton) { int id = child.getId(); // generates an id if it's missing if (id == View.NO_ID) { if (Build.VERSION.SDK_INT < 17) id = child.hashCode(); else id = View.generateViewId(); child.setId(id); } ((CompoundButton) child).setOnCheckedChangeListener(mChildOnCheckedChangeListener); } if (mOnHierarchyChangeListener != null) { mOnHierarchyChangeListener.onChildViewAdded(parent, child); } }
Example 3
Source File: RadioGroup.java From Carbon with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ public void onChildViewAdded(View parent, View child) { if (parent == RadioGroup.this && child instanceof RadioButton) { int id = child.getId(); // generates an id if it's missing if (id == View.NO_ID) { id = child.hashCode(); child.setId(id); } ((RadioButton) child).setOnCheckedChangeWidgetListener( mChildOnCheckedChangeListener); } if (mOnHierarchyChangeListener != null) { mOnHierarchyChangeListener.onChildViewAdded(parent, child); } }
Example 4
Source File: ToggleGroup.java From ToggleButtons with MIT License | 6 votes |
/** * {@inheritDoc} */ public void onChildViewAdded(View parent, View child) { if (parent == ToggleGroup.this && child instanceof CompoundButton) { int id = child.getId(); // generates an id if it's missing if (id == View.NO_ID) { if (Build.VERSION.SDK_INT < 17) id = child.hashCode(); else id = View.generateViewId(); child.setId(id); } ((CompoundButton) child).setOnCheckedChangeListener(mChildOnCheckedChangeListener); } if (mOnHierarchyChangeListener != null) { mOnHierarchyChangeListener.onChildViewAdded(parent, child); } }
Example 5
Source File: RadioGroup.java From Fishing with GNU General Public License v3.0 | 6 votes |
/** * {@inheritDoc} */ public void onChildViewAdded(View parent, View child) { if (parent == RadioGroup.this && child instanceof RadioButton) { int id = child.getId(); // generates an id if it's missing if (id == View.NO_ID) { id = child.hashCode(); child.setId(id); } ((RadioButton) child).setOnCheckedChangeListener( mChildOnCheckedChangeListener); } if (mOnHierarchyChangeListener != null) { mOnHierarchyChangeListener.onChildViewAdded(parent, child); } }
Example 6
Source File: NestedRadioGroup.java From NestedSelectionRadioGroup with Apache License 2.0 | 6 votes |
/** * 设置监听 * * @param child */ private void setListener(View child) { if (child instanceof NestedRadioLayout) { int id = child.getId(); // generates an id if it's missing if (id == View.NO_ID) { id = child.hashCode(); child.setId(id); } ((NestedRadioLayout) child).setOnCheckedChangeWidgetListener( mChildOnCheckedChangeListener); } else if (child instanceof ViewGroup) { ViewGroup view = (ViewGroup) child; for (int i = 0; i < view.getChildCount(); i++) { setListener(view.getChildAt(i)); } } }
Example 7
Source File: AnimationAdapter.java From android-open-project-demo with Apache License 2.0 | 5 votes |
private void cancelExistingAnimation(final View convertView) { int hashCode = convertView.hashCode(); Animator animator = mAnimators.get(hashCode); if (animator != null) { animator.end(); mAnimators.remove(hashCode); } }
Example 8
Source File: ViewAware.java From MiBandDecompiled with Apache License 2.0 | 5 votes |
public int getId() { View view = (View)viewRef.get(); if (view == null) { return super.hashCode(); } else { return view.hashCode(); } }
Example 9
Source File: ViewAnimator.java From ListViewAnimations with Apache License 2.0 | 5 votes |
/** * Cancels any existing animations for given View. */ void cancelExistingAnimation(@NonNull final View view) { int hashCode = view.hashCode(); Animator animator = mAnimators.get(hashCode); if (animator != null) { animator.end(); mAnimators.remove(hashCode); } }
Example 10
Source File: ViewAnimator.java From GankGirl with GNU Lesser General Public License v2.1 | 5 votes |
/** * Cancels any existing animations for given View. */ public void cancelExistingAnimation(@NonNull final View view) { int hashCode = view.hashCode(); Animator animator = mAnimators.get(hashCode); if (animator != null) { animator.end(); mAnimators.remove(hashCode); } }
Example 11
Source File: WindowHelper.java From sa-sdk-android with Apache License 2.0 | 5 votes |
public int compare(View lhs, View rhs) { int lhsHashCode = lhs.hashCode(); int rhsHashCode = rhs.hashCode(); int currentHashCode = AppStateManager.getInstance().getCurrentRootWindowsHashCode(); if (lhsHashCode == currentHashCode) { return -1; } else { return rhsHashCode == currentHashCode ? 1 : rhs.getWidth() * rhs.getHeight() - lhs.getWidth() * lhs.getHeight(); } }
Example 12
Source File: AnimationAdapter.java From UltimateAndroid with Apache License 2.0 | 5 votes |
private void cancelExistingAnimation(final View convertView) { int hashCode = convertView.hashCode(); Animator animator = mAnimators.get(hashCode); if (animator != null) { animator.end(); mAnimators.remove(hashCode); } }
Example 13
Source File: ResponsiveUrl.java From cloudinary_android with MIT License | 5 votes |
/** * Generate the modified url. * * @param baseUrl A url to be used as a base to the responsive transformation. This url can * contain any configurations and transformations. The generated responsive * transformation will be chained as the last transformation in the url. * Important: When generating using a base url, it's preferable to not include * any cropping/scaling in the original transformations. * @param view The view to adapt the resource dimensions to. * @param callback Callback to called when the modified Url is ready. */ public void generate(final Url baseUrl, final View view, final Callback callback) { assertViewValidForResponsive(view); final int key = view.hashCode(); int width = view.getWidth(); int height = view.getHeight(); if (conditionsAreMet(width, height)) { // The required dimensions are already known, build url: callback.onUrlReady(buildUrl(view, baseUrl)); viewsInProgress.remove(key); } else { // save the link between the requested url and the specific view, so that // if in the meantime the view is assigned a new item (e.g. recycling views in a list) // it won't override the correct data. viewsInProgress.put(key, baseUrl); view.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { view.getViewTreeObserver().removeOnPreDrawListener(this); if (baseUrl.equals(viewsInProgress.get(key))) { callback.onUrlReady(buildUrl(view, baseUrl)); viewsInProgress.remove(key); } return true; } }); } }
Example 14
Source File: BaseItem.java From AndroidUtilCode with Apache License 2.0 | 4 votes |
private int getViewTypeByView(@NonNull View view) { return view.hashCode() + getClass().hashCode(); }
Example 15
Source File: BaseItem.java From AndroidUtilCode with Apache License 2.0 | 4 votes |
private int getViewTypeByView(@NonNull View view) { return view.hashCode() + getClass().hashCode(); }
Example 16
Source File: ViewAware.java From android-open-project-demo with Apache License 2.0 | 4 votes |
@Override public int getId() { View view = viewRef.get(); return view == null ? super.hashCode() : view.hashCode(); }
Example 17
Source File: ViewAware.java From CountDownTask with Apache License 2.0 | 4 votes |
public int getId() { View view = mViewRef.get(); return view == null ? super.hashCode() : view.hashCode(); }
Example 18
Source File: ImageReference.java From Dali with Apache License 2.0 | 4 votes |
public ImageReference(View view) { this.view = view; this.contentId = "view_" + view.hashCode(); this.type = SourceType.VIEW; }
Example 19
Source File: ViewAware.java From BigApp_WordPress_Android with Apache License 2.0 | 4 votes |
@Override public int getId() { View view = viewRef.get(); return view == null ? super.hashCode() : view.hashCode(); }
Example 20
Source File: KlyphAnimationAdapter.java From Klyph with MIT License | 4 votes |
@Override public final View getView(int position, View convertView, ViewGroup parent) { boolean alreadyStarted = false; if (!mHasParentAnimationAdapter) { if (getListView() == null) { throw new IllegalStateException("Call setListView() on this AnimationAdapter before setAdapter()!"); } if (convertView != null) { int hashCode = convertView.hashCode(); AnimationInfo animationInfo = mAnimators.get(hashCode); if (animationInfo != null) { if (animationInfo.position != position) { animationInfo.animator.end(); mAnimators.remove(hashCode); } else { alreadyStarted = true; } } } } View itemView = super.getView(position, convertView, parent); if (nextDeactivated <= 0) { if (!mHasParentAnimationAdapter && !alreadyStarted && animationsEnabled) { animateViewIfNecessary(position, itemView, parent); } } else { nextDeactivated--; } return itemView; }