@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    listView = (ListView) findViewById(R.id.listView);
    listView.setOverScrollMode(View.OVER_SCROLL_NEVER);
    dataList = new ArrayList<ItemBean>();
    t1 = (TextView) findViewById(R.id.textView1);

    vibrator = (Vibrator) getSystemService(Service.VIBRATOR_SERVICE);
    vibrator.vibrate(50);

    m1 = (ImageView) findViewById(R.id.imageView1);
    for (int i = 0; i < max * 3; i++) {
      top = 32;
      if (i == top + 2 || i == top + max + 2) {
        dataList.add(new ItemBean("" + i % max, 2));
      } else if (i == top + 1 || i == top + max + 1) {
        dataList.add(new ItemBean("" + i % max, 1));
      } else if (i == top + 3 || i == top + max + 3) {
        dataList.add(new ItemBean("" + i % max, 1));
      } else if (i == top || i == top + max) {
        dataList.add(new ItemBean("" + i % max, -1));
      } else if (i == top + 4 || i == top + max + 4) {
        dataList.add(new ItemBean("" + i % max, -10));
      } else {

        dataList.add(new ItemBean("" + i % max, 0));
      }
    }

    m1111 = new MyAdapter(this, dataList);
    listView.setAdapter(m1111);

    listView.setVerticalScrollBarEnabled(false);
    // listView.setSelection(32);

    listView.setOnScrollListener(this);
    listView.setOnTouchListener(this);
    listView.setOnItemClickListener(this);

    ObjectAnimator.ofFloat(m1, "Alpha", 1F, 0.0F).setDuration(10).start();

    new Thread(
            new Runnable() {

              public void run() {

                try {
                  Thread.sleep(1000);
                } catch (InterruptedException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
                }
                listView.smoothScrollToPosition(35);
              }
            })
        .start();
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   mContext = getApplicationContext();
   mMode = ReadConfigFile.getMode(mContext);
   if (mMode == 1) {
     super.onCreate(savedInstanceState, TITLE_TYPE_COMPANY, null, 0, true);
   } else {
     super.onCreate(savedInstanceState);
   }
   setContentView(R.layout.disscuss_title_layout);
   setupView();
   mListArrayList = new ArrayList<HashMap<String, Object>>();
   mListAdapter =
       new SimpleAdapter(
           getApplicationContext(),
           mListArrayList,
           R.layout.disscus_listitem_layout,
           new String[] {"title", "desc"},
           new int[] {R.id.channel_listitem_title_id, R.id.channel_listitem_desc_id});
   mList.setAdapter(mListAdapter);
   mpageIndex = 1;
   SharedPreferences userpref = mContext.getSharedPreferences("user", MODE_PRIVATE);
   mUser_name = userpref.getString("user_name", "");
   setupData();
   mList.setOnItemClickListener(this);
   mList.setOnScrollListener(this);
   mButton.setOnClickListener(this);
   CloseReceiver.registerCloseActivity(this);
   CommonUpdate.getInstance()
       .registerForUpdateWeather(myHandler, CommonUpdate.EVENT_UPDATE_WEATHER, null);
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.lista_socio_negocio_tab_fragment_lead, container, false);

    sideIndex = (LinearLayout) v.findViewById(R.id.sideIndex);
    lvSN = (ListView) v.findViewById(R.id.lvLstSocioLeadNeg);

    contexto = v.getContext();

    // Obtener el refreshLayout
    refreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipeRefresh);

    // Seteamos los colores que se usar�n a lo largo de la animaci�n
    refreshLayout.setColorSchemeResources(R.color.s1, R.color.s2, R.color.s3, R.color.s4);

    // FLOATING BUTTON
    FloatingActionButton fab = (FloatingActionButton) v.findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            Intent registrarSN = new Intent(v.getContext(), MainSocioNegocio.class);
            startActivity(registrarSN);
          }
        });
    // FLOATING BUTTON

    lvSN.setOnItemLongClickListener(this);
    lvSN.setOnScrollListener(this);
    setHasOptionsMenu(true);
    return v;
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup viewGroup, Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.socio_negocio_buscar_calle_fragment, viewGroup, false);

    if (!MainSocioNegocio.idDistrito.equals("")) {
      codDistrito = MainSocioNegocio.idDistrito;
    }

    sideIndex = (LinearLayout) view.findViewById(R.id.sideIndex);
    lvCalle = (ListView) view.findViewById(R.id.listView4);

    contexto = view.getContext();
    llenarDatos();

    /** ********************************* */
    /** ********* INDEXEEERRRR-> ************ */
    /** ********************************* */
    mGestureDetector = new GestureDetector(contexto, new SideIndexGestureListener());

    buildListCustomFormat();

    view.setOnTouchListener(
        new View.OnTouchListener() {
          @SuppressLint("ClickableViewAccessibility")
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            if (mGestureDetector.onTouchEvent(event)) {
              return true;
            } else {
              return false;
            }
          }
        });

    // Obtener el refreshLayout
    refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeRefresh);

    // Seteamos los colores que se usarán a lo largo de la animación
    refreshLayout.setColorSchemeResources(R.color.s1, R.color.s2, R.color.s3, R.color.s4);

    // Iniciar la tarea al revelar el indicador
    refreshLayout.setOnRefreshListener(
        new SwipeRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh() {
            alphabet.clear();
            sections.clear();
            llenarDatos();
            buildListCustomFormat();
            refreshLayout.setRefreshing(false);
          }
        });

    lvCalle.setOnScrollListener(this);
    lvCalle.setOnItemClickListener(this);

    setHasOptionsMenu(true);
    return view;
  }
 public MyAdapterUseDoubleCaches(Context context, List<String> data, ListView listView) {
   this.mData = data;
   mInflater = LayoutInflater.from(context);
   mImageLoader = new ImageLoaderWithDoubleCaches(context, listView);
   mImageLoader.loadImages(mStart, mEnd);
   listView.setOnScrollListener(this);
 }
  private void setupListeners() {
    lvUsers.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent i = new Intent(getActivity(), ProfileActivity.class);
            User user = users.get(position);
            i.putExtra("user", user);
            startActivity(i);
          }
        });
    //

    lvUsers.setOnScrollListener(
        new EndlessScrollListener() {
          @Override
          public void onLoadMore(int page, int totalItemsCount) {
            // Triggered only when new data needs to be appended to the list
            // Add whatever code is needed to append new items to your AdapterView
            if (cursor != "0") {
              populateUsersList(cursor);
            }
          }
        });
  }
Example #7
0
  @Override
  public void successOperation(Object object, boolean isCalledFirstTime) {

    List<Product> productList = null;
    if (!isCalledFirstTime) productList = new ArrayList<>(data.getProductList());

    data = (Data) object;

    if (!isCalledFirstTime)
      for (int i = 0; i < productList.size(); i++) data.getProductList().add(i, productList.get(i));

    if (isCalledFirstTime) {
      customListAdapter = new CustomListAdapter(data.getProductList(), this);
      listView.setAdapter(customListAdapter);
      listView.setVisibility(View.VISIBLE);
      filterScrollView.setVisibility(View.VISIBLE);
      listView.setOnScrollListener(this);
      filterRG.removeAllViews();
      showFilterOptions();
    } else {
      customListAdapter.productList = data.getProductList();
      customListAdapter.notifyDataSetChanged();
    }
    isApiCalledOnScrollToEnd = false;
    progressView.setVisibility(View.GONE);
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mListView = (ListView) mView.findViewById(R.id.lv);
    mListView.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {
            if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
              PullRightLayout.collapseAll();
            }
          }

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {}
        });

    mStartScanView = (TextView) mView.findViewById(R.id.tv_start_scan);
    mStartScanView.setBackgroundColor(ThemeManager.with(getActivity()).getCurrentColor());
    mStartScanView.setOnClickListener(this);

    mPullLayout = (PullLayout) mView.findViewById(R.id.pull_layout);
    mPullLayout.addOnPullListener(this);
    if (mListener != null) {
      mPullLayout.addOnPullListener(mListener);
      mListener = null;
    }

    mIvScan = (ImageView) mView.findViewById(R.id.iv_scan);

    IntentFilter filter = new IntentFilter(ScanService.ACTION_SCAN_FINISH);
    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(receiver, filter);
  }
  private void setScrollListener() {
    super.setOnScrollListener(
        new OnScrollListener() {
          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            if (ThreeDListView.this.scrollListener != null) {
              ThreeDListView.this.scrollListener.onScroll(
                  view, firstVisibleItem, visibleItemCount, totalItemCount);
            }
          }

          @Override
          public void onScrollStateChanged(final AbsListView view, final int scrollState) {
            if (scrollState == OnScrollListener.SCROLL_STATE_IDLE) {
              ThreeDListView.this.onNativeScroll = false;
              lockPosition(ThreeDListView.this.childToSelect);
            }

            if (scrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
              ThreeDListView.this.onNativeScroll = true;
            }

            if (ThreeDListView.this.scrollListener != null) {
              ThreeDListView.this.scrollListener.onScrollStateChanged(view, scrollState);
            }
          }
        });
  }
Example #10
0
  private void init() {
    isLoading = false;
    loadinView = new LoadingView(getContext());
    addFooterView(loadinView);
    super.setOnScrollListener(
        new OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {
            if (onScrollListener != null) {
              onScrollListener.onScrollStateChanged(view, scrollState);
            }
          }

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            if (onScrollListener != null) {
              onScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
            }

            if (totalItemCount > 0) {
              int lastVisibleItem = firstVisibleItem + visibleItemCount;
              if (!isLoading && hasMoreItems && (lastVisibleItem == totalItemCount)) {
                if (pagingableListener != null) {
                  isLoading = true;
                  pagingableListener.onLoadMoreItems();
                }
              }
            }
          }
        });
  }
Example #11
0
  private static void initUserView(ListView listView, final JSONArray _vehicleDetail) {
    final MyBaseAdapter adapter =
        new MyBaseAdapter(_vehicleDetail, MainActivity1.getDefaultMainActivity());
    listView.setAdapter(adapter);
    adapter.notifyDataSetChanged();
    setListViewHeightBasedOnItems(listView);

    /*
     * UserVehicleListadapter adapter= new
     * UserVehicleListadapter(MainActivity1.getDefaultMainActivity(),
     * _vehicleDetail); listVehicle.setAdapter(adapter);
     * setListViewHeightBasedOnItems(listVehicle);
     */

    final SwipeToDismissTouchListener<ListViewAdapter> touchListener =
        new SwipeToDismissTouchListener<>(
            new ListViewAdapter(listView),
            new SwipeToDismissTouchListener.DismissCallbacks<ListViewAdapter>() {
              @Override
              public boolean canDismiss(int position) {
                return true;
              }

              @Override
              public void onDismiss(ListViewAdapter view, int position) {
                adapter.remove(position);
              }
            });
    listView.setOnTouchListener(touchListener);
    // Setting this scroll listener is required to ensure that during
    // ListView scrolling,
    // we don't look for swipes.
    listView.setOnScrollListener((AbsListView.OnScrollListener) touchListener.makeScrollListener());
    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (touchListener.existPendingDismisses()) {
              touchListener.undoPendingDismiss();
            } else {

              try {
                JSONObject jsonObject = _vehicleDetail.getJSONObject(position);
                // _jsonVehicle.getString("RegNo");
                // _jsonVehicle.getString("Model");

                Intent intent =
                    new Intent(
                        MainActivity1.getDefaultMainActivity(), EditInstallbaseActivity.class);
                intent.putExtra("RegNo", jsonObject.getString("RegNo"));
                intent.putExtra("ID", jsonObject.getString("ID"));
                intent.putExtra("bgImage", jsonObject.getString("Base64Image"));
                ((Activity) MainActivity1.getDefaultMainActivity()).startActivity(intent);
              } catch (JSONException e) {
                e.printStackTrace();
              }
            }
          }
        });
  }
  public void initLayout(final ListView leftView, ListView middleView) {
    this.leftView = leftView;
    this.middleView = middleView;
    this.parentView = (ViewGroup) middleView.getParent();
    parentView.setVisibility(INVISIBLE);
    arrowView = (ImageView) findViewById(R.id.img_arrow);
    leftView.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {
            // To change body of implemented methods use File | Settings | File Templates.
          }

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {

            if (leftView.getChildAt(0) != null) {
              int deltaY = tempScrollY - getScroll();
              tempScrollY = getScroll();
              arrowView.setY(arrowView.getY() + deltaY);
            }
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_time_line);
    client = TwitterApplication.getRestClient();
    populateTimeLine();

    // find the list view
    lvTweets = (ListView) findViewById(R.id.lvTimeLine);
    // Attach the listener to the AdapterView onCreate
    lvTweets.setOnScrollListener(
        new EndlessScrollListener() {
          @Override
          public void onLoadMore(int page, int totalItemsCount) {
            // Triggered only when new data needs to be appended to the list
            // Add whatever code is needed to append new items to your AdapterView
            customLoadMoreDataFromApi(page);
            // or customLoadMoreDataFromApi(totalItemsCount);
          }
        });
    // Create the arraylist of datasource
    tweets = new ArrayList<>();
    // Construct the adapter from data source
    atweets = new TweetsArrayAdapter(this, tweets);
    // Connect adapter to listview
    lvTweets.setAdapter(atweets);
  }
Example #14
0
  private void initMainList() {
    main_list = (ListView) findViewById(R.id.lv_main);

    arr_list.add(new ContentItem());
    arr_list.add(new ContentItem());
    arr_list.add(new ContentItem());
    arr_list.add(new ContentItem());

    // Adapter 생성
    adapter = new ContentAdapter(getApplicationContext(), R.layout.row_content, arr_list);

    // Adapter와 GirdView를 연결
    main_list.setAdapter(adapter);

    adapter.notifyDataSetChanged();

    main_list.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {}

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {}
        });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    SHashtag_list.clear();
    // View 할당
    rootview = inflater.inflate(R.layout.f2_1_2_searchhashtag_layout, container, false);
    listview = (ListView) rootview.findViewById(R.id.listview_searchhashtag);
    searchHashTag_adapter =
        new SearchHashTag_Adapter(getActivity(), R.layout.item_searchhashtag, SHashtag_list);
    listview.setAdapter(searchHashTag_adapter);
    listview.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
            // TODO Auto-generated method stub

            Intent intent = new Intent(getActivity(), A7_SpecificHashTagActivity.class);
            intent.putExtra("id", SHashtag_list.get(position).getHashTag().getId());
            intent.putExtra("title", SHashtag_list.get(position).getHashTag().getTitle());
            intent.putExtra(
                "follower_count", SHashtag_list.get(position).getHashTag().getFollower_count());
            intent.putExtra("photo", SHashtag_list.get(position).getHashTag().getPhoto());
            intent.putExtra(
                "count_schedule", SHashtag_list.get(position).getHashTag().getCount_schedule());
            intent.putExtra(
                "count_upcoming_schedule",
                SHashtag_list.get(position).getHashTag().getCount_upcoming_schedule());
            startActivity(intent);
          }
        });
    listview.setOnScrollListener(new EndlessScrollListener());
    return rootview;
  }
Example #16
0
 private void init() {
   // TODO Auto-generated method stub
   // 线性布局
   LinearLayout layout = new LinearLayout(this);
   // 设置布局 水平方向
   layout.setOrientation(LinearLayout.HORIZONTAL);
   // 进度条
   progressBar = new ProgressBar(this);
   // 进度条显示位置
   progressBar.setPadding(0, 0, 15, 0);
   // 把进度条加入到layout中
   layout.addView(progressBar, mLayoutParams);
   // 文本内容
   TextView textView = new TextView(this);
   textView.setText("加载中...");
   textView.setGravity(Gravity.CENTER_VERTICAL);
   // 把文本加入到layout中
   layout.addView(textView, FFlayoutParams);
   // 设置layout的重力方向,即对齐方式是
   layout.setGravity(Gravity.CENTER);
   // 设置ListView的页脚layout
   loadingLayout = new LinearLayout(this);
   loadingLayout.addView(layout, mLayoutParams);
   loadingLayout.setGravity(Gravity.CENTER);
   // 得到一个ListView用来显示条目
   listView = (ListView) findViewById(R.id.tv);
   // 添加到脚页显示
   listView.addFooterView(loadingLayout);
   // 给ListView添加适配器
   listView.setAdapter(adapter);
   // 给ListView注册滚动监听
   listView.setOnScrollListener(this);
 }
  public void setAdapter(ListAdapter adapter) {
    listView.setAdapter(adapter);

    listView.setOnScrollListener(
        new OnScrollListener() {

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            if (null != dockedTempView) {
              Log.i(TAG, "dockedHeight:" + dockedHeight);
              int[] location = new int[2];
              dockedView.getLocationInWindow(location);
              int x = location[1];
              Log.i(TAG, "x:" + x);
              if (x < dockedHeight) {
                findViewById(DOCKED_TEMPVIEW_ID).setVisibility(View.VISIBLE);
              } else {
                findViewById(DOCKED_TEMPVIEW_ID).setVisibility(View.GONE);
              }
            }
          }

          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {}
        });
  }
  private void ensureList(View rootView) {
    if (mListView != null || rootView == null) {
      return;
    }
    mCitySelectView = rootView.findViewById(R.id.common_city_selected);
    mStandardEmptyView = (TextView) rootView.findViewById(android.R.id.empty);
    mProgressContainer = rootView.findViewById(R.id.progressContainer);
    ImageView ivProgress = (ImageView) rootView.findViewById(R.id.iv_progress);
    ivProgress.setBackgroundResource(R.drawable.animation_progress);
    animationDrawable = (AnimationDrawable) ivProgress.getBackground();

    mListContainer = rootView.findViewById(R.id.listContainer);
    mListView = (ListView) rootView.findViewById(android.R.id.list);
    if (mListView == null) {
      throw new RuntimeException(
          "Your content must have a ListView whose id attribute is " + "'android.R.id.list'");
    }
    mListView.setOnScrollListener(new PauseOnScrollListener(true, false));
    mStandardEmptyView.setText(mEmptyText);
    mListView.setEmptyView(mStandardEmptyView);
    mListShown = true;
    mListView.setOnItemClickListener(mOnClickListener);
    if (mProgressContainer != null) {
      setListShown(false, false);
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.file_select_layout);

    msisdn = getIntent().getStringExtra(HikeConstants.Extras.MSISDN);
    items =
        (ArrayList<FileListItem>)
            HikeConversationsDatabase.getInstance()
                .getSharedMedia(msisdn, HikeConstants.MAX_MEDIA_ITEMS_TO_LOAD_INITIALLY, -1, false);

    listAdapter = new FileListAdapter(this, items);
    emptyView = (TextView) findViewById(R.id.search_empty_view);
    listView = (ListView) findViewById(R.id.file_list);
    listView.setEmptyView(emptyView);
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            FileListItem item = items.get(i);
            HikeFile.openFile(
                item.getFile(),
                item.getHikeSharedFile().getFileTypeString(),
                SharedOtherFilesActivity.this);
          }
        });

    listView.setOnScrollListener(this);
    setupActionBar();
  }
Example #20
0
  private void initGestureList(final MyGestureListAdapter adapter) {
    mGestureListView = (ListView) findViewById(R.id.my_gesture_list);
    mGestureListView.setAdapter(adapter);
    mGestureListView.setOnScrollListener(new ListViewScrollListener());
    mGestureListView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            cancelTask(); // 点击的时候就取消动画线程
            cancelTaskOneItem();
            mHandler.removeMessages(mMESSAGEID_AUTO_DRAW_PREVIEW_ONE_ITEM); // 取消点击单个手势动画的消息

            if (adapter.getGestuureMenuPosition() != position) {
              adapter.setGestureMenuPosition(position);
              Message msg = new Message();
              msg.what = mMESSAGEID_AUTO_DRAW_PREVIEW_ONE_ITEM;
              msg.obj = view;
              msg.arg1 = position;
              mHandler.sendMessageDelayed(msg, 150);
              checkSelectLastOne(position);
            } else {
              adapter.setGestureMenuPosition(-1);
            }
            adapter.notifyDataSetInvalidated();
          }
        });
    autoDrawPreview(); // 启动手势动画线程
  }
Example #21
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    // Find Views
    mListView = (ListView) findViewById(R.id.listView1);
    /** 用mLinear做为load-progress的容器。 */
    LinearLayout mLinear = new LinearLayout(this);
    mLinear.setOrientation(LinearLayout.HORIZONTAL);
    mProgressBar = new ProgressBar(this);
    mProgressBar.setPadding(0, 0, 15, 0);
    mLinear.addView(mProgressBar, WClayoutParams);

    TextView textView = new TextView(this);
    textView.setText("加载中...");
    textView.setGravity(Gravity.CENTER_VERTICAL);
    mLinear.addView(textView, FFlayoutParams);

    mLinear.setGravity(Gravity.CENTER);

    registerForContextMenu(mListView);
    // 将load-progress加进ListView的最底行
    mListView.addFooterView(mLinear);
    mAdapter = new PageAdapter();
    mListView.setAdapter(mAdapter);
    mListView.setOnScrollListener(this);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_list_view, container, false);
    mListView = (ListView) view.findViewById(R.id.listview);
    View placeHolderView = inflater.inflate(R.layout.header_placeholder, mListView, false);
    mListView.addHeaderView(placeHolderView);

    mPosition = getArguments().getInt(ARG_POSITION);

    setAdapter();

    mListView.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {}

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            if (mScrollTabHolder != null) {
              mScrollTabHolder.onListViewScroll(
                  view, firstVisibleItem, visibleItemCount, totalItemCount, mPosition);
            }
          }
        });

    return view;
  }
  public void RefreshTweetList(final Activity act, final View v, final TweetListType mode) {
    LinearLayout ll = (LinearLayout) v;
    ListView lv = (ListView) ll.findViewById(android.R.id.list);

    final List<Tweet> tmpTweets = new ArrayList<Tweet>();
    final TweetListAdapter aa = new TweetListAdapter(act, R.layout.tweetlist_item, tmpTweets);
    getTweets(act, tmpTweets, aa, mode, PagingMode.OLDTWEETS);

    lv.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {}

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            if (visibleItemCount != 0) {
              final int GUESS_WANT_MORE = 1;
              if (firstVisibleItem + visibleItemCount + 1 + GUESS_WANT_MORE > totalItemCount) {
                getTweets(act, tmpTweets, aa, mode, PagingMode.OLDTWEETS);
              }
            }
          }
        });

    TextView tv = (TextView) ll.findViewById(android.R.id.empty);
    if (aa.getCount() > 0) {
      tv.setVisibility(View.GONE);
    } else {
      tv.setVisibility(View.VISIBLE);
    }

    lv.setAdapter(aa);
  }
 /** 初始化全局设置 * */
 private void initEventes() {
   mWifiList = new ArrayList<ScanResult>();
   mHandler = new ApHandler();
   mSearchWifiThread = new SearchWifiThread(mHandler);
   listView.setOnScrollListener(onScroll);
   listView.setOnItemClickListener(onItemClickListener);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_task_manager);
    tv_status = (TextView) findViewById(R.id.tv_status);
    lv_taskmanager = (ListView) findViewById(R.id.lv_taskmanager);
    ll_loading = (LinearLayout) findViewById(R.id.ll_loading);

    am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    tv_mem_info = (TextView) findViewById(R.id.tv_mem_info);
    tv_process_count = (TextView) findViewById(R.id.tv_process_count);
    runningProcessCount = SystemInfoUtils.getRunningProcessCount(this);
    availRam = SystemInfoUtils.getAvailRam(this);
    totalRam = SystemInfoUtils.getTotalRam(this);
    tv_process_count.setText("运行中进程:" + runningProcessCount + "个");
    tv_mem_info.setText(
        "剩余/总内存:"
            + Formatter.formatFileSize(this, availRam)
            + "/"
            + Formatter.formatFileSize(this, totalRam));
    lv_taskmanager.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Object obj = lv_taskmanager.getItemAtPosition(position);
            if (obj != null) {
              CheckBox cb = (CheckBox) view.findViewById(R.id.cb);
              TaskInfo taskInfo = (TaskInfo) obj;
              if (taskInfo.getPackname().equals(getPackageName())) {
                return;
              }
              if (taskInfo.isChecked()) {
                cb.setChecked(false);
                taskInfo.setChecked(false);
              } else {
                cb.setChecked(true);
                taskInfo.setChecked(true);
              }
            }
          }
        });
    lv_taskmanager.setOnScrollListener(
        new OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {}

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            if (userTaskInfos != null && systemTaskInfos != null) {
              if (firstVisibleItem > userTaskInfos.size()) {
                tv_status.setText("系统进程(" + systemTaskInfos.size() + ")");
              } else {
                tv_status.setText("用户进程(" + userTaskInfos.size() + ")");
              }
            }
          }
        });
    fillData();
  }
Example #26
0
  @Override
  public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    view.setClickable(true);

    Bundle bundle = getArguments();
    if (bundle == null) {
      return;
    }

    mEvent = (Event) bundle.getSerializable(ARG_EVENT);

    mListView = (ListView) view.findViewById(R.id.listView);
    mListView.setOnScrollListener(new ScrollListener());
    mAdapter = new EventNewsAdapter();
    mListView.setAdapter(mAdapter);
    mLoaderCallback = new EventNewsLoaderCallback();
    mRestService = HttpHelper.getRestAdapter().create(RestHelper.class);

    Profile profile = User.currentUser().getProfile();
    if (profile != null && profile.getIsAdmin() == 1) {
      setHasOptionsMenu(true);
      registerForContextMenu(mListView);
    }

    onLoadBegins();
    loadEventNews(0);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.tuangouhui_fregment, container, false);
    list = (ListView) view.findViewById(R.id.list);
    inflater = getActivity().getLayoutInflater();
    LinearLayout layout = new LinearLayout(getActivity());
    layout.setOrientation(LinearLayout.VERTICAL);
    View headerView = inflater.inflate(R.layout.list_header, layout);
    initheaderview(headerView);
    mActor.initTGHView(list, headerView);
    tittle = (TextView) view.findViewById(R.id.tv_header_tittle);
    tittle.setText("线下活动");
    btn_right = (Button) view.findViewById(R.id.setting);
    btn_right.setBackgroundResource(R.drawable.bg_search_left);

    list.setOnScrollListener(
        new OnScrollListener() {

          @Override
          public void onScrollStateChanged(AbsListView arg0, int arg1) {}

          @Override
          public void onScroll(AbsListView arg0, int arg1, int arg2, int arg3) {}
        });
    return view;
  }
Example #28
0
 public VideoListAdapter(Context context, List<FileInfo> listFiles, ListView listView) {
   this.listFiles = listFiles;
   mContext = context;
   syncThumbExtractor = new SyncThumbnailExtractor(context);
   listView.setOnScrollListener(this);
   layoutInflater = LayoutInflater.from(context);
 }
Example #29
0
  private void initWithContext(Context context) {
    mScroller = new Scroller(context, new DecelerateInterpolator());
    // XListView need the scroll event, and it will dispatch the event to
    // user's listener (as a proxy).
    super.setOnScrollListener(this);

    // init header view
    mHeaderView = new XListViewHeader(context);
    mHeaderViewContent = (RelativeLayout) mHeaderView.findViewById(R.id.xlistview_header_content);
    mHeaderTimeView = (TextView) mHeaderView.findViewById(R.id.xlistview_header_time);
    addHeaderView(mHeaderView);

    // init footer view
    mFooterView = new XListViewFooter(context);

    // init header height
    mHeaderView
        .getViewTreeObserver()
        .addOnGlobalLayoutListener(
            new OnGlobalLayoutListener() {
              @Override
              public void onGlobalLayout() {
                mHeaderViewHeight = mHeaderViewContent.getHeight();
                getViewTreeObserver().removeGlobalOnLayoutListener(this);
              }
            });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_personal_info, container, false);
    mHeaderView = rootView.findViewById(R.id.header);
    mTopImageView = (ImageView) rootView.findViewById(R.id.theme_top_image);
    mTopImageView.setOnLongClickListener(this);
    displayThemeImages();
    mAvatarImage = (ImageView) rootView.findViewById(R.id.avatar_image);
    MiscUtils.showAvatarThumb(
        mAvatarManager,
        mSettingHelper.getAccountAvatarThumb(),
        mAvatarImage,
        R.drawable.contact_single);
    mAvatarImage.setOnClickListener(this);
    mListView = (ListView) rootView.findViewById(R.id.list);
    View listHeader = inflater.inflate(R.layout.personal_info_list_header, mListView, false);
    mListHeaderView = listHeader;
    mListView.addHeaderView(listHeader);
    mListView.setAdapter(mInfoAdapter);
    mListView.setOnItemClickListener(mInfoAdapter);
    mListView.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView view, int scrollState) {}

          @Override
          public void onScroll(
              AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            ViewHelper.setTranslationY(
                mHeaderView, Math.max(-getScrollY(), -mHeaderView.getMeasuredHeight()));
          }
        });
    return rootView;
  }