Compare commits

..

22 Commits

Author SHA1 Message Date
8f6b615949 <appbase>APK 15.15.21 release Publish. 2026-04-28 17:08:05 +08:00
d02d57d4dd 添加LogUtils日志文件自动裁剪功能 2026-04-28 17:05:50 +08:00
e337bb7a04 <libappbase>Library Release 15.15.20 2026-04-27 20:19:13 +08:00
9ae848e4c2 <appbase>APK 15.15.20 release Publish. 2026-04-27 20:18:59 +08:00
9c66f61891 调整MainActivity按钮顺序将关于应用置顶 2026-04-27 20:15:54 +08:00
bfaf3543b9 添加多窗口支持与LogActivity独立任务栈 2026-04-27 20:04:17 +08:00
b44fe3aaf3 添加分屏测试功能支持多窗口MainActivity 2026-04-27 19:27:25 +08:00
d518ac50a9 优化LogActivity分屏模式支持Android 11适配 2026-04-27 18:40:36 +08:00
d532eae971 调整onLogTest调用LogActivity分屏模式 2026-04-27 17:58:53 +08:00
f661acbbbc 添加LogActivity重载函数支持分屏模式切换 2026-04-27 17:33:51 +08:00
ecced75a4d 调整AboutActivity工具栏与MainActivity一致 2026-04-25 12:10:17 +08:00
5e5d34c90c 调整BaseFunctionItemView派生控件高度间隔为无间隔 2026-04-25 10:43:18 +08:00
85a0d39498 添加BaseFunctionItemView类视图1像素美化边框 2026-04-25 10:40:50 +08:00
c542d8dca7 源码整理 2026-04-25 10:25:59 +08:00
ccbdb4010e 调整一下libappbase模块中layout_about_view.xml的布局文件。缩小一下布局中控件的高度间隔。 2026-04-25 10:22:20 +08:00
2e7b9173f2 <libappbase>Library Release 15.15.19 2026-04-25 04:12:02 +08:00
4f12a5de4f <appbase>APK 15.15.19 release Publish. 2026-04-25 04:11:46 +08:00
7ab399e520 编译调试 2026-04-25 04:10:29 +08:00
dd2d9f3e55 Merge branch 'appbase' of https://gitea.winboll.cc/Studio/WinBoLL.git into appbase 2026-04-25 04:07:49 +08:00
098516d4d7 Merge branch 'winboll' into appbase 2026-04-25 04:07:03 +08:00
b1fab5ce46 <libappbase>Library Release 15.15.18 2026-04-25 03:59:02 +08:00
6c8867e15c 更正maven库引用顺序 2026-04-09 01:38:28 +08:00
17 changed files with 276 additions and 73 deletions

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Fri Apr 10 05:38:18 HKT 2026
stageCount=19
#Tue Apr 28 17:08:04 HKT 2026
stageCount=22
libraryProject=libappbase
baseVersion=15.15
publishVersion=15.15.18
publishVersion=15.15.21
buildCount=0
baseBetaVersion=15.15.19
baseBetaVersion=15.15.22

View File

@@ -16,6 +16,17 @@
android:label="@string/app_name"
android:exported="true"
android:resizeableActivity="true"
android:launchMode="singleTop"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation">
</activity>
<activity
android:name=".MainActivityAlias"
android:label="@string/app_name"
android:exported="true"
android:resizeableActivity="true"
android:launchMode="singleTop"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation">
<intent-filter>
@@ -30,6 +41,17 @@
</activity>
<activity
android:name=".Main2Activity"
android:label="@string/app_name"
android:exported="true"
android:resizeableActivity="true"
android:launchMode="singleTop"
android:taskAffinity="cc.winboll.studio.appbase.Main2Activity"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation">
</activity>
<activity android:name=".GlobalApplication$CrashActivity"/>
<meta-data

View File

@@ -23,17 +23,8 @@ public class AboutActivity extends Activity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
// 设置工具栏
Toolbar toolbar = findViewById(R.id.toolbar);
setActionBar(toolbar);
getActionBar().setSubtitle(TAG);
getActionBar().setDisplayHomeAsUpEnabled(true);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish(); // 点击导航栏返回按钮,触发 finish()
}
});
setActionBar(toolbar);
AboutView aboutView = findViewById(R.id.aboutview);
aboutView.setAPPInfo(genDefaultAppInfo());

View File

@@ -0,0 +1,20 @@
package cc.winboll.studio.appbase;
import android.os.Bundle;
import android.widget.Toolbar;
import cc.winboll.studio.appbase.R;
public class Main2Activity extends MainActivity {
public static final String TAG = "Main2Activity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
Toolbar toolbar = findViewById(R.id.toolbar);
if (toolbar != null) {
setActionBar(toolbar);
}
}
}

View File

@@ -103,14 +103,17 @@ public class MainActivity extends Activity {
}
}
public void onLogTestNewTask(View view) {
LogActivity.startLogActivity(this, true);
}
/**
* 日志测试按钮点击事件(打开日志查看界面)
* 启动 LogActivity用于查看应用运行日志
* @param view 触发事件的 View对应布局中的日志测试按钮
*/
public void onLogTest(View view) {
// 启动日志查看 Activity通过静态方法传入上下文简化跳转逻辑
LogActivity.startLogActivity(this);
LogActivity.startLogActivity(this, false);
}
/**
@@ -158,5 +161,35 @@ public class MainActivity extends Activity {
Intent aboutIntent = new Intent(getApplicationContext(), AboutActivity.class);
startActivity(aboutIntent);
}
public void onSplitScreenMode(View view) {
LogUtils.d(TAG, "onSplitScreenMode() 分屏测试按钮已点击");
ToastUtils.show("分屏测试:已启动新窗口");
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
android.graphics.Rect bounds = new android.graphics.Rect();
getWindow().getDecorView().getDisplay().getRectSize(bounds);
int height = bounds.height();
int width = bounds.width();
bounds.set(0, 0, width, height / 2);
LogUtils.d(TAG, "onSplitScreenMode() 分屏窗口范围: " + bounds);
android.content.Intent intent = new android.content.Intent(this, MainActivityAlias.class);
intent.setFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
LogUtils.d(TAG, "onSplitScreenMode() 准备启动MainActivityAlias");
android.app.ActivityOptions options = android.app.ActivityOptions.makeBasic();
options.setLaunchBounds(bounds);
startActivity(intent, options.toBundle());
LogUtils.d(TAG, "onSplitScreenMode() MainActivityAlias已启动");
}
}
public void onMultiInstance(View view) {
LogUtils.d(TAG, "onMultiInstance() 多开窗口按钮已点击");
ToastUtils.show("多开窗口:已启动新窗口");
android.content.Intent intent = new android.content.Intent(this, Main2Activity.class);
intent.setFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
LogUtils.d(TAG, "onMultiInstance() 准备启动Main2Activity");
startActivity(intent);
LogUtils.d(TAG, "onMultiInstance() Main2Activity已启动");
}
}

View File

@@ -0,0 +1,17 @@
package cc.winboll.studio.appbase;
import android.os.Bundle;
import android.view.View;
import android.widget.Toolbar;
import cc.winboll.studio.appbase.R;
public class MainActivityAlias extends MainActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setActionBar(toolbar);
}
}

View File

@@ -23,6 +23,18 @@
android:gravity="center_vertical"
android:spacing="12dp">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="关于应用"
android:textSize="16sp"
android:textColor="@android:color/white"
android:background="#81C7F5"
android:paddingVertical="12dp"
android:layout_marginHorizontal="24dp"
android:onClick="onAboutActivity"
android:layout_margin="10dp"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -47,6 +59,18 @@
android:onClick="onLogTest"
android:layout_margin="10dp"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="应用日志测试(新窗口)"
android:textSize="16sp"
android:textColor="@android:color/white"
android:background="#81C7F5"
android:paddingVertical="12dp"
android:layout_marginHorizontal="24dp"
android:onClick="onLogTestNewTask"
android:layout_margin="10dp"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -62,18 +86,29 @@
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="关于应用"
android:text="分屏测试"
android:textSize="16sp"
android:textColor="@android:color/white"
android:background="#81C7F5"
android:paddingVertical="12dp"
android:layout_marginHorizontal="24dp"
android:onClick="onAboutActivity"
android:onClick="onSplitScreenMode"
android:layout_margin="10dp"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="多开窗口"
android:textSize="16sp"
android:textColor="@android:color/white"
android:background="#81C7F5"
android:paddingVertical="12dp"
android:layout_marginHorizontal="24dp"
android:onClick="onMultiInstance"
android:layout_margin="10dp"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:background="@android:color/white">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Main2Activity"
android:textSize="24sp"
android:textColor="@color/gray_900"/>
</LinearLayout>

View File

@@ -1,6 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
maven { url 'https://dl.bintray.com/ppartisan/maven/' }
maven { url "https://clojars.org/repo/" }
maven { url "https://jitpack.io" }
mavenCentral()
google()
mavenLocal {
// 设置本地Maven仓库路径
url 'file:///sdcard/.m2/repository/'
@@ -11,19 +20,6 @@ buildscript {
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
// "WinBoLL Snapshot"
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
maven { url 'https://dl.bintray.com/ppartisan/maven/' }
maven { url "https://clojars.org/repo/" }
maven { url "https://jitpack.io" }
mavenCentral()
google()
//println "mavenLocal : ==========="
//println mavenLocal().url
//println "mavenLocal : ==========="
//mavenLocal()
}
dependencies {
// 适配MIUI12
@@ -35,6 +31,15 @@ buildscript {
allprojects {
repositories {
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
maven { url 'https://dl.bintray.com/ppartisan/maven/' }
maven { url "https://clojars.org/repo/" }
maven { url "https://jitpack.io" }
mavenCentral()
google()
mavenLocal {
// 设置本地Maven仓库路径
url 'file:///sdcard/.m2/repository/'
@@ -45,19 +50,6 @@ allprojects {
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
// "WinBoLL Snapshot"
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
maven { url 'https://dl.bintray.com/ppartisan/maven/' }
maven { url "https://clojars.org/repo/" }
maven { url "https://jitpack.io" }
mavenCentral()
google()
//println "mavenLocal : ==========="
//println mavenLocal().url
//println "mavenLocal : ==========="
//mavenLocal()
}
ext {
// 定义全局变量,常用于版本管理

0
gradlew vendored Normal file → Executable file
View File

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Fri Apr 10 05:38:18 HKT 2026
stageCount=19
#Tue Apr 28 17:08:04 HKT 2026
stageCount=22
libraryProject=libappbase
baseVersion=15.15
publishVersion=15.15.18
publishVersion=15.15.21
buildCount=0
baseBetaVersion=15.15.19
baseBetaVersion=15.15.22

View File

@@ -38,6 +38,7 @@
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:exported="true"
android:launchMode="singleInstance"
android:taskAffinity="cc.winboll.studio.libappbase.LogActivity"
android:process=":LogActivity">
</activity>

View File

@@ -1,8 +1,11 @@
package cc.winboll.studio.libappbase;
import android.app.Activity;
import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import cc.winboll.studio.libappbase.LogView;
import cc.winboll.studio.libappbase.R;
@@ -46,20 +49,39 @@ public class LogActivity extends Activity {
* @param context 上下文Activity/Fragment用于启动 Activity
*/
public static void startLogActivity(Context context) {
// 创建启动当前 Activity 的 Intent
startLogActivity(context, true);
}
/**
* 启动日志 Activity 的静态方法重载(外部调用入口)
* @param context 上下文Activity/Fragment用于启动 Activity
* @param newTask 是否在新窗口中启动
*/
public static void startLogActivity(Context context, boolean newTask) {
Intent intent = new Intent(context, LogActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
// 添加 Intent 标志:支持分屏/多窗口模式API 24+
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
// 添加 Intent 标志:创建新任务栈(避免并入调用者任务栈)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// 添加 Intent 标志:标记为新文档(多任务窗口中独立显示)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
// 添加 Intent 标志:允许创建多个任务实例(支持多次启动独立窗口)
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
if (newTask) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
context.startActivity(intent);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
// 启动 Activity
context.startActivity(intent);
Rect bounds = new Rect();
if (context instanceof Activity) {
Activity activity = (Activity) context;
activity.getWindow().getDecorView().getDisplay().getRectSize(bounds);
bounds.set(0, bounds.height() / 2, bounds.width(), bounds.height());
}
ActivityOptions options = ActivityOptions.makeBasic();
options.setLaunchBounds(bounds);
context.startActivity(intent, options.toBundle());
} else {
context.startActivity(intent);
}
}
}

View File

@@ -100,10 +100,52 @@ public class LogUtils {
// 加载当前应用下的所有类的 TAG
addClassTAGList();
loadTAGBeanSettings();
checkAndTrimLogFileSize();
_IsInited = true;
LogUtils.d(TAG, String.format("mapTAGList : %s", mapTAGList.toString()));
}
private static void checkAndTrimLogFileSize() {
if (_mfLogCatchFile == null || !_mfLogCatchFile.exists()) {
return;
}
final long MAX_FILE_SIZE = 6291456L;
final long KEEP_FILE_SIZE = 3145728L;
long fileSize = _mfLogCatchFile.length();
if (fileSize <= MAX_FILE_SIZE) {
return;
}
long needSkip = fileSize - KEEP_FILE_SIZE;
try (FileInputStream fis = new FileInputStream(_mfLogCatchFile);
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
FileOutputStream fos = new FileOutputStream(_mfLogCatchFile);
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fos))) {
StringBuilder sb = new StringBuilder();
String line;
long skippedTotal = 0;
final String lineBreak = System.lineSeparator();
while ((line = reader.readLine()) != null) {
byte[] lineBytes = line.getBytes();
skippedTotal += lineBytes.length + lineBreak.getBytes().length;
if (skippedTotal > needSkip) {
sb.append(line).append(lineBreak);
}
}
writer.write(sb.toString());
} catch (IOException e) {
e.printStackTrace();
}
}
public static Map<String, Boolean> getMapTAGList() {
return mapTAGList;
}

View File

@@ -353,7 +353,7 @@ public class AboutView extends LinearLayout {
*/
private void addFunctionView(View view) {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
params.topMargin = dp2px(PADDING_SMALL);
params.topMargin = 0;
llFunctionContainer.addView(view, params);
}
@@ -413,7 +413,18 @@ public class AboutView extends LinearLayout {
setPadding(dp2px(PADDING_MID), dp2px(PADDING_SMALL), dp2px(PADDING_MID), dp2px(PADDING_SMALL));
setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
setClickable(true);
setBackgroundResource(android.R.drawable.list_selector_background);
setBackground(create_item_background());
}
/**
* 创建带1像素边框的背景drawable
*/
private android.graphics.drawable.Drawable create_item_background() {
android.graphics.drawable.GradientDrawable drawable = new android.graphics.drawable.GradientDrawable();
drawable.setStroke(1, mItemContext.getResources().getColor(R.color.gray_200));
drawable.setCornerRadius(4);
drawable.setColor(mItemContext.getResources().getColor(android.R.color.white));
return drawable;
}
/**

View File

@@ -10,15 +10,15 @@
android:orientation="vertical"
android:gravity="center_horizontal"
android:paddingLeft="16dp"
android:paddingTop="32dp"
android:paddingTop="16dp"
android:paddingRight="16dp"
android:paddingBottom="32dp">
android:paddingBottom="16dp">
<cc.winboll.studio.libappbase.views.DebugSwitchImageView
android:id="@+id/iv_app_icon"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="16dp"
android:layout_marginBottom="8dp"
android:scaleType="centerCrop"/>
<TextView
@@ -32,16 +32,16 @@
android:id="@+id/tv_app_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="8dp"
android:textSize="14sp"
android:textColor="@color/gray_500"/>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="8dp"
android:background="@color/gray_200"/>
<LinearLayout
@@ -55,7 +55,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="16dp"
android:layout_marginTop="8dp"
android:spacing="20dp">
<ImageButton

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Mon Mar 16 19:52:21 GMT 2026
#Wed Apr 08 17:37:24 GMT 2026
stageCount=26
libraryProject=
baseVersion=15.11
publishVersion=15.11.25
buildCount=29
buildCount=30
baseBetaVersion=15.11.26