コード例 #1
0
ファイル: PollListAct.java プロジェクト: sonusinghswd/TeamApp
 @Override
 protected void onPostExecute(Void result) {
   if (mPollList.isEmpty()) {
     pd.dismiss();
     TeamAppAlerts.showToast(
         PollListAct.this,
         getString(R.string.no)
             + " "
             + getString(R.string.poll)
             + " "
             + getString(R.string.available));
     return;
   }
   populateChart();
   populateList();
   bodyLayout.setVisibility(View.VISIBLE);
   pd.dismiss();
 }
コード例 #2
0
  private void runNotification(final String message) {

    final Handler handler =
        new Handler() {
          @Override
          public void handleMessage(Message msg) {
            // TODO Auto-generated method stub
            switch (msg.what) {
              case 0:
                TeamAppAlerts.showToast(
                    SendMessageAct.this,
                    getString(R.string.notification) + " " + getString(R.string.sent_successfully));
                finish();
                break;
              case 1:
                TeamAppAlerts.showToast(
                    SendMessageAct.this,
                    getString(R.string.send_failed) + " " + getString(R.string.notification));
                break;
              case 2:
                TeamAppAlerts.showToast(SendMessageAct.this, getString(R.string.service));
                break;
            }
          }
        };

    TeamAppAlerts.showToast(SendMessageAct.this, getString(R.string.sending));
    new Thread() {
      @Override
      public void run() {

        int what = 0;

        try {
          switch (mKey) {
            case PLAYERS:
              if (!notifySelectedTeamMembers(message)) {
                what = 1;
              }
              break;
            case CAPTAINS:
              if (!notifyOtherTeamCaptains(message)) {
                what = 1;
              }
              break;
            case ACTIVITY:
              if (!sendNotification(message)) {
                what = 1;
              }
              break;
          }

        } catch (Exception e) {
          // TODO Auto-generated catch block
          what = 2;
          e.printStackTrace();
        }

        handler.sendMessage(handler.obtainMessage(what));
      }
    }.start();
  }
コード例 #3
0
ファイル: PollListAct.java プロジェクト: sonusinghswd/TeamApp
 @Override
 protected void onCancelled() {
   pd.dismiss();
   TeamAppAlerts.showToast(PollListAct.this, getString(R.string.service));
 }
コード例 #4
0
  private void validate() {

    if (rowOtherType.isShown()) {
      typeId = "0";
      typeName = txtType.getText().toString();
      if (typeName == null || typeName.length() == 0) {
        TeamAppAlerts.showMessageDialog(
            AddTrainingAct.this,
            getString(R.string.enter)
                + " "
                + getString(R.string.training)
                + " "
                + getString(R.string.enter_type));
        return;
      }
    }

    location = txtLocation.getText().toString();
    if (location == null || location.length() == 0) {
      TeamAppAlerts.showMessageDialog(
          AddTrainingAct.this,
          getString(R.string.enter)
              + " "
              + getString(R.string.training)
              + " "
              + getString(R.string.enter_location));
      return;
    }

    String date = txtDatePicker.getText().toString();
    if (date == null || date.length() == 0) {
      TeamAppAlerts.showMessageDialog(
          AddTrainingAct.this,
          getString(R.string.set)
              + " "
              + getString(R.string.training)
              + " "
              + getString(R.string.set_date));
      return;
    }

    String time = txtTimePicker.getText().toString();
    if (time == null || time.length() == 0) {
      TeamAppAlerts.showMessageDialog(
          AddTrainingAct.this,
          getString(R.string.set)
              + " "
              + getString(R.string.training)
              + " "
              + getString(R.string.set_time));
      return;
    }

    calendar.set(mYear, mMonth, mDay, mHour, mMinute);
    dateTime = dateFormat.format(calendar.getTime());

    Calendar sDate = Calendar.getInstance();
    Calendar eDate = Calendar.getInstance();

    try {

      sDate.setTime(dateFormat.parse(startDate));
      eDate.setTime(dateFormat.parse(endDate));

      if (calendar.before(sDate) || calendar.after(eDate)) {
        TeamAppAlerts.showMessageDialog(
            AddTrainingAct.this,
            getString(R.string.training) + " " + getString(R.string.out_of_season));
        return;
      }

    } catch (ParseException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    HashMap<String, String> status = (HashMap<String, String>) spnStatus.getSelectedItem();
    statusId = status.get("statusId");

    details = txtDetails.getText().toString();
    if (details == null || details.length() == 0) {
      TeamAppAlerts.showMessageDialog(
          AddTrainingAct.this,
          getString(R.string.enter)
              + " "
              + getString(R.string.training)
              + " "
              + getString(R.string.enter_details));
      return;
    }

    runInsert();
  }