Example #1
0
        @Override
        public void handleMessage(Message message) {
          if (message.what == 1) {
            // 更新头像
            mAdapter.notifyDataSetChanged();
          } else if (message.what == 2) {
            // 更新图片
            HLog.out(TAG, "message.what:" + message.what);
            mAdapter.notifyDataSetChanged();
          } else if (message.what == 10) {
            // 更新评论
            Bundle bundle = message.getData();
            Comment xComment = new Comment();
            xComment.setR_id(bundle.getInt("nid"));
            xComment.setUser_id(mUser.getUid());
            xComment.setText(bundle.getString("comment"));
            xComment.setAdd_Time(Integer.parseInt(bundle.getString("time")));
            xComment.setNickname(mUser.getNickname());
            xComment.setHead_pic(bundle.getString("head_pic"));
            ArrayList<Comment> cm = data.get(bundle.getInt("position")).getBcomment();
            if (cm == null) {
              cm = new ArrayList<Comment>();
            }

            cm.add(xComment);
            data.get(bundle.getInt("position")).setBcomment(cm);
            data.get(bundle.getInt("position")).setI_comment(true);
            mAdapter.notifyDataSetChanged();
            Utils.Toast(mActivity, "温馨提示:", "评论成功!");
          } else if (message.what == 1002) {
            mAdapter.notifyDataSetChanged();
          }
        }
 public boolean onContextItemSelected(MenuItem item) {
   AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
   switch (item.getItemId()) {
     case ADD_STEP:
       selectedStep = preset.blankStep();
       preset.steps.add(info.position + 1, selectedStep);
       modifiedStep = selectedStep.clone();
       showDialog(EDIT_STEP);
       return true;
     case DUP_STEP:
       selectedStep = preset.steps.get(info.position).clone();
       selectedStep.name = selectedStep.name + " copy";
       preset.steps.add(info.position + 1, selectedStep);
       modifiedStep = selectedStep.clone();
       showDialog(EDIT_STEP);
       return true;
     case UP_STEP:
       Collections.swap(preset.steps, info.position, info.position - 1);
       adapter.notifyDataSetChanged();
       return true;
     case DOWN_STEP:
       Collections.swap(preset.steps, info.position, info.position + 1);
       adapter.notifyDataSetChanged();
       return true;
     case DEL_STEP: // Unreachable right now.
       preset.steps.remove(preset.steps.get(info.position));
       adapter.notifyDataSetChanged();
       return true;
     default:
       return super.onContextItemSelected(item);
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_activity_list_wish);
    lsvWish = (ListView) findViewById(R.id.lsvWish);
    listWish = new ArrayList<Wish>();
    db = new DatabaseHandler(this);
    listWish = db.getAll();
    adapter = new MyAdapter(this, R.layout.activity_custom_wish, listWish);
    lsvWish.setAdapter(adapter);

    // Gửi dữ liệu qua activity wish detail
    lsvWish.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent i = new Intent(ActivityListWish.this, ActivityWishDetail.class);
            Bundle bundle = new Bundle();
            bundle.putString("title", listWish.get(position).getTitle());
            bundle.putString("content", listWish.get(position).getContent());
            bundle.putString("date", listWish.get(position).getDate());
            bundle.putInt("id", listWish.get(position).getId());
            i.putExtra("data", bundle);
            startActivity(i);
          }
        });

    // Cập nhật lại adapter sau khi xóa wish
    adapter.notifyDataSetChanged();
  }
Example #4
0
 private void update() {
   Log.d(TAG, "Update");
   // mAdapter.initData();
   mAdapter.notifyDataSetChanged();
   toast.cancel(); // progressDialog.dismiss();
   Log.d(TAG, "Update Completed");
 }
Example #5
0
        @Override
        public void handleMessage(Message msg) {
          if (msg.what == 0) {
            // 加载成功
            if (_appList.size() == 0) {
              // 没有数据
              _loadingTextView.setText("暂时没有数据!");
              _loadingAnimation.cancel();
              _loadingImageView.setAnimation(null);
              _loadingImageView.setVisibility(View.GONE);
            } else {
              // TODO: update
              _adapter.notifyDataSetChanged();
              _listView.setVisibility(View.VISIBLE);

              _loadingAnimation.cancel();
              _loadingImageView.setAnimation(null);
              _loadingLayer.setVisibility(View.INVISIBLE);
            }
          } else {
            _loadingAnimation.cancel();
            _loadingImageView.setAnimation(null);
            _loadingImageView.setVisibility(View.GONE);
            _loadingTextView.setText("加载数据失败,请稍后再试一次!");
          }
        }
  @Override
  public void onScrollStateChanged(AbsListView view, int scrollState) {
    // TODO Auto-generated method stub

    if (scrollState == SCROLL_STATE_FLING && byaotu == false) {

      ObjectAnimator.ofFloat(m1, "Alpha", 0.3F, 0.0F).setDuration(100).start();

    } else if (scrollState == SCROLL_STATE_IDLE) {

      if (byaotu == false) {

        ObjectAnimator.ofFloat(m1, "Alpha", 0.1F, 0.0F).setDuration(500).start();

        if (top == 0) {}

        if (top == 85) {

        } else if (top != 0) {

          dataList.clear();
          datachange();

          m1111.notifyDataSetChanged();

          listView.smoothScrollToPosition(top);
          byaotu = true;
        }

      } else {
        byaotu = false;
      }

    } else if (scrollState == SCROLL_STATE_TOUCH_SCROLL && byaotu == false) {

      if (lockforsrcoll == false) {

        dataList.clear();
        for (int i = 0; i < max * 3; i++) {

          dataList.add(new ItemBean("" + i % max, 0));
        }
        m1111.notifyDataSetChanged();
        ObjectAnimator.ofFloat(m1, "Alpha", 0.3F, 0.2F).setDuration(100).start();
      }
    }
  }
 @Override
 public void onServiceStateChanged(ServiceState serviceState) {
   final boolean inAirplaneMode = serviceState.getState() == ServiceState.STATE_POWER_OFF;
   mAirplaneState = inAirplaneMode ? ToggleAction.State.On : ToggleAction.State.Off;
   if (mAirplaneModeOn != null && mAdapter != null) {
     mAirplaneModeOn.updateState(mAirplaneState);
     mAdapter.notifyDataSetChanged();
   }
 }
Example #8
0
 public void handleMessage(android.os.Message msg) {
   // 4,告知listView可以去设置数据适配器
   if (mAdapter == null) {
     mAdapter = new MyAdapter();
     lv_blacknumber.setAdapter(mAdapter);
   } else {
     mAdapter.notifyDataSetChanged();
   }
 };
  public void movetopostion(int mtop) {

    dataList.clear();
    datachange(mtop);

    m1111.notifyDataSetChanged();

    listView.setSelection(mtop);
  }
Example #10
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    context = getActivity();

    sharedata = context.getSharedPreferences("login_info", 0);

    login_data = sharedata.getString("success", ""); // 登陆状态
    login_name_data = sharedata.getString("name", ""); // 登陆名
    editor = sharedata.edit();

    view = inflater.inflate(R.layout.setting_main_fragment, container, false);

    Toast toast = Toast.makeText(getActivity(), "Welcome " + login_name_data, Toast.LENGTH_SHORT);
    toast.show();

    ListView list = (ListView) view.findViewById(R.id.set_listview);
    MyAdapter mAdapter = new MyAdapter(getActivity());
    mAdapter.notifyDataSetChanged();
    list.setAdapter(mAdapter);

    list.setOnItemClickListener(
        new OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> arg0, View view, int pos, long arg3) {

            switch (pos) {
              case 0:
                {
                  Intent intent = new Intent(getActivity(), SettingMyInfoActivity.class);
                  startActivity(intent);
                  break;
                }

              case 1:
                {
                  Intent intent = new Intent(getActivity(), SettingAccountActivity.class);
                  startActivity(intent);
                  break;
                }

              case 2:
                Intent intent = new Intent(getActivity(), SettingContactActivity.class);
                startActivity(intent);
                break;
            }
          }
        });

    initview();

    return view;
  }
Example #11
0
 private void refreshTasks() {
   try {
     idanapp.setTasklist(getInfoValue.getTasks(stateinfo.getCurrentPerson().getPersonID()));
     tasklist = idanapp.getTasklist();
     mAdapter.notifyDataSetChanged();
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Example #12
0
 @Override
 public boolean onNavigationItemSelected(int position, long l) {
   Chapter previous = mViewPagerAdapter.getSelectedChapter();
   mViewPagerAdapter.setSelectedChapter(mSpinnerAdapter.getItem(position));
   if (previous == null || !previous.equals(mSpinnerAdapter.getItem(position))) {
     Timber.d("Switching chapter!");
     mViewPagerAdapter.notifyDataSetChanged();
   }
   return true;
 }
  private void add2removeFooterView() {

    ListView lv = listView.getRefreshableView();
    adapter.notifyDataSetChanged();

    if (data.size() % 20 == 0 && data.size() != 0 && jsonArray.length() != 0) {
      lv.addFooterView(footView);
    } else {
      lv.removeFooterView(footView);
    }
  }
Example #14
0
 @Override
 public boolean onNavigationItemSelected(int itemPosition, long itemId) {
   String previous = mViewPagerAdapter.getSelectedPulseTarget();
   getSupportActionBar().setSelectedNavigationItem(itemPosition);
   mViewPagerAdapter.setSelectedPulseTarget(mSpinnerAdapter.getItem(itemPosition));
   if (!previous.equals(mSpinnerAdapter.getItem(itemPosition))) {
     Log.d(LOG_TAG, "Switching chapter!");
     mViewPagerAdapter.notifyDataSetChanged();
   }
   return true;
 }
  @Override
  protected void onDestroy() {
    mTabs.clear();
    mTabs = null;
    myAdapter.notifyDataSetChanged();
    myAdapter = null;
    mPager.setAdapter(null);
    mPager = null;
    mIndicator = null;

    super.onDestroy();
  }
  @Override
  public void onDismiss(
      @NonNull ViewGroup listView,
      @NonNull FlingDismissListener.DeleteItemWrapper[] reverseSortedPositions) {
    // 当item删除动画结束时执行这里

    for (FlingDismissListener.DeleteItemWrapper deleteItem : reverseSortedPositions) {
      // 由于每次删除一些item所在的position都会改变,所以必须使用对象来删除.
      strs.remove(deleteItem.item);
    }
    adapter.notifyDataSetChanged();
  }
 public void handleMessage(Message msg) {
   switch (msg.what) {
     case 0:
       myAdapter.notifyDataSetChanged();
       page = 1;
       ((PullToRefreshLayout) msg.obj).refreshFinish(PullToRefreshLayout.SUCCEED);
       break;
     case 1:
       if (hasMore) {
         ((PullableListView) msg.obj).finishLoading();
       } else {
         patientListView.setHasMoreData(false);
       }
       myAdapter.notifyDataSetChanged();
       break;
     case 2:
       page = 1;
       ((PullToRefreshLayout) msg.obj).refreshFinish(PullToRefreshLayout.FAIL);
       break;
   }
 };
Example #18
0
 // 刷新数据
 public void refreshData() {
   // 查找数据库所有数据
   stus = dao.findall();
   if (adapter == null) {
     // 创建一个adapter适配器
     adapter = new MyAdapter();
     // 给listView绑定上做好的适配器,就能显示数据库
     day03_02_lis_01.setAdapter(adapter);
   } else {
     // 数据发生了改变,通知listView刷新一下界面
     adapter.notifyDataSetChanged();
   }
 }
  private void prepareDialog() {

    final boolean silentModeOn = mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL;
    mSilentModeToggle.updateState(silentModeOn ? ToggleAction.State.On : ToggleAction.State.Off);

    mAirplaneModeOn.updateState(mAirplaneState);

    mAdapter.notifyDataSetChanged();
    if (mKeyguardShowing) {
      mDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    } else {
      mDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
    }
    mDialog.setTitle(R.string.global_actions);
  }
Example #20
0
  private void doSearch(String keyword) {

    _appList.clear();
    _adapter.notifyDataSetChanged();

    _searchKeyword = keyword;

    _loadingAnimation = AnimationUtils.loadAnimation(this, R.anim.loading_animation);
    // 使用ImageView显示动画
    _loadingImageView.startAnimation(_loadingAnimation);

    _loadingLayer.setVisibility(View.VISIBLE);

    _loadingThread = new LoadThread();
    _loadingThread.start();
  }
  @Override
  public void OnUpdateDataFinish(int Result) {
    if (getActivity() == null) {
      return;
    }
    cancelWait();

    if (Result == TResult.ESuccess) {}

    if (adapter != null) {
      adapter.notifyDataSetChanged();
    }

    if (adapter.getCount() == 0) listView.setVisibility(View.INVISIBLE);
    else listView.setVisibility(View.VISIBLE);
  }
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
      case Const.REQUEST_CODE_CAMERA:
        if (Bimp.drr.size() < 3 && resultCode == -1) {
          Bimp.drr.add(Const.phoneName);
          mAdapter.notifyDataSetChanged();
        }
        break;

      case Const.ADDRESS_CODE:
        if (resultCode == RESULT_OK) {
          mLocation = (Location) data.getSerializableExtra("location");
          tvGoodsAddress.setText(mLocation.getLocation());
        }
        break;
    }
  }
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch (resultCode) {
      case -106:
        adapter.notifyDataSetChanged();
        //                Bundle b = data.getExtras();
        //                svrid = b.getString("svrid");
        //                Intent mIntent = new Intent(getActivity(), DialogCommentActivity.class);
        initData();
        //                startActivity(mIntent);
        //                getActivity().finish();

        break;

      default:
        break;
    }
  }
Example #24
0
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   switch (requestCode) {
     case 1: // 拍照
       if (resultCode == RESULT_OK) {
         Toast.makeText(this, "拍摄成功", Toast.LENGTH_SHORT).show();
         Map<String, Object> map = new HashMap<String, Object>();
         map = new HashMap<String, Object>();
         map.put("title", "第 " + (mData.size() + 1) + "张图片");
         map.put("info", "还未添加描述哦~ ");
         map.put("img", "file://" + strImgPath);
         mData.add(map);
         adapter.notifyDataSetChanged();
       }
       break;
     default:
       break;
   }
 }
  public void dotest(View v) {

    max = 10;
    dataList.clear();
    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.notifyDataSetChanged();
    movetopostion(max + 2 % max - 2);
  }
 @Override
 public void onResume() {
   messageList.setFlag(true);
   if (adapter != null) adapter.notifyDataSetChanged();
   super.onResume();
 }
 /**
  * add a list of tabinfo
  *
  * @param tabs
  */
 public void addTabInfos(ArrayList<TabInfo> tabs) {
   mTabs.addAll(tabs);
   myAdapter.notifyDataSetChanged();
 }
Example #28
0
 public void updateList() {
   myAdapter.notifyDataSetChanged();
 }
Example #29
0
 @Override
 public void setData(List<ScanResult> list) {
   this.mScanResults = list;
   adapter.notifyDataSetChanged();
 }
Example #30
0
 public void setOnSetDatasListener(OnSetDatasListener listener) {
   mOnSetDatasListener = listener;
   datas = mOnSetDatasListener.getDatas();
   mAdapter.notifyDataSetChanged(); // 更新界面
 }