예제 #1
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    // TODO Auto-generated method stub
    super.onListItemClick(l, v, position, id);
    this.selectedMonth = Integer.parseInt(mMonthListAdapter.getItem(position));
    mMonthListAdapter.setSelectedIndex(position);

    sendEvent("monthreport", "monthchanged", "", 0);
    //		System.out.println("月份改变------>>>>");

  }
예제 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_monthreport);
    this.setTitle("发送月报");
    this.getTitlebar().setShowSeperator(false);
    this.getTitlebar()
        .setRightButton(
            "发送",
            new OnClickListener() {
              @Override
              public void onClick(View v) {
                if (selectedMonth < 1) {
                  Builder builder = new Builder(SendMonthReportActivity.this);
                  builder.setTitle("提示");
                  builder.setMessage("请先选择月份");
                  builder.setPositiveButton("确定", null);
                  builder.show();
                  return;
                } else {
                  CommonUtil.showConfirmDialg(
                      SendMonthReportActivity.this,
                      "提示",
                      "确定发送" + selectedYear + "年" + selectedMonth + "月的月报吗?",
                      new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                          SendMonthReportActivity.this.showProgressDialog("正在处理...");
                          sendTask =
                              SoapService.getVistPlanMailRequestTask(
                                  selectedYear + "-" + selectedMonth);
                          sendTask.setListener(SendMonthReportActivity.this);
                          sendTask.start();

                          sendEvent("monthreport", "sned", "", 0);

                          //							System.out.println("发送成功------>>>>");

                        }
                      },
                      null);
                }
              }
            });

    btnSelectYear = (Button) this.findViewById(R.id.btnSelectYear);
    btnSelectYear.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            int currentYear = Calendar.getInstance().get(Calendar.YEAR);
            final String[] years = new String[10];
            for (int i = 0; i < years.length; i++) {
              years[i] = String.valueOf(currentYear - i);
            }

            new AlertDialog.Builder(SendMonthReportActivity.this)
                .setTitle("选择年")
                .setItems(
                    years,
                    new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int which) {
                        btnSelectYear.setText(years[which] + "年");
                        refreshMonth(Integer.parseInt(years[which]));
                      }
                    })
                .create()
                .show();

            sendEvent("monthreport", "yearchanged", "", 0);

            //				System.out.println("年份改变------>>>>");

          }
        });

    this.selectedYear = Calendar.getInstance().get(Calendar.YEAR);
    btnSelectYear.setText(selectedYear + "年");
    this.selectedMonth = -1;
    mMonthListAdapter = new MonthListAdpater();
    this.setListAdapter(mMonthListAdapter);
    refreshMonth(this.selectedYear);
  }