Java Code Examples for android.view.View#hashCode()
The following examples show how to use
android.view.View#hashCode() .
These examples are extracted from open source projects.
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 Project: InteractiveChart File: XRadioGroup.java License: 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 Project: NestedSelectionRadioGroup File: NestedRadioGroup.java License: 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 3
Source Project: Fishing File: RadioGroup.java License: 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 4
Source Project: ToggleButtons File: ToggleGroup.java License: 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 Project: Carbon File: RadioGroup.java License: 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 6
Source Project: ToggleButtons File: ToggleGroup.java License: 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 7
Source Project: cloudinary_android File: ResponsiveUrl.java License: 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 8
Source Project: sa-sdk-android File: WindowHelper.java License: 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 9
Source Project: android-open-project-demo File: AnimationAdapter.java License: 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 10
Source Project: MiBandDecompiled File: ViewAware.java License: 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 11
Source Project: ListViewAnimations File: ViewAnimator.java License: 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 12
Source Project: GankGirl File: ViewAnimator.java License: 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 13
Source Project: UltimateAndroid File: AnimationAdapter.java License: 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 14
Source Project: AndroidUtilCode File: BaseItem.java License: Apache License 2.0 | 4 votes |
private int getViewTypeByView(@NonNull View view) { return view.hashCode() + getClass().hashCode(); }
Example 15
Source Project: AndroidUtilCode File: BaseItem.java License: Apache License 2.0 | 4 votes |
private int getViewTypeByView(@NonNull View view) { return view.hashCode() + getClass().hashCode(); }
Example 16
Source Project: android-open-project-demo File: ViewAware.java License: Apache License 2.0 | 4 votes |
@Override public int getId() { View view = viewRef.get(); return view == null ? super.hashCode() : view.hashCode(); }
Example 17
Source Project: CountDownTask File: ViewAware.java License: Apache License 2.0 | 4 votes |
public int getId() { View view = mViewRef.get(); return view == null ? super.hashCode() : view.hashCode(); }
Example 18
Source Project: Dali File: ImageReference.java License: 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 Project: BigApp_WordPress_Android File: ViewAware.java License: Apache License 2.0 | 4 votes |
@Override public int getId() { View view = viewRef.get(); return view == null ? super.hashCode() : view.hashCode(); }
Example 20
Source Project: Klyph File: KlyphAnimationAdapter.java License: 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; }