|
|
@@ -1,9 +1,12 @@
|
|
|
package com.sheep.gamegroup.module.game.util;
|
|
|
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.util.Log;
|
|
|
import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.bumptech.glide.Glide;
|
|
|
import com.sheep.gamegroup.model.entity.Applications;
|
|
|
import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
@@ -19,6 +22,7 @@ import com.youth.banner.loader.ImageLoader;
|
|
|
|
|
|
import org.afinal.simplecache.ApiKey;
|
|
|
|
|
|
+
|
|
|
import butterknife.BindView;
|
|
|
import butterknife.ButterKnife;
|
|
|
import butterknife.OnClick;
|
|
|
@@ -43,6 +47,8 @@ public class FocusGameHelper {
|
|
|
public TextView tagView3;
|
|
|
@BindView(R.id.item_focus_size_tv)
|
|
|
public TextView sizeView;
|
|
|
+ @BindView(R.id.notice_bar)
|
|
|
+ public ImageView noticeBar;
|
|
|
|
|
|
public FocusGameHelper(View rootView) {
|
|
|
this.rootView = rootView;
|
|
|
@@ -55,6 +61,41 @@ public class FocusGameHelper {
|
|
|
}
|
|
|
|
|
|
public void refresh() {
|
|
|
+ SheepApp.getInstance().getNetComponent().getApiService().getNameUrl("game_center_banner")
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
+ @Override
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
+ noticeBar.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
+ Log.e("-----------", baseMessage.getData().toString());
|
|
|
+ JSONObject mainjson = JSONObject.parseObject(baseMessage.getData().toString());
|
|
|
+ if (mainjson.containsKey("game_center_banner")) {
|
|
|
+ JSONObject json = mainjson.getJSONObject("game_center_banner");
|
|
|
+ if (json.containsKey("status")) {
|
|
|
+ int status = json.getInteger("status");
|
|
|
+ if (status == 1) {
|
|
|
+ noticeBar.setVisibility(View.VISIBLE);
|
|
|
+ Glide.with(rootView.getContext()).load(json.getString("img_url")).into(noticeBar);
|
|
|
+ if (json.containsKey("jump_url") && !TextUtils.isEmpty(json.getString("jump_url"))) {
|
|
|
+ noticeBar.setOnClickListener(v -> {
|
|
|
+ Jump2View.getInstance().goWeb(rootView.getContext(), json.getString("jump_url"));
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ noticeBar.setOnClickListener(null);
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ noticeBar.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
SheepApp.getInstance().getNetComponent().getApiService().getDailyFocusApp()
|
|
|
.subscribeOn(Schedulers.io())
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|