Procházet zdrojové kódy

new search feature

hanjing před 6 roky
rodič
revize
81b1ac3a0d
37 změnil soubory, kde provedl 1029 přidání a 681 odebrání
  1. 1 5
      app/src/main/AndroidManifest.xml
  2. 6 0
      app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java
  3. 68 0
      app/src/main/java/com/sheep/gamegroup/model/entity/GameSimple.java
  4. 8 1
      app/src/main/java/com/sheep/gamegroup/model/entity/GiftBag.java
  5. 32 0
      app/src/main/java/com/sheep/gamegroup/model/entity/Keyword.java
  6. 66 0
      app/src/main/java/com/sheep/gamegroup/model/entity/TaskSimple.java
  7. 1 1
      app/src/main/java/com/sheep/gamegroup/module/game/activity/ActGameCenterType.java
  8. 1 1
      app/src/main/java/com/sheep/gamegroup/module/game/activity/ActGameRank.java
  9. 0 240
      app/src/main/java/com/sheep/gamegroup/module/game/activity/ActSearchGameGroup.java
  10. 1 15
      app/src/main/java/com/sheep/gamegroup/module/game/fragment/FgtGameCenter.java
  11. 232 0
      app/src/main/java/com/sheep/gamegroup/module/search/ActSearch.java
  12. 79 0
      app/src/main/java/com/sheep/gamegroup/module/search/AdpSearchResult.java
  13. 38 0
      app/src/main/java/com/sheep/gamegroup/module/search/ArticleHolder.java
  14. 155 0
      app/src/main/java/com/sheep/gamegroup/module/search/FgtSearch.java
  15. 64 0
      app/src/main/java/com/sheep/gamegroup/module/search/GameHolder.java
  16. 84 0
      app/src/main/java/com/sheep/gamegroup/module/search/GiftHolder.java
  17. 9 0
      app/src/main/java/com/sheep/gamegroup/module/search/SearchItem.java
  18. 25 0
      app/src/main/java/com/sheep/gamegroup/module/search/SearchResultHolder.java
  19. 45 0
      app/src/main/java/com/sheep/gamegroup/module/search/TaskHolder.java
  20. 3 15
      app/src/main/java/com/sheep/gamegroup/util/Jump2View.java
  21. 0 243
      app/src/main/java/com/sheep/gamegroup/view/activity/ActSearchAppOrTask.java
  22. 0 48
      app/src/main/java/com/sheep/gamegroup/view/adapter/HomePageSearchAdapter.java
  23. 0 84
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSearchAppOrTask.java
  24. 1 2
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSmallSheep.java
  25. 7 0
      app/src/main/java/com/sheep/jiuyan/samllsheep/utils/TitleBarUtils.java
  26. 2 0
      app/src/main/java/org/afinal/simplecache/ApiKey.java
  27. binární
      app/src/main/res/drawable-xxhdpi/gif_sheep_loading.gif
  28. 86 0
      app/src/main/res/layout/act_search.xml
  29. 0 18
      app/src/main/res/layout/act_search_app_or_task.xml
  30. 5 4
      app/src/main/res/layout/find_item_news.xml
  31. 2 2
      app/src/main/res/layout/item_download_welfare.xml
  32. 2 2
      app/src/main/res/layout/item_home_page_search.xml
  33. 6 0
      app/src/main/res/layout/keyword_label.xml
  34. binární
      app/src/main/res/mipmap-xxhdpi/wushuju.png
  35. binární
      app/src/main/res/mipmap-xxhdpi/wushuju.webp
  36. binární
      app/src/main/res/mipmap-xxhdpi/wushuju_net_error.png
  37. binární
      app/src/main/res/mipmap-xxhdpi/wushuju_net_error.webp

+ 1 - 5
app/src/main/AndroidManifest.xml

@@ -806,10 +806,6 @@
             android:theme="@style/AppActionTheme"
             android:windowSoftInputMode="adjustUnspecified|stateHidden" />
         <activity
-            android:name="com.sheep.gamegroup.view.activity.ActSearchAppOrTask"
-            android:screenOrientation="portrait"
-            android:theme="@style/AppActionTheme" />
-        <activity
             android:name="com.sheep.gamegroup.view.activity.ActSearchApp"
             android:screenOrientation="portrait"
             android:theme="@style/AppActionTheme" />
@@ -1001,7 +997,7 @@
             android:screenOrientation="portrait"
             android:theme="@style/AppActionTheme" />
         <activity
-            android:name="com.sheep.gamegroup.module.game.activity.ActSearchGameGroup"
+            android:name="com.sheep.gamegroup.module.search.ActSearch"
             android:screenOrientation="portrait"
             android:theme="@style/AppActionTheme" />
         <activity

+ 6 - 0
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -1917,4 +1917,10 @@ public interface ApiService {
     @GET("app/user/check_authorization")
     Observable<BaseMessage> checkAuth(@Query("Authorization") String token);
 
+    @GET("app/search")
+    Observable<BaseMessage> search(@Query("keyword") String keyword, @Query("game_count") int gameCount, @Query("task_count") int taskCount, @Query("gift_count") int giftCount, @Query("article_count") int articleCount);
+
+    @GET("app/search/keywords")
+    Observable<BaseMessage> keywords();
+
 }

+ 68 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/GameSimple.java

@@ -0,0 +1,68 @@
+package com.sheep.gamegroup.model.entity;
+
+public class GameSimple {
+
+    private int id;
+    private String name;
+    private String icon;
+    private int game_discount_id;
+    private int is_display;
+    private float package_size;
+    private Applications applications;
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getIcon() {
+        return icon;
+    }
+
+    public void setIcon(String icon) {
+        this.icon = icon;
+    }
+
+    public int getGame_discount_id() {
+        return game_discount_id;
+    }
+
+    public void setGame_discount_id(int game_discount_id) {
+        this.game_discount_id = game_discount_id;
+    }
+
+    public int getIs_display() {
+        return is_display;
+    }
+
+    public void setIs_display(int is_display) {
+        this.is_display = is_display;
+    }
+
+    public float getPackage_size() {
+        return package_size;
+    }
+
+    public void setPackage_size(float package_size) {
+        this.package_size = package_size;
+    }
+
+    public Applications getApplications() {
+        return applications;
+    }
+
+    public void setApplications(Applications applications) {
+        this.applications = applications;
+    }
+}

+ 8 - 1
app/src/main/java/com/sheep/gamegroup/model/entity/GiftBag.java

@@ -73,6 +73,8 @@ public class GiftBag {
 
     private int UpdatedAt;
 
+    private String Icon;
+
     public void setId(int Id){
         this.Id = Id;
     }
@@ -158,8 +160,13 @@ public class GiftBag {
         return this.UpdatedAt;
     }
 
+    public String getIcon() {
+        return Icon;
+    }
 
-
+    public void setIcon(String icon) {
+        Icon = icon;
+    }
 
     /**
      * 剩余份数

+ 32 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/Keyword.java

@@ -0,0 +1,32 @@
+package com.sheep.gamegroup.model.entity;
+
+public class Keyword {
+
+    private int id;
+    private String keyword;
+    private int position;
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getKeyword() {
+        return keyword;
+    }
+
+    public void setKeyword(String keyword) {
+        this.keyword = keyword;
+    }
+
+    public int getPosition() {
+        return position;
+    }
+
+    public void setPosition(int position) {
+        this.position = position;
+    }
+}

+ 66 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/TaskSimple.java

@@ -0,0 +1,66 @@
+package com.sheep.gamegroup.model.entity;
+
+import com.sheep.gamegroup.absBase.IHomePageSearch;
+
+public class TaskSimple {
+
+    private int id;
+    private String title;
+    private String name;
+    private String icon;
+    private float bonus;
+    private int is_succession;
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getIcon() {
+        return icon;
+    }
+
+    public void setIcon(String icon) {
+        this.icon = icon;
+    }
+
+    public float getBonus() {
+        return bonus;
+    }
+
+    public void setBonus(float bonus) {
+        this.bonus = bonus;
+    }
+
+    public int getIs_succession() {
+        return is_succession;
+    }
+
+    public void setIs_succession(int is_succession) {
+        this.is_succession = is_succession;
+    }
+
+    //该类型是否有奖金
+    public boolean hasBonus() {
+        return true;
+    }
+}

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/module/game/activity/ActGameCenterType.java

@@ -30,7 +30,7 @@ public class ActGameCenterType extends BaseContainerActivity {
                 .setShowOrHide(this, true)
                 .setTitle(this, gameCenterType.getName())
                 .setRightImgBotton(this, R.drawable.index_download, view -> Jump2View.getInstance().goActDownloadManager(this))
-                .setRightSecondBtn(this, R.drawable.search_black_img, view -> Jump2View.getInstance().goActSearchGameGroup(this))
+                .setRightSecondBtn(this, R.drawable.search_black_img, view -> Jump2View.getInstance().goActSearch(this))
                 .setTitleFinish(this);
     }
 

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/module/game/activity/ActGameRank.java

@@ -26,7 +26,7 @@ public class ActGameRank extends BaseContainerActivity {
                 .setShowOrHide(this, true)
                 .setTitle(this, gameCenterType.getName())
                 .setRightImgBotton(this, R.drawable.index_download, view -> Jump2View.getInstance().goActDownloadManager(this))
-                .setRightSecondBtn(this, R.drawable.search_black_img, view -> Jump2View.getInstance().goActSearchGameGroup(this))
+                .setRightSecondBtn(this, R.drawable.search_black_img, view -> Jump2View.getInstance().goActSearch(this))
                 .setTitleFinish(this);
     }
 

+ 0 - 240
app/src/main/java/com/sheep/gamegroup/module/game/activity/ActSearchGameGroup.java

@@ -1,240 +0,0 @@
-package com.sheep.gamegroup.module.game.activity;
-
-import android.support.v4.app.Fragment;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.text.TextUtils;
-import android.view.View;
-import android.view.inputmethod.EditorInfo;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.kfzs.appstore.utils.adapter.recyclerview.RecyclerViewAdapter;
-import com.kfzs.appstore.utils.adapter.recyclerview.ViewHolder;
-import com.sheep.gamegroup.absBase.BaseContainerActivity;
-import com.sheep.gamegroup.absBase.IHomePageSearch;
-import com.sheep.gamegroup.absBase.ISearchRecord;
-import com.sheep.gamegroup.greendao.DDProviderHelper;
-import com.sheep.gamegroup.greendao.download.SearchRecord;
-import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.GameEntity;
-import com.sheep.gamegroup.model.entity.TitleInfoList;
-import com.sheep.gamegroup.model.util.SheepSubscriber;
-import com.sheep.gamegroup.module.game.fragment.FgtSearchGameGroup;
-import com.sheep.gamegroup.util.ApiUtil;
-import com.sheep.gamegroup.util.DataUtil;
-import com.sheep.gamegroup.util.ListUtil;
-import com.sheep.gamegroup.util.ViewUtil;
-import com.sheep.gamegroup.view.adapter.AdpTitleInfoList;
-import com.sheep.jiuyan.samllsheep.R;
-import com.sheep.jiuyan.samllsheep.SheepApp;
-import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
-
-import org.afinal.simplecache.ApiKey;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import butterknife.BindView;
-import io.reactivex.android.schedulers.AndroidSchedulers;
-import io.reactivex.schedulers.Schedulers;
-
-/**
- * Created by realicing on 2019/1/21.
- * realicing@sina.com
- * 小绵羊3.4.10新增 -- 搜索游戏组
- */
-public class ActSearchGameGroup extends BaseContainerActivity {
-    @BindView(R.id.search_app_list)
-    RecyclerView recyclerView;
-    @BindView(R.id.frame_container)
-    View frame_container;
-
-    @Override
-    protected int getLayoutId() {
-        return R.layout.act_search_app_or_task;
-    }
-
-    private FgtSearchGameGroup fgtSearchGameGroup;
-
-    @Override
-    public void initView() {
-        super.initView();
-        if (fgtSearchGameGroup == null && fragment instanceof FgtSearchGameGroup)
-            fgtSearchGameGroup = (FgtSearchGameGroup) fragment;
-    }
-
-    @Override
-    protected Fragment initFragment() {
-        return new FgtSearchGameGroup();
-    }
-
-    private List<TitleInfoList> titleInfoListList = new ArrayList<>();
-
-    @Override
-    public void initListener() {
-        TitleBarUtils.getInstance()
-                .setShowOrHide(this, true)
-                .setTitleFinish(this)
-                .setSearchBox(this, getString(R.string.search_game_name),
-                        (v, actionId, event) -> {
-                            if (actionId == EditorInfo.IME_ACTION_SEARCH) {
-                                toSearchApp();
-                            }
-                            return false;
-                        },
-                        (text) -> {
-                            frame_container.removeCallbacks(autoSearchRunnable);
-                            if (text.isEmpty() && !isTitleInfoListEmpty()) {//输入框内容为空且有搜索记录时显示搜索记录
-                                recyclerView.setVisibility(View.VISIBLE);
-                                frame_container.setVisibility(View.INVISIBLE);
-                            } else {
-                                long delay = textByClick ? 1L : 1000L;
-                                frame_container.postDelayed(autoSearchRunnable, delay);//1秒后自动搜索
-                            }
-                        })
-                .setRightBtn(this, "搜索", 0,
-                        v -> toSearchApp());
-
-        recyclerView.setHasFixedSize(true);
-        recyclerView.setNestedScrollingEnabled(false);
-        recyclerView.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
-        AdpTitleInfoList adpTitleInfoList = new AdpTitleInfoList(titleInfoListList);
-        adpTitleInfoList.bindToRecyclerView(recyclerView);
-    }
-
-    private Runnable autoSearchRunnable = this::toSearchApp;
-
-    public static final int MAX_SHOW_SEARCH_RECORD_COUNT = 10;//最多展示的搜索历史的个数
-    public static final int SORT_TOP_SEARCH = 2;//热门推荐 的排序
-    public static final int SORT_SEARCH_RECORD = 1;//搜索历史 的排序
-    List<ISearchRecord> topSearchList = new ArrayList<>();
-
-    public static final String TOP_SEARCH_NAME = "热门搜索";
-    @Override
-    public void initData() {
-        //尝试获取缓存数据
-        List<GameEntity> newList = DataUtil.getInstance().getCacheList(ApiKey.getFindUserLike, GameEntity.class);
-        if (!ListUtil.isEmpty(newList)) {
-            topSearchList.addAll(newList);
-            addListData(TOP_SEARCH_NAME, topSearchList, SORT_TOP_SEARCH);
-        }
-
-        //初始化搜索历史
-        List<SearchRecord> newSgrList = DDProviderHelper.getInstance().getSearchRecordList(MAX_SHOW_SEARCH_RECORD_COUNT);
-        if (!ListUtil.isEmpty(newSgrList)) {
-            searchRecordList.addAll(newSgrList);
-            addListData("搜索历史", searchRecordList, SORT_SEARCH_RECORD);
-        }
-        notifyDataSetChangedTitleInfoList();
-        SheepApp.getInstance().getNetComponent().getApiService().getFindUserLike()
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-                        boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.top_search_statistics);
-                        if (isNewData) {
-                            List<GameEntity> newList = baseMessage.getDatas(GameEntity.class);
-                            topSearchList.clear();
-                            topSearchList.addAll(newList);
-                            if (ListUtil.getItem(titleInfoListList, titleInfoList -> titleInfoList.getSort() == SORT_TOP_SEARCH) == null) {
-                                addListData(TOP_SEARCH_NAME, topSearchList, SORT_TOP_SEARCH);
-                            }
-                            notifyDataSetChangedTitleInfoList();
-                        }
-                    }
-
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-                    }
-                });
-
-    }
-
-    //排序与刷新
-    private void notifyDataSetChangedTitleInfoList() {
-        //排序
-        Collections.sort(titleInfoListList);
-        //刷新
-        ViewUtil.notifyDataSetChanged(recyclerView);
-        if (isTitleInfoListEmpty()) {
-            frame_container.setVisibility(View.VISIBLE);
-            recyclerView.setVisibility(View.INVISIBLE);
-        } else {
-            frame_container.setVisibility(View.INVISIBLE);
-            recyclerView.setVisibility(View.VISIBLE);
-        }
-    }
-
-    //添加列表数据到总的列表中
-    private void addListData(String title, final List<ISearchRecord> list, int sort) {
-        titleInfoListList.add(new TitleInfoList(title, new RecyclerViewAdapter<ISearchRecord>(SheepApp.getInstance(), R.layout.item_i_serach_record, list) {
-            @Override
-            public void convert(ViewHolder viewHolder, final ISearchRecord item, int position) {
-                View view = viewHolder.itemView;
-                TextView item_search_record_name = view.findViewById(R.id.item_search_record_name);
-                ImageView item_search_record_x = view.findViewById(R.id.item_search_record_x);
-                ViewUtil.setText(item_search_record_name, item.getInput());
-                if (item instanceof SearchRecord) {
-                    //点击一条搜索历史后面的xx
-                    item_search_record_x.setOnClickListener(view12 -> {
-                        list.remove(item);
-                        ViewUtil.notifyDataSetChanged(recyclerView);
-                        DDProviderHelper.getInstance().deleteSearchRecord((SearchRecord) item);
-                        if (isTitleInfoListEmpty()) {
-                            frame_container.setVisibility(View.VISIBLE);
-                            recyclerView.setVisibility(View.INVISIBLE);
-                        }
-                    });
-                } else {
-                    ViewUtil.setVisibility(item_search_record_x, false);
-                }
-                //点击一条搜索历史
-                view.setOnClickListener(view1 -> {
-                    textByClick = true;
-                    TitleBarUtils.getInstance().setSearchText(ActSearchGameGroup.this, item.getInput());
-                    if (item instanceof IHomePageSearch)
-                        ApiUtil.postTopSearchStatisticsClickTopSearch((IHomePageSearch) item);
-                });
-            }
-        }).setSort(sort));
-    }
-    private boolean textByClick = false;//通过点击搜索历史或者热门推荐来搜索,应该立即执行
-
-    //搜索历史中没有数据且没有获取到服务器的热门搜索列表
-    private boolean isTitleInfoListEmpty() {
-        return searchRecordList.isEmpty() && topSearchList.isEmpty();
-    }
-
-    List<ISearchRecord> searchRecordList = new ArrayList<>();
-
-    //尝试搜索游戏
-    private void toSearchApp() {
-        textByClick = false;//重置
-        if(fgtSearchGameGroup == null){
-            return;
-        }
-        if(fgtSearchGameGroup.isLoadingData()){
-            return;
-        }
-        recyclerView.setVisibility(View.INVISIBLE);
-        frame_container.setVisibility(View.VISIBLE);
-        String inputText = TitleBarUtils.getInstance().getSearchText(this);
-        if (!TextUtils.isEmpty(inputText)) {
-            //保存搜索到数据库
-            SearchRecord searchRecord = new SearchRecord();
-            searchRecord.setInput(inputText);
-            searchRecord.setLast_time(System.currentTimeMillis());
-            searchRecord.setCount(1);
-            DDProviderHelper.getInstance().addOrUpdateSearchRecord(searchRecord, item -> {
-                if(item == null) {
-                    searchRecordList.add(searchRecord);
-                    ViewUtil.notifyDataSetChanged(recyclerView);
-                }
-            });
-        }
-        fgtSearchGameGroup.toSearch(inputText);
-    }
-}

+ 1 - 15
app/src/main/java/com/sheep/gamegroup/module/game/fragment/FgtGameCenter.java

@@ -4,46 +4,32 @@ import android.os.Bundle;
 import android.support.design.widget.TabLayout;
 import android.support.v4.app.Fragment;
 import android.support.v4.view.ViewPager;
-import android.text.TextUtils;
 import android.view.KeyEvent;
 import android.view.View;
 import android.widget.Button;
-import android.widget.ImageButton;
 import android.widget.ImageView;
 
 import com.sheep.gamegroup.event.WebViewEvent;
-import com.sheep.gamegroup.model.entity.ArticleTag;
-import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.model.entity.WebParams;
-import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.module.webview.fragment.FgtWeb;
 import com.sheep.gamegroup.module.webview.fragment.FgtWebX5;
 import com.sheep.gamegroup.util.CommonUtil;
-import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.KeyEventUtil;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.view.activity.ActMain;
 import com.sheep.gamegroup.view.adapter.TitleFragmentListAdapter;
-import com.sheep.gamegroup.view.fragment.FgtFindChild;
-import com.sheep.gamegroup.view.fragment.FgtGameMall;
-import com.sheep.gamegroup.view.fragment.FgtWelfareCenter;
 import com.sheep.jiuyan.samllsheep.Config;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.base.BaseFragment;
 import com.sheep.jiuyan.samllsheep.utils.G;
-import com.snail.antifake.jni.EmulatorDetectUtil;
 
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 
 import butterknife.BindView;
 import butterknife.OnClick;
-import io.reactivex.android.schedulers.AndroidSchedulers;
-import io.reactivex.schedulers.Schedulers;
-import rx.functions.Action1;
 
 /**
  * Created by realicing on 2019/1/18.
@@ -182,7 +168,7 @@ public class FgtGameCenter extends BaseFragment {
 
     @OnClick(R.id.search_btn)
     public void doSearch(View v) {
-        Jump2View.getInstance().goActSearchGameGroup(getActivity());
+        Jump2View.getInstance().goActSearch(getActivity());
     }
 
     @OnClick(R.id.my_walfare_btn)

+ 232 - 0
app/src/main/java/com/sheep/gamegroup/module/search/ActSearch.java

@@ -0,0 +1,232 @@
+package com.sheep.gamegroup.module.search;
+
+import android.support.v4.app.Fragment;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.inputmethod.EditorInfo;
+import android.widget.TextView;
+
+import com.kfzs.android.view.tag.FlowLayout;
+import com.kfzs.android.view.tag.TagAdapter;
+import com.kfzs.android.view.tag.TagFlowLayout;
+import com.sheep.gamegroup.absBase.BaseContainerActivity;
+import com.sheep.gamegroup.greendao.DDProviderHelper;
+import com.sheep.gamegroup.greendao.download.SearchRecord;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.Keyword;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.DataUtil;
+import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
+
+import org.afinal.simplecache.ApiKey;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.OnClick;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
+
+/**
+ * Created by realicing on 2019/1/21.
+ * realicing@sina.com
+ * 小绵羊3.4.10新增 -- 搜索游戏组
+ */
+public class ActSearch extends BaseContainerActivity {
+    @BindView(R.id.quick_search_layout)
+    View quickSearchLayout;
+    @BindView(R.id.hot_search_layout)
+    View hotSearchLayout;
+    @BindView(R.id.history_search_layout)
+    View historySearchLayout;
+    @BindView(R.id.hot_list_layout)
+    TagFlowLayout hotListLayout;
+    @BindView(R.id.history_list_layout)
+    TagFlowLayout historyListLayout;
+    @BindView(R.id.seperator)
+    View seperator;
+    @BindView(R.id.frame_container)
+    View frame_container;
+
+    private Keyword hintKeyword;
+    private List<Keyword> hotKeywords = new ArrayList<>();
+    private List<SearchRecord> historyKeywords = new ArrayList<>();
+
+    @Override
+    protected int getLayoutId() {
+        return R.layout.act_search;
+    }
+
+    private FgtSearch fgtSearch;
+
+    @Override
+    public void initView() {
+        super.initView();
+        if (fgtSearch == null && fragment instanceof FgtSearch) {
+            fgtSearch = (FgtSearch) fragment;
+        }
+        frame_container.setVisibility(View.INVISIBLE);
+    }
+
+    @OnClick(R.id.refresh_btn)
+    public void onRefresh() {
+        hintKeyword = null;
+        hotKeywords.clear();
+        SheepApp.getInstance().getNetComponent().getApiService().keywords()
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        hotKeywords = baseMessage.getDatas(Keyword.class);
+                        handleHotKeywords();
+                    }
+
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        hotKeywords = DataUtil.getInstance().getCacheList(ApiKey.hot_search_keywords, Keyword.class);
+                        handleHotKeywords();
+                    }
+
+                    private void handleHotKeywords() {
+                        Iterator<Keyword> it = hotKeywords.iterator();
+                        while (it.hasNext()) {
+                            Keyword keyword = it.next();
+                            if (keyword.getPosition() == 2) {
+                                hintKeyword = keyword;
+                                it.remove();
+                                break;
+                            }
+                        }
+                        showKeywords();
+                    }
+
+                });
+    }
+
+    @OnClick(R.id.clear_btn)
+    public void onClear() {
+
+    }
+
+    @Override
+    protected Fragment initFragment() {
+        return new FgtSearch();
+    }
+
+    @Override
+    public void initListener() {
+        TitleBarUtils.getInstance()
+                .setShowOrHide(this, true)
+                .setTitleFinish(this)
+                .setSearchBox(this, getString(R.string.search_game_name),
+                        (v, actionId, event) -> {
+                            if (actionId == EditorInfo.IME_ACTION_SEARCH) {
+                                toSearchApp();
+                            }
+                            return false;
+                        },
+                        (text) -> {
+                            if (text.isEmpty()) {//输入框内容为空且有搜索记录时显示搜索记录
+                                quickSearchLayout.setVisibility(View.VISIBLE);
+                                frame_container.setVisibility(View.INVISIBLE);
+                            }
+                        })
+                .setRightBtn(this, "搜索", 0,
+                        v -> toSearchApp());
+    }
+
+    @Override
+    public void initData() {
+        historyKeywords = DDProviderHelper.getInstance().getSearchRecordList(50);
+        onRefresh();
+    }
+
+    private void showKeywords() {
+        if (hintKeyword != null) {
+            TitleBarUtils.getInstance().setSearchText(ActSearch.this, hintKeyword.getKeyword());
+        } else {
+            TitleBarUtils.getInstance().setSearchText(ActSearch.this, "");
+        }
+        addHotView(hotListLayout, hotKeywords);
+        addHistoryView(historyListLayout, historyKeywords);
+    }
+
+    private void addHotView(TagFlowLayout keywordLayout, List<Keyword> keywords) {
+        TagAdapter adapter = new TagAdapter<Keyword>(keywords) {
+            @Override
+            public View getView(FlowLayout parent, int position, Keyword keyword) {
+
+                TextView tv = (TextView) LayoutInflater.from(ActSearch.this).inflate(R.layout.keyword_label, parent, false);
+                ViewUtil.setText(tv, keyword.getKeyword());
+                return tv;
+            }
+        };
+
+        keywordLayout.setAdapter(adapter);
+        keywordLayout.setOnTagClickListener((view, position, parent) -> {
+            Keyword keyword = ListUtil.getItem(keywords, position);
+            if (keyword != null) {
+                TitleBarUtils.getInstance().setSearchText(ActSearch.this, keyword.getKeyword());
+                toSearchApp();
+            }
+            return false;
+        });
+    }
+
+    private void addHistoryView(TagFlowLayout keywordLayout, List<SearchRecord> keywords) {
+        TagAdapter adapter = new TagAdapter<SearchRecord>(keywords) {
+            @Override
+            public View getView(FlowLayout parent, int position, SearchRecord keyword) {
+
+                TextView tv = (TextView) LayoutInflater.from(ActSearch.this).inflate(R.layout.keyword_label, parent, false);
+                ViewUtil.setText(tv, keyword.getInput());
+                return tv;
+            }
+        };
+
+        keywordLayout.setAdapter(adapter);
+        keywordLayout.setOnTagClickListener((view, position, parent) -> {
+            SearchRecord keyword = ListUtil.getItem(keywords, position);
+            if (keyword != null) {
+                TitleBarUtils.getInstance().setSearchText(ActSearch.this, keyword.getInput());
+                toSearchApp();
+            }
+            return false;
+        });
+    }
+
+    //尝试搜索游戏
+    private void toSearchApp() {
+        if (fgtSearch == null) {
+            return;
+        }
+//        if (fgtSearch.isLoadingData()) {
+//            return;
+//        }
+        quickSearchLayout.setVisibility(View.INVISIBLE);
+        frame_container.setVisibility(View.VISIBLE);
+        String inputText = TitleBarUtils.getInstance().getSearchText(this);
+        if (!TextUtils.isEmpty(inputText)) {
+            //保存搜索到数据库
+            SearchRecord searchRecord = new SearchRecord();
+            searchRecord.setInput(inputText);
+            searchRecord.setLast_time(System.currentTimeMillis());
+            searchRecord.setCount(1);
+            DDProviderHelper.getInstance().addOrUpdateSearchRecord(searchRecord, item -> {
+                if (item == null) {
+                    historyKeywords.add(searchRecord);
+                    showKeywords();
+                }
+            });
+        }
+        fgtSearch.toSearch(inputText);
+    }
+}

+ 79 - 0
app/src/main/java/com/sheep/gamegroup/module/search/AdpSearchResult.java

@@ -0,0 +1,79 @@
+package com.sheep.gamegroup.module.search;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import com.sheep.jiuyan.samllsheep.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class AdpSearchResult extends RecyclerView.Adapter<SearchResultHolder> {
+
+    private Context mContext;
+
+    private List<SearchItem> items = new ArrayList<>();
+
+    public AdpSearchResult(Context context) {
+        this.mContext = context;
+    }
+
+    public void setItems(List<SearchItem> items) {
+        this.items = items;
+        notifyDataSetChanged();
+    }
+
+    public void appendItems(List<SearchItem> items) {
+        this.items.addAll(items);
+        notifyDataSetChanged();
+    }
+
+    @NonNull
+    @Override
+    public SearchResultHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
+        SearchResultHolder holder = null;
+        View itemView = null;
+        if (i == 1) {
+            itemView = LayoutInflater.from(mContext).inflate(R.layout.play_game_vertical_list_item, viewGroup, false);
+            holder = new GameHolder(itemView);
+        } else if (i == 2) {
+            itemView = LayoutInflater.from(mContext).inflate(R.layout.item_home_page_search, viewGroup, false);
+            holder = new TaskHolder(itemView);
+        } else if (i == 3) {
+            itemView = LayoutInflater.from(mContext).inflate(R.layout.item_download_welfare, viewGroup, false);
+            holder = new GiftHolder(itemView);
+        } else if (i == 4) {
+            itemView = LayoutInflater.from(mContext).inflate(R.layout.find_item_news, viewGroup, false);
+            holder = new ArticleHolder(itemView);
+        } else {
+            itemView = new TextView(mContext);
+            holder = new SearchResultHolder(itemView) {
+                @Override
+                protected void configView() {
+
+                }
+            };
+        }
+        return holder;
+    }
+
+    @Override
+    public void onBindViewHolder(@NonNull SearchResultHolder searchResultHolder, int i) {
+        searchResultHolder.bind(items.get(i).object);
+    }
+
+    @Override
+    public int getItemViewType(int i) {
+        return items.get(i).type;
+    }
+
+    @Override
+    public int getItemCount() {
+        return items.size();
+    }
+}

+ 38 - 0
app/src/main/java/com/sheep/gamegroup/module/search/ArticleHolder.java

@@ -0,0 +1,38 @@
+package com.sheep.gamegroup.module.search;
+
+import android.support.annotation.NonNull;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.sheep.gamegroup.model.entity.Article;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.jiuyan.samllsheep.R;
+
+import butterknife.BindView;
+
+public class ArticleHolder extends SearchResultHolder<Article> {
+
+    @BindView(R.id.find_item_name)
+    TextView find_item_name;
+    @BindView(R.id.find_item_time)
+    TextView find_item_time;
+    @BindView(R.id.find_item_iv)
+    ImageView find_item_iv;
+
+    public ArticleHolder(@NonNull View itemView) {
+        super(itemView);
+        itemView.setOnClickListener((v) -> {
+            Jump2View.getInstance().goFindItem(itemView.getContext(), item);
+        });
+    }
+
+    @Override
+    public void configView() {
+        ViewUtil.setText(find_item_name, item.getTitle());
+        ViewUtil.setTextTime(find_item_time, item.getCreated_at(), "yyyy-MM-dd");
+        ViewUtil.setImage(find_item_iv, item.getPictures());
+    }
+
+}

+ 155 - 0
app/src/main/java/com/sheep/gamegroup/module/search/FgtSearch.java

@@ -0,0 +1,155 @@
+package com.sheep.gamegroup.module.search;
+
+import android.support.v7.widget.LinearLayoutManager;
+import android.view.View;
+
+import com.alibaba.fastjson.JSON;
+import com.jcodecraeer.xrecyclerview.XRecyclerView;
+import com.sheep.gamegroup.absBase.ISearch;
+import com.sheep.gamegroup.model.entity.Applications;
+import com.sheep.gamegroup.model.entity.Article;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.entity.GameSimple;
+import com.sheep.gamegroup.model.entity.GiftBag;
+import com.sheep.gamegroup.model.entity.GiftBagApp;
+import com.sheep.gamegroup.model.entity.TaskSimple;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.base.BaseFragment;
+import com.sheep.jiuyan.samllsheep.utils.G;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
+import rx.functions.Action1;
+
+public class FgtSearch extends BaseFragment implements ISearch {
+
+    private int gameCount = 0;
+    private int taskCount = 0;
+    private int giftCount = 0;
+    private int articleCount = 0;
+
+    private String keyword;
+
+    @BindView(R.id.empty_view)
+    protected View empty_view;
+    @BindView(R.id.check_net_ll)
+    protected View check_net_ll;
+    @BindView(R.id.view_list)
+    public XRecyclerView listView;
+    private AdpSearchResult listAdapter;
+    protected View bottomLine;
+
+    @Override
+    public int getLayoutId() {
+        return R.layout.net_empty_xrecycler;
+    }
+
+    @Override
+    public void onViewCreated() {
+        empty_view.setVisibility(View.GONE);
+        check_net_ll.setVisibility(View.GONE);
+        listAdapter = new AdpSearchResult(getContext());
+        listView.setLoadingListener(new XRecyclerView.LoadingListener() {
+            @Override
+            public void onRefresh() {
+                refreshData();
+            }
+
+            @Override
+            public void onLoadMore() {
+                loadMoreData();
+            }
+        });
+        bottomLine = ViewUtil.setBottomLine(listView, getNoMoreCallBack());
+        listView.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
+        listView.setAdapter(listAdapter);
+    }
+
+    public Action1<String> getNoMoreCallBack() {
+        return null;
+    }
+
+    @Override
+    public void toSearch(String keyword) {
+        this.keyword = keyword;
+        refreshData();
+    }
+
+    private void refreshData() {
+        gameCount = 0;
+        taskCount = 0;
+        giftCount = 0;
+        articleCount = 0;
+        search(true);
+    }
+
+    private void loadMoreData() {
+        search(false);
+    }
+
+    private void search(boolean isRefresh) {
+        SheepApp.getInstance().getNetComponent().getApiService()
+                .search(keyword, gameCount, taskCount, giftCount, articleCount)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        try {
+                            List<SearchItem> items = new ArrayList<>();
+                            JSONObject base = new JSONObject(baseMessage.getData().toString());
+                            gameCount += base.getInt("game_count");
+                            taskCount += base.getInt("task_count");
+                            giftCount += base.getInt("gift_count");
+                            articleCount += base.getInt("article_count");
+                            JSONArray array = base.getJSONArray("list");
+                            for (int i = 0; i < array.length(); i++) {
+                                JSONObject object = array.getJSONObject(i);
+                                SearchItem item = new SearchItem();
+                                item.type = object.getInt("type");
+                                item.data = object.getString("data");
+                                if (item.type == 1) {
+                                    item.object = com.alibaba.fastjson.JSONObject.parseObject(item.data, GameSimple.class);
+                                } else if (item.type == 2) {
+                                    item.object = com.alibaba.fastjson.JSONObject.parseObject(item.data, TaskSimple.class);
+                                } else if (item.type == 3) {
+                                    item.object = com.alibaba.fastjson.JSONObject.parseObject(item.data, GiftBagApp.class);
+                                } else if (item.type == 4) {
+                                    item.object = com.alibaba.fastjson.JSONObject.parseObject(item.data, Article.class);
+                                } else {
+                                    continue;
+                                }
+                                items.add(item);
+                            }
+                            if (isRefresh) {
+                                listAdapter.setItems(items);
+                            } else {
+                                listAdapter.appendItems(items);
+                            }
+                        } catch (JSONException e) {
+                            e.printStackTrace();
+                            G.showToast("数据解析出错");
+                        }
+                    }
+
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        G.showToast("查询出错:" + baseMessage.getMsg() + " " + baseMessage.getErrorMsg());
+                    }
+                });
+    }
+
+}

+ 64 - 0
app/src/main/java/com/sheep/gamegroup/module/search/GameHolder.java

@@ -0,0 +1,64 @@
+package com.sheep.gamegroup.module.search;
+
+import android.support.annotation.NonNull;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.sheep.gamegroup.model.entity.Applications;
+import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.entity.GameSimple;
+import com.sheep.gamegroup.model.entity.Lp;
+import com.sheep.gamegroup.module.game.api.IGameGroup;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.GlideImageLoader;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.gamegroup.util.viewHelper.LayoutParamsUtil;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.utils.G;
+
+import butterknife.BindView;
+
+public class GameHolder extends SearchResultHolder<GameSimple> {
+
+    @BindView(R.id.line_tv)
+    View item_download_welfare_line;
+    @BindView(R.id.detail_task_tv_center)
+    TextView detail_task_tv_center;
+    @BindView(R.id.detail_task_tv_center2)
+    TextView detail_task_tv_center2;
+    @BindView(R.id.item_name_tv)
+    TextView item_name_tv;
+    @BindView(R.id.item_date_tv)
+    TextView item_date_tv;
+    @BindView(R.id.ll_game_tag)
+    LinearLayout ll_game_tag;
+    @BindView(R.id.item_icon_iv)
+    ImageView item_icon_iv;
+
+    public GameHolder(@NonNull View itemView) {
+        super(itemView);
+        itemView.setOnClickListener((v) -> {
+            Jump2View.getInstance().goActGameGroupDetail(item.getId());
+        });
+    }
+
+    @Override
+    public void configView() {
+        LayoutParamsUtil.resetLayoutParams(item_name_tv, new Lp(G.DENSITY).setTopMargin(8));
+        ViewUtil.setText(item_name_tv, item.getName());
+        ViewUtil.setText(item_date_tv, item.getPackage_size());
+        GlideImageLoader.setGameImage(item_icon_iv, item.getIcon());
+        ViewUtil.setText(detail_task_tv_center, "查看详情");
+
+//        ViewUtil.setVisibility(item_download_welfare_line, getAdapterPosition() + 1 == getItemCount() ? View.GONE : View.VISIBLE);
+        ViewUtil.setVisibility(detail_task_tv_center2, item.getGame_discount_id() > 0);
+
+        //tag 标签绘制
+        CommonUtil.getInstance().paintLineaLayout(item.getApplications(), ll_game_tag, 4, R.color.txt_bule, R.drawable.shape_blue_stroke_rectangle_no_lb);
+
+    }
+
+}

+ 84 - 0
app/src/main/java/com/sheep/gamegroup/module/search/GiftHolder.java

@@ -0,0 +1,84 @@
+package com.sheep.gamegroup.module.search;
+
+import android.app.Activity;
+import android.support.annotation.NonNull;
+import android.text.TextUtils;
+import android.view.Gravity;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.sheep.gamegroup.model.entity.Applications;
+import com.sheep.gamegroup.model.entity.DialogConfig;
+import com.sheep.gamegroup.model.entity.GiftBag;
+import com.sheep.gamegroup.model.entity.GiftBagApp;
+import com.sheep.gamegroup.model.entity.TaskSimple;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.GlideImageLoader;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.StringUtils;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.service.DownloadService;
+import com.sheep.jiuyan.samllsheep.utils.G;
+
+import java.util.Locale;
+
+import butterknife.BindView;
+import rx.functions.Action1;
+
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.GIFT_BAG_COPY_CODE;
+import static com.sheep.gamegroup.util.UMConfigUtils.Event.GIFT_BAG_LOOK_TIP;
+
+public class GiftHolder extends SearchResultHolder<GiftBagApp> {
+
+    @BindView(R.id.item_download_welfare_iv)
+    ImageView item_download_welfare_iv;
+    @BindView(R.id.item_download_welfare_tip_iv)
+    ImageView item_download_welfare_tip_iv;
+    @BindView(R.id.item_download_welfare_iv2)
+    ImageView item_download_welfare_iv2;
+    @BindView(R.id.item_download_welfare_name_tv)
+    TextView item_download_welfare_name_tv;
+    @BindView(R.id.item_download_welfare_money)
+    TextView item_download_welfare_money;
+    @BindView(R.id.item_download_welfare_num_tv)
+    TextView item_download_welfare_num_tv;
+    @BindView(R.id.item_download_welfare_num_tv1)
+    TextView item_download_welfare_num_tv1;
+    @BindView(R.id.item_download_welfare_date_tv)
+    TextView item_download_welfare_date_tv;
+    @BindView(R.id.item_download_welfare_btn_bottom)
+    TextView item_download_welfare_btn_bottom;
+    @BindView(R.id.item_download_welfare_btn_top)
+    TextView item_download_welfare_btn_top;
+    @BindView(R.id.item_download_welfare_btn_center)
+    TextView item_download_welfare_btn_center;
+    @BindView(R.id.item_download_welfare_line)
+    View item_download_welfare_line;
+
+    public GiftHolder(@NonNull View itemView) {
+        super(itemView);
+        itemView.setOnClickListener((v) -> {
+            Jump2View.getInstance().goGiftDetail(itemView.getContext(), item);
+        });
+    }
+
+    @Override
+    public void configView() {
+        item_download_welfare_money.setVisibility(View.GONE);
+        item_download_welfare_btn_bottom.setVisibility(View.GONE);
+        item_download_welfare_btn_top.setVisibility(View.GONE);
+        item_download_welfare_num_tv1.setVisibility(View.GONE);
+        item_download_welfare_iv2.setVisibility(View.GONE);
+        item_download_welfare_btn_center.setVisibility(View.VISIBLE);
+        GlideImageLoader.setGameImage(item_download_welfare_iv, item.getApp().getIcon());
+        ViewUtil.setText(item_download_welfare_name_tv, item.getGift_bag().getGiftName());
+        ViewUtil.setText(item_download_welfare_date_tv, item.getGift_bag().getDateText());
+        item_download_welfare_tip_iv.setVisibility(View.GONE);
+        ViewUtil.setText(item_download_welfare_num_tv, item.getGift_bag().getLastNumText());
+        item_download_welfare_btn_center.setText("领取");
+    }
+
+}

+ 9 - 0
app/src/main/java/com/sheep/gamegroup/module/search/SearchItem.java

@@ -0,0 +1,9 @@
+package com.sheep.gamegroup.module.search;
+
+public class SearchItem {
+
+    public int type;
+    public String data;
+    public Object object;
+
+}

+ 25 - 0
app/src/main/java/com/sheep/gamegroup/module/search/SearchResultHolder.java

@@ -0,0 +1,25 @@
+package com.sheep.gamegroup.module.search;
+
+import android.support.annotation.NonNull;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+
+import butterknife.ButterKnife;
+
+public abstract class SearchResultHolder<T> extends RecyclerView.ViewHolder {
+
+    protected T item;
+
+    public SearchResultHolder(@NonNull View itemView) {
+        super(itemView);
+        ButterKnife.bind(this, itemView);
+    }
+
+    public void bind(T t) {
+        this.item = t;
+        configView();
+    }
+
+    protected abstract void configView();
+
+}

+ 45 - 0
app/src/main/java/com/sheep/gamegroup/module/search/TaskHolder.java

@@ -0,0 +1,45 @@
+package com.sheep.gamegroup.module.search;
+
+import android.support.annotation.NonNull;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.kfzs.duanduan.utils.NumberFormatUtils;
+import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.model.entity.TaskSimple;
+import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.jiuyan.samllsheep.R;
+
+import java.util.Locale;
+
+import butterknife.BindView;
+
+public class TaskHolder extends SearchResultHolder<TaskSimple> {
+
+    @BindView(R.id.item_home_page_search_iv)
+    ImageView item_home_page_search_iv;
+    @BindView(R.id.item_home_page_search_content_tv)
+    TextView item_home_page_search_content_tv;
+    @BindView(R.id.item_home_page_search_bonus_tv)
+    TextView item_home_page_search_bonus_tv;
+
+    public TaskHolder(@NonNull View itemView) {
+        super(itemView);
+        itemView.setOnClickListener((v) -> {
+            Jump2View.getInstance().goTaskDetailView(itemView.getContext(), item.getId());
+        });
+    }
+
+    @Override
+    public void configView() {
+        ViewUtil.setVisibility(item_home_page_search_bonus_tv, item.hasBonus());
+        ViewUtil.setText(item_home_page_search_bonus_tv, String.format(Locale.CHINA, "+%s元", NumberFormatUtils.retainMost2(item.getBonus())));
+        ViewUtil.setText(item_home_page_search_content_tv, String.format(Locale.CHINA, "%s/%s", item.getTitle(), item.getName()));
+        ViewUtil.setGameImage(item_home_page_search_iv, item.getIcon());
+
+    }
+
+}

+ 3 - 15
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -7,7 +7,6 @@ import android.content.pm.PackageManager;
 import android.net.Uri;
 import android.os.Bundle;
 import android.text.TextUtils;
-import android.view.Gravity;
 import android.view.View;
 
 import com.kfzs.cfyl.share_library.util.CallBackAPI;
@@ -61,7 +60,7 @@ import com.sheep.gamegroup.module.game.activity.ActGameGroupOrGameDetail;
 import com.sheep.gamegroup.module.game.activity.ActGameRank;
 import com.sheep.gamegroup.module.game.activity.ActGitBagList;
 import com.sheep.gamegroup.module.game.activity.ActMyGameList;
-import com.sheep.gamegroup.module.game.activity.ActSearchGameGroup;
+import com.sheep.gamegroup.module.search.ActSearch;
 import com.sheep.gamegroup.module.game.activity.ActWelfareSpecialArea;
 import com.sheep.gamegroup.module.game.model.GameCenterType;
 import com.sheep.gamegroup.module.game.model.GameGroup;
@@ -120,7 +119,6 @@ import com.sheep.gamegroup.view.activity.ActPlayGameUserLikeList;
 import com.sheep.gamegroup.view.activity.ActPlayVideo;
 import com.sheep.gamegroup.view.activity.ActPublishArticle;
 import com.sheep.gamegroup.view.activity.ActSearchApp;
-import com.sheep.gamegroup.view.activity.ActSearchAppOrTask;
 import com.sheep.gamegroup.view.activity.ActSearchGame;
 import com.sheep.gamegroup.view.activity.ActSetting;
 import com.sheep.gamegroup.view.activity.ActSignCard;
@@ -179,7 +177,6 @@ import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
 import com.sheep.jiuyan.samllsheep.utils.SpUtils;
 import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
-import com.snail.antifake.jni.EmulatorDetectUtil;
 import com.youmi.android.offer.BaseActYmPermissionCheck;
 import com.youmi.android.offer.YmConfig;
 import com.zhy.http.okhttp.OkHttpUtils;
@@ -1993,15 +1990,6 @@ public class Jump2View {
     }
 
     /**
-     * 3.4 新的搜索(游戏与任务)
-     */
-    public void goAppTaskSearch(Activity activity, Object o) {
-        Intent intent = new Intent(activity, ActSearchAppOrTask.class);
-        activity.startActivity(intent);
-        SEARCH_APP_OR_TASK.onEvent();
-    }
-
-    /**
      * 新的游戏搜索
      */
     public void goAppSearch(Activity activity, Object o) {
@@ -2858,8 +2846,8 @@ public class Jump2View {
     /**
      * 小绵羊3.4.10新增 -- 游戏组搜索
      */
-    public void goActSearchGameGroup(Activity activity) {
-        Intent intent = new Intent(activity, ActSearchGameGroup.class);
+    public void goActSearch(Activity activity) {
+        Intent intent = new Intent(activity, ActSearch.class);
         activity.startActivity(intent);
         GAME_GROUP_SEARCH.onEvent();
     }

+ 0 - 243
app/src/main/java/com/sheep/gamegroup/view/activity/ActSearchAppOrTask.java

@@ -1,243 +0,0 @@
-package com.sheep.gamegroup.view.activity;
-
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentTransaction;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.text.TextUtils;
-import android.view.View;
-import android.view.inputmethod.EditorInfo;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.kfzs.appstore.utils.adapter.recyclerview.RecyclerViewAdapter;
-import com.kfzs.appstore.utils.adapter.recyclerview.ViewHolder;
-import com.sheep.gamegroup.absBase.BaseActivity;
-import com.sheep.gamegroup.absBase.IHomePageSearch;
-import com.sheep.gamegroup.absBase.ISearchRecord;
-import com.sheep.gamegroup.greendao.DDProviderHelper;
-import com.sheep.gamegroup.greendao.download.SearchRecord;
-import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.TitleInfoList;
-import com.sheep.gamegroup.model.entity.TopSearchStatistics;
-import com.sheep.gamegroup.model.util.SheepSubscriber;
-import com.sheep.gamegroup.util.ApiUtil;
-import com.sheep.gamegroup.util.DataUtil;
-import com.sheep.gamegroup.util.ListUtil;
-import com.sheep.gamegroup.util.ViewUtil;
-import com.sheep.gamegroup.view.adapter.AdpTitleInfoList;
-import com.sheep.gamegroup.view.fragment.FgtSearchAppOrTask;
-import com.sheep.jiuyan.samllsheep.R;
-import com.sheep.jiuyan.samllsheep.SheepApp;
-import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
-
-import org.afinal.simplecache.ApiKey;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import butterknife.BindView;
-import io.reactivex.android.schedulers.AndroidSchedulers;
-import io.reactivex.schedulers.Schedulers;
-import rx.functions.Action1;
-
-/**
- * Created by realicing on 2018/9/13.
- * realicing@sina.com
- */
-public class ActSearchAppOrTask extends BaseActivity {
-    @BindView(R.id.search_app_list)
-    RecyclerView recyclerView;
-    @BindView(R.id.frame_container)
-    View frame_container;
-
-    FgtSearchAppOrTask fgtSearchAppOrTask;
-
-    @Override
-    protected int getLayoutId() {
-        return R.layout.act_search_app_or_task;
-    }
-
-    @Override
-    public void initView() {
-        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
-        Fragment fragment = getSupportFragmentManager().findFragmentByTag("tag");
-        if (fragment == null) {
-            fragment = new FgtSearchAppOrTask();
-            transaction.add(R.id.frame_container, fragment, "tag");
-            transaction.commitAllowingStateLoss();
-        } else {
-            transaction.replace(R.id.frame_container, fragment);
-            transaction.commitAllowingStateLoss();
-        }
-        if (fgtSearchAppOrTask == null && fragment instanceof FgtSearchAppOrTask)
-            fgtSearchAppOrTask = (FgtSearchAppOrTask) fragment;
-    }
-
-    private List<TitleInfoList> titleInfoListList = new ArrayList<>();
-
-    @Override
-    public void initListener() {
-        TitleBarUtils.getInstance()
-                .setShowOrHide(this, true)
-                .setTitleFinish(this)
-                .setSearchBox(this, getString(R.string.search_task_or_game_name),
-                        (v, actionId, event) -> {
-                            if (actionId == EditorInfo.IME_ACTION_SEARCH) {
-                                toSearchApp();
-                            }
-                            return false;
-                        },
-                        (text) -> {
-                            frame_container.removeCallbacks(autoSearchRunnable);
-                            if (text.isEmpty() && !isTitleInfoListEmpty()) {//输入框内容为空且有搜索记录时显示搜索记录
-                                recyclerView.setVisibility(View.VISIBLE);
-                                frame_container.setVisibility(View.INVISIBLE);
-                            } else {
-                                long delay = textByClick ? 1L : 1000L;
-                                frame_container.postDelayed(autoSearchRunnable, delay);//1秒后自动搜索
-                            }
-                        })
-                .setRightBtn(this, "搜索", 0, v -> toSearchApp());
-
-        recyclerView.setHasFixedSize(true);
-        recyclerView.setNestedScrollingEnabled(false);
-        recyclerView.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
-        AdpTitleInfoList adpTitleInfoList = new AdpTitleInfoList(titleInfoListList);
-        adpTitleInfoList.bindToRecyclerView(recyclerView);
-    }
-
-    private Runnable autoSearchRunnable = this::toSearchApp;
-
-    public static final int MAX_SHOW_SEARCH_RECORD_COUNT = 10;//最多展示的搜索历史的个数
-    public static final int SORT_TOP_SEARCH = 1;//热门推荐 的排序
-    public static final int SORT_SEARCH_RECORD = 2;//搜索历史 的排序
-    List<ISearchRecord> topSearchStatisticsList = new ArrayList<>();
-
-    @Override
-    public void initData() {
-        //尝试获取缓存数据
-        List<TopSearchStatistics> newList = DataUtil.getInstance().getCacheList(ApiKey.top_search_statistics, TopSearchStatistics.class);
-        if (!ListUtil.isEmpty(newList)) {
-            topSearchStatisticsList.addAll(newList);
-            addListData("热门推荐", topSearchStatisticsList, SORT_TOP_SEARCH);
-        }
-
-        //初始化搜索历史
-        List<SearchRecord> newSgrList = DDProviderHelper.getInstance().getSearchRecordList(MAX_SHOW_SEARCH_RECORD_COUNT);
-        if (!ListUtil.isEmpty(newSgrList)) {
-            searchRecordList.addAll(newSgrList);
-            addListData("搜索历史", searchRecordList, SORT_SEARCH_RECORD);
-        }
-        notifyDataSetChangedTitleInfoList();
-        SheepApp.getInstance().getNetComponent().getApiService().getTopSearchStatistics()
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-                        boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.top_search_statistics);
-                        if (isNewData) {
-                            List<TopSearchStatistics> newList = baseMessage.getDatas(TopSearchStatistics.class);
-                            topSearchStatisticsList.clear();
-                            topSearchStatisticsList.addAll(newList);
-                            if (ListUtil.getItem(titleInfoListList, titleInfoList -> titleInfoList.getSort() == SORT_TOP_SEARCH) == null) {
-                                addListData("热门推荐", topSearchStatisticsList, SORT_TOP_SEARCH);
-                            }
-                            notifyDataSetChangedTitleInfoList();
-                        }
-                    }
-
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-                    }
-                });
-
-    }
-
-    //排序与刷新
-    private void notifyDataSetChangedTitleInfoList() {
-        //排序
-        Collections.sort(titleInfoListList);
-        //刷新
-        ViewUtil.notifyDataSetChanged(recyclerView);
-        if (isTitleInfoListEmpty()) {
-            frame_container.setVisibility(View.VISIBLE);
-            recyclerView.setVisibility(View.INVISIBLE);
-        } else {
-            frame_container.setVisibility(View.INVISIBLE);
-            recyclerView.setVisibility(View.VISIBLE);
-        }
-    }
-
-    //添加列表数据到总的列表中
-    private void addListData(String title, final List<ISearchRecord> list, int sort) {
-        titleInfoListList.add(new TitleInfoList(title, new RecyclerViewAdapter<ISearchRecord>(SheepApp.getInstance(), R.layout.item_i_serach_record, list) {
-            @Override
-            public void convert(ViewHolder viewHolder, final ISearchRecord item, int position) {
-                View view = viewHolder.itemView;
-                TextView item_search_record_name = view.findViewById(R.id.item_search_record_name);
-                ImageView item_search_record_x = view.findViewById(R.id.item_search_record_x);
-                ViewUtil.setText(item_search_record_name, item.getInput());
-                if (item instanceof SearchRecord) {
-                    //点击一条搜索历史后面的xx
-                    item_search_record_x.setOnClickListener(view12 -> {
-                        list.remove(item);
-                        ViewUtil.notifyDataSetChanged(recyclerView);
-                        DDProviderHelper.getInstance().deleteSearchRecord((SearchRecord) item);
-                        if (isTitleInfoListEmpty()) {
-                            frame_container.setVisibility(View.VISIBLE);
-                            recyclerView.setVisibility(View.INVISIBLE);
-                        }
-                    });
-                } else {
-                    ViewUtil.setVisibility(item_search_record_x, false);
-                }
-                //点击一条搜索历史
-                view.setOnClickListener(view1 -> {
-                    textByClick = true;
-                    TitleBarUtils.getInstance().setSearchText(ActSearchAppOrTask.this, item.getInput());
-                    if (item instanceof IHomePageSearch)
-                        ApiUtil.postTopSearchStatisticsClickTopSearch((IHomePageSearch) item);
-                });
-            }
-        }).setSort(sort));
-    }
-    private boolean textByClick = false;//通过点击搜索历史或者热门推荐来搜索,应该立即执行
-
-    //搜索历史中没有数据且没有获取到服务器的热门搜索列表
-    private boolean isTitleInfoListEmpty() {
-        return searchRecordList.isEmpty() && topSearchStatisticsList.isEmpty();
-    }
-
-    List<ISearchRecord> searchRecordList = new ArrayList<>();
-
-    //尝试搜索游戏
-    private void toSearchApp() {
-        textByClick = false;//重置
-        if(fgtSearchAppOrTask == null){
-            return;
-        }
-        if(fgtSearchAppOrTask.isLoadingData()){
-            return;
-        }
-        recyclerView.setVisibility(View.INVISIBLE);
-        frame_container.setVisibility(View.VISIBLE);
-        String inputText = TitleBarUtils.getInstance().getSearchText(this).trim();
-        if (!TextUtils.isEmpty(inputText)) {
-            //保存搜索到数据库
-            SearchRecord searchRecord = new SearchRecord();
-            searchRecord.setInput(inputText);
-            searchRecord.setLast_time(System.currentTimeMillis());
-            searchRecord.setCount(1);
-            DDProviderHelper.getInstance().addOrUpdateSearchRecord(searchRecord, item -> {
-                if(item == null) {
-                    searchRecordList.add(searchRecord);
-                    ViewUtil.notifyDataSetChanged(recyclerView);
-                }
-            });
-        }
-        fgtSearchAppOrTask.toSearch(inputText);
-    }
-}

+ 0 - 48
app/src/main/java/com/sheep/gamegroup/view/adapter/HomePageSearchAdapter.java

@@ -1,48 +0,0 @@
-package com.sheep.gamegroup.view.adapter;
-
-import android.support.annotation.Nullable;
-import android.text.TextUtils;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import com.chad.library.adapter.base.BaseQuickAdapter;
-import com.chad.library.adapter.base.BaseViewHolder;
-import com.kfzs.duanduan.utils.NumberFormatUtils;
-import com.sheep.gamegroup.absBase.IContentContainer;
-import com.sheep.gamegroup.model.entity.HomePageSearch;
-import com.sheep.gamegroup.util.ViewUtil;
-import com.sheep.jiuyan.samllsheep.R;
-
-import java.util.List;
-import java.util.Locale;
-
-/**
- * Created by realicing on 2018/11/8.
- * realicing@sina.com
- */
-public class HomePageSearchAdapter extends BaseQuickAdapter<HomePageSearch, BaseViewHolder> {
-
-    public HomePageSearchAdapter(@Nullable List<HomePageSearch> data) {
-        super(R.layout.item_home_page_search, data);
-    }
-
-    @Override
-    protected void convert(BaseViewHolder helper, HomePageSearch item) {
-        ImageView item_home_page_search_iv = helper.itemView.findViewById(R.id.item_home_page_search_iv);
-        TextView item_home_page_search_content_tv = helper.itemView.findViewById(R.id.item_home_page_search_content_tv);
-        TextView item_home_page_search_bonus_tv = helper.itemView.findViewById(R.id.item_home_page_search_bonus_tv);
-
-        ViewUtil.setVisibility(item_home_page_search_bonus_tv, item.hasBonus());
-        ViewUtil.setText(item_home_page_search_bonus_tv, String.format(Locale.CHINA, "+%s元", NumberFormatUtils.retainMost2(NumberFormatUtils.parseFloat(item.getBonus()))));
-        if(contentContainer != null && !TextUtils.isEmpty(contentContainer.getContent()))
-            ViewUtil.setColorMapText(item_home_page_search_content_tv, String.format(Locale.CHINA, "%s/%s", item.getTitle(), item.getContent()), contentContainer.getContent(), "#4889FF");
-        else
-            ViewUtil.setText(item_home_page_search_content_tv, String.format(Locale.CHINA, "%s/%s", item.getTitle(), item.getContent()));
-        ViewUtil.setGameImage(item_home_page_search_iv, item.getIcon());
-    }
-
-    private IContentContainer<String> contentContainer;
-    public void setContentContainer(IContentContainer<String> contentContainer) {
-        this.contentContainer = contentContainer;
-    }
-}

+ 0 - 84
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSearchAppOrTask.java

@@ -1,84 +0,0 @@
-package com.sheep.gamegroup.view.fragment;
-
-import android.support.v7.widget.RecyclerView;
-import android.view.View;
-
-import com.chad.library.adapter.base.BaseQuickAdapter;
-import com.sheep.gamegroup.absBase.IContentContainer;
-import com.sheep.gamegroup.absBase.ISearch;
-import com.sheep.gamegroup.model.api.ApiService;
-import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.entity.HomePageSearch;
-import com.sheep.gamegroup.util.ApiUtil;
-import com.sheep.gamegroup.util.Jump2View;
-import com.sheep.gamegroup.util.ListUtil;
-import com.sheep.gamegroup.view.adapter.HomePageSearchAdapter;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.Locale;
-
-import io.reactivex.Observable;
-
-/**
- * Created by realicing on 2018/9/13.
- * realicing@sina.com
- *
- * 小绵羊3.4.10后也可以搜索出游戏组
- */
-public class FgtSearchAppOrTask extends BaseListFragment3<HomePageSearch> implements ISearch, BaseQuickAdapter.OnItemClickListener, IContentContainer<String> {
-
-    @Override
-    public int refreshDataType() {
-        return -1;
-    }
-
-    private String search_content;
-
-    @Override
-    protected RecyclerView.Adapter getAdapter() {
-        HomePageSearchAdapter adapter = new HomePageSearchAdapter(list);
-        adapter.setContentContainer(this);
-        adapter.setOnItemClickListener(this);
-        return adapter;
-    }
-
-    @Override
-    protected String getKey(int page, int per_page) {
-        String sc = search_content;
-        try {
-            sc = URLEncoder.encode(search_content,"utf-8");
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-        return String.format(Locale.CHINA, "app/top_search_statistics/home_page_search?search_content=%s", sc);
-    }
-
-    @Override
-    protected Observable<BaseMessage> getApi(ApiService apiService) {
-        return apiService.getTopSearchStatisticsHomePageSearch(search_content);
-    }
-
-    @Override
-    protected Class<HomePageSearch> getTClass() {
-        return HomePageSearch.class;
-    }
-
-    @Override
-    public void toSearch(String name) {
-        this.search_content = name;
-        refreshData();
-    }
-
-    @Override
-    public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
-        HomePageSearch item = ListUtil.getItem(list, position);
-        ApiUtil.postTopSearchStatisticsClickTopSearch(item);
-        Jump2View.getInstance().goEntity(getContext(), item);
-    }
-
-    @Override
-    public String getContent() {
-        return search_content;
-    }
-}

+ 1 - 2
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSmallSheep.java

@@ -97,7 +97,6 @@ import com.sheep.gamegroup.util.viewHelper.LayoutParamsUtil;
 import com.sheep.gamegroup.util.viewHelper.PopupWindowUtil;
 import com.sheep.gamegroup.view.activity.ActMain;
 import com.sheep.gamegroup.view.activity.ActMsg;
-import com.sheep.gamegroup.view.activity.ActWebX5SBD;
 import com.sheep.gamegroup.view.activity.NotificationsUtils;
 import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
 import com.sheep.gamegroup.view.adapter.AdpTryMakemoney;
@@ -316,7 +315,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
 
     @OnClick(R.id.to_search_but)
     public void toSearchActivity() {
-        Jump2View.getInstance().goAppTaskSearch(activity, null);
+        Jump2View.getInstance().goActSearch(getActivity());
     }
 
     @OnClick(R.id.home_search_sbd_iv)

+ 7 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/utils/TitleBarUtils.java

@@ -231,6 +231,13 @@ public class TitleBarUtils {
         return this;
     }
 
+    public void setSearchHint(Activity activity, String hint) {
+        AppCompatAutoCompleteTextView box = activity.getWindow().getDecorView().findViewById(R.id.box_baseactivity_search);
+        if (box != null) {
+            box.setHint(hint);
+        }
+    }
+
     public void setSearchText(Activity activity, String text) {
         AppCompatAutoCompleteTextView box = activity.getWindow().getDecorView().findViewById(R.id.box_baseactivity_search);
         if (box != null) {

+ 2 - 0
app/src/main/java/org/afinal/simplecache/ApiKey.java

@@ -28,6 +28,8 @@ import java.util.Locale;
 public class ApiKey {
     //搜索热门推荐
     public static final String top_search_statistics = "app/top_search_statistics?platform=1";
+    //搜索热门
+    public static final String hot_search_keywords = "app/search/keywords";
     //关于我们
     public static final String new_about_us = "app/about_us/new_about_us";
     //公告

binární
app/src/main/res/drawable-xxhdpi/gif_sheep_loading.gif


+ 86 - 0
app/src/main/res/layout/act_search.xml

@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/bg"
+    android:fitsSystemWindows="true"
+    android:orientation="vertical">
+
+    <ScrollView
+        android:id="@+id/quick_search_layout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:scrollbars="none">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical">
+
+            <RelativeLayout
+                android:id="@+id/hot_search_layout"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+                <TextView
+                    android:text="大家都在搜"
+                    android:textColor="@color/gray_999"
+                    android:textSize="16sp"
+                    android:gravity="center_vertical"
+                    android:layout_width="wrap_content"
+                    android:layout_marginLeft="16dp"
+                    android:layout_height="50dp" />
+                <ImageView
+                    android:id="@+id/refresh_btn"
+                    android:layout_alignParentRight="true"
+                    android:padding="18dp"
+                    android:src="@mipmap/ic_change_one"
+                    android:layout_width="50dp"
+                    android:layout_height="50dp" />
+                <com.kfzs.android.view.tag.TagFlowLayout
+                    android:id="@+id/hot_list_layout"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="50dp"
+                    android:paddingBottom="30dp"></com.kfzs.android.view.tag.TagFlowLayout>
+            </RelativeLayout>
+
+            <View android:id="@+id/seperator"
+                android:layout_width="match_parent"
+                android:layout_height="8dp"
+                android:background="@color/gray_F0F0F0"></View>
+            <RelativeLayout
+                android:id="@+id/history_search_layout"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+                <TextView
+                    android:text="历史搜索"
+                    android:textColor="@color/gray_999"
+                    android:textSize="16sp"
+                    android:gravity="center_vertical"
+                    android:layout_width="wrap_content"
+                    android:layout_marginLeft="16dp"
+                    android:layout_height="50dp" />
+                <ImageView
+                    android:id="@+id/clear_btn"
+                    android:layout_alignParentRight="true"
+                    android:padding="18dp"
+                    android:src="@mipmap/cross_delete"
+                    android:tint="@color/gray_999"
+                    android:layout_width="50dp"
+                    android:layout_height="50dp" />
+                <com.kfzs.android.view.tag.TagFlowLayout
+                    android:id="@+id/history_list_layout"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="50dp"
+                    android:paddingBottom="30dp"></com.kfzs.android.view.tag.TagFlowLayout>
+            </RelativeLayout>
+        </LinearLayout>
+
+    </ScrollView>
+
+    <FrameLayout
+        android:id="@+id/frame_container"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
+</RelativeLayout>

+ 0 - 18
app/src/main/res/layout/act_search_app_or_task.xml

@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:fitsSystemWindows="true"
-    android:orientation="vertical"
-    android:background="@color/bg">
-
-    <android.support.v7.widget.RecyclerView
-        android:id="@+id/search_app_list"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent" />
-
-    <FrameLayout
-        android:id="@+id/frame_container"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent" />
-</RelativeLayout>

+ 5 - 4
app/src/main/res/layout/find_item_news.xml

@@ -3,8 +3,8 @@
     android:id="@+id/find_item_container"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:paddingTop="16dp"
     android:paddingStart="16dp"
+    android:paddingTop="16dp"
     android:paddingEnd="16dp">
 
     <TextView
@@ -13,8 +13,7 @@
         android:layout_height="wrap_content"
         android:layout_toStartOf="@+id/find_item_iv"
         android:ellipsize="end"
-        android:maxLines="3"
-        android:minLines="2"
+        android:lines="2"
         android:text="abcab"
         android:textColor="@color/black_6_3"
         android:textSize="15sp" />
@@ -43,7 +42,9 @@
     <View
         android:id="@+id/item_bottom_line"
         style="@style/style_item_line_full"
+        android:layout_height="0.5dp"
+        android:layout_below="@+id/find_item_iv"
         android:layout_marginTop="16dp"
-        android:layout_below="@+id/find_item_iv"/>
+        android:background="@color/gray_F0F0F0" />
 
 </RelativeLayout>

+ 2 - 2
app/src/main/res/layout/item_download_welfare.xml

@@ -177,8 +177,8 @@
     <View
         android:id="@+id/item_download_welfare_line"
         android:layout_width="match_parent"
-        android:layout_height="1dp"
+        android:layout_height="0.5dp"
         android:layout_marginEnd="16dp"
         android:layout_marginStart="16dp"
-        android:background="@color/gray_F2F2F2" />
+        android:background="@color/gray_F0F0F0" />
 </LinearLayout>

+ 2 - 2
app/src/main/res/layout/item_home_page_search.xml

@@ -44,8 +44,8 @@
 
     <View
         android:layout_width="match_parent"
-        android:layout_height="1px"
-        android:background="#F2F2F2"
+        android:layout_height="0.5px"
+        android:background="@color/gray_F0F0F0"
         app:layout_constraintBottom_toBottomOf="parent" />
 
 

+ 6 - 0
app/src/main/res/layout/keyword_label.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/user_label_tv"
+    style="@style/style_check_stroke"
+    android:layout_marginRight="@dimen/content_padding_3"
+    android:text="小标签" />

binární
app/src/main/res/mipmap-xxhdpi/wushuju.png


binární
app/src/main/res/mipmap-xxhdpi/wushuju.webp


binární
app/src/main/res/mipmap-xxhdpi/wushuju_net_error.png


binární
app/src/main/res/mipmap-xxhdpi/wushuju_net_error.webp