use of android.widget.Gallery in project android_frameworks_base by ParanoidAndroid.
the class BiDiTestGalleryRtl method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.gallery_rtl, container, false);
Gallery g = (Gallery) v.findViewById(R.id.galleryview);
g.setAdapter(new BiDiTestGalleryImages(this.getActivity().getBaseContext()));
return v;
}
use of android.widget.Gallery in project Fairphone by Kwamecorp.
the class WallpaperChooserDialogFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
findWallpapers();
/* If this fragment is embedded in the layout of this activity, then we should
* generate a view to display. Otherwise, a dialog will be created in
* onCreateDialog()
*/
if (mEmbedded) {
View view = inflater.inflate(R.layout.wallpaper_chooser, container, false);
view.setBackground(mWallpaperDrawable);
final Gallery gallery = (Gallery) view.findViewById(R.id.gallery);
gallery.setCallbackDuringFling(false);
gallery.setOnItemSelectedListener(this);
gallery.setAdapter(new ImageAdapter(getActivity()));
View setButton = view.findViewById(R.id.set);
setButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
selectWallpaper(gallery.getSelectedItemPosition());
}
});
return view;
}
return null;
}
use of android.widget.Gallery in project androidquery by androidquery.
the class Common method shouldDelayGallery.
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;
}
use of android.widget.Gallery in project platform_frameworks_base by android.
the class BiDiTestGalleryLtr method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.gallery_ltr, container, false);
Gallery g = (Gallery) v.findViewById(R.id.galleryview);
g.setAdapter(new BiDiTestGalleryImages(this.getActivity().getBaseContext()));
return v;
}
use of android.widget.Gallery in project ignition by mttkay.
the class RemoteImageGalleryAdapter method getView.
// TODO: both convertView and ViewHolder are pointless at the moment, since there's a framework
// bug which causes views to not be cached in a Gallery widget:
// http://code.google.com/p/android/issues/detail?id=3376
@Override
public View getView(int position, View convertView, ViewGroup parent) {
String imageUrl = (String) getItem(position);
ViewHolder viewHolder = null;
RemoteImageView remoteImageView = null;
if (convertView == null) {
// create the image view
remoteImageView = new RemoteImageView(context, null, progressDrawable, errorDrawable, false);
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
lp.gravity = Gravity.CENTER;
remoteImageView.setLayoutParams(lp);
// create the container layout for the image view
FrameLayout container = new FrameLayout(context);
container.setLayoutParams(new Gallery.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
container.addView(remoteImageView, 0);
convertView = container;
viewHolder = new ViewHolder();
viewHolder.webImageView = remoteImageView;
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
remoteImageView = viewHolder.webImageView;
}
// calling reset is important to prevent old images from displaying in a recycled view.
remoteImageView.reset();
remoteImageView.setImageUrl(imageUrl);
remoteImageView.loadImage();
onGetView(position, remoteImageView, (ViewGroup) convertView, parent);
return convertView;
}
Aggregations