Beispiel #1
0
  private void setStatus() {
    try {
      getStateInfo myGetStateInfo = getStateInfo.getInstance(getApplicationContext());
      StateInfo myStateInfo = myGetStateInfo.getStateinfo();
      myStateInfo.setCurrentState(1);
      myGetStateInfo.setStateinfo(myStateInfo);

    } catch (Exception e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }
  }
Beispiel #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.i("jxb", "create");
    setContentView(R.layout.business_list);
    idanapp = iDanApp.getInstance();
    tasklist = idanapp.getTasklist();
    JPushInterface.init(getApplicationContext());
    try {
      stateinfo = getStateInfo.getInstance(getApplicationContext()).getStateinfo();
      pauseNote = stateinfo.getPauseNote();
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      Toast.makeText(this.getApplicationContext(), R.string.error, 2000);
    }
    mHandler.sendMessage(mHandler.obtainMessage(MSG_SET_ALIAS, stateinfo.getUserAccount()));
    ActivityControler.addActivity(this);

    findView();
    uploadNotes();
    tv_title.setText(iDanApp.getInstance().getUSERNAME());
    mAdapter = new MyAdapter(this);
    mListView.setAdapter(mAdapter);
    mListView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // tasklist.get(position).setReadmark(0);
            curTask = tasklist.get(position);
            // curTask=iDanApp.getInstance().getTasklist().get(position);
            curTask.setReadmark(0);
            Intent intent = new Intent();
            intent.putExtra(POSITION, position);
            intent.setClass(getApplicationContext(), OrderDetail.class);
            startActivity(intent);
          }
        });
    tv_addStart.setVisibility(View.VISIBLE);
    tv_addEnd.setVisibility(View.GONE);
    if (stateinfo.getIsOutDoor()) {
      tv_addStart.setVisibility(View.VISIBLE);
      tv_addEnd.setVisibility(View.GONE);
    } else {
      tv_addStart.setVisibility(View.GONE);
      tv_addEnd.setVisibility(View.VISIBLE);
    }

    // configure the SlidingMenu
    MenuLeftFragment menuLayout = new MenuLeftFragment(getApplicationContext());
    // final SlidingMenu
    menu = new SlidingMenu(this);
    menu.setMode(SlidingMenu.LEFT);
    menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    menu.setShadowWidthRes(R.dimen.shadow_width);
    menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    menu.setFadeDegree(0.35f);
    /**
     * SLIDING_WINDOW will include the Title/ActionBar in the content section of the SlidingMenu,
     * while SLIDING_CONTENT does not.
     */
    menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
    menu.setMenu(R.layout.left_menu);

    checkVersion(this);

    iv_return.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            menu.showMenu();
            // refreshTasks();
          }
        });
    iv_refresh.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            refreshTasks();
          }
        });
    tv_addStart.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            final EditText editText = new EditText(MainActivity.this);
            editText.setInputType(InputType.TYPE_CLASS_NUMBER);
            new AlertDialog.Builder(MainActivity.this)
                .setTitle("请填写出场路码")
                .setView(editText)
                .setPositiveButton(
                    "确定",
                    new android.content.DialogInterface.OnClickListener() {

                      @Override
                      public void onClick(DialogInterface dialog, int which) {

                        String input = editText.getText().toString();
                        if (input.equals("")) {
                          Toast.makeText(getApplicationContext(), "路码不能为空", Toast.LENGTH_SHORT)
                              .show();
                        } else {
                          try {
                            getStateInfo myGetStateInfo =
                                getStateInfo.getInstance(getApplicationContext());
                            StateInfo myStateInfo = myGetStateInfo.getStateinfo();
                            myStateInfo.setBeginKMsOfToday(input);
                            myStateInfo.setIsOutDoor(false);
                            myGetStateInfo.setStateinfo(myStateInfo);
                            tv_addStart.setVisibility(View.GONE);
                            tv_addEnd.setVisibility(View.VISIBLE);
                          } catch (Exception e1) {
                            // TODO Auto-generated catch
                            // block
                            e1.printStackTrace();
                          }
                        }
                      }
                    })
                .show();
          }
        });
    tv_addEnd.setOnClickListener(myClickListener);
    stateinfo.setCurrentState(1);
    getStateInfo.getInstance(getApplicationContext()).setStateinfo(stateinfo);
  }