This commit is contained in:
Sinofine Lotusie 2023-02-25 22:08:23 +08:00
parent 828ab89765
commit 6f03ef65d3
7 changed files with 126 additions and 0 deletions

View File

@ -18,6 +18,9 @@
android:theme="@style/AppTheme.SC.Light"
tools:ignore="UnusedAttribute"
tools:replace="android:allowBackup">
<property
android:name="android.window.PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED"
android:value="true" />
<!-- Activity alias for the launcher Activity (must be declared after the Activity it targets) -->
<!-- exported="true" is required to launch application -->
@ -53,6 +56,9 @@
<meta-data
android:name="androidx.emoji2.text.EmojiCompatInitializer"
tools:node="remove" />
<meta-data
android:name="im.vector.app.features.ui.SplitInitializer"
android:value="androidx.startup" />
</provider>
<provider

View File

@ -199,6 +199,8 @@ dependencies {
implementation libs.androidx.autoFill
implementation 'jp.wasabeef:glide-transformations:4.3.0'
implementation 'com.github.hyuwah:DraggableView:1.0.0'
implementation 'androidx.window:window:1.1.0-alpha04'
implementation 'androidx.startup:startup-runtime:1.1.1'
// Custom Tab
implementation 'androidx.browser:browser:1.4.0'

View File

@ -71,6 +71,10 @@
<application android:supportsRtl="true">
<activity
android:name=".features.home.PlaceholderActivity"
android:exported="false" />
<!-- Sentry auto-initialization disable -->
<meta-data
android:name="io.sentry.auto-init"

View File

@ -0,0 +1,38 @@
/*
* 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.home
import android.annotation.SuppressLint
import android.graphics.Color
import android.os.Bundle
import androidx.core.view.WindowCompat
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivityPlaceholderBinding
@AndroidEntryPoint
class PlaceholderActivity :
VectorBaseActivity<ActivityPlaceholderBinding>(){
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)
}
}

View File

@ -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<SplitController> {
override fun create(context: Context): SplitController {
SplitController.initialize(context, R.xml.split_configuration)
return SplitController.getInstance()
}
override fun dependencies(): List<Class<out Initializer<*>>> {
return emptyList()
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/placeholder">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,34 @@
<resources
xmlns:window="http://schemas.android.com/apk/res-auto">
<!-- Define a split for the named activity pair. -->
<SplitPairRule
window:splitRatio="0.4"
window:splitMinWidth="600dp"
window:finishPrimaryWithSecondary="never"
window:finishSecondaryWithPrimary="always">
<SplitPairFilter
window:primaryActivityName="im.vector.app.features.home.HomeActivity"
window:secondaryActivityName="im.vector.app.features.home.room.detail.RoomDetailActivity"/>
</SplitPairRule>
<!-- Automatically launch a placeholder for the list activity. -->
<SplitPlaceholderRule
window:placeholderActivityName="im.vector.app.features.home.PlaceholderActivity"
window:splitRatio="0.4"
window:splitMinWidth="600dp">
<ActivityFilter
window:activityName="im.vector.app.features.home.HomeActivity"/>
</SplitPlaceholderRule>
<!-- Define activities that should never enter a split. Note: Takes
precedence over other split rules. -->
<ActivityRule
window:alwaysExpand="true">
<ActivityFilter window:activityName="im.vector.app.features.media.VectorAttachmentViewerActivity"/>
<ActivityFilter window:activityName="im.vector.app.features.media.BigImageViewerActivity"/>
</ActivityRule>
</resources>