/**
  * 点击底部按钮
  *
  * @param v
  */
 public void onClick(View v) {
   Log.d("debug", "isLastRow -->> " + isLastRow);
   if (adapter.getCount() < totalCount) { // 当前加载的数据条数小于总条数
     // 加载更多分页的课程成绩信息
     dlg.loadMoreData(adapter.getCount());
     // 进度条可见,按钮不可见
     pbFoot.setVisibility(View.VISIBLE);
     btnFoot.setVisibility(View.GONE);
     isLastRow = false;
   } else if (isLastRow) { // 所有的条目已经和最大条数相等,则移除底部的View,弹出提示信息
     lvCourseScore.removeFooterView(listfoot);
     Toast.makeText(ac, R.string.complete_loading_all_data, Toast.LENGTH_SHORT).show();
   }
 }
Пример #2
0
  private void loadMoreData() {

    count = adapter.getCount();
    for (int i = count; i < count + 5; i++) {
      HashMap<String, String> map = new HashMap<String, String>();
      map.put("itemText", "测试数据" + i);
      listData.add(map);
    }
    count = listData.size();
  }
Пример #3
0
 @Override
 public void onScrollStateChanged(AbsListView view, int scrollState) {
   if (scrollState == SCROLL_STATE_IDLE || scrollState == SCROLL_STATE_FLING) {
     if (isScrollBottom && !isLoadingMore) {
       isLoadingMore = true;
       Log.i("onScrollStateChanged", "=======1======");
       listview.addFooterView(FootView);
       listview.setAdapter(simpleAdapter);
       listview.setSelection(simpleAdapter.getCount() - 10);
       addData();
     }
   }
 }
Пример #4
0
 @Override
 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
   String codecName = (String) buttonView.getTag();
   if (codecName != null) {
     HashMap<String, Object> codec = null;
     for (int i = 0; i < mAdapter.getCount(); i++) {
       @SuppressWarnings("unchecked")
       HashMap<String, Object> tCodec = (HashMap<String, Object>) mAdapter.getItem(i);
       if (codecName.equalsIgnoreCase((String) tCodec.get(CODEC_NAME))) {
         codec = tCodec;
         break;
       }
     }
     if (codec != null) {
       userActivateCodec(codec, isChecked);
     }
   }
 }
Пример #5
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.trackdetail_menu_save:
        String enteredName = etName.getText().toString().trim();
        if ((enteredName.length() > 0) && (!enteredName.equals(trackNameInDB))) {
          DataHelper.setTrackName(trackId, enteredName, getContentResolver());
        }

        // All done
        finish();
        break;
      case R.id.trackdetail_menu_cancel:
        finish();
        break;
      case R.id.trackdetail_menu_display:
        Intent i;
        boolean useOpenStreetMapBackground =
            PreferenceManager.getDefaultSharedPreferences(this)
                .getBoolean(
                    OSMTracker.Preferences.KEY_UI_DISPLAYTRACK_OSM,
                    OSMTracker.Preferences.VAL_UI_DISPLAYTRACK_OSM);
        if (useOpenStreetMapBackground) {
          i = new Intent(this, DisplayTrackMap.class);
        } else {
          i = new Intent(this, DisplayTrack.class);
        }
        i.putExtra(Schema.COL_TRACK_ID, trackId);
        startActivity(i);
        break;
      case R.id.trackdetail_menu_export:
        new ExportTrackTask(this, trackId).execute();
        // Pick last list item (Exported date) and update it
        SimpleAdapter adapter = ((SimpleAdapter) lv.getAdapter());
        @SuppressWarnings("unchecked")
        Map<String, String> data = (Map<String, String>) adapter.getItem(adapter.getCount() - 1);
        data.put(
            ITEM_VALUE,
            DateFormat.getDateTimeInstance().format(new Date(System.currentTimeMillis())));
        adapter.notifyDataSetChanged();
        break;
    }
    return super.onOptionsItemSelected(item);
  }