Java Code Examples for android.widget.GridView#setOnScrollListener()
The following examples show how to use
android.widget.GridView#setOnScrollListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From android-art-res with Apache License 2.0 | 6 votes |
private void initView() { mImageGridView = (GridView) findViewById(R.id.gridView1); mImageAdapter = new ImageAdapter(this); mImageGridView.setAdapter(mImageAdapter); mImageGridView.setOnScrollListener(this); if (!mIsWifi) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("初次使用会从网络下载大概5MB的图片,确认要下载吗?"); builder.setTitle("注意"); builder.setPositiveButton("是", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mCanGetBitmapFromNetWork = true; mImageAdapter.notifyDataSetChanged(); } }); builder.setNegativeButton("否", null); builder.show(); } }
Example 2
Source File: GalleryFragment.java From remoteyourcam-usb with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { formatParser = new SimpleDateFormat("yyyyMMdd'T'HHmmss.S"); currentScrollState = OnScrollListener.SCROLL_STATE_IDLE; View view = inflater.inflate(R.layout.gallery_frag, container, false); storageSpinner = (Spinner) view.findViewById(R.id.storage_spinner); storageAdapter = new StorageAdapter(getActivity()); storageSpinner.setAdapter(storageAdapter); emptyView = (TextView) view.findViewById(android.R.id.empty); emptyView.setText(getString(R.string.gallery_loading)); galleryView = (GridView) view.findViewById(android.R.id.list); galleryAdapter = new GalleryAdapter(getActivity(), this); galleryAdapter.setReverseOrder(getSettings().isGalleryOrderReversed()); galleryView.setAdapter(galleryAdapter); galleryView.setOnScrollListener(this); galleryView.setEmptyView(emptyView); galleryView.setOnItemClickListener(this); orderCheckbox = (CheckBox) view.findViewById(R.id.reverve_order_checkbox); orderCheckbox.setChecked(getSettings().isGalleryOrderReversed()); orderCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { onReverseOrderStateChanged(isChecked); } }); enableUi(false); ((SessionActivity) getActivity()).setSessionView(this); return view; }
Example 3
Source File: GroupManagerFragment.java From sctalk with Apache License 2.0 | 5 votes |
private void initAdapter(){ logger.d("groupmgr#initAdapter"); gridView = (GridView) curView.findViewById(R.id.group_manager_grid); gridView.setSelector(new ColorDrawable(Color.TRANSPARENT));// 去掉点击时的黄色背影 gridView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), true, true)); adapter = new GroupManagerAdapter(getActivity(),imService,peerEntity); gridView.setAdapter(adapter); }
Example 4
Source File: MediaShowActivity.java From BigApp_WordPress_Android with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.zg_activity_media_show); mTV_catalog_name = (TextView) findViewById(R.id.tv_catalog_name); mTV_catalog_name.setOnClickListener(this); mTV_catalog_name.setEnabled(false); mTV_preview = (TextView) findViewById(R.id.tv_preview); mTV_preview.setOnClickListener(this); mTv_right = (TextView) findViewById(R.id.tv_right); mTv_right.setOnClickListener(this); findViewById(R.id.iv_left).setOnClickListener(this); initMode(); mImageLoader = ImageLoader.getInstance(); mGridView = (GridView) findViewById(R.id.gridview); mGridView.setFastScrollEnabled(true); PauseOnScrollListener listener = new PauseOnScrollListener( mImageLoader, true, true); mGridView.setOnScrollListener(listener); mMediaAdapter = new AdapterMediaShow(this, mediaType, mSelectedList); mGridView.setAdapter(mMediaAdapter); mGridView.setOnItemClickListener(this); new Thread(new getMediaInfoTask(null)).start(); }
Example 5
Source File: SuperGridview.java From UltimateAndroid with Apache License 2.0 | 5 votes |
@Override protected void initAbsListView(View v) { View listView = v.findViewById(android.R.id.list); if (listView instanceof GridView) mList = (GridView) listView; else throw new IllegalArgumentException(listView.getClass().getName()); if (mList!=null) { getList().setNumColumns(mColumns); getList().setVerticalSpacing(mVerticalSpacing); getList().setHorizontalSpacing(mHorizontalSpacing); getList().setHorizontalSpacing((int) mDividerHeight); getList().setVerticalSpacing((int) mDividerHeight); mList.setClipToPadding(mClipToPadding); mList.setOnScrollListener(this); if (mSelector != 0) mList.setSelector(mSelector); if (mPadding != -1.0f) { mList.setPadding(mPadding, mPadding, mPadding, mPadding); } else { mList.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom); } mList.setScrollBarStyle(mScrollbarStyle); } }
Example 6
Source File: PicassoDemoActivity.java From android-open-project-demo with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final PicassoDemoActivity activity = (PicassoDemoActivity) getActivity(); final DemoAdapter adapter = new DemoAdapter(activity); GridView rootView = (GridView) inflater.inflate(R.layout.grid_detail_list, container, false); rootView.setAdapter(adapter); rootView.setOnScrollListener(new DemoScrollListener(activity)); return rootView; }
Example 7
Source File: MainActivity.java From android-open-project-demo with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); gridView = (GridView) findViewById(R.id.grid_photo); PhotoAdapter adapter = new PhotoAdapter(this); gridView.setAdapter(adapter); gridView.setOnItemClickListener(photoClickListener); gridView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), false, true)); }
Example 8
Source File: GalleryFragment.java From remoteyourcam-usb with Apache License 2.0 | 5 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { formatParser = new SimpleDateFormat("yyyyMMdd'T'HHmmss.S"); currentScrollState = OnScrollListener.SCROLL_STATE_IDLE; View view = inflater.inflate(R.layout.gallery_frag, container, false); storageSpinner = (Spinner) view.findViewById(R.id.storage_spinner); storageAdapter = new StorageAdapter(getActivity()); storageSpinner.setAdapter(storageAdapter); emptyView = (TextView) view.findViewById(android.R.id.empty); emptyView.setText(getString(R.string.gallery_loading)); galleryView = (GridView) view.findViewById(android.R.id.list); galleryAdapter = new GalleryAdapter(getActivity(), this); galleryAdapter.setReverseOrder(getSettings().isGalleryOrderReversed()); galleryView.setAdapter(galleryAdapter); galleryView.setOnScrollListener(this); galleryView.setEmptyView(emptyView); galleryView.setOnItemClickListener(this); orderCheckbox = (CheckBox) view.findViewById(R.id.reverve_order_checkbox); orderCheckbox.setChecked(getSettings().isGalleryOrderReversed()); orderCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { onReverseOrderStateChanged(isChecked); } }); enableUi(false); ((SessionActivity) getActivity()).setSessionView(this); return view; }
Example 9
Source File: DemoSecondActivity.java From XImageLoader with Apache License 2.0 | 4 votes |
private void initViews() { mGridView = (GridView) findViewById(R.id.gridView); mImageAdapter = new ImageAdapter(this, urls); mGridView.setAdapter(mImageAdapter); mGridView.setOnScrollListener(this); }
Example 10
Source File: CustomGalleryActivity.java From MultipleImagePicker with Apache License 2.0 | 4 votes |
private void init() { handler = new Handler(); gridGallery = (GridView) findViewById(R.id.gridGallery); gridGallery.setFastScrollEnabled(true); adapter = new CustomGalleryAdapter(getApplicationContext(), imageLoader); PauseOnScrollListener listener = new PauseOnScrollListener(imageLoader, true, true); gridGallery.setOnScrollListener(listener); if (action.equalsIgnoreCase(Action.ACTION_MULTIPLE_PICK)) { findViewById(R.id.llBottomContainer).setVisibility(View.VISIBLE); gridGallery.setOnItemClickListener(mItemMulClickListener); adapter.setMultiplePick(true); } else if (action.equalsIgnoreCase(Action.ACTION_PICK)) { findViewById(R.id.llBottomContainer).setVisibility(View.GONE); gridGallery.setOnItemClickListener(mItemSingleClickListener); adapter.setMultiplePick(false); } gridGallery.setAdapter(adapter); imgNoMedia = (ImageView) findViewById(R.id.imgNoMedia); btnGalleryOk = (Button) findViewById(R.id.btnGalleryOk); btnGalleryOk.setOnClickListener(mOkClickListener); new Thread() { @Override public void run() { Looper.prepare(); handler.post(new Runnable() { @Override public void run() { adapter.addAll(getGalleryPhotos()); checkImageStatus(); } }); Looper.loop(); }; }.start(); }
Example 11
Source File: ImageWallGridAdapter.java From GreenDamFileExploere with Apache License 2.0 | 4 votes |
public ImageWallGridAdapter(Context mContext, List<String> mImages, GridView mGridView) { this.mContext = mContext; this.mImages = mImages; this.mGridView = mGridView; mGridView.setOnScrollListener(this); }