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


Java Gallery.getLastVisiblePosition方法代碼示例

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


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

示例1: shouldDelayGallery

import android.widget.Gallery; //導入方法依賴的package包/類
private static boolean shouldDelayGallery(int position, View convertView, ViewGroup parent, String url)
{
	if (url == null || BitmapAjaxCallback.isMemoryCached(url))
	{
		return false;
	}
	Gallery gallery = (Gallery) parent;
	Integer selected = (Integer) gallery.getTag(AQuery.TAG_NUM);
	if (selected == null)
	{
		selected = 0;
		gallery.setTag(AQuery.TAG_NUM, 0);
		gallery.setCallbackDuringFling(false);
		Common common = new Common();
		common.listen(gallery);
	}
	int first = gallery.getFirstVisiblePosition();
	int last = gallery.getLastVisiblePosition();
	int diff = last - first;
	int delta = (diff / 2) + 1;
	int from = selected - delta;
	int to = selected + delta;
	if (from < 0)
	{
		//shift window back to positive region
		to = to - from;
		from = 0;
	}
	if ((position >= from && position <= to))
	{
		//AQUtility.debug("yes", position + ":" + from + "." + to);
		convertView.setTag(AQuery.TAG_NUM, position);
		return false;
	}
	//AQUtility.debug("no", position + ":" + from + "." + to);
	convertView.setTag(AQuery.TAG_NUM, null);
	return true;
}
 
開發者ID:libit,項目名稱:lr_dialer,代碼行數:39,代碼來源:Common.java

示例2: shouldDelayGallery

import android.widget.Gallery; //導入方法依賴的package包/類
private static boolean shouldDelayGallery(int position, View convertView, ViewGroup parent, String url){
	

	if(url == null || BitmapAjaxCallback.isMemoryCached(url)){
		return false;
	}
	
	Gallery gallery = (Gallery) parent;
	
	Integer selected = (Integer) gallery.getTag(AQuery.TAG_NUM);
	
	if(selected == null){
		
		selected = 0;
		gallery.setTag(AQuery.TAG_NUM, 0);
		
		gallery.setCallbackDuringFling(false);
		
		Common common = new Common();
		common.listen(gallery);
		
	}
	
	int first = gallery.getFirstVisiblePosition();
	int last = gallery.getLastVisiblePosition();
	
	int diff = last - first;
	int delta = (diff / 2) + 1;
	
	int from = selected - delta;
	int to = selected + delta;
	
	if(from < 0){
		//shift window back to positive region
		to = to - from;
		from = 0;
	}
	
	if((position >= from && position <= to)){
		
		//AQUtility.debug("yes", position + ":" + from + "." + to);
		convertView.setTag(AQuery.TAG_NUM, position);
		
		return false;
	}
	
	//AQUtility.debug("no", position + ":" + from + "." + to);
	convertView.setTag(AQuery.TAG_NUM, null);
	return true;
	
}
 
開發者ID:bblue000,項目名稱:ExoPlayerDemo,代碼行數:52,代碼來源:Common.java

示例3: shouldDelayGallery

import android.widget.Gallery; //導入方法依賴的package包/類
private static boolean shouldDelayGallery(int position, View convertView,
		ViewGroup parent, String url) {

	if (url == null || BitmapAjaxCallback.isMemoryCached(url)) {
		return false;
	}

	Gallery gallery = (Gallery) parent;

	Integer selected = (Integer) gallery.getTag(Constants.TAG_NUM);

	if (selected == null) {

		selected = 0;
		gallery.setTag(Constants.TAG_NUM, 0);

		gallery.setCallbackDuringFling(false);

		Common common = new Common();
		common.listen(gallery);

	}

	int first = gallery.getFirstVisiblePosition();
	int last = gallery.getLastVisiblePosition();

	int diff = last - first;
	int delta = (diff / 2) + 1;

	int from = selected - delta;
	int to = selected + delta;

	if (from < 0) {
		// shift window back to positive region
		to = to - from;
		from = 0;
	}

	if ((position >= from && position <= to)) {

		// AQUtility.debug("yes", position + ":" + from + "." + to);
		convertView.setTag(Constants.TAG_NUM, position);

		return false;
	}

	// AQUtility.debug("no", position + ":" + from + "." + to);
	convertView.setTag(Constants.TAG_NUM, null);
	return true;

}
 
開發者ID:steven2947,項目名稱:NeXT_pyp,代碼行數:52,代碼來源:Common.java


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