|
|
@@ -7,10 +7,9 @@ import android.content.ClipData;
|
|
|
import android.content.ClipboardManager;
|
|
|
import android.content.Context;
|
|
|
import android.content.DialogInterface;
|
|
|
+import android.content.Intent;
|
|
|
import android.graphics.Color;
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
-import android.graphics.drawable.Drawable;
|
|
|
-import android.graphics.drawable.GradientDrawable;
|
|
|
import android.os.Build;
|
|
|
import android.os.Handler;
|
|
|
import android.os.Looper;
|
|
|
@@ -58,6 +57,7 @@ import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
import com.sheep.gamegroup.model.entity.BulletinEnty;
|
|
|
import com.sheep.gamegroup.model.entity.CashAwarsEntity;
|
|
|
import com.sheep.gamegroup.model.entity.HomeListEntity;
|
|
|
+import com.sheep.gamegroup.model.entity.MessageUnReadEntity;
|
|
|
import com.sheep.gamegroup.model.entity.MoreDataEntity;
|
|
|
import com.sheep.gamegroup.model.entity.RecyleObj;
|
|
|
import com.sheep.gamegroup.model.entity.RecyleType;
|
|
|
@@ -87,6 +87,7 @@ import com.sheep.gamegroup.util.TestUtil;
|
|
|
import com.sheep.gamegroup.util.UMConfigUtils;
|
|
|
import com.sheep.gamegroup.util.ViewHolder;
|
|
|
import com.sheep.gamegroup.util.ViewUtil;
|
|
|
+import com.sheep.gamegroup.view.activity.ActMsg;
|
|
|
import com.sheep.gamegroup.view.activity.NotificationsUtils;
|
|
|
import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
|
|
|
import com.sheep.gamegroup.view.adapter.AdpHomeListGrideview;
|
|
|
@@ -361,10 +362,14 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- @OnClick(R.id.to_search_but_rl)
|
|
|
+ @OnClick(R.id.to_search_but)
|
|
|
public void toSearchActivity() {
|
|
|
Jump2View.getInstance().goAppTaskSearch(activity, null);
|
|
|
}
|
|
|
+ @OnClick(R.id.home_search_msg_iv)
|
|
|
+ public void toActMsg() {
|
|
|
+ startActivity(new Intent(activity, ActMsg.class));
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 兑换红包
|
|
|
@@ -700,6 +705,8 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
+ //上面的搜索
|
|
|
+ ViewUtil.setVisibility(home_search_msg_tv, false);
|
|
|
}
|
|
|
|
|
|
private int curPosition = 0;
|
|
|
@@ -829,19 +836,6 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
* 初始化数据
|
|
|
*/
|
|
|
public void initData() {
|
|
|
- SysAppUtil.checkNet(new AbsObserver<Integer>() {
|
|
|
- @Override
|
|
|
- public void onNext(Integer result) {
|
|
|
- if (result != 0) {//无网络
|
|
|
- if (check_net_ll != null)
|
|
|
- check_net_ll.setVisibility(View.VISIBLE);
|
|
|
- } else {
|
|
|
- if (check_net_ll != null)
|
|
|
- check_net_ll.setVisibility(View.GONE);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
//用户信息
|
|
|
userEntity = DataUtil.getInstance().getUserEntity();
|
|
|
if (userEntity != null) {
|
|
|
@@ -935,6 +929,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
notifyDataSetChanged();
|
|
|
}
|
|
|
});
|
|
|
+ getUnReadMessageCounts();
|
|
|
if (upview1 != null) {
|
|
|
//停止滚动
|
|
|
upview1.stopFlipping();
|
|
|
@@ -1724,4 +1719,34 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
// }
|
|
|
adpHomeListGrideview.notifyDataSetChanged();
|
|
|
}
|
|
|
+ @BindView(R.id.home_search_msg_tv)
|
|
|
+ TextView home_search_msg_tv;
|
|
|
+ /**
|
|
|
+ * 获取是否有未读消息并更新图标
|
|
|
+ */
|
|
|
+ private void getUnReadMessageCounts() {
|
|
|
+ SheepApp.getInstance()
|
|
|
+ .getNetComponent()
|
|
|
+ .getApiService()
|
|
|
+ .getMessageUnReadNum(DataUtil.getInstance().getUserId())
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
+ @Override
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
+ MessageUnReadEntity entity = baseMessage.getData(MessageUnReadEntity.class);
|
|
|
+ if (entity != null && entity.getNum() > 0) {
|
|
|
+ ViewUtil.setVisibility(home_search_msg_tv, true);
|
|
|
+ ViewUtil.setText(home_search_msg_tv, entity.getNum());
|
|
|
+ } else {
|
|
|
+ ViewUtil.setVisibility(home_search_msg_tv, false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
}
|