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