|
|
@@ -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;
|
|
|
@@ -747,24 +754,24 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
titleCardLayout.setVisibility(View.GONE);
|
|
|
}
|
|
|
//设置搜索框颜色变化
|
|
|
- float ratio = Math.min(bannerHeight, y) * 1.0f / bannerHeight;
|
|
|
- to_search_but_rl.setBackgroundColor(Color.argb((int) (ratio * 255), 255, 255, 255));
|
|
|
- float colorRatio = 1 - ratio * 0.26f;
|
|
|
- Drawable bg = to_search_but.getBackground();
|
|
|
- if(bg instanceof GradientDrawable){
|
|
|
- GradientDrawable drawable = (GradientDrawable) bg;
|
|
|
- drawable.setColor(Color.argb(216, (int) (colorRatio * 255), (int) (colorRatio * 255), (int) (colorRatio * 255)));
|
|
|
- }
|
|
|
- int[] minPerS = {102, 153};
|
|
|
- for (int i = 0; i < to_search_but.getChildCount(); i++) {
|
|
|
- int minPer = minPerS[i % minPerS.length];
|
|
|
- int per = (int) ((255 - minPer) * ratio + minPer);
|
|
|
- int textColor = Color.argb(255, per, per, per);
|
|
|
- View childView = to_search_but.getChildAt(i);
|
|
|
- if(childView instanceof TextView){
|
|
|
- ((TextView) childView).setTextColor(textColor);
|
|
|
- }
|
|
|
- }
|
|
|
+// float ratio = Math.min(bannerHeight, y) * 1.0f / bannerHeight;
|
|
|
+// to_search_but_rl.setBackgroundColor(Color.argb((int) (ratio * 255), 255, 255, 255));
|
|
|
+// float colorRatio = 1 - ratio * 0.26f;
|
|
|
+// Drawable bg = to_search_but.getBackground();
|
|
|
+// if(bg instanceof GradientDrawable){
|
|
|
+// GradientDrawable drawable = (GradientDrawable) bg;
|
|
|
+// drawable.setColor(Color.argb(216, (int) (colorRatio * 255), (int) (colorRatio * 255), (int) (colorRatio * 255)));
|
|
|
+// }
|
|
|
+// int[] minPerS = {102, 153};
|
|
|
+// for (int i = 0; i < to_search_but.getChildCount(); i++) {
|
|
|
+// int minPer = minPerS[i % minPerS.length];
|
|
|
+// int per = (int) ((255 - minPer) * ratio + minPer);
|
|
|
+// int textColor = Color.argb(255, per, per, per);
|
|
|
+// View childView = to_search_but.getChildAt(i);
|
|
|
+// if(childView instanceof TextView){
|
|
|
+// ((TextView) childView).setTextColor(textColor);
|
|
|
+// }
|
|
|
+// }
|
|
|
// LogUtil.println("FgtSmallSheep", "onScrollChange", x, y, oldX, oldY, locate[0], locate[1]);
|
|
|
}
|
|
|
});
|
|
|
@@ -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) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
}
|