示例#1
0
 @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
 @Override
 protected void onCancelled() {
   pd.dismiss();
   TeamAppAlerts.showToast(PollListAct.this, getString(R.string.service));
 }