From 6f03ef65d33e855c044f8b0c89023d66601222c3 Mon Sep 17 00:00:00 2001 From: Sinofine Lotusie Date: Sat, 25 Feb 2023 22:08:23 +0800 Subject: [PATCH] split --- vector-app/src/main/AndroidManifest.xml | 6 +++ vector/build.gradle | 2 + vector/src/main/AndroidManifest.xml | 4 ++ .../app/features/home/PlaceholderActivity.kt | 38 +++++++++++++++++++ .../app/features/ui/SplitInitializer.kt | 33 ++++++++++++++++ .../main/res/layout/activity_placeholder.xml | 9 +++++ .../src/main/res/xml/split_configuration.xml | 34 +++++++++++++++++ 7 files changed, 126 insertions(+) create mode 100644 vector/src/main/java/im/vector/app/features/home/PlaceholderActivity.kt create mode 100644 vector/src/main/java/im/vector/app/features/ui/SplitInitializer.kt create mode 100644 vector/src/main/res/layout/activity_placeholder.xml create mode 100644 vector/src/main/res/xml/split_configuration.xml diff --git a/vector-app/src/main/AndroidManifest.xml b/vector-app/src/main/AndroidManifest.xml index 66a6fb8b8fe..7e68eec7575 100644 --- a/vector-app/src/main/AndroidManifest.xml +++ b/vector-app/src/main/AndroidManifest.xml @@ -18,6 +18,9 @@ android:theme="@style/AppTheme.SC.Light" tools:ignore="UnusedAttribute" tools:replace="android:allowBackup"> + @@ -53,6 +56,9 @@ + + + (){ + override fun getBinding() = ActivityPlaceholderBinding.inflate(layoutInflater) + @SuppressLint("ResourceAsColor") + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + WindowCompat.setDecorFitsSystemWindows(window, false) + window.statusBarColor = Color.TRANSPARENT + setContentView(R.layout.activity_placeholder) + } +} diff --git a/vector/src/main/java/im/vector/app/features/ui/SplitInitializer.kt b/vector/src/main/java/im/vector/app/features/ui/SplitInitializer.kt new file mode 100644 index 00000000000..c77f116cc64 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/ui/SplitInitializer.kt @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2023 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.ui + +import android.content.Context +import androidx.startup.Initializer +import androidx.window.embedding.SplitController +import im.vector.app.R +class SplitInitializer : Initializer { + + override fun create(context: Context): SplitController { + SplitController.initialize(context, R.xml.split_configuration) + return SplitController.getInstance() + } + + override fun dependencies(): List>> { + return emptyList() + } +} diff --git a/vector/src/main/res/layout/activity_placeholder.xml b/vector/src/main/res/layout/activity_placeholder.xml new file mode 100644 index 00000000000..1ec13506f38 --- /dev/null +++ b/vector/src/main/res/layout/activity_placeholder.xml @@ -0,0 +1,9 @@ + + + diff --git a/vector/src/main/res/xml/split_configuration.xml b/vector/src/main/res/xml/split_configuration.xml new file mode 100644 index 00000000000..0948bc8f620 --- /dev/null +++ b/vector/src/main/res/xml/split_configuration.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + +