Ejemplo n.º 1
0
  private void getDatasFromNetbefore() {
    gn.getDepartment(
        Config.URL,
        Config.SENDMSG,
        new Response.Listener<String>() {
          @Override
          public void onResponse(String s) {
            db = new DBOption(ShowSendPublishAty.this);
            if (s != null) {
              list = JsonToPubhlishData.getPublishDataSend(s);
              Intent intent = getIntent();
              data = (PublishData) intent.getSerializableExtra("data");
              for (PublishData d : list) {
                if (d.getTime().equals(d.getTime())) {
                  title.setText(d.getTitle());
                  datetime = d.getTime();
                  time.setText(datetime);
                  content.setText(d.getContent());
                  replyCount.setText(d.getReplyedCount());
                  unreplyCount.setText(d.getUnReplyCount());
                }
              }
            }
          }
        },
        new Response.ErrorListener() {

          @Override
          public void onErrorResponse(VolleyError volleyError) {}
        },
        Config.loadUser(ShowSendPublishAty.this).getUsername());
  }
Ejemplo n.º 2
0
  private void getDatasFromNetafter() {
    gn.getDepartment(
        Config.URL,
        Config.SENDMSG,
        new Response.Listener<String>() {
          @Override
          public void onResponse(String s) {
            db = new DBOption(ShowSendPublishAty.this);
            if (s != null) {
              db.updateCatch(
                  Config.URL
                      + Config.SENDMSG
                      + Config.loadUser(ShowSendPublishAty.this).getUsername(),
                  s,
                  System.currentTimeMillis() + "");
              Intent intent = new Intent(ShowSendPublishAty.this, PublishDatasAty.class);
              intent.setAction("refresh");
              startActivity(intent);
              ActivityContror.removeActivity(ShowSendPublishAty.this);
            } else {
              ShowToast.show(ShowSendPublishAty.this, "没有通知");
            }
            Log.d("hehe", s);
          }
        },
        new Response.ErrorListener() {

          @Override
          public void onErrorResponse(VolleyError volleyError) {
            ShowToast.show(ShowSendPublishAty.this, "获取数据失败");
            Log.d("hehe", "error");
          }
        },
        Config.loadUser(ShowSendPublishAty.this).getUsername());
  }
Ejemplo n.º 3
0
  private void deletepublish() {
    JSONObject json = new JSONObject();
    try {
      json.put("uid", Config.loadUser(this).getUsername());
      json.put("datetime", datetime);
    } catch (JSONException e) {
      e.printStackTrace();
    }
    gn.getDepartment(
        Config.URL,
        Config.DELETEMYSENDNOTICE,
        new Response.Listener<String>() {

          @Override
          public void onResponse(String s) {
            ShowToast.show(ShowSendPublishAty.this, "删除成功");
            getDatasFromNetafter();
          }
        },
        new Response.ErrorListener() {

          @Override
          public void onErrorResponse(VolleyError volleyError) {
            ShowToast.show(ShowSendPublishAty.this, "删除失败");
          }
        },
        json.toString());
  }