private void init() { this.mStatusCache = FileCache.get(this.ctx, getClass().getName()); this.mMealType = getIntent().getStringExtra("meal_type"); setActionBarTitle(); this.mBean = getCacheData(); this.mDatas = this.mBean != null ? this.mBean.getMeals() : new ArrayList(); this.loadingFooter = new TurboLoadingFooter(this); this.mAdapter = new SelectStatusAdapter(this.ctx, this.mDatas); this.mListView = (PullToRefreshListView) this.finder.find(R.id.listView); ((ListView) this.mListView.getRefreshableView()).addFooterView(this.loadingFooter.getView ()); this.mListView.setOnScrollListener(new PauseOnScrollListener(this.imageLoader, true, true)); this.mListView.setOnRefreshListener(new RefreshL()); this.mListView.setOnLastItemVisibleListener(new LoadMoreL()); this.mListView.setOnItemClickListener(this); this.mListView.setAdapter(this.mAdapter); }
/** * @Description 初始化界面资源 */ private void initRes() { // 设置顶部标题栏 showContactTopBar(); hideTopBar(); super.init(curView); showProgressBar(); sortSideBar = (SortSideBar) curView.findViewById(R.id.sidrbar); dialog = (TextView) curView.findViewById(R.id.dialog); sortSideBar.setTextView(dialog); sortSideBar.setOnTouchingLetterChangedListener(this); allContactListView = (ListView) curView.findViewById(R.id.all_contact_list); departmentContactListView = (ListView) curView.findViewById(R.id.department_contact_list); //this is critical, disable loading when finger sliding, otherwise you'll find sliding is not very smooth allContactListView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), true, true)); departmentContactListView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), true, true)); // todo eric // showLoadingProgressBar(true); }
private void findViews() { // loading loadingFrame = findView(R.id.contact_loading_frame); // count View countLayout = View.inflate(getView().getContext(), R.layout.nim_contacts_count_item, null); countLayout.setClickable(false); countText = (TextView) countLayout.findViewById(R.id.contactCountText); // ListView listView = findView(R.id.contact_list_view); listView.addFooterView(countLayout); // 注意:addFooter要放在setAdapter之前,否则旧版本手机可能会add不上 listView.setAdapter(adapter); listView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), true, true)); ContactItemClickListener listener = new ContactItemClickListener(); listView.setOnItemClickListener(listener); listView.setOnItemLongClickListener(listener); }
/** * �ܶ��Ա�����ij�ʼ������ */ public PhotoWallAdapter(Context context, int textViewResourceId, List<Manhua> manhuas, GridView photoWall) { super(context, textViewResourceId, manhuas); mLayoutInflater = LayoutInflater.from(context); mPhotoWall = photoWall; mImageLoader = ImageLoader.getInstance(); mOptions = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.empty_photo) .showImageOnFail(R.drawable.empty_photo) .cacheInMemory(true) .cacheOnDisk(true) .bitmapConfig(android.graphics.Bitmap.Config.RGB_565) .build(); mPhotoWall.setOnScrollListener(new PauseOnScrollListener(mImageLoader, true, true)); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View contentView = inflater.inflate(R.layout.fragment_image_grid_layout, null); imageGridView = (HeaderGridView) contentView.findViewById(R.id.gridGallery); int numColumns = (getResources().getDisplayMetrics().widthPixels - DisplayUtils.dip2px(6, getActivity())) / DisplayUtils.dip2px(116, getActivity()); imageGridView.setNumColumns(numColumns); imageGridView.setVerticalScrollBarEnabled(false); View footerView = new View(getActivity()); LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, DisplayUtils.dip2px(82, getActivity())); footerView.setLayoutParams(lp); imageGridView.addFooterView(footerView, null, false); mAdapter = new ImageGridAdapter(getActivity(), options); mAdapter.setChoseImageListener(mViewImageListener); mAdapter.swapDatas(mImages); PauseOnScrollListener listener = new PauseOnScrollListener(ImageLoader.getInstance(), true, true); imageGridView.setOnScrollListener(listener); imageGridView.setOnItemClickListener(this); imageGridView.setAdapter(mAdapter); return contentView; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mListView = (ListView) inflater.inflate(R.layout.comments_list, container, false); mListView.setAdapter(new CommentsAdapter()); mListView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), true, true)); mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); mListView.setOnItemClickListener(mItemClickListener); mListView.addHeaderView(createPostView()); if(mComments == null) { // Inflate loading layout. mLoadingView = inflater.inflate(R.layout.loading, mListView, false); // Add loadind view to listview bottom. mListView.addFooterView(mLoadingView, null, false); // Send request intent. Intent intent = new Intent(Constants.INTENT_FILTER.ACTION_GET_POST_COMMENTS); intent.putExtra(Constants.BUNDLE.KEY_POST, mLepraPost); LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intent); } return mListView; }
private void initContactListView() { contactListView = (ListView) curView.findViewById(R.id.ContactListView); contactListView.setOnItemClickListener(this); contactListView.setOnItemLongClickListener(this); contactAdapter = new ChatAdapter(getActivity()); contactListView.setAdapter(contactAdapter); // this is critical, disable loading when finger sliding, otherwise // you'll find sliding is not very smooth contactListView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), true, true)); }
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); }
private void initViews() { mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); View headerView= navigationView.inflateHeaderView(R.layout.nav_header_main); navigationView.setNavigationItemSelectedListener(this); headerView.findViewById(R.id.head_img).setOnClickListener(this); headerView.findViewById(R.id.head_web).setOnClickListener(this); headerView.findViewById(R.id.head_name).setOnClickListener(this); mRefreshLayout = (RefreshLayout) findViewById(R.id.id_swipe_ly); mRefreshLayout.setOnRefreshListener(this); mRefreshLayout.setOnLoadListener(this); mAdapter = new GankCommonAdapter(MainActivity.this,null); mListView = (ListView) findViewById(R.id.id_listview); mListView.setAdapter(mAdapter); mListView.setOnItemClickListener(this); mListView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), true, false)); }
private void init(String action) { gv_gallery = (GridView) findViewById(R.id.gallery); gv_gallery.setFastScrollEnabled(true); adapter = new GalleryAdapter(this, imageLoader); PauseOnScrollListener listener = new PauseOnScrollListener(imageLoader, true, true); gv_gallery.setOnScrollListener(listener); if(action.equals(ACTION_PICK_SINGLE)) { findViewById(R.id.container).setVisibility(View.GONE); gv_gallery.setOnItemClickListener(mItemSingleClickListener); adapter.setSelectMode(false); if(picture_max > 1) { picture_max = 1; Log.w(TAG, "ACTION_PICK_SINGLE mismatch with picture number " + picture_max); } } gv_gallery.setAdapter(adapter); iv_picture_unavailable = (ImageView) findViewById(R.id.picture_unavailable); new Runnable() { @Override public void run() { adapter.add(getGalleryPhotos()); iv_picture_unavailable.setVisibility(adapter.isEmpty() ? View.VISIBLE:View.GONE); } }.run(); }
@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)); }
@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(); }
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); listView = (ListView)getView().findViewById(R.id.listView); ivLoading = (ImageView)getView().findViewById(R.id.iv_live_loading); lySrf = (SwipeRefreshLayout)getView().findViewById(R.id.id_swipe_ly); // lySrf.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { // @Override // public void onRefresh() { // if (!isRefresh) { // isRefresh = true; // queryData(); // System.out.println("refresh"); // } // } // }); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { LiveBean liveBean = (LiveBean) listView.getItemAtPosition(position); if (liveBean != null) { // System.out.println(liveBean.getTvUrl()); LiveActivity.activityStart(MyApplication.getNavagationActivity(), liveBean.getTvUrl(), liveBean.getTvName()); } } }); listView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), true, true)); setadapter(); initTempData(); }
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); listView = (ListView)getView().findViewById(R.id.listView); ivLoading = (ImageView)getView().findViewById(R.id.iv_video_loading); lySrf = (SwipeRefreshLayout)getView().findViewById(R.id.id_swipe_ly); // lySrf.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { // @Override // public void onRefresh() { // if(!isRefresh) // { // isLoadData = false; // isRefresh = true; // System.out.println("refresh"); // } // } // }); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { VideoBean videoBean = (VideoBean) listView.getItemAtPosition(position); if (videoBean != null) { // System.out.println(liveBean.getTvUrl()); LiveActivity.activityStart(MyApplication.getNavagationActivity(), videoBean.getTvUrl(), videoBean.getTvName()); } } }); listView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), true, true)); setadapter(); initTemData(); }
private void initListView() { mAdapter = new ChatMsgAdapter(ctx, mMsgs); mAdapter.setDatas(mMsgs); xListView.setAdapter(mAdapter); xListView.setPullRefreshEnable(true); xListView.setPullLoadEnable(false); xListView.setXListViewListener(this); xListView.setOnScrollListener( new PauseOnScrollListener(UserService.imageLoader, true, true)); }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); getListView().setDivider(null); getListView().setDividerHeight(0); getListView().setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), false, true)); }
private void init() { ImageLoader imageLoader = ImageLoader.getInstance(); handler = new Handler(); gridGallery = (GridView) findViewById(R.id.gridGallery); gridGallery.setFastScrollEnabled(true); adapter = new GalleryAdapter(imageLoader); PauseOnScrollListener listener = new PauseOnScrollListener(imageLoader, true, true); gridGallery.setOnScrollListener(listener); gridGallery.setOnItemClickListener(this); gridGallery.setOnItemLongClickListener(this); gridGallery.setAdapter(adapter); imgNoMedia = (ImageView) findViewById(R.id.imgNoMedia); new Thread() { @Override public void run() { Looper.prepare(); handler.post(new Runnable() { @Override public void run() { adapter.addData(ImageUtil.getGalleryPhotos(ImagePickActivity.this)); checkImageStatus(); } }); Looper.loop(); } }.start(); }
private void findViews() { mCommentListView = (UpDownRefershListView) mRootView .findViewById(R.id.lv_home); refreshListener = new MyRefreshListener(); mCommentListView.setRefreshListener(refreshListener); mCommentListView.setOnScrollListener(new PauseOnScrollListener( ImageLoader.getInstance(), pauseOnScroll, pauseOnFling)); }
private void findViews() { mListView = (UpDownRefershListView) mRootView .findViewById(R.id.lv_home); refreshListener = new MyRefreshListener(); mListView.setRefreshListener(refreshListener); mListView.setOnScrollListener(new PauseOnScrollListener(ImageLoader .getInstance(), pauseOnScroll, pauseOnFling)); initListDataFrmFile("response.json"); }
private void applyScrollListener() { listView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), pauseOnScroll, pauseOnFling)); }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); getListView().setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), false, true)); registerForContextMenu(getListView()); }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); getListView().setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), false, true)); }
private void applyScrollListener() { listView.setOnScrollListener(new PauseOnScrollListener(imageLoader, pauseOnScroll, pauseOnFling)); }
@Override public void onReceive(Context context, Intent intent) { switch(intent.getAction()) { case Constants.INTENT_FILTER.ACTION_LOGOUT_FAIL: { break; } case Constants.INTENT_FILTER.ACTION_LOGOUT_SUCCESS: { // Workaround with View.setFitsSystemWindows issue. // It seems not possible to request fit system windows without activity restart. getActivity().finish(); getActivity().startActivity(getActivity().getIntent()); break; } case Constants.INTENT_FILTER.ACTION_GET_POSTS_RESULT_FAIL: { break; } case Constants.INTENT_FILTER.ACTION_GET_POSTS_RESULT_SUCCESS: { mPosts = intent.getParcelableArrayListExtra(Constants.BUNDLE.KEY_POSTS); Calendar calendar = new GregorianCalendar(); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); mTodayBegin = calendar.getTime().getTime(); calendar.add(Calendar.DAY_OF_MONTH, -1); mYesterdayBegin = calendar.getTime().getTime(); // Remove loading view. ViewGroup wrapper = (ViewGroup) getView().findViewById(R.id.posts_wrapper); wrapper.removeAllViews(); // Inflate posts layout. getActivity().getLayoutInflater().inflate(R.layout.posts_list, wrapper, true); ListView listView = (ListView) wrapper.findViewById(R.id.posts_list); listView.setAdapter(new PostsAdapter()); listView.setOnScrollListener(new PauseOnScrollListener(ImageLoader.getInstance(), true, true)); listView.setOnItemClickListener(mPostItemClickListener); // Invalidate ab menu after posts is loaded. getActivity().supportInvalidateOptionsMenu(); break; } } }
private void applyScrollListener() { if (listView != null) { listView.setOnScrollListener(new PauseOnScrollListener(imageLoader, pauseOnScroll, pauseOnFling)); } }
@Override public void onCreateView(final Fragment fragment, View view, LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (fragment instanceof XListFragment) { ((XListFragment) fragment).setOnScrollListViewListener(new PauseOnScrollListener(ImageLoader.getInstance(), true, true)); } }