예제 #1
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.send:
       {
         if (statusData.getCurrentService().equals(IGeneral.SERVICE_NAME_SINA)
             || statusData.getCurrentService().equals(IGeneral.SERVICE_NAME_TENCENT)) {
           if ("".equals(mEditStatus.getText())) {
             Toast.makeText(
                     UpdateTagsActivity.this,
                     getString(R.string.alert_input_data),
                     Toast.LENGTH_SHORT)
                 .show();
           } else if (statusData.getCurrentService().equals(IGeneral.SERVICE_NAME_SINA)
                   && mEditStatus.getText().length() > 7
               || statusData.getCurrentService().equals(IGeneral.SERVICE_NAME_TENCENT)
                   && mEditStatus.getText().length() > 8) {
             Toast.makeText(
                     UpdateTagsActivity.this,
                     getString(R.string.alert_input_data_overflow),
                     Toast.LENGTH_SHORT)
                 .show();
           } else {
             showProgressDialog();
             // Prepare Parameters
             Map<String, Object> parameters;
             parameters = new HashMap<String, Object>();
             parameters.put("tags", mEditStatus.getText().toString());
             // Request
             try {
               apiServiceInterface.request(
                   statusData.getCurrentService(),
                   CommHandler.TYPE_UPDATE_TAGS,
                   apiServiceListener,
                   parameters);
             } catch (RemoteException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
             }
           }
         }
         break;
       }
     case R.id.head_refresh:
       {
         Intent home = new Intent(UpdateTagsActivity.this, HomeTimelineActivity.class);
         home.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
         startActivity(home);
         break;
       }
     case R.id.head_back:
       {
         finish();
         break;
       }
     default:
       break;
   }
 }
  @Override
  public void onServiceConnected(ComponentName name, IBinder service) {
    // TODO Auto-generated method stub
    if (name.getShortClassName().equals(API_SERVICE_NAME)) {
      apiServiceInterface = ApiServiceInterface.Stub.asInterface(service);
      if (data.isEmpty()) {
        try {

          // setProgressBarIndeterminateVisibility(true);
          showProgressDialog();

          // Prepare Parameters
          Map<String, Object> parameters;
          parameters = new HashMap<String, Object>();

          Bundle bundle = this.getIntent().getExtras();
          parameters.put("uid", bundle.getString("uid"));
          parameters.put("aid", bundle.getString("aid"));
          if ("4".equals(bundle.getString("visible"))) {
            parameters.put("password", bundle.getString("password"));
          }

          // Request
          apiServiceInterface.request(
              statusData.getCurrentService(),
              CommHandler.TYPE_GET_ALBUM_PHOTOS,
              apiServiceListener,
              parameters);
        } catch (RemoteException e) {
          e.printStackTrace();
        }
      }
    }
  }
예제 #3
0
        @SuppressWarnings("unchecked")
        @Override
        public void requestCompleted(String service, int type, String statusCode, String message)
            throws RemoteException {

          closeProgressDialog();
          if (statusCode != null && statusCode.equals("200") && message != null) {
            if (type == CommHandler.TYPE_UPDATE_TAGS) {

              Toast.makeText(
                      UpdateTagsActivity.this, getString(R.string.success), Toast.LENGTH_SHORT)
                  .show();

              finish();
            }
          }
          if (!"200".equals(statusCode)) {
            if ("360004".equals(statusCode)
                && statusData.getCurrentService().equals(IGeneral.SERVICE_NAME_TENCENT)) {
              Toast.makeText(
                      UpdateTagsActivity.this,
                      getString(R.string.alert_tag_same_data),
                      Toast.LENGTH_SHORT)
                  .show();
              mEditStatus.setText("");

            } else if ("10025".equals(statusCode)
                    && statusData.getCurrentService().equals(IGeneral.SERVICE_NAME_SINA)
                || "360002".equals(statusCode)
                    && statusData.getCurrentService().equals(IGeneral.SERVICE_NAME_TENCENT)) {
              Toast.makeText(
                      UpdateTagsActivity.this,
                      getString(R.string.alert_tag_add_overflow),
                      Toast.LENGTH_SHORT)
                  .show();
              finish();
            } else {
              Toast.makeText(
                      UpdateTagsActivity.this,
                      ErrorMessage.getErrorMessage(UpdateTagsActivity.this, statusCode),
                      Toast.LENGTH_SHORT)
                  .show();
            }
          }
        }