本文整理匯總了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;
}
示例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;
}
示例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;
}