hanjing лет назад: 6
Родитель
Сommit
89aa49e166

+ 4 - 0
app/src/main/java/com/sheep/gamegroup/greendao/DDProviderHelper.java

@@ -661,6 +661,10 @@ public class DDProviderHelper {
                 .list();
                 .list();
     }
     }
 
 
+    public void deleteAllSearchRecords(){
+        getDaossion().getSearchRecordDao().deleteAll();
+    }
+
     /**
     /**
      * 删除搜索记录
      * 删除搜索记录
      * 删除成功返回true
      * 删除成功返回true

+ 13 - 8
app/src/main/java/com/sheep/gamegroup/module/search/ActSearch.java

@@ -113,7 +113,9 @@ public class ActSearch extends BaseContainerActivity {
 
 
     @OnClick(R.id.clear_btn)
     @OnClick(R.id.clear_btn)
     public void onClear() {
     public void onClear() {
-
+        DDProviderHelper.getInstance().deleteAllSearchRecords();
+        historyKeywords.clear();
+        historyListLayout.getAdapter().notifyDataChanged();
     }
     }
 
 
     @Override
     @Override
@@ -151,9 +153,7 @@ public class ActSearch extends BaseContainerActivity {
 
 
     private void showKeywords() {
     private void showKeywords() {
         if (hintKeyword != null) {
         if (hintKeyword != null) {
-            TitleBarUtils.getInstance().setSearchText(ActSearch.this, hintKeyword.getKeyword());
-        } else {
-            TitleBarUtils.getInstance().setSearchText(ActSearch.this, "");
+            TitleBarUtils.getInstance().setSearchHint(ActSearch.this, hintKeyword.getKeyword());
         }
         }
         addHotView(hotListLayout, hotKeywords);
         addHotView(hotListLayout, hotKeywords);
         addHistoryView(historyListLayout, historyKeywords);
         addHistoryView(historyListLayout, historyKeywords);
@@ -208,12 +208,17 @@ public class ActSearch extends BaseContainerActivity {
         if (fgtSearch == null) {
         if (fgtSearch == null) {
             return;
             return;
         }
         }
-//        if (fgtSearch.isLoadingData()) {
-//            return;
-//        }
+        String inputText = TitleBarUtils.getInstance().getSearchText(this);
+        if(TextUtils.isEmpty(inputText)){
+            if(hintKeyword!=null){
+                inputText = hintKeyword.getKeyword();
+                TitleBarUtils.getInstance().setSearchText(ActSearch.this, inputText);
+            } else{
+                return;
+            }
+        }
         quickSearchLayout.setVisibility(View.INVISIBLE);
         quickSearchLayout.setVisibility(View.INVISIBLE);
         frame_container.setVisibility(View.VISIBLE);
         frame_container.setVisibility(View.VISIBLE);
-        String inputText = TitleBarUtils.getInstance().getSearchText(this);
         if (!TextUtils.isEmpty(inputText)) {
         if (!TextUtils.isEmpty(inputText)) {
             //保存搜索到数据库
             //保存搜索到数据库
             SearchRecord searchRecord = new SearchRecord();
             SearchRecord searchRecord = new SearchRecord();

+ 5 - 5
app/src/main/java/com/sheep/gamegroup/view/activity/SplashAct.java

@@ -112,10 +112,10 @@ public class SplashAct extends BaseActivity {
 
 
                     private void handleResult(boolean isNewSmallSheep) {
                     private void handleResult(boolean isNewSmallSheep) {
                         DataUtil.getInstance().setIsNewSmallSheep(isNewSmallSheep);
                         DataUtil.getInstance().setIsNewSmallSheep(isNewSmallSheep);
-//                        if (SysAppUtil.isNewSmallSheep() || TestUtil.isDev()) {//新版本只显示引导页面,不展示弹窗和开屏广告
-//                            initAdvertisement(false);//只更新,不加载,下次加载上次的数据
-//                            sendHandlerMessages(2000);
-//                        } else {
+                        if (SysAppUtil.isNewSmallSheep() || TestUtil.isDev()) {//新版本只显示引导页面,不展示弹窗和开屏广告
+                            initAdvertisement(false);//只更新,不加载,下次加载上次的数据
+                            sendHandlerMessages(2000);
+                        } else {
                             Advertising cacheAdvertising = DataUtil.getInstance().getCacheResult(ApiKey.advertisements(1), Advertising.class);
                             Advertising cacheAdvertising = DataUtil.getInstance().getCacheResult(ApiKey.advertisements(1), Advertising.class);
                             if (cacheAdvertising != null) {
                             if (cacheAdvertising != null) {
                                 advertising = cacheAdvertising;
                                 advertising = cacheAdvertising;
@@ -124,7 +124,7 @@ public class SplashAct extends BaseActivity {
                             } else {
                             } else {
                                 initAdvertisement(true);
                                 initAdvertisement(true);
                             }
                             }
-//                        }
+                        }
                     }
                     }
                 });
                 });
     }
     }