当前位置: 首页>>代码示例>>Java>>正文


Java Gallery.getFirstVisiblePosition方法代码示例

本文整理汇总了Java中android.widget.Gallery.getFirstVisiblePosition方法的典型用法代码示例。如果您正苦于以下问题:Java Gallery.getFirstVisiblePosition方法的具体用法?Java Gallery.getFirstVisiblePosition怎么用?Java Gallery.getFirstVisiblePosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.Gallery的用法示例。


在下文中一共展示了Gallery.getFirstVisiblePosition方法的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.getFirstVisiblePosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。