Procházet zdrojové kódy

完成搜索界面修改

zengjiebin před 7 roky
rodič
revize
c1cf4a2b5e

+ 16 - 13
app/build.gradle

@@ -81,19 +81,21 @@ android {
             buildConfigField "String", "API_DOMAIN", '"app.ss.kfzs.com"'
             signingConfig signingConfigs.config
         }
-        sheeptestjiguang {
-            applicationId "com.sheep.jiuyan.samllsheep.test"
-            manifestPlaceholders = [DUANDUAN_GRAPH    : "sheeptestjiguang",
-                                    DUANDUAN_DATASHARE: "sheeptestjiguang",
-                                    jpush_appkey      : "627ffad0b1cdf701d15e027a",
-                                    umeng_app_key     : "5ab0a1da8f4a9d742900035f"
-            ]
-            buildConfigField "String", "DUANDUAN_DATASHARE", '"sheeptestjiguang"'
-            buildConfigField "String", "DUANDUAN_GRAPH", '"sheeptestjiguang"'
-            resValue "string", "app_name", "小绵羊极光测试"
-            buildConfigField "boolean", "XXTEA_ENCRYPT", 'true'
-            buildConfigField "String", "API_DOMAIN", '"app.ss.kfzs.com"'
-            signingConfig signingConfigs.config
+        if(!DONT_ADD_JI_GUANG as boolean) {
+            sheeptestjiguang {
+                applicationId "com.sheep.jiuyan.samllsheep.test"
+                manifestPlaceholders = [DUANDUAN_GRAPH    : "sheeptestjiguang",
+                                        DUANDUAN_DATASHARE: "sheeptestjiguang",
+                                        jpush_appkey      : "627ffad0b1cdf701d15e027a",
+                                        umeng_app_key     : "5ab0a1da8f4a9d742900035f"
+                ]
+                buildConfigField "String", "DUANDUAN_DATASHARE", '"sheeptestjiguang"'
+                buildConfigField "String", "DUANDUAN_GRAPH", '"sheeptestjiguang"'
+                resValue "string", "app_name", "小绵羊极光测试"
+                buildConfigField "boolean", "XXTEA_ENCRYPT", 'true'
+                buildConfigField "String", "API_DOMAIN", '"app.ss.kfzs.com"'
+                signingConfig signingConfigs.config
+            }
         }
         sheep {
             applicationId "com.sheep.jiuyan.samllsheep"
@@ -438,6 +440,7 @@ dependencies {
 static def releaseTime() {
     return new Date().format("MMddHHmm", TimeZone.getDefault())
 }
+
 //在apk文件后边生成版本号信息
 android.applicationVariants.all {
     variant ->

+ 41 - 16
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSmallSheep.java

@@ -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) {
+                    }
+                });
+
+    }
 }

+ 6 - 0
app/src/main/res/drawable/shape_f81b5f_rec_7.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle" >
+    <corners android:radius="7dp"/>
+    <solid android:color="#F81B5F" />
+</shape>

+ 11 - 3
app/src/main/res/layout/include_home_search.xml

@@ -15,12 +15,20 @@
         android:src="@mipmap/ic_msg" />
 
     <TextView
-        android:layout_width="13dp"
-        android:layout_height="13dp"
+        android:id="@+id/home_search_msg_tv"
+        android:layout_width="wrap_content"
+        android:layout_height="14dp"
+        android:layout_marginTop="30dp"
+        android:layout_marginEnd="8dp"
+        android:paddingStart="4dp"
+        android:paddingEnd="4dp"
+        android:layout_alignParentEnd="true"
+        android:minWidth="14dp"
         android:gravity="center"
         android:textSize="9sp"
+        android:text="0"
         android:textColor="@color/white"
-        android:background="#F81B5F"/>
+        android:background="@drawable/shape_f81b5f_rec_7"/>
     <LinearLayout
         android:id="@+id/to_search_but"
         android:layout_width="match_parent"