Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions library/ui-strings/src/main/res/values/strings_sc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,9 @@
<string name="settings_initial_sync">Initial sync</string>
<string name="settings_initial_sync_summary">Clear cache and reload from server</string>

<string name="labs_enable_tablet_mode_title">Enable tablet mode (split screen)</string>
<string name="labs_enable_tablet_mode_summary">Allow Chats to be opened in split window.</string>
<string name="labs_enable_multichat_title">Enable multiwindow chats</string>
<string name="labs_enable_multichat_summary">Allow Multiple Chats to be opened in split windows (need tablet mode enabled).</string>

</resources>
7 changes: 6 additions & 1 deletion vector/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,14 @@
android:name="com.google.android.gms.car.application"
android:resource="@xml/automotive_app_desc" />

<meta-data
android:name="android.allow_multiple_resumed_activities"
android:value="true" />

<activity
android:name=".features.MainActivity"
android:theme="@style/AppTheme.Launcher.SC" />
android:theme="@style/AppTheme.Launcher.SC"
android:resizeableActivity="true"/>

<activity android:name=".features.home.HomeActivity" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ class DefaultNavigator @Inject constructor(

val args = TimelineArgs(roomId = roomId, eventId = eventId, isInviteAlreadyAccepted = isInviteAlreadyAccepted, openAtFirstUnread = openAtFirstUnread, openAnonymously = openAnonymously)
val intent = RoomDetailActivity.newIntent(context, args, false)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && vectorPreferences.isTabletModeEnabled()) {
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
if (vectorPreferences.isMultiChatEnabled()){
intent.flags = intent.flags or Intent.FLAG_ACTIVITY_MULTIPLE_TASK
} else {
intent.flags = intent.flags or Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT or Intent.FLAG_ACTIVITY_CLEAR_TASK
}
}
startActivity(context, intent, buildTask)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ class VectorPreferences @Inject constructor(
const val SETTINGS_UNVERIFIED_SESSIONS_ALERT_LAST_SHOWN_MILLIS = "SETTINGS_UNVERIFIED_SESSIONS_ALERT_LAST_SHOWN_MILLIS_"
const val SETTINGS_NEW_LOGIN_ALERT_SHOWN_FOR_DEVICE = "SETTINGS_NEW_LOGIN_ALERT_SHOWN_FOR_DEVICE_"

const val SETTINGS_LABS_ENABLE_TABLET_MODE = "SETTINGS_LABS_ENABLE_TABLET_MODE"
const val SETTINGS_LABS_ENABLE_MULTICHAT = "SETTINGS_LABS_ENABLE_MULTICHAT"

// Possible values for TAKE_PHOTO_VIDEO_MODE
const val TAKE_PHOTO_VIDEO_MODE_ALWAYS_ASK = 0
const val TAKE_PHOTO_VIDEO_MODE_PHOTO = 1
Expand Down Expand Up @@ -1558,4 +1561,13 @@ class VectorPreferences @Inject constructor(
putBoolean(SETTINGS_NEW_LOGIN_ALERT_SHOWN_FOR_DEVICE + deviceId, true)
}
}

fun isTabletModeEnabled(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_LABS_ENABLE_TABLET_MODE, false)
}


fun isMultiChatEnabled(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_LABS_ENABLE_MULTICHAT, false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,17 @@ class VectorSettingsLabsFragment :
pref.isVisible = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && vectorFeatures.isVoiceBroadcastEnabled()
}

findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_ENABLE_TABLET_MODE)?.let { pref ->
pref.isVisible = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
Comment thread
Sinofine marked this conversation as resolved.
pref.onPreferenceClickListener = Preference.OnPreferenceClickListener {
onTabletModePreferenceClicked()
true
}
}

configureUnreadNotificationsAsTabPreference()
configureEnableClientInfoRecordingPreference()
configureMultiChatPreference()
}

private fun configureUnreadNotificationsAsTabPreference() {
Expand All @@ -132,6 +141,13 @@ class VectorSettingsLabsFragment :
}
}

private fun configureMultiChatPreference() {
findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_ENABLE_MULTICHAT)?.let { pref ->
pref.isVisible = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
pref.isEnabled = vectorPreferences.isTabletModeEnabled()
}
}

/**
* Intercept the click to display a user friendly dialog when their homeserver do not support threads.
*/
Expand Down Expand Up @@ -180,6 +196,10 @@ class VectorSettingsLabsFragment :
configureUnreadNotificationsAsTabPreference()
}

private fun onTabletModePreferenceClicked() {
configureMultiChatPreference()
}

private fun configureEnableClientInfoRecordingPreference() {
findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_LABS_CLIENT_INFO_RECORDING_KEY)?.onPreferenceChangeListener =
OnPreferenceChangeListener { _, newValue ->
Expand Down
12 changes: 12 additions & 0 deletions vector/src/main/res/xml/vector_settings_labs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@
android:title="@string/url_previews_in_encrypted_rooms"
android:summary="@string/url_previews_in_encrypted_rooms_summary" />

<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="false"
android:key="SETTINGS_LABS_ENABLE_TABLET_MODE"
android:summary="@string/labs_enable_tablet_mode_summary"
android:title="@string/labs_enable_tablet_mode_title" />

<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="false"
android:key="SETTINGS_LABS_ENABLE_MULTICHAT"
android:summary="@string/labs_enable_multichat_summary"
android:title="@string/labs_enable_multichat_title" />

</im.vector.app.core.preference.VectorPreferenceCategory>

<im.vector.app.core.preference.VectorPreferenceCategory
Expand Down