Ejemplo n.º 1
0
        @Override
        public void onNext(ShareBean result) {

          sf_lv_share_item_swipe_refresh.setRefreshing(false);
          lastId = result.getData().get(result.getData().size() - 1).getId() + "";
          lastTime = result.getData().get(result.getData().size() - 1).getCreateTime() + "";

          shares.addAll(result.getData());
          paintAdapter.notifyDataSetChanged();
        }
Ejemplo n.º 2
0
        @Override
        public void onNext(ShareBean result) {
          sf_lv_share_item_swipe_refresh.setRefreshing(false);
          String strJson = "";
          Gson gson = new Gson();
          strJson = gson.toJson(result);

          if (type == 4) {
            if (strJson != null
                && !"".equals(strJson)
                && strJson.equals(SharePreferences.getInstance(context).getShareDaily())) {
              SharePreferences.getInstance(context).setShareDaily(strJson);
              return;
            }
            SharePreferences.getInstance(context).setShareDaily(strJson);
          } else if (type == 5) {
            if (strJson != null
                && !"".equals(strJson)
                && strJson.equals(SharePreferences.getInstance(context).getShareTucao())) {
              SharePreferences.getInstance(context).setShareTucao(strJson);
              return;
            }
            SharePreferences.getInstance(context).setShareTucao(strJson);

          } else if (type == 6) {
            if (strJson != null
                && !"".equals(strJson)
                && strJson.equals(SharePreferences.getInstance(context).getShareFanju())) {
              SharePreferences.getInstance(context).setShareFanju(strJson);
              return;
            }
            SharePreferences.getInstance(context).setShareFanju(strJson);

          } else if (type == 3) {
            if (strJson != null
                && !"".equals(strJson)
                && strJson.equals(SharePreferences.getInstance(context).getShareCos())) {
              SharePreferences.getInstance(context).setShareCos(strJson);
              return;
            }
            SharePreferences.getInstance(context).setShareCos(strJson);
          }
          lastId = result.getData().get(result.getData().size() - 1).getId() + "";
          lastTime = result.getData().get(result.getData().size() - 1).getCreateTime() + "";
          shares.addAll(result.getData());
          paintAdapter.notifyDataSetChanged();
        }
Ejemplo n.º 3
0
  private void getAppIndexData(int dateType, int pageNo3) {

    shares.clear();
    ShareBean list = null;
    if (type == 4) {
      if (!Utils.isNull(SharePreferences.getInstance(context).getShareDaily())) {
        Gson gson = new Gson();
        list =
            gson.fromJson(SharePreferences.getInstance(context).getShareDaily(), ShareBean.class);
        shares.addAll(list.getData());
        paintAdapter.notifyDataSetChanged();
      }
    } else if (type == 5) {
      if (!Utils.isNull(SharePreferences.getInstance(context).getShareTucao())) {
        Gson gson = new Gson();
        list =
            gson.fromJson(SharePreferences.getInstance(context).getShareTucao(), ShareBean.class);
        shares.addAll(list.getData());
        paintAdapter.notifyDataSetChanged();
      }
    } else if (type == 6) {
      if (!Utils.isNull(SharePreferences.getInstance(context).getShareFanju())) {
        Gson gson = new Gson();
        list =
            gson.fromJson(SharePreferences.getInstance(context).getShareFanju(), ShareBean.class);
        shares.addAll(list.getData());
        paintAdapter.notifyDataSetChanged();
      }
    } else if (type == 3) {
      if (!Utils.isNull(SharePreferences.getInstance(context).getShareCos())) {
        Gson gson = new Gson();
        list = gson.fromJson(SharePreferences.getInstance(context).getShareCos(), ShareBean.class);
        shares.addAll(list.getData());
        paintAdapter.notifyDataSetChanged();
      }
    }

    if (list != null && list.getData() != null && list.getData().size() > 0) {
      lastId = list.getData().get(list.getData().size() - 1).getId() + "";
      lastTime = list.getData().get(list.getData().size() - 1).getCreateTime() + "";
    }

    Log.d("zkk", "---type" + dateType);
    // http://api.moeju.cn//painting/originalList?lastId=&lastTime=0&dk=5ed40069e20354be&ak=~68EECA63-0FB4-1EB8-628D-CDCF663CEB41&v=2.1.0&os=a&channel=Xiaomi
    MengquApi.getInstance()
        .getShare(dateType + "", "", "5ed40069e20354be", "~68EECA63-0FB4-1EB8-628D-CDCF663CEB41")
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(observer);
  }