예제 #1
0
  private void getJson(final int type) {
    OkHttpUtils.get()
        .url(url)
        .build()
        .execute(
            new StringCallback() {
              @Override
              public void onError(Call call, Exception e) {

                Toast.makeText(SearchNews.this, R.string.intent_error, Toast.LENGTH_SHORT).show();
              }

              @Override
              public void onResponse(String response) {
                if (type == 1) {
                  arrayList.clear();
                }
                setArray(response);
                adapter.notifyDataSetChanged();
              }
            });
  }
예제 #2
0
  private void getArtistInfo(String tingUid) {
    OkHttpUtils.get()
        .url(Constants.BASE_URL)
        .addParams(Constants.PARAM_METHOD, Constants.METHOD_ARTIST_INFO)
        .addParams(Constants.PARAM_TING_UID, tingUid)
        .build()
        .execute(
            new JsonCallback<JArtistInfo>(JArtistInfo.class) {
              @Override
              public void onResponse(JArtistInfo response) {
                ViewUtils.changeViewState(
                    svArtistInfo, llLoading, llLoadFail, LoadStateEnum.LOAD_SUCCESS);
                onSuccess(response);
              }

              @Override
              public void onError(Call call, Exception e) {
                ViewUtils.changeViewState(
                    svArtistInfo, llLoading, llLoadFail, LoadStateEnum.LOAD_FAIL);
              }
            });
  }