Java Code Examples for android.view.View.onStartTemporaryDetach()

The following are Jave code examples for showing how to use onStartTemporaryDetach() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: letv   File: ViewCompat.java   Source Code and License Vote up 5 votes
public void dispatchStartTemporaryDetach(View view) {
    if (!this.mTempDetachBound) {
        bindTempDetach();
    }
    if (this.mDispatchStartTemporaryDetach != null) {
        try {
            this.mDispatchStartTemporaryDetach.invoke(view, new Object[0]);
            return;
        } catch (Exception e) {
            Log.d("ViewCompat", "Error calling dispatchStartTemporaryDetach", e);
            return;
        }
    }
    view.onStartTemporaryDetach();
}
 
Example 2
Project: boohee_v5.6   File: ViewCompat.java   Source Code and License Vote up 5 votes
public void dispatchStartTemporaryDetach(View view) {
    if (!this.mTempDetachBound) {
        bindTempDetach();
    }
    if (this.mDispatchStartTemporaryDetach != null) {
        try {
            this.mDispatchStartTemporaryDetach.invoke(view, new Object[0]);
            return;
        } catch (Exception e) {
            Log.d("ViewCompat", "Error calling dispatchStartTemporaryDetach", e);
            return;
        }
    }
    view.onStartTemporaryDetach();
}
 
Example 3
Project: exciting-app   File: AbsHListView.java   Source Code and License Vote up 4 votes
/**
 * Put a view into the ScrapViews list. These views are unordered.
 * 
 * @param scrap
 *            The view to add
 */
@SuppressLint("NewApi")
public void addScrapView(View scrap, int position) {
	AbsHListView.LayoutParams lp = (AbsHListView.LayoutParams) scrap
			.getLayoutParams();
	if (lp == null) {
		return;
	}

	lp.scrappedFromPosition = position;

	// Don't put header or footer views or views that should be ignored
	// into the scrap heap
	int viewType = lp.viewType;

	final boolean scrapHasTransientState = android.os.Build.VERSION.SDK_INT >= 16 ? scrap
			.hasTransientState() : false;

	if (!shouldRecycleViewType(viewType) || scrapHasTransientState) {
		if (viewType != ITEM_VIEW_TYPE_HEADER_OR_FOOTER
				|| scrapHasTransientState) {
			if (mSkippedScrap == null) {
				mSkippedScrap = new ArrayList<View>();
			}
			mSkippedScrap.add(scrap);
		}
		if (scrapHasTransientState) {
			if (mTransientStateViews == null) {
				mTransientStateViews = new SparseArrayCompat<View>();
			}
			scrap.onStartTemporaryDetach();
			mTransientStateViews.put(position, scrap);
		}
		return;
	}

	scrap.onStartTemporaryDetach();
	if (mViewTypeCount == 1) {
		mCurrentScrap.add(scrap);
	} else {
		mScrapViews[viewType].add(scrap);
	}

	if (android.os.Build.VERSION.SDK_INT >= 14) {
		scrap.setAccessibilityDelegate(null);
	}

	if (mRecyclerListener != null) {
		mRecyclerListener.onMovedToScrapHeap(scrap);
	}
}
 
Example 4
Project: exciting-app   File: AbsHListView.java   Source Code and License Vote up 4 votes
/**
 * Move all views remaining in mActiveViews to mScrapViews.
 */
@SuppressLint("NewApi")
public void scrapActiveViews() {
	final View[] activeViews = mActiveViews;
	final boolean hasListener = mRecyclerListener != null;
	final boolean multipleScraps = mViewTypeCount > 1;

	ArrayList<View> scrapViews = mCurrentScrap;
	final int count = activeViews.length;
	for (int i = count - 1; i >= 0; i--) {
		final View victim = activeViews[i];
		if (victim != null) {
			final AbsHListView.LayoutParams lp = (AbsHListView.LayoutParams) victim
					.getLayoutParams();
			int whichScrap = lp.viewType;

			activeViews[i] = null;

			final boolean scrapHasTransientState = android.os.Build.VERSION.SDK_INT >= 16 ? victim
					.hasTransientState() : false;
			if (!shouldRecycleViewType(whichScrap)
					|| scrapHasTransientState) {
				// Do not move views that should be ignored
				if (whichScrap != ITEM_VIEW_TYPE_HEADER_OR_FOOTER
						|| scrapHasTransientState) {
					removeDetachedView(victim, false);
				}
				if (scrapHasTransientState) {
					if (mTransientStateViews == null) {
						mTransientStateViews = new SparseArrayCompat<View>();
					}
					mTransientStateViews.put(mFirstActivePosition + i,
							victim);
				}
				continue;
			}

			if (multipleScraps) {
				scrapViews = mScrapViews[whichScrap];
			}
			victim.onStartTemporaryDetach();
			lp.scrappedFromPosition = mFirstActivePosition + i;
			scrapViews.add(victim);

			if (android.os.Build.VERSION.SDK_INT >= 14) {
				victim.setAccessibilityDelegate(null);
			}

			if (hasListener) {
				mRecyclerListener.onMovedToScrapHeap(victim);
			}
		}
	}

	pruneScrapViews();
}