use of greendroid.widget.PagedView in project simplefacebook by androidquery.
the class ImageActivity method initView.
private void initView() {
photos = new ArrayList<FeedItem>();
pv = (PagedView) findViewById(R.id.paged);
pi = (PageIndicator) findViewById(R.id.page_indicator);
pv.setOnPageChangeListener(new OnPagedViewChangeListener() {
@Override
public void onStopTracking(PagedView pagedView) {
}
@Override
public void onStartTracking(PagedView pagedView) {
}
@Override
public void onPageChanged(PagedView pagedView, int previousPage, int newPage) {
pi.setActiveDot(newPage);
}
});
adapter = new PagedAdapter() {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (position >= photos.size())
return PageAdapter.getEmptyView(parent);
FeedItem item = photos.get(position);
String url = item.getSource();
if (url == null)
return PageAdapter.getEmptyView(parent);
String name = item.getItemName();
View cached = photoViews.get(url);
if (cached == null) {
convertView = aq.inflate(null, R.layout.item_photo, parent);
photoViews.put(url, convertView);
} else {
convertView = cached;
return convertView;
}
PQuery aq = aq2.recycle(convertView);
aq.id(R.id.web).progress(R.id.progress).invisible();
AQUtility.debug("image load url", url);
aq.webImage(url, true, false, 0xFF000000);
aq.id(R.id.text).text(name, BufferType.NORMAL, true);
convertView.setDrawingCacheEnabled(true);
return convertView;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public Object getItem(int position) {
return photos.get(position);
}
@Override
public int getCount() {
return photos.size();
}
};
pv.setAdapter(adapter);
}
use of greendroid.widget.PagedView in project GreenDroid by cyrilmottier.
the class PagedViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setActionBarContentView(R.layout.paged_view);
final PagedView pagedView = (PagedView) findViewById(R.id.paged_view);
pagedView.setOnPageChangeListener(mOnPagedViewChangedListener);
pagedView.setAdapter(new PhotoSwipeAdapter());
mPageIndicatorNext = (PageIndicator) findViewById(R.id.page_indicator_next);
mPageIndicatorNext.setDotCount(PAGE_MAX_INDEX);
mPageIndicatorNext.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
pagedView.smoothScrollToNext();
}
});
mPageIndicatorPrev = (PageIndicator) findViewById(R.id.page_indicator_prev);
mPageIndicatorPrev.setDotCount(PAGE_MAX_INDEX);
mPageIndicatorPrev.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
pagedView.smoothScrollToPrevious();
}
});
mPageIndicatorOther = (PageIndicator) findViewById(R.id.page_indicator_other);
mPageIndicatorOther.setDotCount(PAGE_COUNT);
setActivePage(pagedView.getCurrentPage());
}
Aggregations