コード例 #1
0
  @Override
  protected void onPreExecute() {
    super.onPreExecute();
    if (divider != null) {
      divider.setLoading(true);
    }

    if (GlobalVars.NET_TYPE == NetType.NONE) {
      cancel(true);
      resultMsg =
          ResourceBook.getStatusCodeValue(ExceptionCode.NET_UNCONNECTED, adapter.getContext());
      Toast.makeText(adapter.getContext(), resultMsg, Toast.LENGTH_LONG).show();

      if (divider != null) {
        divider.setLoading(false);
      }
      adapter.notifyDataSetChanged();
    }
  }
コード例 #2
0
  @Override
  protected void onPostExecute(Boolean result) {
    if (divider != null) {
      divider.setLoading(false);
    }

    if (result) {
      adapter.addCacheToDivider(divider, listStatus);
    } else {
      if (resultMsg != null) {
        Toast.makeText(adapter.getContext(), resultMsg, Toast.LENGTH_LONG).show();
      } else {
        Toast.makeText(adapter.getContext(), R.string.msg_no_divider_data, Toast.LENGTH_LONG)
            .show();
        adapter.remove(divider);
      }

      // 如果没有的话,修改状态
      adapter.notifyDataSetChanged();
    }
  }