|
|
@@ -9,6 +9,8 @@ import android.content.Context;
|
|
|
import android.content.DialogInterface;
|
|
|
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;
|
|
|
@@ -77,6 +79,7 @@ import com.sheep.gamegroup.util.DataUtil;
|
|
|
import com.sheep.gamegroup.util.GlideImageLoader;
|
|
|
import com.sheep.gamegroup.util.Jump2View;
|
|
|
import com.sheep.gamegroup.util.ListUtil;
|
|
|
+import com.sheep.gamegroup.util.LogUtil;
|
|
|
import com.sheep.gamegroup.util.MyGridview;
|
|
|
import com.sheep.gamegroup.util.MyListview;
|
|
|
import com.sheep.gamegroup.util.RefreshUtil;
|
|
|
@@ -199,6 +202,10 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
TextView test_change_user;
|
|
|
@BindView(R.id.list_title)
|
|
|
LinearLayout listTitle;
|
|
|
+ @BindView(R.id.to_search_but_rl)
|
|
|
+ View to_search_but_rl;
|
|
|
+ @BindView(R.id.to_search_but)
|
|
|
+ LinearLayout to_search_but;
|
|
|
@BindView(R.id.title_car)
|
|
|
LinearLayout titleCardLayout;
|
|
|
/* 记录滑动坐标的数组 */
|
|
|
@@ -355,7 +362,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- @OnClick(R.id.to_search_but)
|
|
|
+ @OnClick(R.id.to_search_but_rl)
|
|
|
public void toSearchActivity() {
|
|
|
Jump2View.getInstance().goAppTaskSearch(activity, null);
|
|
|
}
|
|
|
@@ -609,6 +616,8 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
}
|
|
|
|
|
|
|
|
|
+ //banner的高度
|
|
|
+ private int bannerHeight = G.WIDTH * 17 / 40;
|
|
|
public void initView() {
|
|
|
try {
|
|
|
EventBus.getDefault().register(this);
|
|
|
@@ -623,7 +632,8 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
.inject(this);
|
|
|
recyclerInitView();
|
|
|
ViewGroup.LayoutParams bannerLayoutParams = banner.getLayoutParams();
|
|
|
- bannerLayoutParams.height = G.WIDTH * 17 / 40;//图片比例发生变化 :306*720
|
|
|
+ bannerHeight = G.WIDTH * 17 / 40;
|
|
|
+ bannerLayoutParams.height = bannerHeight;//图片比例发生变化 :306*720
|
|
|
// bannerLayoutParams.height = G.WIDTH * 25 / 72;
|
|
|
banner.setLayoutParams(bannerLayoutParams);
|
|
|
|
|
|
@@ -730,13 +740,33 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
|
|
|
public void initListener() {
|
|
|
scrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
|
|
|
@Override
|
|
|
- public void onScrollChange(NestedScrollView nestedScrollView, int i, int i1, int i2, int i3) {
|
|
|
+ public void onScrollChange(NestedScrollView nestedScrollView, int x, int y, int oldX, int oldY) {
|
|
|
listTitle.getLocationInWindow(locate);
|
|
|
if (locate[1] < 0 && titleCardLayout.getVisibility() == View.GONE) {
|
|
|
titleCardLayout.setVisibility(View.VISIBLE);
|
|
|
} else if (locate[1] > 20 && titleCardLayout.getVisibility() == View.VISIBLE) {
|
|
|
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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+// LogUtil.println("FgtSmallSheep", "onScrollChange", x, y, oldX, oldY, locate[0], locate[1]);
|
|
|
}
|
|
|
});
|
|
|
scrollView.setOnTouchListener(new View.OnTouchListener() {
|