添加BoBullToon URL 自定义功能...
This commit is contained in:
		| @@ -1,8 +1,8 @@ | |||||||
| #Created by .winboll/winboll_app_build.gradle | #Created by .winboll/winboll_app_build.gradle | ||||||
| #Tue Apr 01 17:48:43 HKT 2025 | #Sat Apr 12 13:11:52 GMT 2025 | ||||||
| stageCount=7 | stageCount=7 | ||||||
| libraryProject= | libraryProject= | ||||||
| baseVersion=15.2 | baseVersion=15.2 | ||||||
| publishVersion=15.2.6 | publishVersion=15.2.6 | ||||||
| buildCount=0 | buildCount=5 | ||||||
| baseBetaVersion=15.2.7 | baseBetaVersion=15.2.7 | ||||||
|   | |||||||
| @@ -24,6 +24,7 @@ import androidx.appcompat.app.AppCompatActivity; | |||||||
| import androidx.appcompat.widget.Toolbar; | import androidx.appcompat.widget.Toolbar; | ||||||
| import androidx.recyclerview.widget.LinearLayoutManager; | import androidx.recyclerview.widget.LinearLayoutManager; | ||||||
| import androidx.recyclerview.widget.RecyclerView; | import androidx.recyclerview.widget.RecyclerView; | ||||||
|  | import cc.winboll.studio.contacts.App; | ||||||
| import cc.winboll.studio.contacts.R; | import cc.winboll.studio.contacts.R; | ||||||
| import cc.winboll.studio.contacts.adapters.PhoneConnectRuleAdapter; | import cc.winboll.studio.contacts.adapters.PhoneConnectRuleAdapter; | ||||||
| import cc.winboll.studio.contacts.beans.MainServiceBean; | import cc.winboll.studio.contacts.beans.MainServiceBean; | ||||||
| @@ -34,13 +35,11 @@ import cc.winboll.studio.contacts.bobulltoon.TomCat; | |||||||
| import cc.winboll.studio.contacts.dun.Rules; | import cc.winboll.studio.contacts.dun.Rules; | ||||||
| import cc.winboll.studio.contacts.services.MainService; | import cc.winboll.studio.contacts.services.MainService; | ||||||
| import cc.winboll.studio.contacts.views.DuInfoTextView; | import cc.winboll.studio.contacts.views.DuInfoTextView; | ||||||
| import cc.winboll.studio.libaes.winboll.APPInfo; |  | ||||||
| import cc.winboll.studio.libappbase.LogUtils; | import cc.winboll.studio.libappbase.LogUtils; | ||||||
| import cc.winboll.studio.libappbase.winboll.IWinBollActivity; | import cc.winboll.studio.libappbase.winboll.IWinBollActivity; | ||||||
| import com.hjq.toast.ToastUtils; | import com.hjq.toast.ToastUtils; | ||||||
| import java.lang.reflect.Field; | import java.lang.reflect.Field; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import cc.winboll.studio.contacts.App; |  | ||||||
|  |  | ||||||
| public class SettingsActivity extends AppCompatActivity implements IWinBollActivity { | public class SettingsActivity extends AppCompatActivity implements IWinBollActivity { | ||||||
|  |  | ||||||
| @@ -177,6 +176,8 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv | |||||||
|         etDunResumeSecondCount.setEnabled(!isEnableDun); |         etDunResumeSecondCount.setEnabled(!isEnableDun); | ||||||
|         etDunResumeCount.setEnabled(!isEnableDun); |         etDunResumeCount.setEnabled(!isEnableDun); | ||||||
|  |  | ||||||
|  |         EditText etBoBullToonURL = findViewById(R.id.bobulltoonurl_et); | ||||||
|  |         etBoBullToonURL.setText(Rules.getInstance(this).getBoBullToonURL()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static void notifyDunInfoUpdate() { |     public static void notifyDunInfoUpdate() { | ||||||
| @@ -232,8 +233,17 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv | |||||||
|             ToastUtils.show("悬浮窗已开启"); |             ToastUtils.show("悬浮窗已开启"); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     public void onResetBoBullToonURL(View view) { | ||||||
|  |         Rules.getInstance(this).resetDefaultBoBullToonURL(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     public void onDownloadBoBullToon(View view) { |     public void onDownloadBoBullToon(View view) { | ||||||
|  |         EditText etBoBullToonURL = findViewById(R.id.bobulltoonurl_et); | ||||||
|  |         if(!etBoBullToonURL.getText().toString().trim().equals(Rules.getInstance(this).getBoBullToonURL())) { | ||||||
|  |             Rules.getInstance(this).setBoBullToonURL(etBoBullToonURL.getText().toString().trim()); | ||||||
|  |         } | ||||||
|  |          | ||||||
|         final TomCat tomCat = TomCat.getInstance(this); |         final TomCat tomCat = TomCat.getInstance(this); | ||||||
|         new Thread(new Runnable() { |         new Thread(new Runnable() { | ||||||
|                 @Override |                 @Override | ||||||
| @@ -247,8 +257,6 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv | |||||||
|             }).start(); |             }).start(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     public void onSearchBoBullToonPhone(View view) { |     public void onSearchBoBullToonPhone(View view) { | ||||||
|         TomCat tomCat = TomCat.getInstance(this); |         TomCat tomCat = TomCat.getInstance(this); | ||||||
|         EditText etPhone = findViewById(R.id.activitysettingsEditText1); |         EditText etPhone = findViewById(R.id.activitysettingsEditText1); | ||||||
| @@ -311,7 +319,7 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |  | ||||||
|     public void onAbout(View view) { |     public void onAbout(View view) { | ||||||
|         App.getWinBollActivityManager().startWinBollActivity(this, AboutActivity.class); |         App.getWinBollActivityManager().startWinBollActivity(this, AboutActivity.class); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -13,6 +13,8 @@ import java.io.IOException; | |||||||
| public class SettingsModel extends BaseBean { | public class SettingsModel extends BaseBean { | ||||||
|  |  | ||||||
|     public static final String TAG = "SettingsModel"; |     public static final String TAG = "SettingsModel"; | ||||||
|  |      | ||||||
|  |     public static final String DEFAULT_BOBULLTOON_URL = "http://10.8.0.12:3000/Studio/BoBullToon/archive/main.zip"; // 替换为实际的 ZIP 文件 URL | ||||||
|  |  | ||||||
|     // 云盾防御层数量 |     // 云盾防御层数量 | ||||||
|     int dunTotalCount; |     int dunTotalCount; | ||||||
| @@ -24,6 +26,8 @@ public class SettingsModel extends BaseBean { | |||||||
|     int dunResumeCount; |     int dunResumeCount; | ||||||
|     // 是否启用云盾 |     // 是否启用云盾 | ||||||
|     boolean isEnableDun; |     boolean isEnableDun; | ||||||
|  |     // BoBullToon 应用模块数据请求地址 | ||||||
|  |     String szBoBullToon_URL; | ||||||
|  |  | ||||||
|     public SettingsModel() { |     public SettingsModel() { | ||||||
|         this.dunTotalCount = 6; |         this.dunTotalCount = 6; | ||||||
| @@ -31,14 +35,24 @@ public class SettingsModel extends BaseBean { | |||||||
|         this.dunResumeSecondCount = 60; |         this.dunResumeSecondCount = 60; | ||||||
|         this.dunResumeCount = 1; |         this.dunResumeCount = 1; | ||||||
|         this.isEnableDun = false; |         this.isEnableDun = false; | ||||||
|  |         this.szBoBullToon_URL = DEFAULT_BOBULLTOON_URL; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public SettingsModel(int dunTotalCount, int dunCurrentCount, int dunResumeSecondCount, int dunResumeCount, boolean isEnableDun) { |     public SettingsModel(int dunTotalCount, int dunCurrentCount, int dunResumeSecondCount, int dunResumeCount, boolean isEnableDun, String szBoBullToon_URL) { | ||||||
|         this.dunTotalCount = dunTotalCount; |         this.dunTotalCount = dunTotalCount; | ||||||
|         this.dunCurrentCount = dunCurrentCount; |         this.dunCurrentCount = dunCurrentCount; | ||||||
|         this.dunResumeSecondCount = dunResumeSecondCount; |         this.dunResumeSecondCount = dunResumeSecondCount; | ||||||
|         this.dunResumeCount = dunResumeCount; |         this.dunResumeCount = dunResumeCount; | ||||||
|         this.isEnableDun = isEnableDun; |         this.isEnableDun = isEnableDun; | ||||||
|  |         this.szBoBullToon_URL = szBoBullToon_URL; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void setBoBullToon_URL(String boBullToon_URL) { | ||||||
|  |         this.szBoBullToon_URL = boBullToon_URL; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public String getBoBullToon_URL() { | ||||||
|  |         return szBoBullToon_URL; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void setDunTotalCount(int dunTotalCount) { |     public void setDunTotalCount(int dunTotalCount) { | ||||||
| @@ -96,7 +110,8 @@ public class SettingsModel extends BaseBean { | |||||||
|         jsonWriter.name("dunResumeSecondCount").value(getDunResumeSecondCount()); |         jsonWriter.name("dunResumeSecondCount").value(getDunResumeSecondCount()); | ||||||
|         jsonWriter.name("dunResumeCount").value(getDunResumeCount()); |         jsonWriter.name("dunResumeCount").value(getDunResumeCount()); | ||||||
|         jsonWriter.name("isEnableDun").value(isEnableDun()); |         jsonWriter.name("isEnableDun").value(isEnableDun()); | ||||||
|  |         jsonWriter.name("szBoBullToon_URL").value(getBoBullToon_URL()); | ||||||
|  |          | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
| @@ -112,6 +127,8 @@ public class SettingsModel extends BaseBean { | |||||||
|                 setDunResumeCount(jsonReader.nextInt()); |                 setDunResumeCount(jsonReader.nextInt()); | ||||||
|             } else if (name.equals("isEnableDun")) { |             } else if (name.equals("isEnableDun")) { | ||||||
|                 setIsEnableDun(jsonReader.nextBoolean()); |                 setIsEnableDun(jsonReader.nextBoolean()); | ||||||
|  |             } else if (name.equals("szBoBullToon_URL")) { | ||||||
|  |                 setBoBullToon_URL(jsonReader.nextString()); | ||||||
|             } else { |             } else { | ||||||
|                 return false; |                 return false; | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ package cc.winboll.studio.contacts.bobulltoon; | |||||||
|  * @Describe 汤姆猫管家 :使用 BoBullToon 项目,对通讯地址进行筛选判断的好朋友。 |  * @Describe 汤姆猫管家 :使用 BoBullToon 项目,对通讯地址进行筛选判断的好朋友。 | ||||||
|  */ |  */ | ||||||
| import android.content.Context; | import android.content.Context; | ||||||
|  | import cc.winboll.studio.contacts.dun.Rules; | ||||||
| import cc.winboll.studio.libappbase.LogUtils; | import cc.winboll.studio.libappbase.LogUtils; | ||||||
| import com.hjq.toast.ToastUtils; | import com.hjq.toast.ToastUtils; | ||||||
| import java.io.File; | import java.io.File; | ||||||
| @@ -28,6 +29,7 @@ public class TomCat { | |||||||
|     public static final String TAG = "TomCat"; |     public static final String TAG = "TomCat"; | ||||||
|  |  | ||||||
|     List<String> listPhoneBoBullToon = new ArrayList<String>(); |     List<String> listPhoneBoBullToon = new ArrayList<String>(); | ||||||
|  |     String mszBoBullToon_URL; | ||||||
|  |  | ||||||
|     static volatile TomCat _TomCat; |     static volatile TomCat _TomCat; | ||||||
|     Context mContext; |     Context mContext; | ||||||
| @@ -42,7 +44,7 @@ public class TomCat { | |||||||
|         return _TomCat; |         return _TomCat; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     void downloadAndExtractZip(String zipUrl, String destinationFolder) throws IOException { |     boolean downloadAndExtractZip(String zipUrl, String destinationFolder) throws IOException { | ||||||
|         OkHttpClient client = new OkHttpClient(); |         OkHttpClient client = new OkHttpClient(); | ||||||
|         Request request = new Request.Builder() |         Request request = new Request.Builder() | ||||||
|             .url(zipUrl) |             .url(zipUrl) | ||||||
| @@ -95,13 +97,16 @@ public class TomCat { | |||||||
|             // 删除临时 ZIP 文件 |             // 删除临时 ZIP 文件 | ||||||
|             tempZipFile.delete(); |             tempZipFile.delete(); | ||||||
|             LogUtils.d(TAG, "已更新 BoBullToon 数据"); |             LogUtils.d(TAG, "已更新 BoBullToon 数据"); | ||||||
|  |             return true; | ||||||
|         } catch (Exception e) { |         } catch (Exception e) { | ||||||
|  |             ToastUtils.show(e.getMessage()); | ||||||
|             LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); |             LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); | ||||||
|  |             return false; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public boolean downloadBoBullToon() { |     public boolean downloadBoBullToon() { | ||||||
|         String zipUrl = "http://10.8.0.12:3000/Studio/BoBullToon/archive/main.zip"; // 替换为实际的 ZIP 文件 URL |         String zipUrl = Rules.getInstance(mContext).getBoBullToonURL(); // 替换为实际的 ZIP 文件 URL | ||||||
|         String destinationFolder = getWorkingFolder().getPath(); // 替换为实际的目标文件夹路径 |         String destinationFolder = getWorkingFolder().getPath(); // 替换为实际的目标文件夹路径 | ||||||
|         try { |         try { | ||||||
|             // 删除旧文件 |             // 删除旧文件 | ||||||
| @@ -113,9 +118,11 @@ public class TomCat { | |||||||
|             } |             } | ||||||
|  |  | ||||||
|             // 更新新文件 |             // 更新新文件 | ||||||
|             downloadAndExtractZip(zipUrl, destinationFolder); |             if(downloadAndExtractZip(zipUrl, destinationFolder)) { | ||||||
|             LogUtils.d(TAG, "ZIP 文件下载并解压成功。"); |                 LogUtils.d(TAG, "ZIP 文件下载并解压成功。"); | ||||||
|             return true; |                 return true; | ||||||
|  |             } | ||||||
|  |             return false; | ||||||
|         } catch (IOException e) { |         } catch (IOException e) { | ||||||
|             LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); |             LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -81,6 +81,20 @@ public class Rules { | |||||||
|         LogUtils.d(TAG, String.format("saveRules()")); |         LogUtils.d(TAG, String.format("saveRules()")); | ||||||
|         PhoneConnectRuleModel.saveBeanList(mContext, _PhoneConnectRuleModelList, PhoneConnectRuleModel.class); |         PhoneConnectRuleModel.saveBeanList(mContext, _PhoneConnectRuleModelList, PhoneConnectRuleModel.class); | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     public void resetDefaultBoBullToonURL() { | ||||||
|  |         mSettingsModel.setBoBullToon_URL(SettingsModel.DEFAULT_BOBULLTOON_URL); | ||||||
|  |         saveDun(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void setBoBullToonURL(String szUrl) { | ||||||
|  |         mSettingsModel.setBoBullToon_URL(szUrl); | ||||||
|  |         saveDun(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public String getBoBullToonURL() { | ||||||
|  |         return mSettingsModel.getBoBullToon_URL(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     public void loadDun() { |     public void loadDun() { | ||||||
|         mSettingsModel = SettingsModel.loadBean(mContext, SettingsModel.class); |         mSettingsModel = SettingsModel.loadBean(mContext, SettingsModel.class); | ||||||
|   | |||||||
| @@ -195,16 +195,29 @@ | |||||||
| 				android:text="拨不通电话记录查询:"/> | 				android:text="拨不通电话记录查询:"/> | ||||||
|  |  | ||||||
| 			<LinearLayout | 			<LinearLayout | ||||||
| 				android:orientation="vertical" | 				android:orientation="horizontal" | ||||||
| 				android:layout_width="match_parent" | 				android:layout_width="match_parent" | ||||||
| 				android:layout_height="wrap_content" | 				android:layout_height="wrap_content" | ||||||
| 				android:gravity="right" | 				android:gravity="right" | ||||||
| 				android:layout_margin="10dp"> | 				android:layout_margin="10dp"> | ||||||
|  |  | ||||||
|  | 				<EditText | ||||||
|  | 					android:layout_width="0dp" | ||||||
|  | 					android:ems="10" | ||||||
|  | 					android:layout_height="wrap_content" | ||||||
|  | 					android:layout_weight="1.0" | ||||||
|  | 					android:id="@+id/bobulltoonurl_et"/> | ||||||
|  |  | ||||||
| 				<Button | 				<Button | ||||||
| 					android:layout_width="wrap_content" | 					android:layout_width="wrap_content" | ||||||
| 					android:layout_height="wrap_content" | 					android:layout_height="wrap_content" | ||||||
| 					android:text="下载 BoBullToon" | 					android:text="重置地址" | ||||||
|  | 					android:onClick="onResetBoBullToonURL"/> | ||||||
|  |  | ||||||
|  | 				<Button | ||||||
|  | 					android:layout_width="wrap_content" | ||||||
|  | 					android:layout_height="wrap_content" | ||||||
|  | 					android:text="下载数据" | ||||||
| 					android:onClick="onDownloadBoBullToon"/> | 					android:onClick="onDownloadBoBullToon"/> | ||||||
|  |  | ||||||
| 			</LinearLayout> | 			</LinearLayout> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 ZhanGSKen
					ZhanGSKen