當前位置: 首頁>>代碼示例>>Java>>正文


Java View.hasTransientState方法代碼示例

本文整理匯總了Java中android.view.View.hasTransientState方法的典型用法代碼示例。如果您正苦於以下問題:Java View.hasTransientState方法的具體用法?Java View.hasTransientState怎麽用?Java View.hasTransientState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.View的用法示例。


在下文中一共展示了View.hasTransientState方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: pruneScrapViews

import android.view.View; //導入方法依賴的package包/類
/**
 * Makes sure that the size of mScrapViews does not exceed the size of
 * mActiveViews. (This can happen if an adapter does not recycle its
 * views).
 */
@SuppressLint("NewApi")
private void pruneScrapViews() {
	final int maxViews = mActiveViews.length;
	final int viewTypeCount = mViewTypeCount;
	final ArrayList<View>[] scrapViews = mScrapViews;
	for (int i = 0; i < viewTypeCount; ++i) {
		final ArrayList<View> scrapPile = scrapViews[i];
		int size = scrapPile.size();
		final int extras = size - maxViews;
		size--;
		for (int j = 0; j < extras; j++) {
			removeDetachedView(scrapPile.remove(size--), false);
		}
	}

	if (mTransientStateViews != null) {
		for (int i = 0; i < mTransientStateViews.size(); i++) {
			final View v = mTransientStateViews.valueAt(i);

			// this code is never executed on android < 16
			if (!v.hasTransientState()) {
				mTransientStateViews.removeAt(i);
				i--;
			}
		}
	}
}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:33,代碼來源:AbsHListView.java

示例2: cancelAnimationsRecursive

import android.view.View; //導入方法依賴的package包/類
protected static void cancelAnimationsRecursive(View view) {
    if (view != null && view.hasTransientState()) {
        view.animate().cancel();
        if (view instanceof ViewGroup) {
            final int count = ((ViewGroup) view).getChildCount();
            for (int i = 0; view.hasTransientState() && i < count; i++) {
                cancelAnimationsRecursive(((ViewGroup) view).getChildAt(i));
            }
        }
    }
}
 
開發者ID:JarvisGG,項目名稱:ObjectAdapter,代碼行數:12,代碼來源:Presenter.java

示例3: hasTransientState

import android.view.View; //導入方法依賴的package包/類
public static boolean hasTransientState(View view) {
    return view.hasTransientState();
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:4,代碼來源:ViewCompatJB.java

示例4: addScrapView

import android.view.View; //導入方法依賴的package包/類
/**
 * 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);
	}
}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:57,代碼來源:AbsHListView.java

示例5: scrapActiveViews

import android.view.View; //導入方法依賴的package包/類
/**
 * 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();
}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:59,代碼來源:AbsHListView.java


注:本文中的android.view.View.hasTransientState方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。