Search in sources :

Example 11 with Gallery

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;
}
Also used : Gallery(android.widget.Gallery) View(android.view.View)

Example 12 with Gallery

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;
}
Also used : Gallery(android.widget.Gallery) OnClickListener(android.view.View.OnClickListener) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 13 with Gallery

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;
}
Also used : Gallery(android.widget.Gallery)

Example 14 with Gallery

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;
}
Also used : Gallery(android.widget.Gallery) View(android.view.View)

Example 15 with Gallery

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;
}
Also used : LayoutParams(android.widget.Gallery.LayoutParams) RemoteImageView(com.github.ignition.core.widgets.RemoteImageView) FrameLayout(android.widget.FrameLayout) LayoutParams(android.widget.Gallery.LayoutParams) Gallery(android.widget.Gallery)

Aggregations

Gallery (android.widget.Gallery)19 View (android.view.View)15 AdapterView (android.widget.AdapterView)5 ImageView (android.widget.ImageView)5 OnClickListener (android.view.View.OnClickListener)2 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)2 RemoteImageView (com.github.ignition.core.widgets.RemoteImageView)2 ViewGroup (android.view.ViewGroup)1 FrameLayout (android.widget.FrameLayout)1 LayoutParams (android.widget.Gallery.LayoutParams)1 TextView (android.widget.TextView)1 RemoteImageGalleryAdapter (com.github.ignition.core.adapters.RemoteImageGalleryAdapter)1 RemoteImageLoader (com.github.ignition.support.images.remote.RemoteImageLoader)1 IImageFilter (com.marshalchen.common.uimodule.ImageFilter.IImageFilter)1