简化应用启动窗口配置:移除分屏测试功能,MainActivity 设为唯一启动器
- 删除 MainActivityAlias 分屏窗口类及相关文件 - 移除 AndroidManifest 中的 MainActivityAlias activity 声明 - 从 activity_main.xml 移除分屏测试按钮 - 删除 MainActivity 中的 onSplitScreenMode() 方法 - 为 MainActivity 添加 LAUNCHER intent-filter,作为唯一启动主窗口
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Sat May 09 20:50:12 HKT 2026
|
#Sun May 10 03:46:22 CST 2026
|
||||||
stageCount=23
|
stageCount=23
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=15.15
|
baseVersion=15.15
|
||||||
publishVersion=15.15.22
|
publishVersion=15.15.22
|
||||||
buildCount=0
|
buildCount=5
|
||||||
baseBetaVersion=15.15.23
|
baseBetaVersion=15.15.23
|
||||||
|
|||||||
@@ -19,28 +19,16 @@
|
|||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation">
|
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>
|
<intent-filter>
|
||||||
|
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".Main2Activity"
|
android:name=".Main2Activity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|||||||
@@ -162,25 +162,7 @@ public class MainActivity extends Activity {
|
|||||||
startActivity(aboutIntent);
|
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) {
|
public void onMultiInstance(View view) {
|
||||||
LogUtils.d(TAG, "onMultiInstance() 多开窗口按钮已点击");
|
LogUtils.d(TAG, "onMultiInstance() 多开窗口按钮已点击");
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -83,17 +83,7 @@
|
|||||||
android:onClick="onToastUtilsTest"
|
android:onClick="onToastUtilsTest"
|
||||||
android:layout_margin="10dp"/>
|
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="onSplitScreenMode"
|
|
||||||
android:layout_margin="10dp"/>
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Sat May 09 20:49:55 HKT 2026
|
#Sun May 10 03:46:22 CST 2026
|
||||||
stageCount=23
|
stageCount=23
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=15.15
|
baseVersion=15.15
|
||||||
publishVersion=15.15.22
|
publishVersion=15.15.22
|
||||||
buildCount=0
|
buildCount=5
|
||||||
baseBetaVersion=15.15.23
|
baseBetaVersion=15.15.23
|
||||||
|
|||||||
Reference in New Issue
Block a user