com.nostra13.universalimageloader.core.assist.PauseOnScrollListener Java Examples

The following examples show how to use com.nostra13.universalimageloader.core.assist.PauseOnScrollListener. 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: GenericChannelsFragment.java    From buddycloud-android with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	View view = inflater.inflate(R.layout.channel_list, container, false);
	
	OnChildClickListener channelItemListener = new OnChildClickListener() {
		@Override
		public boolean onChildClick(ExpandableListView parent, View v,
				int groupPosition, int childPosition, long id) {
			JSONObject channelItem = (JSONObject) adapter.getChild(groupPosition, childPosition);
			channelSelected(channelItem);
			return true;
		}
	};
	
	ExpandableListView channelsView = (ExpandableListView) view.findViewById(R.id.channelListView);
	channelsView.setEmptyView(view.findViewById(R.id.channelListProgress));
	channelsView.setAdapter(adapter);
	channelsView.setOnChildClickListener(channelItemListener);
	
	PauseOnScrollListener listener = new PauseOnScrollListener(ImageLoader.getInstance(), true, true);
	channelsView.setOnScrollListener(listener);
	expandAll(view);
	
	return view;
}
 
Example #2
Source File: PostListFragment.java    From Broadsheet.ie-Android with MIT License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = super.onCreateView(inflater, container, savedInstanceState);

    // Get original ListView and Frame
    ListView originalLv = (ListView) layout.findViewById(android.R.id.list);
    ViewGroup frame = (ViewGroup) originalLv.getParent();

    // Remove old ListView
    frame.removeView(originalLv);

    // Create new PullToRefreshListView and add to Frame
    mPullRefreshListView = new PullToRefreshListView(getActivity());
    frame.addView(mPullRefreshListView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
        @Override
        public void onRefresh(PullToRefreshBase<ListView> refreshView) {
            fetchPosts(null);
        }
    });

    boolean pauseOnScroll = false;
    boolean pauseOnFling = true;
    PauseOnScrollListener listener = new PauseOnScrollListener(ImageLoader.getInstance(), pauseOnScroll,
            pauseOnFling);
    mPullRefreshListView.setOnScrollListener(listener);

    return layout;
}
 
Example #3
Source File: CommentListActivity.java    From Broadsheet.ie-Android with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_comment_list);

    if (savedInstanceState != null) {
        Log.d(TAG, "saved instance");
        mPost = (Post) savedInstanceState.getSerializable(CURRENT_POST);
    } else {
        Bundle extras = getIntent().getExtras();

        if (extras != null) {
            BroadsheetApplication app = (BroadsheetApplication) getApplication();

            if (app.getPosts().size() > 0) {
                mPost = app.getPosts().get(extras.getInt("item_id"));
            }
        }
    }

    ListView list = (ListView) findViewById(android.R.id.list);

    comments = new CommentAdapter(this, R.layout.comment_list_item, mPost.getSortedComments());
    comments.setReplyCommentListener(this);

    list.setAdapter(comments);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    boolean pauseOnScroll = false;
    boolean pauseOnFling = true;
    PauseOnScrollListener listener = new PauseOnScrollListener(ImageLoader.getInstance(), pauseOnScroll,
            pauseOnFling);
    list.setOnScrollListener(listener);

    setTitle(getResources().getString(R.string.comment));
}
 
Example #4
Source File: CustomGalleryActivity.java    From MultipleImagePicker with Apache License 2.0 4 votes vote down vote up
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();

	}