Przeglądaj źródła

Merge remote-tracking branch 'origin/sheep_develop' into sheep_develop

liujiangyao 7 lat temu
rodzic
commit
830a0d9e91
26 zmienionych plików z 578 dodań i 73 usunięć
  1. 2 0
      app/src/main/AndroidManifest.xml
  2. 6 2
      app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java
  3. 60 0
      app/src/main/java/com/sheep/gamegroup/model/entity/SearchAppRecord.java
  4. 2 2
      app/src/main/java/com/sheep/gamegroup/util/DataUtil.java
  5. 9 0
      app/src/main/java/com/sheep/gamegroup/util/Jump2View.java
  6. 5 0
      app/src/main/java/com/sheep/gamegroup/util/ListUtil.java
  7. 58 33
      app/src/main/java/com/sheep/gamegroup/util/MyDbManager.java
  8. 1 0
      app/src/main/java/com/sheep/gamegroup/util/UMConfigUtils.java
  9. 1 1
      app/src/main/java/com/sheep/gamegroup/view/activity/ActGameCenter.java
  10. 204 0
      app/src/main/java/com/sheep/gamegroup/view/activity/ActSearchApp.java
  11. 15 9
      app/src/main/java/com/sheep/gamegroup/view/fragment/BaseListFragment.java
  12. 6 6
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtFind.java
  13. 2 2
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtMsgCenter.java
  14. 57 0
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSearchApp.java
  15. 6 1
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSmallSheep.java
  16. 2 2
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtTryMakeMoney.java
  17. 6 0
      app/src/main/res/drawable/shape_f5_solid_rectangle.xml
  18. 2 2
      app/src/main/res/layout/act_audit_layout.xml
  19. 25 0
      app/src/main/res/layout/act_search_app.xml
  20. 2 6
      app/src/main/res/layout/fgt_find.xml
  21. 12 7
      app/src/main/res/layout/fgt_personacenter_item_top.xml
  22. 46 0
      app/src/main/res/layout/item_serach_record.xml
  23. 49 0
      app/src/main/res/layout/title_search.xml
  24. BIN
      app/src/main/res/mipmap-xxhdpi/x_search.webp
  25. BIN
      app/src/main/res/mipmap-xxhdpi/yilingq.png
  26. BIN
      app/src/main/res/mipmap-xxhdpi/yilingq.webp

+ 2 - 0
app/src/main/AndroidManifest.xml

@@ -578,6 +578,8 @@
             android:screenOrientation="portrait"/>
         <activity android:name="com.sheep.gamegroup.view.activity.ActSearchGame"
             android:screenOrientation="portrait"/>
+        <activity android:name="com.sheep.gamegroup.view.activity.ActSearchApp"
+            android:screenOrientation="portrait"/>
         <activity android:name="com.sheep.gamegroup.view.activity.ActSetting"
             android:screenOrientation="portrait"/>
         <activity android:name="com.sheep.gamegroup.view.activity.MessagesActivity"

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

@@ -493,8 +493,6 @@ public interface ApiService {
     Observable<BaseMessage> agreementBack(@Body JSONArray jsonArray);
 
 
-    /****************div****************/
-
     /**
      * 获取累计打卡记录
      * 1当月 2上个月 3上上个月
@@ -972,6 +970,12 @@ public interface ApiService {
      */
     @GET("app/find")
     Observable<BaseMessage> playgameDailyOrHotOrTypePlay(@Query("page") int page, @Query("per_page") int per_page, @Query("is_hot") int is_hot, @Query("daily_play") int daily_play, @Query("type") int type);
+    /**
+     *
+     * type: 1002:快发出包 1003:腾讯出包 1004:小米出包
+     */
+    @GET("app/find")
+    Observable<BaseMessage> searchApp(@Query("page") int page, @Query("per_page") int per_page, @Query("name") String name, @Query("type") int type);
 
     /**
      * platform 平台 1:andriod 2:ios

+ 60 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/SearchAppRecord.java

@@ -0,0 +1,60 @@
+package com.sheep.gamegroup.model.entity;
+
+import android.text.TextUtils;
+
+import org.xutils.db.annotation.Column;
+import org.xutils.db.annotation.Table;
+
+/**
+ * Created by realicing on 2018/9/13.
+ * realicing@sina.com
+ */
+@Table(name = "search_app_record")
+public class SearchAppRecord {
+    @Column(name = "input", isId = true)
+    private String input;
+    @Column(name = "time")
+    private long time;
+    @Column(name = "count")//搜索次数
+    private int count;
+
+    public String getInput() {
+        return input;
+    }
+
+    public void setInput(String input) {
+        this.input = input;
+    }
+
+    public long getTime() {
+        return time;
+    }
+
+    public void setTime(long time) {
+        this.time = time;
+    }
+
+    public int getCount() {
+        return count;
+    }
+
+    public void setCount(int count) {
+        this.count = count;
+    }
+
+    @Override
+    public String toString() {
+        return input;
+    }
+
+
+    @Override
+    public boolean equals(Object obj) {
+        return obj instanceof SearchAppRecord && TextUtils.equals(((SearchAppRecord) obj).input, input);
+    }
+
+    //搜索次数增加
+    public void addCount() {
+        count++;
+    }
+}

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/util/DataUtil.java

@@ -286,9 +286,9 @@ public class DataUtil {
         return null;
     }
     //是否使用小绵羊截图方案
-    public static final boolean IS_USE_SCREEN_SHOT = true;
+    public static final boolean IS_USE_SCREEN_SHOT = false;
     //是否监听媒体库图片变化
-    public static final boolean IS_LISTEN_SCREEN_SHOT = true;
+    public static final boolean IS_LISTEN_SCREEN_SHOT = false;
     /**
      * 截图路径
      *

+ 9 - 0
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -58,6 +58,7 @@ import com.sheep.gamegroup.view.activity.ActNewbieTaskList;
 import com.sheep.gamegroup.view.activity.ActNotice;
 import com.sheep.gamegroup.view.activity.ActPlayGameDetail;
 import com.sheep.gamegroup.view.activity.ActReservation;
+import com.sheep.gamegroup.view.activity.ActSearchApp;
 import com.sheep.gamegroup.view.activity.ActSearchGame;
 import com.sheep.gamegroup.view.activity.ActSetting;
 import com.sheep.gamegroup.view.activity.ActSignCard;
@@ -1442,6 +1443,14 @@ public class Jump2View {
         GAME_INSTEAD_OF_RECHARGE.onEvent();
     }
     /**
+     * 新的游戏搜索
+     */
+    public void goAppSearch(Activity activity, Object o){
+        Intent intent = new Intent(activity, ActSearchApp.class);
+        activity.startActivity(intent);
+        SEARCH_GAME.onEvent();
+    }
+    /**
      * 游戏搜索
      */
     public void goGameSearch(Activity activity, Object o){

+ 5 - 0
app/src/main/java/com/sheep/gamegroup/util/ListUtil.java

@@ -127,6 +127,11 @@ public class ListUtil {
         });
     }
 
+    public static <T>  void removeAll(List<T> allList, List<T> removeList) {
+        if(allList != null && removeList != null)
+            allList.removeAll(removeList);
+    }
+
     public static interface CallBack<I, R>{
         public R call(I i);
     }

+ 58 - 33
app/src/main/java/com/sheep/gamegroup/util/MyDbManager.java

@@ -7,10 +7,10 @@ import com.sheep.gamegroup.model.entity.AppRecord;
 import com.sheep.gamegroup.model.entity.AppUsage;
 import com.sheep.gamegroup.model.entity.LoginUser;
 import com.sheep.gamegroup.model.entity.NewbieTaskRecord;
+import com.sheep.gamegroup.model.entity.SearchAppRecord;
 import com.sheep.gamegroup.model.entity.SearchGameRecord;
 import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.jiuyan.samllsheep.SheepApp;
-import com.sheep.jiuyan.samllsheep.utils.SpUtils;
 
 import org.xutils.DbManager;
 import org.xutils.ex.DbException;
@@ -34,18 +34,18 @@ public class MyDbManager {
         db = x.getDb(daoConfig);
     }
 
-    public static MyDbManager getInstance(){
-        if (myDbManager == null){
+    public static MyDbManager getInstance() {
+        if (myDbManager == null) {
             myDbManager = new MyDbManager();
         }
         return myDbManager;
     }
 
     /**
-     *保存或更新表表
+     * 保存或更新表表
      */
     public void saveOrUpdateUser(final UserEntity user) throws DbException {
-        if(user != null){
+        if (user != null) {
             DataUtil.getInstance().setUserEntity(user);
             deleteTable(UserEntity.class);//先清空表
             new Handler().postDelayed(new Runnable() {
@@ -66,66 +66,70 @@ public class MyDbManager {
     /**
      * 查找NewbieTaskRecord
      */
-    public NewbieTaskRecord dbFindNewbieTaskRecord(String invitation_code) throws DbException{
+    public NewbieTaskRecord dbFindNewbieTaskRecord(String invitation_code) throws DbException {
         return db.findById(NewbieTaskRecord.class, invitation_code);
     }
 
 
     /**
-     *保存或更新表表
+     * 保存或更新表表
      */
     public void saveOrUpdate(Object o) {
-        try{
+        try {
             db.saveOrUpdate(o);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
 
     }
 
     /**
-     *删除表
+     * 删除表
+     *
      * @param o
      */
-    public void deleteTable(Class<?> o){
+    public void deleteTable(Class<?> o) {
         try {
             db.dropTable(o);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
-    public List<AppRecord> getAppRecordList(String packageName){
-        try{
+
+    public List<AppRecord> getAppRecordList(String packageName) {
+        try {
             return db.selector(AppRecord.class)
                     .where("package_name", "=", packageName)
                     .findAll();
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return ListUtil.emptyList();
     }
-    public void removeAppRecord(){
-        try{
+
+    public void removeAppRecord() {
+        try {
             db.dropTable(AppRecord.class);
 //            String sql = String.format(Locale.CHINA,"delete from app_record where package_name in('%s')" , packageName);
 //            Cursor cursor = db.execQuery(sql);
 //            cursor.close();
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
-    public long getAppRunTime(String packageName){
-        try{
-    //type_id 为32时对应 AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
+
+    public long getAppRunTime(String packageName) {
+        try {
+            //type_id 为32时对应 AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED
 //            Cursor cursor = db.execQuery(String.format(Locale.CHINA,"select sum(time) as all_time from app_record where package_name = '%s' and type_id = 32" , packageName));
 //            Cursor cursor = db.execQuery(String.format(Locale.CHINA,"select sum(time) from app_record where package_name = '%s' and time > %d" , packageName, AutoTaskListUtil.getInstance().getFindTime()));
-            Cursor cursor = db.execQuery(String.format(Locale.CHINA,"select sum(time) from app_record where package_name = '%s'" , packageName));
+            Cursor cursor = db.execQuery(String.format(Locale.CHINA, "select sum(time) from app_record where package_name = '%s'", packageName));
             cursor.moveToFirst();
             long time = cursor.getLong(0);
-            LogUtil.println( "MyDbManager","getAppRunTime","runTime", "=", time);
+            LogUtil.println("MyDbManager", "getAppRunTime", "runTime", "=", time);
             cursor.close();
             return time;
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return 0;
@@ -140,39 +144,60 @@ public class MyDbManager {
 //    }
 
     public List<LoginUser> getAllLoginUser() {
-        try{
+        try {
             return db.selector(LoginUser.class)
                     .where("service_name", "=", SheepApp.getInstance().getConnectAddress().getName())
                     .findAll();
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return ListUtil.emptyList();
     }
-    public long getAppUsageTime(String packageName){
+
+    public long getAppUsageTime(String packageName) {
         AppUsage appUsage = getAppUsage(packageName);
         return appUsage == null ? 0 : appUsage.getTotalTimeInForeground();
     }
 
-    public AppUsage getAppUsage(String packageName){
-        try{
+    public AppUsage getAppUsage(String packageName) {
+        try {
             return db.selector(AppUsage.class)
                     .where("package_name", "=", packageName)
                     .findFirst();
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return null;
     }
 
     public List<SearchGameRecord> getAllSearchGameRecord(int type) {
-        try{
+        try {
             return db.selector(SearchGameRecord.class)
-                    .where("type","=", type)
+                    .where("type", "=", type)
                     .findAll();
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return ListUtil.emptyList();
     }
+
+    public List<SearchAppRecord> getAllSearchAppRecord() {
+        try {
+            return db.selector(SearchAppRecord.class)
+                    .where("count", ">", 0)
+                    .findAll();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return ListUtil.emptyList();
+    }
+
+    public void hideSearchApp(SearchAppRecord item) {
+        item.setCount(0);
+        try {
+            db.save(item);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 }

+ 1 - 0
app/src/main/java/com/sheep/gamegroup/util/UMConfigUtils.java

@@ -169,6 +169,7 @@ public class UMConfigUtils {
         GIFT_BAG_DIALOG_COPY_CODE("礼包中心 -> 领取礼包 -> 对话框内复制礼包码 参数 gift_bag_id gift_bag_code"),
         GIFT_BAG_DIALOG_START_APP("礼包中心 -> 领取礼包 -> 对话框内启动游戏 参数 gift_bag_id package_name"),
         SHARE_TO_WEIXIN_CIRCLE("分享到微信朋友圈"),
+        SEARCH_APP("玩转游戏 -> 搜索游戏"),
         ;
         private String tag;
 

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/ActGameCenter.java

@@ -62,7 +62,7 @@ public class ActGameCenter extends BaseActivity {
                 titleBarUtils.setRightSecondBtn(activity, R.mipmap.search_black_img, new View.OnClickListener() {
                     @Override
                     public void onClick(View view) {
-                        Jump2View.getInstance().goGameSearch(activity, null);
+                        Jump2View.getInstance().goAppSearch(activity, null);
                     }
                 })
                         .setRightImgBotton(activity, R.drawable.index_download, new View.OnClickListener() {

+ 204 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/ActSearchApp.java

@@ -0,0 +1,204 @@
+package com.sheep.gamegroup.view.activity;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentTransaction;
+import android.support.v7.widget.AppCompatAutoCompleteTextView;
+import android.text.Editable;
+import android.text.TextUtils;
+import android.text.TextWatcher;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.inputmethod.EditorInfo;
+import android.widget.AdapterView;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import com.sheep.gamegroup.absBase.BaseActivity;
+import com.sheep.gamegroup.model.entity.SearchAppRecord;
+import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.MyDbManager;
+import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.gamegroup.view.adapter.ArrayAdapter;
+import com.sheep.gamegroup.view.fragment.FgtSearchApp;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import butterknife.BindView;
+import butterknife.OnClick;
+
+/**
+ * Created by realicing on 2018/9/13.
+ * realicing@sina.com
+ */
+public class ActSearchApp extends BaseActivity {
+    @BindView(R.id.title_search_input)
+    AppCompatAutoCompleteTextView title_search_input;
+    @BindView(R.id.search_app_list)
+    ListView search_app_list;
+    @BindView(R.id.frame_container)
+    View frame_container;
+    @BindView(R.id.title_search_commit)
+    TextView title_search_commit;
+
+    @Override
+    protected int getLayoutId() {
+        return R.layout.act_search_app;
+    }
+
+    private FgtSearchApp fgtSearchApp;
+
+    @Override
+    public void initView() {
+        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+        Bundle bundle = new Bundle();
+        Fragment fragment = getSupportFragmentManager().findFragmentByTag("tag");
+        if (fragment == null) {
+            fragment = new FgtSearchApp();
+            fragment.setArguments(bundle);
+            transaction.add(R.id.frame_container, fragment, "tag");
+            transaction.commitAllowingStateLoss();
+        } else {
+            fragment.setArguments(bundle);
+            transaction.replace(R.id.frame_container, fragment);
+            transaction.commitAllowingStateLoss();
+        }
+        if (fgtSearchApp == null && fragment instanceof FgtSearchApp)
+            fgtSearchApp = (FgtSearchApp) fragment;
+        inputAdapter = new ArrayAdapter<SearchAppRecord>(SheepApp.getInstance(), R.layout.item_serach_record, searchRecordList){
+            @Override
+            public boolean convert(int position, View view, ViewGroup parent, final SearchAppRecord item) {
+                TextView item_search_record_name = (TextView)view.findViewById(R.id.item_search_record_name);
+                ImageView item_search_record_x = (ImageView)view.findViewById(R.id.item_search_record_x);
+                ViewUtil.setText(item_search_record_name, item.getInput());
+                item_search_record_x.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View view) {
+                        searchRecordList.remove(item);
+                        inputAdapter.notifyDataSetChanged();
+                        MyDbManager.getInstance().hideSearchApp(item);
+                    }
+                });
+                return true;
+            }
+        };
+        search_app_list.setAdapter(inputAdapter);
+        frame_container.setVisibility(View.INVISIBLE);
+    }
+
+    private ArrayAdapter<SearchAppRecord> inputAdapter;
+
+    @Override
+    public void initListener() {
+        search_app_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
+                SearchAppRecord item = ListUtil.getItem(searchRecordList, position);
+                if(item != null){
+                    title_search_input.setText(item.getInput());
+                    title_search_input.setSelection(item.getInput().length());
+                }
+            }
+        });
+        title_search_input.setOnEditorActionListener(new TextView.OnEditorActionListener() {
+            @Override
+            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+                if (actionId == EditorInfo.IME_ACTION_SEARCH) {
+                    title_search_commit.performClick();
+                }
+                return false;
+            }
+        });
+        title_search_input.addTextChangedListener(new TextWatcher() {
+            @Override
+            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
+            }
+
+            @Override
+            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+            }
+
+            @Override
+            public void afterTextChanged(Editable editable) {
+                title_search_input.removeCallbacks(autoSearchRunnable);
+                title_search_input.postDelayed(autoSearchRunnable, 1000L);//1秒后自动搜索
+            }
+        });
+    }
+
+    private Runnable autoSearchRunnable = new Runnable() {
+        @Override
+        public void run() {
+            title_search_commit.performClick();
+        }
+    };
+
+    @Override
+    public void initData() {
+        //初始化搜索历史
+        List<SearchAppRecord> newSgrList = MyDbManager.getInstance().getAllSearchAppRecord();
+        ListUtil.addAll(searchRecordList, newSgrList);
+        Collections.sort(searchRecordList, new Comparator<SearchAppRecord>() {
+            @Override
+            public int compare(SearchAppRecord item1, SearchAppRecord item2) {
+                return item2.getCount() - item1.getCount();
+            }
+        });
+        for (SearchAppRecord item : searchRecordList) {
+            searchRecordMap.put(item.getInput(), item);
+        }
+        inputAdapter.notifyDataSetChanged();
+    }
+
+    @OnClick({R.id.title_search_commit, R.id.title_img_back})
+    public void onViewClicked(View view) {
+        switch (view.getId()) {
+            case R.id.title_search_commit:
+                toSearchApp();
+                break;
+            case R.id.title_img_back:
+                finish();
+                break;
+        }
+    }
+
+    List<SearchAppRecord> searchRecordList = new ArrayList<>();
+    Map<String, SearchAppRecord> searchRecordMap = new HashMap<>();
+
+    //尝试搜索游戏
+    private void toSearchApp() {
+        String inputText = title_search_input.getText().toString();
+        if (TextUtils.isEmpty(inputText)) {
+            fgtSearchApp.clear();
+            fgtSearchApp.notifyDataSetChanged();
+            search_app_list.setVisibility(View.VISIBLE);
+            frame_container.setVisibility(View.INVISIBLE);
+            return;
+        }
+        search_app_list.setVisibility(View.INVISIBLE);
+        frame_container.setVisibility(View.VISIBLE);
+        //保存搜索到数据库
+        SearchAppRecord searchRecord = searchRecordMap.get(inputText);
+        if(searchRecord == null) {
+            searchRecord = new SearchAppRecord();
+            searchRecord.setInput(inputText);
+            searchRecordList.add(searchRecord);
+            searchRecordMap.put(inputText, searchRecord);
+        }
+        searchRecord.setTime(System.currentTimeMillis());
+        searchRecord.addCount();
+        MyDbManager.getInstance().saveOrUpdate(searchRecord);
+        inputAdapter.notifyDataSetChanged();
+        fgtSearchApp.toSearch(inputText);
+    }
+}

+ 15 - 9
app/src/main/java/com/sheep/gamegroup/view/fragment/BaseListFragment.java

@@ -50,9 +50,15 @@ public abstract class BaseListFragment<T> extends BaseFragment {
         activity = getActivity();
         initView();
         initListener();
-        if(!refreshDataAfterOnResume())
-            view_list.refresh();
-
+        switch (refreshDataType()) {
+            case 0:
+                view_list.refresh();
+            case 1:
+                break;
+            default:
+                notifyDataSetChanged();
+                break;
+        }
     }
     @BindView(R.id.title)
     protected View title;
@@ -139,7 +145,7 @@ public abstract class BaseListFragment<T> extends BaseFragment {
                         lastMessage = baseMessage;
                         boolean isNewData = DataUtil.getInstance().isNewData(urlKey);
                         if(isNewData || !isFirstGetACache()) {
-                            list.removeAll(lastCacheList);
+                            ListUtil.removeAll(list, lastCacheList);
                             List<T> newList = baseMessage.getDatas(getTClass());
                             loadList(newList);
                         }else {
@@ -161,17 +167,17 @@ public abstract class BaseListFragment<T> extends BaseFragment {
     @Override
     public void onResume() {
         super.onResume();
-        if(refreshDataAfterOnResume()){
+        if(refreshDataType() == 1){
             view_list.refresh();
         }
     }
 
     /**
-     * 每次都在onResume方法中进行更新数据
+     * 在哪里初始化数据:0 onViewCreated后, 1 onResume后, -1 不初始化
      * @return
      */
-    public boolean refreshDataAfterOnResume() {
-        return false;
+    public int refreshDataType() {
+        return 0;
     }
 
     public void refreshData(){
@@ -189,7 +195,7 @@ public abstract class BaseListFragment<T> extends BaseFragment {
         ListUtil.addAll(list, newList);
         notifyDataSetChanged();
     }
-    protected void notifyDataSetChanged(){
+    public void notifyDataSetChanged(){
         CommonUtil.getInstance().updateEmptyView(empty_view, list.isEmpty());
         if(page == 1){
             view_list.refreshComplete();

+ 6 - 6
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtFind.java

@@ -52,12 +52,14 @@ public class FgtFind extends BaseFragment {
         initView();
         initData();
     }
+
     Unbinder unbinder;
+
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
         // TODO: inflate a fragment view
         View rootView = super.onCreateView(inflater, container, savedInstanceState);
-        if(rootView != null)
+        if (rootView != null)
             unbinder = ButterKnife.bind(this, rootView);
         return rootView;
     }
@@ -67,8 +69,7 @@ public class FgtFind extends BaseFragment {
         super.onDestroyView();
         unbinder.unbind();
     }
-    @BindView(R.id.layout_navigationBar)
-    View layout_navigationBar;
+
     @BindView(R.id.indicator)
     TabLayout indicator;
     @BindView(R.id.pager)
@@ -77,7 +78,6 @@ public class FgtFind extends BaseFragment {
     private TitleFragmentListAdapter mAdapter;
 
     private void initView() {
-        layout_navigationBar.setVisibility(View.GONE);
         mAdapter = new TitleFragmentListAdapter(getFragmentManager());
         mAdapter.add(FgtFindChild.newInstance(0), "全部");
     }
@@ -85,7 +85,7 @@ public class FgtFind extends BaseFragment {
     private void initData() {
         //尝试获取缓存数据
         List<FindTag> newList = DataUtil.getInstance().getCacheList(ApiKey.articles_tags, FindTag.class);
-        if(ListUtil.isEmpty(newList)){
+        if (ListUtil.isEmpty(newList)) {
             initNetData();
         } else {
             loadList(newList);
@@ -110,7 +110,7 @@ public class FgtFind extends BaseFragment {
                     @Override
                     public void onNext(BaseMessage baseMessage) {
                         List<FindTag> newList = baseMessage.getDatas(FindTag.class);
-                        if(list.isEmpty() && !ListUtil.isEmpty(newList))//有缓存时不会加载,没有缓存时获取到数据会加载
+                        if (list.isEmpty() && !ListUtil.isEmpty(newList))//有缓存时不会加载,没有缓存时获取到数据会加载
                             loadList(newList);
                     }
 

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

@@ -28,8 +28,8 @@ public class FgtMsgCenter extends BaseListFragment<MessageCenterEntity> implemen
     }
 
     @Override
-    public boolean refreshDataAfterOnResume() {
-        return true;
+    public int refreshDataType() {
+        return 1;
     }
 
     @Override

+ 57 - 0
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtSearchApp.java

@@ -0,0 +1,57 @@
+package com.sheep.gamegroup.view.fragment;
+
+import android.support.v7.widget.RecyclerView;
+
+import com.sheep.gamegroup.model.api.ApiService;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.GameEntity;
+import com.sheep.gamegroup.view.adapter.PlayGameItemAdapter;
+
+import java.util.Locale;
+
+import rx.Observable;
+
+/**
+ * Created by realicing on 2018/9/13.
+ * realicing@sina.com
+ */
+public class FgtSearchApp extends BaseListFragment<GameEntity> {
+
+    @Override
+    public int refreshDataType() {
+        return -1;
+    }
+
+    private String name;
+    private int type = 0;
+    @Override
+    protected RecyclerView.Adapter getAdapter() {
+        return new PlayGameItemAdapter(activity, list);
+    }
+
+    @Override
+    protected String getKey(int page, int per_page) {
+        return String.format(Locale.CHINA, "app/find?page=%d&per_page=%d&name=%s&type=%d", page, per_page, name, type);
+    }
+
+    @Override
+    protected Observable<BaseMessage> getApi(ApiService apiService) {
+        return apiService.searchApp(page, per_page, name, type);
+    }
+
+    @Override
+    protected Class<GameEntity> getTClass() {
+        return GameEntity.class;
+    }
+
+    @Override
+    public void notifyData() {
+    }
+    public void clear() {
+        list.clear();
+    }
+    public void toSearch(String name) {
+        this.name = name;
+        view_list.refresh();
+    }
+}

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

@@ -571,7 +571,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
         adpViewPagerDetail.add(firstItem,"每日必做");
         adpViewPagerDetail.add(FgtTryMakeMoney.newInstance(1, "about_to_begin"), "即将开始");
 
-//        mViewPager.setOffscreenPageLimit(2);
+        mViewPager.setOffscreenPageLimit(2);
         mViewPager.setAdapter(adpViewPagerDetail);
 
         tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
@@ -600,6 +600,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
         CommonUtil.getInstance().reflex(tabLayout, activity);
         setAnimation(ivDuty);
         //只显示图片并且充满的homeList
+        fullHomeList.clear();
         full_home_list_rv.setHasFixedSize(true);
         full_home_list_rv.setNestedScrollingEnabled(false);
         full_home_list_rv.setLayoutManager(new LinearLayoutManager(activity));
@@ -763,6 +764,7 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
             full_home_list_rv.setVisibility(View.GONE);
         } else {
             home_list_gridview_layout.setVisibility(View.VISIBLE);
+            fullHomeList.clear();
             CommonUtil.getInstance().splitHomeList(cacheHomeListEtyList, homeListEntitys, fullHomeList);
             full_home_list_rv.setVisibility(fullHomeList.isEmpty() ? View.GONE : View.VISIBLE);
             boolean isShowQB = false;
@@ -1128,12 +1130,15 @@ public class FgtSmallSheep extends BaseFragment implements SmallSheepContract.Vi
             List<HomeListEntity> homeListEntityList = baseMessage.getDataList(HomeListEntity.class);
             if (ListUtil.isEmpty(homeListEntityList)) {
                 home_list_gridview_layout.setVisibility(View.GONE);
+                full_home_list_rv.setVisibility(View.GONE);
             } else {
                 home_list_gridview_layout.setVisibility(View.VISIBLE);
                 homeListEntitys.clear();
                 homeListEntitysGridview.clear();
                 homeListEntitysListview.clear();
+                fullHomeList.clear();
                 CommonUtil.getInstance().splitHomeList(homeListEntityList, homeListEntitys, fullHomeList);
+                full_home_list_rv.setVisibility(fullHomeList.isEmpty() ? View.GONE : View.VISIBLE);
                 boolean isShowQB = false;
                 boolean isShowMd = false;
                 for (int i = 0; i < homeListEntitys.size(); i++) {

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

@@ -469,11 +469,11 @@ public class FgtTryMakeMoney extends BaseFragment implements TryMakeMoneyContrac
             List<TaskReleaseEty> releaseEtyList = baseMessage.getDataList(TaskReleaseEty.class);
             switch (about_to_begin) {
                 case 0:
-                    releaseEtyLists.removeAll(lastCacheReleaseEtyLists);
+                    ListUtil.removeAll(releaseEtyLists, lastCacheReleaseEtyLists);
                     ListUtil.addAll(releaseEtyLists, releaseEtyList);
                     break;
                 case 1:
-                    releaseEtyListsBegin.removeAll(lastCacheReleaseEtyListsBegin);
+                    ListUtil.removeAll(releaseEtyListsBegin, lastCacheReleaseEtyLists);
                     ListUtil.addAll(releaseEtyListsBegin, releaseEtyList);
                     break;
             }

+ 6 - 0
app/src/main/res/drawable/shape_f5_solid_rectangle.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="15dp" />
+    <solid android:color="#F5F5F5" />
+</shape>

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

@@ -11,7 +11,7 @@
         android:layout_height="wrap_content"
         android:background="@mipmap/audit_top_bg"
         android:paddingBottom="@dimen/content_padding_15"
-        android:paddingTop="@dimen/content_padding_15">
+        android:layout_marginTop="5dp">
 
 
         <ImageView
@@ -123,7 +123,7 @@
     <android.support.design.widget.TabLayout
         android:id="@+id/indicator"
         style="@style/style_tab"
-        android:background="@color/white"  />
+        android:background="@color/white" />
 
     <android.support.v4.view.ViewPager
         android:id="@+id/pager"

+ 25 - 0
app/src/main/res/layout/act_search_app.xml

@@ -0,0 +1,25 @@
+<?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/white"
+    android:orientation="vertical">
+
+    <include
+        android:id="@+id/include_title"
+        layout="@layout/title_search" />
+
+    <ListView
+        android:id="@+id/search_app_list"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:dividerHeight="0dp"
+        android:divider="@color/transparent"
+        android:layout_below="@+id/include_title" />
+
+    <FrameLayout
+        android:id="@+id/frame_container"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_below="@+id/include_title" />
+</RelativeLayout>

+ 2 - 6
app/src/main/res/layout/fgt_find.xml

@@ -7,15 +7,11 @@
 
     <View
         android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_marginTop="24dp" />
-
-    <include layout="@layout/title" />
+        android:layout_height="20dp" />
 
     <android.support.design.widget.TabLayout
         android:id="@+id/indicator"
-        style="@style/style_tab"
-        android:layout_marginTop="7dp" />
+        style="@style/style_tab" />
 
     <android.support.v4.view.ViewPager
         android:id="@+id/pager"

+ 12 - 7
app/src/main/res/layout/fgt_personacenter_item_top.xml

@@ -13,6 +13,8 @@
         <RelativeLayout
             android:id="@+id/layout_navigationBar"
             android:layout_width="match_parent"
+            android:layout_marginTop="10dp"
+            app:layout_constraintTop_toTopOf="parent"
             android:layout_height="?attr/actionBarSize">
 
             <ImageView
@@ -40,21 +42,23 @@
             <!--右边消息图标按钮-->
             <ImageButton
                 android:id="@+id/ibtn_baseactivity_message"
-                android:layout_width="?attr/actionBarSize"
-                android:layout_height="wrap_content"
+                android:layout_width="40dp"
+                android:layout_height="40dp"
+                android:layout_marginEnd="16dp"
                 android:layout_alignParentBottom="true"
-                android:layout_alignParentRight="true"
+                android:layout_alignParentEnd="true"
                 android:background="@color/translate"
                 android:gravity="center"
                 android:src="@mipmap/message_read_icon" />
             <!--右边设置图标按钮-->
             <ImageButton
                 android:id="@+id/ibtn_baseactivity_right"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
+                android:layout_width="40dp"
+                android:layout_height="40dp"
+                android:layout_marginEnd="56dp"
                 android:layout_alignParentBottom="true"
+                android:layout_alignParentEnd="true"
                 android:background="@color/translate"
-                android:layout_toLeftOf="@id/ibtn_baseactivity_message"
                 android:gravity="center"
                 android:src="@mipmap/setting" />
 
@@ -71,11 +75,12 @@
             android:id="@+id/icon_img_iv"
             android:layout_width="55dp"
             android:layout_height="55dp"
+            android:layout_marginTop="60dp"
             android:layout_marginBottom="@dimen/content_padding"
             android:layout_marginStart="@dimen/content_padding_15"
             android:src="@drawable/avatar"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@+id/layout_navigationBar" />
+            app:layout_constraintTop_toTopOf="parent" />
 
         <TextView
             android:id="@+id/name_tv"

+ 46 - 0
app/src/main/res/layout/item_serach_record.xml

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="51dp"
+    android:background="@color/white">
+
+    <TextView
+        android:id="@+id/item_search_record_name"
+        android:layout_width="0dp"
+        android:layout_height="50dp"
+        android:gravity="center|start"
+        android:text="王者荣耀"
+        android:textColor="#666666"
+        android:textSize="13sp"
+        android:paddingStart="27dp"
+        android:paddingEnd="11dp"
+        app:layout_constraintBottom_toTopOf="@+id/item_search_record_line"
+        app:layout_constraintEnd_toStartOf="@+id/item_search_record_x"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ImageView
+        android:id="@+id/item_search_record_x"
+        android:layout_width="62dp"
+        android:layout_height="50dp"
+        android:paddingTop="20dp"
+        android:paddingBottom="20dp"
+        android:paddingStart="25dp"
+        android:paddingEnd="27dp"
+        android:src="@mipmap/x_search"
+        app:layout_constraintBottom_toTopOf="@+id/item_search_record_line"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toEndOf="@+id/item_search_record_name"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <View
+        android:id="@+id/item_search_record_line"
+        android:layout_width="match_parent"
+        android:layout_height="1dp"
+        android:background="#fff5f5f5"
+        android:layout_marginStart="16dp"
+        android:layout_marginEnd="16dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/item_search_record_name" />
+</android.support.constraint.ConstraintLayout>

+ 49 - 0
app/src/main/res/layout/title_search.xml

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/layout_navigationBar"
+    android:layout_width="match_parent"
+    android:layout_height="?attr/actionBarSize">
+
+    <ImageView
+        android:id="@+id/title_img_back"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:layout_centerVertical="true"
+        android:gravity="center_vertical"
+        android:minWidth="?attr/actionBarSize"
+        android:scaleType="centerInside"
+        android:src="@drawable/narrow_back_black" />
+
+    <android.support.v7.widget.AppCompatAutoCompleteTextView
+        android:id="@+id/title_search_input"
+        android:layout_width="match_parent"
+        android:layout_height="30dp"
+        android:layout_centerVertical="true"
+        android:layout_toEndOf="@+id/title_img_back"
+        android:layout_toStartOf="@+id/title_search_commit"
+        android:background="@drawable/shape_f5_solid_rectangle"
+        android:drawablePadding="4dp"
+        android:drawableStart="@drawable/index_search"
+        android:gravity="center|start"
+        android:hint="搜索游戏、礼包、福利"
+        android:paddingEnd="6dp"
+        android:paddingStart="6dp"
+        android:textColor="#ff666666"
+        android:textSize="14sp" />
+
+    <TextView
+        android:id="@+id/title_search_commit"
+        android:layout_width="50dp"
+        android:layout_height="?attr/actionBarSize"
+        android:layout_alignParentEnd="true"
+        android:gravity="center"
+        android:text="搜索"
+        android:textColor="#ff2ebef2"
+        android:textSize="14sp" />
+
+    <include
+        layout="@layout/title_bottom_line"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true" />
+</RelativeLayout>

BIN
app/src/main/res/mipmap-xxhdpi/x_search.webp


BIN
app/src/main/res/mipmap-xxhdpi/yilingq.png


BIN
app/src/main/res/mipmap-xxhdpi/yilingq.webp