@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; }
@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; }
@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)); }
private void init() { handler = new Handler(); gridGallery = (GridView) findViewById(R.id.gridGallery); gridGallery.setFastScrollEnabled(true); adapter = new GalleryAdapter(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(); }
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(); }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); animeAdapter.setSupplementaryTextFactory(getSupplementaryTextFactory()); itemListView.setAdapter(animeAdapter); itemListView.setOnItemClickListener(this); PauseOnScrollListener listener = new PauseOnScrollListener(lazyLoader, false, true); itemListView.setOnScrollListener(listener); animeLoader = getLoaderManager().initLoader(0, null, this); animeLoader.forceLoad(); }
private void applyScrollListener() { listView.setOnScrollListener(new PauseOnScrollListener(imageLoader, pauseOnScroll, pauseOnFling)); }