// 绑定数据
 public void BinderListData(MyListAdapter saImageItems) {
   // ListView listView_cart = (ListView)
   // findViewById(R.id.listView_chakan);
   // 添加并且显示
   lv_usbdatarecord.setAdapter(saImageItems);
   saImageItems.notifyDataSetChanged();
   // 点击控件监听器
   lv_usbdatarecord.setOnItemClickListener(new ItemClickListener());
 }
Exemple #2
0
  /** 回到正常选择模式 */
  public void toNormal() {
    editmodel = false;
    listAdapter.setEdit(false);
    listAdapter.initMap();
    noteListView.setAdapter(listAdapter);

    if (editTopLayout.getVisibility() == View.VISIBLE) {
      editTopLayout.setVisibility(View.GONE);
      bottomLayout.setVisibility(View.GONE);
      bottomLayout.startAnimation(AnimationUtils.loadAnimation(this, R.anim.push_bottom_out));
      editTopLayout.startAnimation(AnimationUtils.loadAnimation(this, R.anim.push_top_out));
    }

    if (searchTitle.getVisibility() == View.VISIBLE) {
      searchTitle.setVisibility(View.GONE);
      searchTitle.startAnimation(AnimationUtils.loadAnimation(this, R.anim.push_top_out));
    }

    // 恢复侧栏可用
    slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    seeAllButton.setEnabled(true); // 恢复侧栏按钮可用
    addNoteButton.setEnabled(true); // 恢复添加按钮可用
  }
  private void update_list(boolean notifyChange) {
    int len;

    if (!total_process.isEmpty()) total_process.clear();
    if (!display_process.isEmpty()) display_process.clear();

    total_process = activity_man.getRunningAppProcesses();
    len = total_process.size();

    for (int i = 0; i < len; i++) {
      if (total_process.get(i).importance != RunningAppProcessInfo.IMPORTANCE_FOREGROUND
          && total_process.get(i).importance != RunningAppProcessInfo.IMPORTANCE_SERVICE)
        display_process.add(total_process.get(i));
    }

    if (notifyChange) delegate.notifyDataSetChanged();

    update_labels();
  }
Exemple #4
0
  /** 进入编辑模式 */
  public void toEdit() {
    editmodel = true;
    listAdapter.setEdit(true);
    noteListView.setAdapter(listAdapter);

    editTopLayout.setVisibility(View.VISIBLE);
    bottomLayout.setVisibility(View.VISIBLE);

    bottomLayout.startAnimation(AnimationUtils.loadAnimation(this, R.anim.push_bottom_in));
    editTopLayout.startAnimation(AnimationUtils.loadAnimation(this, R.anim.push_top_in));

    // 侧栏不可用
    slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
    seeAllButton.setEnabled(false); // 侧栏按钮不可用
    addNoteButton.setEnabled(false); // 添加按钮不可用
    // 必定选择了一项,所以全部按钮都为可见
    deleteButton.setVisibility(View.VISIBLE);
    shareButton.setVisibility(View.VISIBLE);
    moveButton.setVisibility(View.VISIBLE);
    lockedButton.setVisibility(View.VISIBLE);
    unlockedButton.setVisibility(View.VISIBLE);
  }
  private void initView() {
    context = this;
    sp = getSharedPreferences(SPkeys.SPNAME.getString(), 0);
    imageLoader = new ImageLoader(context.getApplicationContext());
    passengerList = new ArrayList<Passenger>();
    allPassengerList = new ArrayList<Passenger>();

    xibie_listview = (ListView) findViewById(R.id.xibie_listview);
    add_passager_rl = (RelativeLayout) findViewById(R.id.add_passager_rl);
    baoxian_rl = (RelativeLayout) findViewById(R.id.baoxian_rl);
    lianxiren_icon_imgbtn = (ImageButton) findViewById(R.id.lianxiren_icon_imgbtn);
    back_imgbtn = (ImageButton) findViewById(R.id.back_imgbtn);
    home_imgbtn = (ImageButton) findViewById(R.id.home_imgbtn);
    train_num_tv = (TextView) findViewById(R.id.train_num_tv);
    train_type_tv = (TextView) findViewById(R.id.train_type_tv);
    runtime_tv = (TextView) findViewById(R.id.runtime_tv);
    start_station_tv = (TextView) findViewById(R.id.start_station_tv);
    start_time_tv = (TextView) findViewById(R.id.start_time_tv);
    start_date_tv = (TextView) findViewById(R.id.start_date_tv);
    end_station_tv = (TextView) findViewById(R.id.end_station_tv);
    end_time_tv = (TextView) findViewById(R.id.end_time_tv);
    end_date_tv = (TextView) findViewById(R.id.end_date_tv);
    seat_grad_tv = (TextView) findViewById(R.id.seat_grad_tv);
    ticket_price_tv = (TextView) findViewById(R.id.ticket_price_tv);
    remain_count_tv = (TextView) findViewById(R.id.remain_count_tv);
    modify_seat_tv = (TextView) findViewById(R.id.modify_seat_tv);
    add_passager_tv = (TextView) findViewById(R.id.add_passager_tv);
    djsx_tv = (TextView) findViewById(R.id.djsx_tv);
    baoxian_price_and_count_tv = (TextView) findViewById(R.id.baoxian_price_and_count_tv);
    order_totalmoney_tv = (TextView) findViewById(R.id.order_totalmoney_tv);
    contact_person_phone_et = (ClearEditText) findViewById(R.id.contact_person_phone_et);
    yanzhengma_input_et = (ClearEditText) findViewById(R.id.yanzhengma_input_et);
    passenger_head_divid_line = findViewById(R.id.passenger_head_divid_line);
    passenger_listview = (ListView) findViewById(R.id.passenger_listview);
    start_station_icon_iv = (ImageView) findViewById(R.id.start_station_icon_iv);
    end_station_icon_iv = (ImageView) findViewById(R.id.end_station_icon_iv);
    yanzhengma_iv = (ImageView) findViewById(R.id.yanzhengma_iv);
    order_now_btn = (Button) findViewById(R.id.order_now_btn);
    back_imgbtn.setOnClickListener(btnClickListner);
    home_imgbtn.setOnClickListener(btnClickListner);
    modify_seat_tv.setOnClickListener(btnClickListner);
    yanzhengma_iv.setOnClickListener(btnClickListner);
    ((TextView) findViewById(R.id.djsx_tv)).setOnClickListener(btnClickListner);
    add_passager_rl.setOnClickListener(btnClickListner);
    order_now_btn.setOnClickListener(btnClickListner);
    baoxian_price_and_count_tv.setOnClickListener(btnClickListner);
    baoxian_rl.setOnClickListener(btnClickListner);
    lianxiren_icon_imgbtn.setOnClickListener(btnClickListner);

    getIntentTrainInfo();
    train_num_tv.setText(ti.getTrainID());
    train_type_tv.setText(ti.getTrainType());
    runtime_tv.setText("历时:" + ti.getRunTime());
    start_station_tv.setText(ti.getStationS());
    end_station_tv.setText(ti.getStationE());
    seat_grad_tv.setText(ti.getSeat_Type());
    ticket_price_tv.setText("¥" + ticket_price);
    remain_count_tv.setText("余票" + ti.getRemain_Count() + "张");
    start_time_tv.setText(ti.getGoTime());
    end_time_tv.setText(ti.getETime());
    adapter_xibie = new MyListAdapter(context, ti.getSeatList());
    adapter_xibie.setCurrentID(selectedSeatIndex);
    remainTicketCount = Integer.valueOf(ti.getRemain_Count());
    // adapter_xibie.notifyDataSetChanged();
    xibie_listview.setAdapter(adapter_xibie);
    ActivityInlandAirlineticketBooking.setListViewHeightBasedOnChildren(xibie_listview);
    xibie_listview.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            try {
              if (position != selectedSeatIndex) {
                adapter_xibie.setCurrentID(position);
                adapter_xibie.notifyDataSetChanged();
              }
              selectedSeatIndex = position;
              // adapter_xibie.notifyDataSetChanged();
              ticket_price = Float.valueOf(ti.getSeatList().get(position).getPrice());
              remainTicketCount = Integer.valueOf(ti.getSeatList().get(position).getShengyu());
              caculateMoney();
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        });
    if (selectedSeatIndex == -1) {
      order_now_btn.setEnabled(false);
      order_now_btn.setBackground(
          getResources().getDrawable(R.drawable.booking_immediately_button_d));
    }

    String SFType = ti.getSFType();
    if (SFType.length() == 3) {
      String SType = SFType.substring(0, 1);
      String FType = SFType.substring(2, 3);
      if (SType.equals("始")) {
        start_station_icon_iv.setBackground(getResources().getDrawable(R.drawable.trains_start));
      } else if (SType.equals("过")) {
        start_station_icon_iv.setBackground(getResources().getDrawable(R.drawable.train_over));
      }
      if (FType.equals("终")) {
        end_station_icon_iv.setBackground(getResources().getDrawable(R.drawable.train_final));
      } else if (FType.equals("过")) {
        end_station_icon_iv.setBackground(getResources().getDrawable(R.drawable.train_over));
      }
    }
    getValidCodePic(); // 获取验证码信息
    // 对于常用联系人,直接返回上次订票时的联系人手机号,若不存在则返回本机手机号码
    if (sp.getString(SPkeys.trainContactPhone.getString(), "").equals(""))
      contact_person_phone_et.setText(CommonFunc.getPhoneNumber(context));
    else contact_person_phone_et.setText(sp.getString(SPkeys.trainContactPhone.getString(), ""));
    caculateMoney();
  }
 private void expandAll() {
   int count = listAdapter.getGroupCount();
   for (int i = 0; i < count; i++) {
     myList.expandGroup(i);
   }
 }
 // method to collapse all groups
 private void collapseAll(int skip) {
   int count = listAdapter.getGroupCount();
   for (int i = 0; i < count; i++) {
     if (i != skip) myList.collapseGroup(i);
   }
 }
        public void afterTextChanged(Editable s) {
          String inputTxt = txt.getText().toString().toLowerCase();

          String brightString = inputTxt;
          String colorString = "";
          int groupPosition;
          int count = 0;
          int countB = 0;

          expandAll();

          // fel, kolla en bool typ, om checkText = true;
          System.out.println("click: " + click);
          if (click == true) {
            click = false;
            return;
          }

          // check if the text contains a /
          if (inputTxt.contains("/") && inputTxt.length() > 1) {
            String[] separated = inputTxt.split("/");

            if (inputTxt.startsWith("/")) {
              brightString = separated[1];
              colorString = "";

              if (separated.length > 2) {
                brightString = separated[1];
                colorString = separated[2];
              }
            } else {
              if (separated.length > 1) {
                brightString = separated[0];
                colorString = separated[1];
              } else {
                brightString = separated[0];
                colorString = "";
              }
            }
          }

          // System.out.println("brString: " + brightString);
          // System.out.println("colString: " + colorString);

          // check the header
          for (int i = 0; i < listAdapter.getGroupCount(); i++) {

            // get the group header
            Brightness headerInfo = brightList.get(i);

            if (headerInfo.getName().startsWith(brightString)) {

              groupPosition = brightList.indexOf(headerInfo);
              txt.setBackgroundColor(android.graphics.Color.WHITE);
              countB = 1;

              // loop through the children
              for (int j = 0; j < headerInfo.getColorList().size(); j++) {

                // get the child info
                Color childInfo = headerInfo.getColorList().get(j);

                if (childInfo.getName().startsWith(colorString) && colorString.length() > 0) {

                  // expand other groups
                  collapseAll(groupPosition);
                  count = 1;

                  // check if the whole word is typed
                  if (colorString.contains(childInfo.getName())) {

                    index =
                        myList.getFlatListPosition(
                            ExpandableListView.getPackedPositionForChild(i, j));
                    myList.setItemChecked(index, true);
                  }
                }
              }

              if (count == 0 && colorString.length() > 0) {
                txt.setBackgroundColor(android.graphics.Color.RED);
                myList.setItemChecked(index, false);
                return;
              }
            }
            if (countB == 0 && brightString.length() > 0) {
              if (brightString.startsWith("/"))
                txt.setBackgroundColor(android.graphics.Color.WHITE);
              else txt.setBackgroundColor(android.graphics.Color.RED);
            }
          }
        }