Merge pull request #164 from vector-im/feature/cleanup

Theme integration
This commit is contained in:
Benoit Marty 2019-06-06 19:27:39 +02:00 committed by GitHub
commit b782e5e8af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
128 changed files with 2604 additions and 1038 deletions

View File

@ -16,7 +16,6 @@


package im.vector.matrix.android.api package im.vector.matrix.android.api


import java.util.*
import java.util.regex.Pattern import java.util.regex.Pattern


/** /**
@ -25,53 +24,53 @@ import java.util.regex.Pattern
object MatrixPatterns { object MatrixPatterns {


// Note: TLD is not mandatory (localhost, IP address...) // Note: TLD is not mandatory (localhost, IP address...)
private val DOMAIN_REGEX = ":[A-Z0-9.-]+(:[0-9]{2,5})?" private const val DOMAIN_REGEX = ":[A-Z0-9.-]+(:[0-9]{2,5})?"


// regex pattern to find matrix user ids in a string. // regex pattern to find matrix user ids in a string.
// See https://matrix.org/speculator/spec/HEAD/appendices.html#historical-user-ids // See https://matrix.org/speculator/spec/HEAD/appendices.html#historical-user-ids
private val MATRIX_USER_IDENTIFIER_REGEX = "@[A-Z0-9\\x21-\\x39\\x3B-\\x7F]+$DOMAIN_REGEX" private const val MATRIX_USER_IDENTIFIER_REGEX = "@[A-Z0-9\\x21-\\x39\\x3B-\\x7F]+$DOMAIN_REGEX"
val PATTERN_CONTAIN_MATRIX_USER_IDENTIFIER = Pattern.compile(MATRIX_USER_IDENTIFIER_REGEX, Pattern.CASE_INSENSITIVE) private val PATTERN_CONTAIN_MATRIX_USER_IDENTIFIER = Pattern.compile(MATRIX_USER_IDENTIFIER_REGEX, Pattern.CASE_INSENSITIVE)


// regex pattern to find room ids in a string. // regex pattern to find room ids in a string.
private val MATRIX_ROOM_IDENTIFIER_REGEX = "![A-Z0-9]+$DOMAIN_REGEX" private const val MATRIX_ROOM_IDENTIFIER_REGEX = "![A-Z0-9]+$DOMAIN_REGEX"
val PATTERN_CONTAIN_MATRIX_ROOM_IDENTIFIER = Pattern.compile(MATRIX_ROOM_IDENTIFIER_REGEX, Pattern.CASE_INSENSITIVE) private val PATTERN_CONTAIN_MATRIX_ROOM_IDENTIFIER = Pattern.compile(MATRIX_ROOM_IDENTIFIER_REGEX, Pattern.CASE_INSENSITIVE)


// regex pattern to find room aliases in a string. // regex pattern to find room aliases in a string.
private val MATRIX_ROOM_ALIAS_REGEX = "#[A-Z0-9._%#@=+-]+$DOMAIN_REGEX" private const val MATRIX_ROOM_ALIAS_REGEX = "#[A-Z0-9._%#@=+-]+$DOMAIN_REGEX"
val PATTERN_CONTAIN_MATRIX_ALIAS = Pattern.compile(MATRIX_ROOM_ALIAS_REGEX, Pattern.CASE_INSENSITIVE) private val PATTERN_CONTAIN_MATRIX_ALIAS = Pattern.compile(MATRIX_ROOM_ALIAS_REGEX, Pattern.CASE_INSENSITIVE)


// regex pattern to find message ids in a string. // regex pattern to find message ids in a string.
private val MATRIX_EVENT_IDENTIFIER_REGEX = "\\$[A-Z0-9]+$DOMAIN_REGEX" private const val MATRIX_EVENT_IDENTIFIER_REGEX = "\\$[A-Z0-9]+$DOMAIN_REGEX"
val PATTERN_CONTAIN_MATRIX_EVENT_IDENTIFIER = Pattern.compile(MATRIX_EVENT_IDENTIFIER_REGEX, Pattern.CASE_INSENSITIVE) private val PATTERN_CONTAIN_MATRIX_EVENT_IDENTIFIER = Pattern.compile(MATRIX_EVENT_IDENTIFIER_REGEX, Pattern.CASE_INSENSITIVE)


// regex pattern to find message ids in a string. // regex pattern to find message ids in a string.
private val MATRIX_EVENT_IDENTIFIER_V3_REGEX = "\\$[A-Z0-9/+]+" private const val MATRIX_EVENT_IDENTIFIER_V3_REGEX = "\\$[A-Z0-9/+]+"
val PATTERN_CONTAIN_MATRIX_EVENT_IDENTIFIER_V3 = Pattern.compile(MATRIX_EVENT_IDENTIFIER_V3_REGEX, Pattern.CASE_INSENSITIVE) private val PATTERN_CONTAIN_MATRIX_EVENT_IDENTIFIER_V3 = Pattern.compile(MATRIX_EVENT_IDENTIFIER_V3_REGEX, Pattern.CASE_INSENSITIVE)


// regex pattern to find group ids in a string. // regex pattern to find group ids in a string.
private val MATRIX_GROUP_IDENTIFIER_REGEX = "\\+[A-Z0-9=_\\-./]+$DOMAIN_REGEX" private const val MATRIX_GROUP_IDENTIFIER_REGEX = "\\+[A-Z0-9=_\\-./]+$DOMAIN_REGEX"
val PATTERN_CONTAIN_MATRIX_GROUP_IDENTIFIER = Pattern.compile(MATRIX_GROUP_IDENTIFIER_REGEX, Pattern.CASE_INSENSITIVE) private val PATTERN_CONTAIN_MATRIX_GROUP_IDENTIFIER = Pattern.compile(MATRIX_GROUP_IDENTIFIER_REGEX, Pattern.CASE_INSENSITIVE)


// regex pattern to find permalink with message id. // regex pattern to find permalink with message id.
// Android does not support in URL so extract it. // Android does not support in URL so extract it.
private val PERMALINK_BASE_REGEX = "https://matrix\\.to/#/" private const val PERMALINK_BASE_REGEX = "https://matrix\\.to/#/"
private val APP_BASE_REGEX = "https://[A-Z0-9.-]+\\.[A-Z]{2,}/[A-Z]{3,}/#/room/" private const val APP_BASE_REGEX = "https://[A-Z0-9.-]+\\.[A-Z]{2,}/[A-Z]{3,}/#/room/"
val SEP_REGEX = "/" const val SEP_REGEX = "/"


private val LINK_TO_ROOM_ID_REGEXP = PERMALINK_BASE_REGEX + MATRIX_ROOM_IDENTIFIER_REGEX + SEP_REGEX + MATRIX_EVENT_IDENTIFIER_REGEX private const val LINK_TO_ROOM_ID_REGEXP = PERMALINK_BASE_REGEX + MATRIX_ROOM_IDENTIFIER_REGEX + SEP_REGEX + MATRIX_EVENT_IDENTIFIER_REGEX
val PATTERN_CONTAIN_MATRIX_TO_PERMALINK_ROOM_ID = Pattern.compile(LINK_TO_ROOM_ID_REGEXP, Pattern.CASE_INSENSITIVE) private val PATTERN_CONTAIN_MATRIX_TO_PERMALINK_ROOM_ID = Pattern.compile(LINK_TO_ROOM_ID_REGEXP, Pattern.CASE_INSENSITIVE)


private val LINK_TO_ROOM_ALIAS_REGEXP = PERMALINK_BASE_REGEX + MATRIX_ROOM_ALIAS_REGEX + SEP_REGEX + MATRIX_EVENT_IDENTIFIER_REGEX private const val LINK_TO_ROOM_ALIAS_REGEXP = PERMALINK_BASE_REGEX + MATRIX_ROOM_ALIAS_REGEX + SEP_REGEX + MATRIX_EVENT_IDENTIFIER_REGEX
val PATTERN_CONTAIN_MATRIX_TO_PERMALINK_ROOM_ALIAS = Pattern.compile(LINK_TO_ROOM_ALIAS_REGEXP, Pattern.CASE_INSENSITIVE) private val PATTERN_CONTAIN_MATRIX_TO_PERMALINK_ROOM_ALIAS = Pattern.compile(LINK_TO_ROOM_ALIAS_REGEXP, Pattern.CASE_INSENSITIVE)


private val LINK_TO_APP_ROOM_ID_REGEXP = APP_BASE_REGEX + MATRIX_ROOM_IDENTIFIER_REGEX + SEP_REGEX + MATRIX_EVENT_IDENTIFIER_REGEX private const val LINK_TO_APP_ROOM_ID_REGEXP = APP_BASE_REGEX + MATRIX_ROOM_IDENTIFIER_REGEX + SEP_REGEX + MATRIX_EVENT_IDENTIFIER_REGEX
val PATTERN_CONTAIN_APP_LINK_PERMALINK_ROOM_ID = Pattern.compile(LINK_TO_APP_ROOM_ID_REGEXP, Pattern.CASE_INSENSITIVE) private val PATTERN_CONTAIN_APP_LINK_PERMALINK_ROOM_ID = Pattern.compile(LINK_TO_APP_ROOM_ID_REGEXP, Pattern.CASE_INSENSITIVE)


private val LINK_TO_APP_ROOM_ALIAS_REGEXP = APP_BASE_REGEX + MATRIX_ROOM_ALIAS_REGEX + SEP_REGEX + MATRIX_EVENT_IDENTIFIER_REGEX private const val LINK_TO_APP_ROOM_ALIAS_REGEXP = APP_BASE_REGEX + MATRIX_ROOM_ALIAS_REGEX + SEP_REGEX + MATRIX_EVENT_IDENTIFIER_REGEX
val PATTERN_CONTAIN_APP_LINK_PERMALINK_ROOM_ALIAS = Pattern.compile(LINK_TO_APP_ROOM_ALIAS_REGEXP, Pattern.CASE_INSENSITIVE) private val PATTERN_CONTAIN_APP_LINK_PERMALINK_ROOM_ALIAS = Pattern.compile(LINK_TO_APP_ROOM_ALIAS_REGEXP, Pattern.CASE_INSENSITIVE)


// list of patterns to find some matrix item. // list of patterns to find some matrix item.
val MATRIX_PATTERNS = Arrays.asList( val MATRIX_PATTERNS = listOf(
PATTERN_CONTAIN_MATRIX_TO_PERMALINK_ROOM_ID, PATTERN_CONTAIN_MATRIX_TO_PERMALINK_ROOM_ID,
PATTERN_CONTAIN_MATRIX_TO_PERMALINK_ROOM_ALIAS, PATTERN_CONTAIN_MATRIX_TO_PERMALINK_ROOM_ALIAS,
PATTERN_CONTAIN_APP_LINK_PERMALINK_ROOM_ID, PATTERN_CONTAIN_APP_LINK_PERMALINK_ROOM_ID,
@ -133,4 +132,4 @@ object MatrixPatterns {
fun isGroupId(str: String?): Boolean { fun isGroupId(str: String?): Boolean {
return str != null && PATTERN_CONTAIN_MATRIX_GROUP_IDENTIFIER.matcher(str).matches() return str != null && PATTERN_CONTAIN_MATRIX_GROUP_IDENTIFIER.matcher(str).matches()
} }
}// Cannot be instantiated }

View File

@ -18,16 +18,16 @@ package im.vector.matrix.android.api.session.room.model.message


object MessageType { object MessageType {


val MSGTYPE_TEXT = "m.text" const val MSGTYPE_TEXT = "m.text"
val MSGTYPE_EMOTE = "m.emote" const val MSGTYPE_EMOTE = "m.emote"
val MSGTYPE_NOTICE = "m.notice" const val MSGTYPE_NOTICE = "m.notice"
val MSGTYPE_IMAGE = "m.image" const val MSGTYPE_IMAGE = "m.image"
val MSGTYPE_AUDIO = "m.audio" const val MSGTYPE_AUDIO = "m.audio"
val MSGTYPE_VIDEO = "m.video" const val MSGTYPE_VIDEO = "m.video"
val MSGTYPE_LOCATION = "m.location" const val MSGTYPE_LOCATION = "m.location"
val MSGTYPE_FILE = "m.file" const val MSGTYPE_FILE = "m.file"
val FORMAT_MATRIX_HTML = "org.matrix.custom.html" const val FORMAT_MATRIX_HTML = "org.matrix.custom.html"
// Add, in local, a fake message type in order to StickerMessage can inherit Message class // Add, in local, a fake message type in order to StickerMessage can inherit Message class
// Because sticker isn't a message type but a event type without msgtype field // Because sticker isn't a message type but a event type without msgtype field
val MSGTYPE_STICKER_LOCAL = "org.matrix.android.sdk.sticker" const val MSGTYPE_STICKER_LOCAL = "org.matrix.android.sdk.sticker"
} }

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<activity android:name="im.vector.riotredesign.features.debug.TestLinkifyActivity" />
<activity
android:name="im.vector.riotredesign.features.debug.DebugMaterialThemeLightActivity"
android:theme="@style/VectorMaterialThemeDebugLight" />
<activity
android:name="im.vector.riotredesign.features.debug.DebugMaterialThemeDarkActivity"
android:theme="@style/VectorMaterialThemeDebugDark" />
</application>

</manifest>

View File

@ -0,0 +1,65 @@
/*
* Copyright 2019 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.riotredesign.features.debug

import android.os.Bundle
import android.view.Menu
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.snackbar.Snackbar
import im.vector.riotredesign.R
import im.vector.riotredesign.core.utils.toast
import kotlinx.android.synthetic.debug.activity_test_material_theme.*

// Rendering is not the same with VectorBaseActivity
abstract class DebugMaterialThemeActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_test_material_theme)

debugShowSnackbar.setOnClickListener {
Snackbar.make(debugMaterialCoordinator, "Snackbar!", Snackbar.LENGTH_SHORT)
.setAction("Action") { }
.show()
}

debugShowToast.setOnClickListener {
toast("Toast")
}

debugShowDialog.setOnClickListener {
AlertDialog.Builder(this)
.setMessage("Dialog content")
.setIcon(R.drawable.ic_settings_x)
.setPositiveButton("Positive", null)
.setNegativeButton("Negative", null)
.setNeutralButton("Neutral", null)
.show()
}

debugShowBottomSheet.setOnClickListener {
BottomSheetDialogFragment().show(supportFragmentManager, "TAG")
}
}

override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.vector_home, menu)
return true
}
}

View File

@ -0,0 +1,19 @@
/*
* Copyright 2019 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.riotredesign.features.debug

class DebugMaterialThemeDarkActivity : DebugMaterialThemeActivity()

View File

@ -0,0 +1,19 @@
/*
* Copyright 2019 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.riotredesign.features.debug

class DebugMaterialThemeLightActivity : DebugMaterialThemeActivity()

View File

@ -0,0 +1,137 @@
/*
* Copyright 2019 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.riotredesign.features.debug

import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.content.Intent
import android.os.Build
import androidx.core.app.NotificationCompat
import androidx.core.app.Person
import butterknife.OnClick
import im.vector.riotredesign.R
import im.vector.riotredesign.core.platform.VectorBaseActivity


class DebugMenuActivity : VectorBaseActivity() {

override fun getLayoutRes() = R.layout.activity_debug_menu

@OnClick(R.id.debug_test_text_view_link)
fun testTextViewLink() {
startActivity(Intent(this, TestLinkifyActivity::class.java))
}

@OnClick(R.id.debug_test_notification)
fun testNotification() {
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager

// Create channel first
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel =
NotificationChannel(
"CHAN",
"Channel name",
NotificationManager.IMPORTANCE_DEFAULT
)

channel.description = "Channel description"
(getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).createNotificationChannel(channel)

val channel2 =
NotificationChannel(
"CHAN2",
"Channel name 2",
NotificationManager.IMPORTANCE_DEFAULT
)

channel2.description = "Channel description 2"
(getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).createNotificationChannel(channel2)
}


val builder = NotificationCompat.Builder(this, "CHAN")
.setWhen(System.currentTimeMillis())
.setContentTitle("Title")
.setContentText("Content")
// No effect because it's a group summary notif
.setNumber(33)
.setSmallIcon(R.drawable.logo_transparent)
// This provocate the badge issue: no badge for group notification
.setGroup("GroupKey")
.setGroupSummary(true)

val messagingStyle1 = NotificationCompat.MessagingStyle(
Person.Builder()
.setName("User name")
.build()
)
.addMessage("Message 1 - 1", System.currentTimeMillis(), Person.Builder().setName("user 1-1").build())
.addMessage("Message 1 - 2", System.currentTimeMillis(), Person.Builder().setName("user 1-2").build())

val messagingStyle2 = NotificationCompat.MessagingStyle(
Person.Builder()
.setName("User name 2")
.build()
)
.addMessage("Message 2 - 1", System.currentTimeMillis(), Person.Builder().setName("user 1-1").build())
.addMessage("Message 2 - 2", System.currentTimeMillis(), Person.Builder().setName("user 1-2").build())


notificationManager.notify(10, builder.build())

notificationManager.notify(
11,
NotificationCompat.Builder(this, "CHAN")
.setChannelId("CHAN")
.setWhen(System.currentTimeMillis())
.setContentTitle("Title 1")
.setContentText("Content 1")
// For shortcut on long press on launcher icon
.setBadgeIconType(NotificationCompat.BADGE_ICON_NONE)
.setStyle(messagingStyle1)
.setSmallIcon(R.drawable.logo_transparent)
.setGroup("GroupKey")
.build()
)

notificationManager.notify(
12,
NotificationCompat.Builder(this, "CHAN2")
.setWhen(System.currentTimeMillis())
.setContentTitle("Title 2")
.setContentText("Content 2")
.setStyle(messagingStyle2)
.setSmallIcon(R.drawable.logo_transparent)
.setGroup("GroupKey")
.build()
)
}

@OnClick(R.id.debug_test_material_theme_light)
fun testMaterialThemeLight() {
startActivity(Intent(this, DebugMaterialThemeLightActivity::class.java))
}

@OnClick(R.id.debug_test_material_theme_dark)
fun testMaterialThemeDark() {
startActivity(Intent(this, DebugMaterialThemeDarkActivity::class.java))
}

}

View File

@ -0,0 +1,133 @@
/*
* Copyright 2019 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.riotredesign.features.debug

import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.coordinatorlayout.widget.CoordinatorLayout
import butterknife.BindView
import butterknife.ButterKnife
import im.vector.riotredesign.R


class TestLinkifyActivity : AppCompatActivity() {

@BindView(R.id.test_linkify_content_view)
lateinit var scrollContent: LinearLayout

@BindView(R.id.test_linkify_coordinator)
lateinit var coordinatorLayout: CoordinatorLayout


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_test_linkify)
ButterKnife.bind(this)

scrollContent.removeAllViews()

listOf(
"https://www.html5rocks.com/en/tutorials/webrtc/basics/ |",
"https://www.html5rocks.com/en/tutorials/webrtc/basics/",
"mailto mailto:test@toto.com test@toto.com",
"Here is the link.www.test.com/foo/?23=35 you got it?",
"www.lemonde.fr",
" /www.lemonde.fr",
"://www.lemonde.fr",
"file:///dev/null ",
" ansible/xoxys.matrix#2c0b65eb",
"foo.ansible/xoxys.matrix#2c0b65eb",
"foo.ansible.fpo/xoxys.matrix#2c0b65eb",
"https://foo.ansible.fpo/xoxys.matrix#2c0b65eb",
"@vf:matrix.org",
"+44 207 123 1234",
"+33141437940",
"1234",
"3456.34,089",
"ksks9808",
"For example: geo:48.85828,2.29449?z=16 should be clickable",
"geo:37.786971,-122.399677;u=35",
"37.786971,-122.399677;u=35",
"48.107864,-1.712153",
"synchrone peut tenir la route la",
"that.is.some.sexy.link",
"test overlap 48.107864,0673728392 geo + pn?",
"test overlap 0673728392,48.107864 geo + pn?",
"If I add a link in brackets like (help for Riot: https://about.riot.im/help), the link is usable on Riot for Desktop",
"(help for Riot: https://about.riot.im/help)",
"http://example.com/test(1).html",
"http://example.com/test(1)",
"https://about.riot.im/help)",
"(http://example.com/test(1))",
"http://example.com/test1)",
"http://example.com/test1/, et ca",
"www.example.com/, et ca",
"foo.ansible.toplevel/xoxys.matrix#2c0b65eb",
"foo.ansible.ninja/xoxys.matrix#2c0b65eb",
"in brackets like (help for Riot: https://www.exemple/com/find(1)) , the link is usable ",
"""
In brackets like (help for Riot: https://about.riot.im/help) , the link is usable,
But you can call +44 207 123 1234 and come to 37.786971,-122.399677;u=35 then
see if this mail jhon@riot.im is active but this should not 12345
""".trimIndent()
)
.forEach { textContent ->
val item = LayoutInflater.from(this)
.inflate(R.layout.item_test_linkify, scrollContent, false)

item.findViewById<TextView>(R.id.test_linkify_auto_text)
?.apply {
text = textContent
/* TODO Use BetterLinkMovementMethod when the other PR is merged
movementMethod = MatrixLinkMovementMethod(object : MockMessageAdapterActionListener() {
override fun onURLClick(uri: Uri?) {
Snackbar.make(coordinatorLayout, "URI Clicked: $uri", Snackbar.LENGTH_LONG)
.setAction("open") {
openUrlInExternalBrowser(this@TestLinkifyActivity, uri)
}
.show()
}
})
*/
}

item.findViewById<TextView>(R.id.test_linkify_custom_text)
?.apply {
text = textContent
/* TODO Use BetterLinkMovementMethod when the other PR is merged
movementMethod = MatrixLinkMovementMethod(object : MockMessageAdapterActionListener() {
override fun onURLClick(uri: Uri?) {
Snackbar.make(coordinatorLayout, "URI Clicked: $uri", Snackbar.LENGTH_LONG)
.setAction("open") {
openUrlInExternalBrowser(this@TestLinkifyActivity, uri)
}
.show()
}
})
*/

// TODO Call VectorLinkify.addLinks(text)
}

scrollContent.addView(item, ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))
}
}
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

<size
android:width="8dp"
android:height="8dp" />

</shape>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="im.vector.riotredesign.features.debug.DebugMenuActivity"
tools:ignore="HardcodedText">

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@drawable/linear_divider"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="@dimen/layout_horizontal_margin"
android:showDividers="middle">

<com.google.android.material.button.MaterialButton
android:id="@+id/debug_test_text_view_link"
style="@style/VectorButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test linkification" />

<com.google.android.material.button.MaterialButton
android:id="@+id/debug_test_notification"
style="@style/VectorButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test Notification" />

<com.google.android.material.button.MaterialButton
android:id="@+id/debug_test_material_theme_light"
style="@style/VectorButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test Material theme Light" />

<com.google.android.material.button.MaterialButton
android:id="@+id/debug_test_material_theme_dark"
style="@style/VectorButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test Material theme Dark" />

</LinearLayout>

</ScrollView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/test_linkify_coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/riot_secondary_text_color_status"
tools:context="im.vector.riotredesign.features.debug.TestLinkifyActivity">

<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:id="@+id/test_linkify_content_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<!-- Will be removed at runtime -->
<include layout="@layout/item_test_linkify" />

<include layout="@layout/item_test_linkify" />

<include layout="@layout/item_test_linkify" />

</LinearLayout>

</androidx.core.widget.NestedScrollView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -0,0 +1,168 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:id="@+id/debugMaterialCoordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".features.debug.DebugMaterialThemeActivity"
tools:ignore="HardcodedText">

<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@drawable/linear_divider"
android:orientation="vertical"
android:padding="16dp"
android:showDividers="middle">

<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:subtitle="Toolbar Subtitle"
app:title="Toolbar Title" />

<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="OutlinedBox">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="OutlinedBox.Dense">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1" />

</com.google.android.material.textfield.TextInputLayout>


<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="FilledBox">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="FilledBox.Dense">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1" />

</com.google.android.material.textfield.TextInputLayout>


<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Material Button Classic"
app:icon="@drawable/ic_settings_x" />

<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Material Button OutlinedButton"
app:icon="@drawable/ic_settings_x" />

<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Material Button TextButton"
app:icon="@drawable/ic_settings_x" />

<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Material Button UnelevatedButton"
app:icon="@drawable/ic_settings_x" />

<com.google.android.material.button.MaterialButton
android:id="@+id/debugShowSnackbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Snackbar" />

<com.google.android.material.button.MaterialButton
android:id="@+id/debugShowToast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Toast" />

<com.google.android.material.button.MaterialButton
android:id="@+id/debugShowDialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Dialog" />

<com.google.android.material.button.MaterialButton
android:id="@+id/debugShowBottomSheet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Bottom Sheet" />

<com.google.android.material.checkbox.MaterialCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Material CheckBox" />

<com.google.android.material.switchmaterial.SwitchMaterial
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Material Switch" />

<com.google.android.material.card.MaterialCardView
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="48dp"
android:text="TextView in MaterialCardView" />

</com.google.android.material.card.MaterialCardView>

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_settings_x" />

</LinearLayout>

</androidx.core.widget.NestedScrollView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/store_title" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/store_whats_new" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/store_short_description" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/store_full_description" />

</LinearLayout>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
The aim of this file is to test the different themes of Riot
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:ignore="HardcodedText">

<TextView
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="?colorPrimaryDark"
android:gravity="center_vertical"
android:text="Status Bar" />

<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="?colorPrimary"
android:gravity="center_vertical"
android:text="This is a simple text" />

</LinearLayout>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
The aim of this file is to test the different themes of Riot
Unfortunately, this does not work in the preview.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:theme="@style/AppTheme.Light">

<include layout="@layout/demo_theme_sample" />

</FrameLayout>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:theme="@style/AppTheme.Dark">

<include layout="@layout/demo_theme_sample" />

</FrameLayout>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:theme="@style/AppTheme.Black">

<include layout="@layout/demo_theme_sample" />

</FrameLayout>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:theme="@style/AppTheme.Status">

<include layout="@layout/demo_theme_sample" />

</FrameLayout>

</LinearLayout>

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
tools:ignore="HardcodedText">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
style="@style/ListHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="AutoLink" />

<TextView
android:id="@+id/test_linkify_auto_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:autoLink="all"
tools:text="www.example.org" />

<TextView
style="@style/ListHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Custom Link" />

<TextView
android:id="@+id/test_linkify_custom_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
tools:text="www.example.org" />

</LinearLayout>

</androidx.cardview.widget.CardView>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="VectorDebug">
<item name="android:visibility">visible</item>
</style>


<style name="VectorMaterialThemeDebugLight" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">#7F7F00</item>
<item name="colorPrimaryVariant">#00FF00</item>
<item name="colorOnPrimary">#0000FF</item>

<item name="colorSecondary">#FF00FF</item>
<item name="colorSecondaryVariant">#00FFFF</item>
<item name="colorOnSecondary">#FFF000</item>

<item name="colorError">#FF0000</item>
<item name="colorOnError">#330033</item>

<item name="colorSurface">#003333</item>
<item name="colorOnSurface">#777777</item>

<item name="android:colorBackground">#FF7777</item>
<item name="colorOnBackground">#077700</item>

<!-- TODO is it still required? -->
<item name="colorAccent">#03b381</item>

<item name="android:statusBarColor">#1188FF</item>
<item name="android:navigationBarColor">#FF8811</item>
</style>

<style name="VectorMaterialThemeDebugDark" parent="Theme.MaterialComponents.NoActionBar">
<item name="colorPrimary">#7F7F00</item>
<item name="colorPrimaryVariant">#00FF00</item>
<item name="colorOnPrimary">#0000FF</item>

<item name="colorSecondary">#FF00FF</item>
<item name="colorSecondaryVariant">#00FFFF</item>
<item name="colorOnSecondary">#FFF000</item>

<item name="colorError">#FF0000</item>
<item name="colorOnError">#330033</item>

<item name="colorSurface">#003333</item>
<item name="colorOnSurface">#777777</item>

<item name="android:colorBackground">#FF7777</item>
<item name="colorOnBackground">#077700</item>

<!-- TODO is it still required? -->
<item name="colorAccent">#03b381</item>

<item name="android:statusBarColor">#1188FF</item>
<item name="android:navigationBarColor">#FF8811</item>
</style>

</resources>

View File

@ -46,6 +46,7 @@
<activity android:name=".features.roomdirectory.RoomDirectoryActivity" /> <activity android:name=".features.roomdirectory.RoomDirectoryActivity" />
<activity android:name=".features.roomdirectory.roompreview.RoomPreviewActivity" /> <activity android:name=".features.roomdirectory.roompreview.RoomPreviewActivity" />
<activity android:name=".features.home.room.detail.RoomDetailActivity" /> <activity android:name=".features.home.room.detail.RoomDetailActivity" />
<activity android:name=".features.debug.DebugMenuActivity" />


<service <service
android:name=".core.services.CallService" android:name=".core.services.CallService"

View File

@ -18,6 +18,7 @@ package im.vector.riotredesign


import android.app.Application import android.app.Application
import android.content.Context import android.content.Context
import android.content.res.Configuration
import androidx.multidex.MultiDex import androidx.multidex.MultiDex
import com.airbnb.epoxy.EpoxyAsyncUtil import com.airbnb.epoxy.EpoxyAsyncUtil
import com.airbnb.epoxy.EpoxyController import com.airbnb.epoxy.EpoxyController
@ -27,10 +28,12 @@ import com.github.piasy.biv.loader.glide.GlideImageLoader
import com.jakewharton.threetenabp.AndroidThreeTen import com.jakewharton.threetenabp.AndroidThreeTen
import im.vector.matrix.android.api.Matrix import im.vector.matrix.android.api.Matrix
import im.vector.riotredesign.core.di.AppModule import im.vector.riotredesign.core.di.AppModule
import im.vector.riotredesign.features.configuration.VectorConfiguration
import im.vector.riotredesign.features.home.HomeModule import im.vector.riotredesign.features.home.HomeModule
import im.vector.riotredesign.features.rageshake.VectorFileLogger import im.vector.riotredesign.features.rageshake.VectorFileLogger
import im.vector.riotredesign.features.rageshake.VectorUncaughtExceptionHandler import im.vector.riotredesign.features.rageshake.VectorUncaughtExceptionHandler
import im.vector.riotredesign.features.roomdirectory.RoomDirectoryModule import im.vector.riotredesign.features.roomdirectory.RoomDirectoryModule
import org.koin.android.ext.android.inject
import org.koin.log.EmptyLogger import org.koin.log.EmptyLogger
import org.koin.standalone.StandAloneContext.startKoin import org.koin.standalone.StandAloneContext.startKoin
import timber.log.Timber import timber.log.Timber
@ -38,6 +41,8 @@ import timber.log.Timber


class VectorApplication : Application() { class VectorApplication : Application() {


val vectorConfiguration: VectorConfiguration by inject()

override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()


@ -61,6 +66,8 @@ class VectorApplication : Application() {
startKoin(listOf(appModule, homeModule, roomDirectoryModule), logger = EmptyLogger()) startKoin(listOf(appModule, homeModule, roomDirectoryModule), logger = EmptyLogger())


Matrix.getInstance().setApplicationFlavor(BuildConfig.FLAVOR_DESCRIPTION) Matrix.getInstance().setApplicationFlavor(BuildConfig.FLAVOR_DESCRIPTION)

vectorConfiguration.initConfiguration()
} }


override fun attachBaseContext(base: Context) { override fun attachBaseContext(base: Context) {
@ -68,4 +75,10 @@ class VectorApplication : Application() {
MultiDex.install(this) MultiDex.install(this)
} }


override fun onConfigurationChanged(newConfig: Configuration?) {
super.onConfigurationChanged(newConfig)

vectorConfiguration.onConfigurationChanged(newConfig)
}

} }

View File

@ -0,0 +1,41 @@
/*
* Copyright 2019 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.riotredesign.core.animations

import androidx.transition.Transition

open class SimpleTransitionListener : Transition.TransitionListener {
override fun onTransitionEnd(transition: Transition) {
// No op
}

override fun onTransitionResume(transition: Transition) {
// No op
}

override fun onTransitionPause(transition: Transition) {
// No op
}

override fun onTransitionCancel(transition: Transition) {
// No op
}

override fun onTransitionStart(transition: Transition) {
// No op
}
}

View File

@ -0,0 +1,44 @@
/*
* Copyright 2019 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.riotredesign.core.animations

import android.content.Context
import android.util.AttributeSet
import androidx.transition.ChangeBounds
import androidx.transition.ChangeTransform
import androidx.transition.Fade
import androidx.transition.TransitionSet

class VectorFullTransitionSet : TransitionSet {

constructor() {
init()
}

constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
init()
}

private fun init() {
ordering = ORDERING_TOGETHER
addTransition(Fade(Fade.OUT))
.addTransition(ChangeBounds())
.addTransition(ChangeTransform())
.addTransition(Fade(Fade.IN))
}

}

View File

@ -24,6 +24,7 @@ import im.vector.riotredesign.core.error.ErrorFormatter
import im.vector.riotredesign.core.resources.LocaleProvider import im.vector.riotredesign.core.resources.LocaleProvider
import im.vector.riotredesign.core.resources.StringArrayProvider import im.vector.riotredesign.core.resources.StringArrayProvider
import im.vector.riotredesign.core.resources.StringProvider import im.vector.riotredesign.core.resources.StringProvider
import im.vector.riotredesign.features.configuration.VectorConfiguration
import im.vector.riotredesign.features.home.HomeRoomListObservableStore import im.vector.riotredesign.features.home.HomeRoomListObservableStore
import im.vector.riotredesign.features.home.group.SelectedGroupStore import im.vector.riotredesign.features.home.group.SelectedGroupStore
import im.vector.riotredesign.features.home.room.list.AlphabeticalRoomComparator import im.vector.riotredesign.features.home.room.list.AlphabeticalRoomComparator
@ -37,6 +38,10 @@ class AppModule(private val context: Context) {


val definition = module { val definition = module {


single {
VectorConfiguration(context)
}

single { single {
LocaleProvider(context.resources) LocaleProvider(context.resources)
} }

View File

@ -0,0 +1,55 @@
/*
* Copyright 2019 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.riotredesign.core.platform

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import im.vector.riotredesign.core.utils.LiveEvent
import im.vector.riotredesign.features.configuration.VectorConfiguration
import org.koin.standalone.KoinComponent
import org.koin.standalone.inject
import timber.log.Timber

class ConfigurationViewModel : ViewModel(), KoinComponent {

private val vectorConfiguration: VectorConfiguration by inject()

private var currentConfigurationValue: String? = null

private val _activityRestarter = MutableLiveData<LiveEvent<Unit>>()
val activityRestarter: LiveData<LiveEvent<Unit>>
get() = _activityRestarter


fun onActivityResumed() {
if (currentConfigurationValue == null) {
currentConfigurationValue = vectorConfiguration.getHash()
Timber.v("Configuration: init to $currentConfigurationValue")
} else {
val newHash = vectorConfiguration.getHash()
Timber.v("Configuration: newHash $newHash")

if (newHash != currentConfigurationValue) {
Timber.v("Configuration: recreate the Activity")
currentConfigurationValue = newHash

_activityRestarter.postValue(LiveEvent(Unit))
}
}
}
}

View File

@ -16,6 +16,7 @@


package im.vector.riotredesign.core.platform package im.vector.riotredesign.core.platform


import android.content.Context
import android.content.res.Configuration import android.content.res.Configuration
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
@ -24,6 +25,8 @@ import android.view.View
import androidx.annotation.* import androidx.annotation.*
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import butterknife.BindView import butterknife.BindView
import butterknife.ButterKnife import butterknife.ButterKnife
import butterknife.Unbinder import butterknife.Unbinder
@ -33,14 +36,16 @@ import com.google.android.material.snackbar.Snackbar
import im.vector.riotredesign.BuildConfig import im.vector.riotredesign.BuildConfig
import im.vector.riotredesign.R import im.vector.riotredesign.R
import im.vector.riotredesign.core.utils.toast import im.vector.riotredesign.core.utils.toast
import im.vector.riotredesign.features.configuration.VectorConfiguration
import im.vector.riotredesign.features.rageshake.BugReportActivity import im.vector.riotredesign.features.rageshake.BugReportActivity
import im.vector.riotredesign.features.rageshake.BugReporter import im.vector.riotredesign.features.rageshake.BugReporter
import im.vector.riotredesign.features.rageshake.RageShake import im.vector.riotredesign.features.rageshake.RageShake
import im.vector.riotredesign.features.themes.ThemeUtils import im.vector.riotredesign.features.themes.ThemeUtils
import im.vector.riotredesign.receivers.DebugReceiver import im.vector.riotredesign.receivers.DebugReceiver
import im.vector.ui.themes.ActivityOtherThemes import im.vector.riotredesign.features.themes.ActivityOtherThemes
import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable import io.reactivex.disposables.Disposable
import org.koin.android.ext.android.inject
import timber.log.Timber import timber.log.Timber




@ -58,6 +63,10 @@ abstract class VectorBaseActivity : BaseMvRxActivity() {
* DATA * DATA
* ========================================================================================== */ * ========================================================================================== */


private val vectorConfiguration: VectorConfiguration by inject()

private lateinit var configurationViewModel: ConfigurationViewModel

private var unBinder: Unbinder? = null private var unBinder: Unbinder? = null


private var savedInstanceState: Bundle? = null private var savedInstanceState: Bundle? = null
@ -70,6 +79,10 @@ abstract class VectorBaseActivity : BaseMvRxActivity() {


private var rageShake: RageShake? = null private var rageShake: RageShake? = null


override fun attachBaseContext(base: Context) {
super.attachBaseContext(vectorConfiguration.getLocalisedContext(base))
}

override fun onSaveInstanceState(outState: Bundle) { override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState) super.onSaveInstanceState(outState)
restorables.forEach { it.onSaveInstanceState(outState) } restorables.forEach { it.onSaveInstanceState(outState) }
@ -95,6 +108,16 @@ abstract class VectorBaseActivity : BaseMvRxActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)


configurationViewModel = ViewModelProviders.of(this).get(ConfigurationViewModel::class.java)

configurationViewModel.activityRestarter.observe(this, Observer {
if (!it.hasBeenHandled) {
// Recreate the Activity because configuration has changed
startActivity(intent)
finish()
}
})

// Shake detector // Shake detector
rageShake = RageShake(this) rageShake = RageShake(this)


@ -136,6 +159,8 @@ abstract class VectorBaseActivity : BaseMvRxActivity() {


Timber.d("onResume Activity ${this.javaClass.simpleName}") Timber.d("onResume Activity ${this.javaClass.simpleName}")


configurationViewModel.onActivityResumed()

if (this !is BugReportActivity) { if (this !is BugReportActivity) {
rageShake?.start() rageShake?.start()
} }

View File

@ -0,0 +1,146 @@
/*
* Copyright 2019 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.riotredesign.features.configuration

import android.annotation.SuppressLint
import android.content.Context
import android.content.res.Configuration
import android.os.Build
import im.vector.riotredesign.features.settings.FontScale
import im.vector.riotredesign.features.settings.VectorLocale
import im.vector.riotredesign.features.themes.ThemeUtils
import timber.log.Timber
import java.util.*

/**
* Handle locale configuration change, such as theme, font size and locale chosen by the user
*/
class VectorConfiguration(private val context: Context) {

// TODO Import mLanguageReceiver From Riot?
fun onConfigurationChanged(newConfig: Configuration?) {
if (Locale.getDefault().toString() != VectorLocale.applicationLocale.toString()) {
Timber.v("## onConfigurationChanged() : the locale has been updated to " + Locale.getDefault().toString()
+ ", restore the expected value " + VectorLocale.applicationLocale.toString())
updateApplicationSettings(VectorLocale.applicationLocale,
FontScale.getFontScalePrefValue(context),
ThemeUtils.getApplicationTheme(context))
}
}


private fun updateApplicationSettings(locale: Locale, textSize: String, theme: String) {
VectorLocale.saveApplicationLocale(context, locale)
FontScale.saveFontScale(context, textSize)
Locale.setDefault(locale)

val config = Configuration(context.resources.configuration)
config.locale = locale
config.fontScale = FontScale.getFontScale(context)
context.resources.updateConfiguration(config, context.resources.displayMetrics)

ThemeUtils.setApplicationTheme(context, theme)
// TODO PhoneNumberUtils.onLocaleUpdate()
}

/**
* Update the application theme
*
* @param theme the new theme
*/
fun updateApplicationTheme(theme: String) {
ThemeUtils.setApplicationTheme(context, theme)
updateApplicationSettings(VectorLocale.applicationLocale,
FontScale.getFontScalePrefValue(context),
theme)
}

/**
* Init the configuration from the saved one
*/
fun initConfiguration() {
VectorLocale.init(context)

val locale = VectorLocale.applicationLocale
val fontScale = FontScale.getFontScale(context)
val theme = ThemeUtils.getApplicationTheme(context)

Locale.setDefault(locale)
val config = Configuration(context.resources.configuration)
config.locale = locale
config.fontScale = fontScale
context.resources.updateConfiguration(config, context.resources.displayMetrics)

// init the theme
ThemeUtils.setApplicationTheme(context, theme)
}

/**
* Update the application locale
*
* @param locale
*/
// TODO Call from LanguagePickerActivity
fun updateApplicationLocale(locale: Locale) {
updateApplicationSettings(locale, FontScale.getFontScalePrefValue(context), ThemeUtils.getApplicationTheme(context))
}

/**
* Compute a localised context
*
* @param context the context
* @return the localised context
*/
@SuppressLint("NewApi")
fun getLocalisedContext(context: Context): Context {
try {
val resources = context.resources
val locale = VectorLocale.applicationLocale
val configuration = resources.configuration
configuration.fontScale = FontScale.getFontScale(context)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
configuration.setLocale(locale)
configuration.setLayoutDirection(locale)
return context.createConfigurationContext(configuration)
} else {
configuration.locale = locale
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
configuration.setLayoutDirection(locale)
}
resources.updateConfiguration(configuration, resources.displayMetrics)
return context
}
} catch (e: Exception) {
Timber.e(e, "## getLocalisedContext() failed")
}

return context
}

/**
* Compute the locale status value
* @param activity the activity
* @return the local status value
*/
// TODO Create data class for this
fun getHash(): String {
return (VectorLocale.applicationLocale.toString()
+ "_" + FontScale.getFontScalePrefValue(context)
+ "_" + ThemeUtils.getApplicationTheme(context))
}
}

View File

@ -45,9 +45,9 @@ object AvatarRenderer {
private const val THUMBNAIL_SIZE = 250 private const val THUMBNAIL_SIZE = 250


private val AVATAR_COLOR_LIST = listOf( private val AVATAR_COLOR_LIST = listOf(
R.color.avatar_color_1, R.color.riotx_avatar_fill_1,
R.color.avatar_color_2, R.color.riotx_avatar_fill_2,
R.color.avatar_color_3 R.color.riotx_avatar_fill_3
) )


@UiThread @UiThread
@ -118,33 +118,4 @@ object AvatarRenderer {
.load(resolvedUrl) .load(resolvedUrl)
.apply(RequestOptions.circleCropTransform()) .apply(RequestOptions.circleCropTransform())
} }


//Based on riot-web implementation
@ColorRes
fun getColorFromUserId(sender: String): Int {
var hash = 0
var i = 0
var chr: Char
if (sender.isEmpty()) {
return R.color.username_1
}
while (i < sender.length) {
chr = sender[i]
hash = (hash shl 5) - hash + chr.toInt()
hash = hash or 0
i++
}
val cI = Math.abs(hash) % 8 + 1
return when (cI) {
1 -> R.color.username_1
2 -> R.color.username_2
3 -> R.color.username_3
4 -> R.color.username_4
5 -> R.color.username_5
6 -> R.color.username_6
7 -> R.color.username_7
else -> R.color.username_8
}
}
} }

View File

@ -56,5 +56,10 @@ class HomeDrawerFragment : VectorBaseFragment() {
homeDrawerHeaderSettingsView.setOnClickListener { homeDrawerHeaderSettingsView.setOnClickListener {
navigator.openSettings() navigator.openSettings()
} }

// Debug menu
homeDrawerHeaderDebugView.setOnClickListener {
navigator.openDebug()
}
} }
} }

View File

@ -0,0 +1,49 @@
/*
* Copyright 2019 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.riotredesign.features.home

import androidx.annotation.ColorRes
import im.vector.riotredesign.R


@ColorRes
fun getColorFromUserId(userId: String?): Int {
if (userId.isNullOrBlank()) {
return R.color.riotx_username_1
}

var hash = 0
var i = 0
var chr: Char

while (i < userId.length) {
chr = userId[i]
hash = (hash shl 5) - hash + chr.toInt()
i++
}

return when (Math.abs(hash) % 8 + 1) {
1 -> R.color.riotx_username_1
2 -> R.color.riotx_username_2
3 -> R.color.riotx_username_3
4 -> R.color.riotx_username_4
5 -> R.color.riotx_username_5
6 -> R.color.riotx_username_6
7 -> R.color.riotx_username_7
else -> R.color.riotx_username_8
}
}

View File

@ -75,6 +75,7 @@ import im.vector.riotredesign.features.command.Command
import im.vector.riotredesign.features.home.AvatarRenderer import im.vector.riotredesign.features.home.AvatarRenderer
import im.vector.riotredesign.features.home.HomeModule import im.vector.riotredesign.features.home.HomeModule
import im.vector.riotredesign.features.home.HomePermalinkHandler import im.vector.riotredesign.features.home.HomePermalinkHandler
import im.vector.riotredesign.features.home.getColorFromUserId
import im.vector.riotredesign.features.home.room.detail.composer.TextComposerActions import im.vector.riotredesign.features.home.room.detail.composer.TextComposerActions
import im.vector.riotredesign.features.home.room.detail.composer.TextComposerView import im.vector.riotredesign.features.home.room.detail.composer.TextComposerView
import im.vector.riotredesign.features.home.room.detail.composer.TextComposerViewModel import im.vector.riotredesign.features.home.room.detail.composer.TextComposerViewModel
@ -223,8 +224,7 @@ class RoomDetailFragment :
//switch to expanded bar //switch to expanded bar
composerLayout.composerRelatedMessageTitle.apply { composerLayout.composerRelatedMessageTitle.apply {
text = event.senderName text = event.senderName
setTextColor(ContextCompat.getColor(requireContext(), AvatarRenderer.getColorFromUserId(event.root.sender setTextColor(ContextCompat.getColor(requireContext(), getColorFromUserId(event.root.sender)))
?: "")))
} }


//TODO this is used at several places, find way to refactor? //TODO this is used at several places, find way to refactor?

View File

@ -16,6 +16,8 @@
package im.vector.riotredesign.features.home.room.detail.timeline.action package im.vector.riotredesign.features.home.room.detail.timeline.action


import android.os.Bundle import android.os.Bundle
import android.os.Parcelable
import com.airbnb.mvrx.MvRx
import com.airbnb.mvrx.MvRxView import com.airbnb.mvrx.MvRxView
import com.airbnb.mvrx.MvRxViewModelStore import com.airbnb.mvrx.MvRxViewModelStore
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
@ -51,6 +53,10 @@ abstract class BaseMvRxBottomSheetDialog : BottomSheetDialogFragment(), MvRxView
// subscribe to a ViewModel. // subscribe to a ViewModel.
postInvalidate() postInvalidate()
} }

protected fun setArguments(args: Parcelable? = null) {
arguments = args?.let { Bundle().apply { putParcelable(MvRx.KEY_ARG, it) } }
}
} }


private const val PERSISTED_VIEW_ID_KEY = "mvrx:bottomsheet_persisted_view_id" private const val PERSISTED_VIEW_ID_KEY = "mvrx:bottomsheet_persisted_view_id"

View File

@ -144,15 +144,15 @@ class MessageActionsBottomSheet : BaseMvRxBottomSheetDialog() {


companion object { companion object {
fun newInstance(roomId: String, informationData: MessageInformationData): MessageActionsBottomSheet { fun newInstance(roomId: String, informationData: MessageInformationData): MessageActionsBottomSheet {
val args = Bundle() return MessageActionsBottomSheet().apply {
val parcelableArgs = ParcelableArgs( setArguments(
informationData.eventId, ParcelableArgs(
roomId, informationData.eventId,
informationData roomId,
) informationData
args.putParcelable(MvRx.KEY_ARG, parcelableArgs) )
return MessageActionsBottomSheet().apply { arguments = args } )

}
} }
} }
} }

View File

@ -41,6 +41,7 @@ import im.vector.riotredesign.core.resources.ColorProvider
import im.vector.riotredesign.core.resources.StringProvider import im.vector.riotredesign.core.resources.StringProvider
import im.vector.riotredesign.core.utils.DebouncedClickListener import im.vector.riotredesign.core.utils.DebouncedClickListener
import im.vector.riotredesign.features.home.AvatarRenderer import im.vector.riotredesign.features.home.AvatarRenderer
import im.vector.riotredesign.features.home.getColorFromUserId
import im.vector.riotredesign.features.home.room.detail.timeline.TimelineEventController import im.vector.riotredesign.features.home.room.detail.timeline.TimelineEventController
import im.vector.riotredesign.features.home.room.detail.timeline.helper.TimelineDateFormatter import im.vector.riotredesign.features.home.room.detail.timeline.helper.TimelineDateFormatter
import im.vector.riotredesign.features.home.room.detail.timeline.helper.TimelineMediaSizeProvider import im.vector.riotredesign.features.home.room.detail.timeline.helper.TimelineMediaSizeProvider
@ -79,7 +80,7 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
val avatarUrl = event.senderAvatar val avatarUrl = event.senderAvatar
val memberName = event.senderName ?: event.root.sender ?: "" val memberName = event.senderName ?: event.root.sender ?: ""
val formattedMemberName = span(memberName) { val formattedMemberName = span(memberName) {
textColor = colorProvider.getColor(AvatarRenderer.getColorFromUserId(event.root.sender textColor = colorProvider.getColor(getColorFromUserId(event.root.sender
?: "")) ?: ""))
} }
val hasBeenEdited = event.annotations?.editSummary != null val hasBeenEdited = event.annotations?.editSummary != null
@ -135,7 +136,8 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
} }
} }


private fun buildAudioMessageItem(messageContent: MessageAudioContent, informationData: MessageInformationData, private fun buildAudioMessageItem(messageContent: MessageAudioContent,
informationData: MessageInformationData,
callback: TimelineEventController.Callback?): MessageFileItem? { callback: TimelineEventController.Callback?): MessageFileItem? {
return MessageFileItem_() return MessageFileItem_()
.informationData(informationData) .informationData(informationData)
@ -164,7 +166,8 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
} }
} }


private fun buildFileMessageItem(messageContent: MessageFileContent, informationData: MessageInformationData, private fun buildFileMessageItem(messageContent: MessageFileContent,
informationData: MessageInformationData,
callback: TimelineEventController.Callback?): MessageFileItem? { callback: TimelineEventController.Callback?): MessageFileItem? {
return MessageFileItem_() return MessageFileItem_()
.informationData(informationData) .informationData(informationData)
@ -198,7 +201,8 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
return DefaultItem_().text(text) return DefaultItem_().text(text)
} }


private fun buildImageMessageItem(messageContent: MessageImageContent, informationData: MessageInformationData, private fun buildImageMessageItem(messageContent: MessageImageContent,
informationData: MessageInformationData,
callback: TimelineEventController.Callback?): MessageImageVideoItem? { callback: TimelineEventController.Callback?): MessageImageVideoItem? {


val (maxWidth, maxHeight) = timelineMediaSizeProvider.getMaxSize() val (maxWidth, maxHeight) = timelineMediaSizeProvider.getMaxSize()
@ -233,14 +237,14 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
DebouncedClickListener(View.OnClickListener { view -> DebouncedClickListener(View.OnClickListener { view ->
callback?.onEventCellClicked(informationData, messageContent, view) callback?.onEventCellClicked(informationData, messageContent, view)
})) }))

.longClickListener { view -> .longClickListener { view ->
return@longClickListener callback?.onEventLongClicked(informationData, messageContent, view) return@longClickListener callback?.onEventLongClicked(informationData, messageContent, view)
?: false ?: false
} }
} }


private fun buildVideoMessageItem(messageContent: MessageVideoContent, informationData: MessageInformationData, private fun buildVideoMessageItem(messageContent: MessageVideoContent,
informationData: MessageInformationData,
callback: TimelineEventController.Callback?): MessageImageVideoItem? { callback: TimelineEventController.Callback?): MessageImageVideoItem? {


val (maxWidth, maxHeight) = timelineMediaSizeProvider.getMaxSize() val (maxWidth, maxHeight) = timelineMediaSizeProvider.getMaxSize()
@ -283,7 +287,8 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
} }
} }


private fun buildTextMessageItem(sendState: SendState, messageContent: MessageTextContent, private fun buildTextMessageItem(sendState: SendState,
messageContent: MessageTextContent,
informationData: MessageInformationData, informationData: MessageInformationData,
hasBeenEdited: Boolean, hasBeenEdited: Boolean,
editSummary: EditAggregatedSummary?, editSummary: EditAggregatedSummary?,
@ -335,6 +340,7 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
editSummary: EditAggregatedSummary?): SpannableStringBuilder { editSummary: EditAggregatedSummary?): SpannableStringBuilder {
val spannable = SpannableStringBuilder() val spannable = SpannableStringBuilder()
spannable.append(linkifiedBody) spannable.append(linkifiedBody)
// TODO i18n
val editedSuffix = "(edited)" val editedSuffix = "(edited)"
spannable.append(" ").append(editedSuffix) spannable.append(" ").append(editedSuffix)
val color = colorProvider.getColorFromAttribute(R.attr.vctr_list_header_secondary_text_color) val color = colorProvider.getColorFromAttribute(R.attr.vctr_list_header_secondary_text_color)
@ -362,13 +368,14 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
return spannable return spannable
} }


private fun buildNoticeMessageItem(messageContent: MessageNoticeContent, informationData: MessageInformationData, private fun buildNoticeMessageItem(messageContent: MessageNoticeContent,
informationData: MessageInformationData,
callback: TimelineEventController.Callback?): MessageTextItem? { callback: TimelineEventController.Callback?): MessageTextItem? {


val message = messageContent.body.let { val message = messageContent.body.let {
val formattedBody = span { val formattedBody = span {
text = it text = it
textColor = colorProvider.getColor(R.color.slate_grey) textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
textStyle = "italic" textStyle = "italic"
} }
linkifyBody(formattedBody, callback) linkifyBody(formattedBody, callback)
@ -395,7 +402,8 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
} }
} }


private fun buildEmoteMessageItem(messageContent: MessageEmoteContent, informationData: MessageInformationData, private fun buildEmoteMessageItem(messageContent: MessageEmoteContent,
informationData: MessageInformationData,
hasBeenEdited: Boolean, hasBeenEdited: Boolean,
editSummary: EditAggregatedSummary?, editSummary: EditAggregatedSummary?,
callback: TimelineEventController.Callback?): MessageTextItem? { callback: TimelineEventController.Callback?): MessageTextItem? {
@ -433,7 +441,8 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
} }
} }


private fun buildRedactedItem(informationData: MessageInformationData, callback: TimelineEventController.Callback?): RedactedMessageItem? { private fun buildRedactedItem(informationData: MessageInformationData,
callback: TimelineEventController.Callback?): RedactedMessageItem? {
return RedactedMessageItem_() return RedactedMessageItem_()
.informationData(informationData) .informationData(informationData)
.avatarClickListener( .avatarClickListener(
@ -456,32 +465,4 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
VectorLinkify.addLinks(spannable, true) VectorLinkify.addLinks(spannable, true)
return spannable return spannable
} }

//Based on riot-web implementation
@ColorRes
private fun getColorFor(sender: String): Int {
var hash = 0
var i = 0
var chr: Char
if (sender.isEmpty()) {
return R.color.username_1
}
while (i < sender.length) {
chr = sender[i]
hash = (hash shl 5) - hash + chr.toInt()
hash = hash or 0
i++
}
val cI = Math.abs(hash) % 8 + 1
return when (cI) {
1 -> R.color.username_1
2 -> R.color.username_2
3 -> R.color.username_3
4 -> R.color.username_4
5 -> R.color.username_5
6 -> R.color.username_6
7 -> R.color.username_7
else -> R.color.username_8
}
}
} }

View File

@ -21,6 +21,7 @@ import im.vector.matrix.android.api.session.room.timeline.TimelineEvent
import im.vector.riotredesign.core.epoxy.EmptyItem_ import im.vector.riotredesign.core.epoxy.EmptyItem_
import im.vector.riotredesign.core.epoxy.VectorEpoxyModel import im.vector.riotredesign.core.epoxy.VectorEpoxyModel
import im.vector.riotredesign.features.home.room.detail.timeline.TimelineEventController import im.vector.riotredesign.features.home.room.detail.timeline.TimelineEventController
import timber.log.Timber


class TimelineItemFactory(private val messageItemFactory: MessageItemFactory, class TimelineItemFactory(private val messageItemFactory: MessageItemFactory,
private val noticeItemFactory: NoticeItemFactory, private val noticeItemFactory: NoticeItemFactory,
@ -32,8 +33,10 @@ class TimelineItemFactory(private val messageItemFactory: MessageItemFactory,


val computedModel = try { val computedModel = try {
when (event.root.type) { when (event.root.type) {
// Message
EventType.MESSAGE -> messageItemFactory.create(event, nextEvent, callback) EventType.MESSAGE -> messageItemFactory.create(event, nextEvent, callback)


// State and call
EventType.STATE_ROOM_NAME, EventType.STATE_ROOM_NAME,
EventType.STATE_ROOM_TOPIC, EventType.STATE_ROOM_TOPIC,
EventType.STATE_ROOM_MEMBER, EventType.STATE_ROOM_MEMBER,
@ -42,12 +45,16 @@ class TimelineItemFactory(private val messageItemFactory: MessageItemFactory,
EventType.CALL_HANGUP, EventType.CALL_HANGUP,
EventType.CALL_ANSWER -> noticeItemFactory.create(event) EventType.CALL_ANSWER -> noticeItemFactory.create(event)


// Unhandled event types (yet)
EventType.ENCRYPTED, EventType.ENCRYPTED,
EventType.ENCRYPTION, EventType.ENCRYPTION,
EventType.STATE_ROOM_THIRD_PARTY_INVITE, EventType.STATE_ROOM_THIRD_PARTY_INVITE,
EventType.STICKER, EventType.STICKER,
EventType.STATE_ROOM_CREATE -> defaultItemFactory.create(event) EventType.STATE_ROOM_CREATE -> defaultItemFactory.create(event)
else -> null else -> {
Timber.w("Ignored event (type: ${event.root.type}")
null
}
} }
} catch (e: Exception) { } catch (e: Exception) {
defaultItemFactory.create(event, e) defaultItemFactory.create(event, e)

View File

@ -40,6 +40,6 @@ abstract class DefaultItem : BaseEventItem<DefaultItem.Holder>() {
} }


companion object { companion object {
private val STUB_ID = R.id.messageContentDefaultStub private const val STUB_ID = R.id.messageContentDefaultStub
} }
} }

View File

@ -57,6 +57,6 @@ abstract class NoticeItem : BaseEventItem<NoticeItem.Holder>() {
} }


companion object { companion object {
private val STUB_ID = R.id.messageContentNoticeStub private const val STUB_ID = R.id.messageContentNoticeStub
} }
} }

View File

@ -25,6 +25,7 @@ import com.airbnb.epoxy.EpoxyModelClass
import im.vector.riotredesign.R import im.vector.riotredesign.R
import im.vector.riotredesign.core.epoxy.VectorEpoxyHolder import im.vector.riotredesign.core.epoxy.VectorEpoxyHolder
import im.vector.riotredesign.core.epoxy.VectorEpoxyModel import im.vector.riotredesign.core.epoxy.VectorEpoxyModel
import im.vector.riotredesign.features.themes.ThemeUtils


@EpoxyModelClass(layout = R.layout.item_room_category) @EpoxyModelClass(layout = R.layout.item_room_category)
abstract class RoomCategoryItem : VectorEpoxyModel<RoomCategoryItem.Holder>() { abstract class RoomCategoryItem : VectorEpoxyModel<RoomCategoryItem.Holder>() {
@ -36,7 +37,7 @@ abstract class RoomCategoryItem : VectorEpoxyModel<RoomCategoryItem.Holder>() {
@EpoxyAttribute var listener: (() -> Unit)? = null @EpoxyAttribute var listener: (() -> Unit)? = null


override fun bind(holder: Holder) { override fun bind(holder: Holder) {
val tintColor = ContextCompat.getColor(holder.rootView.context, R.color.bluey_grey_two) val tintColor = ThemeUtils.getColor(holder.rootView.context, R.attr.riotx_text_secondary)
val expandedArrowDrawableRes = if (expanded) R.drawable.ic_expand_more_white else R.drawable.ic_expand_less_white val expandedArrowDrawableRes = if (expanded) R.drawable.ic_expand_more_white else R.drawable.ic_expand_less_white
val expandedArrowDrawable = ContextCompat.getDrawable(holder.rootView.context, expandedArrowDrawableRes)?.also { val expandedArrowDrawable = ContextCompat.getDrawable(holder.rootView.context, expandedArrowDrawableRes)?.also {
DrawableCompat.setTint(it, tintColor) DrawableCompat.setTint(it, tintColor)

View File

@ -16,7 +16,6 @@


package im.vector.riotredesign.features.home.room.list package im.vector.riotredesign.features.home.room.list


import android.animation.Animator
import android.os.Bundle import android.os.Bundle
import android.os.Parcelable import android.os.Parcelable
import androidx.annotation.StringRes import androidx.annotation.StringRes
@ -25,18 +24,16 @@ import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.airbnb.mvrx.* import com.airbnb.mvrx.*
import com.google.android.material.floatingactionbutton.FloatingActionButton
import im.vector.matrix.android.api.failure.Failure import im.vector.matrix.android.api.failure.Failure
import im.vector.matrix.android.api.session.room.model.Membership import im.vector.matrix.android.api.session.room.model.Membership
import im.vector.matrix.android.api.session.room.model.RoomSummary import im.vector.matrix.android.api.session.room.model.RoomSummary
import im.vector.riotredesign.R import im.vector.riotredesign.R
import im.vector.riotredesign.core.animations.ANIMATION_DURATION_SHORT
import im.vector.riotredesign.core.animations.SimpleAnimatorListener
import im.vector.riotredesign.core.epoxy.LayoutManagerStateRestorer import im.vector.riotredesign.core.epoxy.LayoutManagerStateRestorer
import im.vector.riotredesign.core.extensions.observeEvent import im.vector.riotredesign.core.extensions.observeEvent
import im.vector.riotredesign.core.platform.OnBackPressed import im.vector.riotredesign.core.platform.OnBackPressed
import im.vector.riotredesign.core.platform.StateView import im.vector.riotredesign.core.platform.StateView
import im.vector.riotredesign.core.platform.VectorBaseFragment import im.vector.riotredesign.core.platform.VectorBaseFragment
import im.vector.riotredesign.features.home.room.list.widget.FabMenuView
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
import kotlinx.android.synthetic.main.fragment_room_list.* import kotlinx.android.synthetic.main.fragment_room_list.*
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
@ -47,11 +44,7 @@ data class RoomListParams(
) : Parcelable ) : Parcelable




class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, OnBackPressed { class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, OnBackPressed, FabMenuView.Listener {

lateinit var fabButton: FloatingActionButton

private var isFabMenuOpened = false


enum class DisplayMode(@StringRes val titleRes: Int) { enum class DisplayMode(@StringRes val titleRes: Int) {
HOME(R.string.bottom_action_home), HOME(R.string.bottom_action_home),
@ -82,21 +75,16 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, O
navigator.openRoom(it) navigator.openRoom(it)
} }


isFabMenuOpened = false createChatFabMenu.listener = this
} }


private fun setupCreateRoomButton() { private fun setupCreateRoomButton() {
fabButton = when (roomListParams.displayMode) { when (roomListParams.displayMode) {
DisplayMode.HOME -> createRoomButton DisplayMode.HOME -> createChatFabMenu.isVisible = true
DisplayMode.PEOPLE -> createChatRoomButton DisplayMode.PEOPLE -> createChatRoomButton.isVisible = true
else -> createGroupRoomButton else -> createGroupRoomButton.isVisible = true
} }


fabButton.isVisible = true

createRoomButton.setOnClickListener {
toggleFabMenu()
}
createChatRoomButton.setOnClickListener { createChatRoomButton.setOnClickListener {
createDirectChat() createDirectChat()
} }
@ -104,93 +92,34 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, O
openRoomDirectory() openRoomDirectory()
} }


createRoomItemChat.setOnClickListener {
toggleFabMenu()
createDirectChat()
}
createRoomItemGroup.setOnClickListener {
toggleFabMenu()
openRoomDirectory()
}

createRoomTouchGuard.setOnClickListener {
toggleFabMenu()
}

createRoomTouchGuard.isClickable = false

// Hide FAB when list is scrolling // Hide FAB when list is scrolling
epoxyRecyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() { epoxyRecyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
fabButton.removeCallbacks(showFabRunnable) createChatFabMenu.removeCallbacks(showFabRunnable)


when (newState) { when (newState) {
RecyclerView.SCROLL_STATE_IDLE -> { RecyclerView.SCROLL_STATE_IDLE -> {
fabButton.postDelayed(showFabRunnable, 1000) createChatFabMenu.postDelayed(showFabRunnable, 1000)
} }
RecyclerView.SCROLL_STATE_DRAGGING, RecyclerView.SCROLL_STATE_DRAGGING,
RecyclerView.SCROLL_STATE_SETTLING -> { RecyclerView.SCROLL_STATE_SETTLING -> {
fabButton.hide() when (roomListParams.displayMode) {
DisplayMode.HOME -> createChatFabMenu.hide()
DisplayMode.PEOPLE -> createChatRoomButton.hide()
else -> createGroupRoomButton.hide()
}
} }
} }
} }
}) })
} }


private fun toggleFabMenu() {
isFabMenuOpened = !isFabMenuOpened


if (isFabMenuOpened) { override fun openRoomDirectory() {
createRoomItemChat.isVisible = true
createRoomItemGroup.isVisible = true

createRoomButton.animate()
.setDuration(ANIMATION_DURATION_SHORT)
.rotation(135f)
createRoomItemChat.animate()
.setDuration(ANIMATION_DURATION_SHORT)
.translationY(-resources.getDimension(R.dimen.fab_menu_offset_1))
createRoomItemGroup.animate()
.setDuration(ANIMATION_DURATION_SHORT)
.translationY(-resources.getDimension(R.dimen.fab_menu_offset_2))
createRoomTouchGuard.animate()
.setDuration(ANIMATION_DURATION_SHORT)
.alpha(0.6f)
.setListener(null)
createRoomTouchGuard.isClickable = true
} else {
createRoomButton.animate()
.setDuration(ANIMATION_DURATION_SHORT)
.rotation(0f)
createRoomItemChat.animate()
.setDuration(ANIMATION_DURATION_SHORT)
.translationY(0f)
createRoomItemGroup.animate()
.setDuration(ANIMATION_DURATION_SHORT)
.translationY(0f)
createRoomTouchGuard.animate()
.setDuration(ANIMATION_DURATION_SHORT)
.alpha(0f)
.setListener(object : SimpleAnimatorListener() {
override fun onAnimationCancel(animation: Animator?) {
animation?.removeListener(this)
}

override fun onAnimationEnd(animation: Animator?) {
// Use isFabMenuOpened because it may have been open meanwhile
createRoomItemChat.isVisible = isFabMenuOpened
createRoomItemGroup.isVisible = isFabMenuOpened
}
})
createRoomTouchGuard.isClickable = false
}
}

private fun openRoomDirectory() {
navigator.openRoomDirectory() navigator.openRoomDirectory()
} }


private fun createDirectChat() { override fun createDirectChat() {
vectorBaseActivity.notImplemented("creating direct chat") vectorBaseActivity.notImplemented("creating direct chat")
} }


@ -206,7 +135,13 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, O
} }


private val showFabRunnable = Runnable { private val showFabRunnable = Runnable {
fabButton.show() if (isAdded) {
when (roomListParams.displayMode) {
DisplayMode.HOME -> createChatFabMenu.show()
DisplayMode.PEOPLE -> createChatRoomButton.show()
else -> createGroupRoomButton.show()
}
}
} }


private fun renderState(state: RoomListViewState) { private fun renderState(state: RoomListViewState) {
@ -278,8 +213,7 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, O
} }


override fun onBackPressed(): Boolean { override fun onBackPressed(): Boolean {
if (isFabMenuOpened) { if (createChatFabMenu.onBackPressed()) {
toggleFabMenu()
return true return true
} }



View File

@ -20,6 +20,7 @@ import android.util.AttributeSet
import android.view.View import android.view.View
import androidx.appcompat.widget.AppCompatTextView import androidx.appcompat.widget.AppCompatTextView
import im.vector.riotredesign.R import im.vector.riotredesign.R
import im.vector.riotredesign.features.themes.ThemeUtils


class UnreadCounterBadgeView : AppCompatTextView { class UnreadCounterBadgeView : AppCompatTextView {


@ -37,7 +38,7 @@ class UnreadCounterBadgeView : AppCompatTextView {
val bgRes = if (state.highlighted) { val bgRes = if (state.highlighted) {
R.drawable.bg_unread_highlight R.drawable.bg_unread_highlight
} else { } else {
R.drawable.bg_unread_notification ThemeUtils.getResourceId(context, R.drawable.bg_unread_notification_light)
} }
setBackgroundResource(bgRes) setBackgroundResource(bgRes)
text = RoomSummaryFormatter.formatUnreadMessagesCounter(state.count) text = RoomSummaryFormatter.formatUnreadMessagesCounter(state.count)

View File

@ -0,0 +1,166 @@
/*
* Copyright 2019 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.riotredesign.features.home.room.list.widget

import android.content.Context
import android.util.AttributeSet
import android.view.ViewGroup
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.view.isVisible
import androidx.transition.ChangeTransform
import androidx.transition.Transition
import androidx.transition.TransitionManager
import im.vector.riotredesign.R
import im.vector.riotredesign.core.animations.ANIMATION_DURATION_SHORT
import im.vector.riotredesign.core.animations.SimpleTransitionListener
import im.vector.riotredesign.core.animations.VectorFullTransitionSet
import im.vector.riotredesign.features.themes.ThemeUtils
import kotlinx.android.synthetic.main.merge_fab_menu_view.view.*

class FabMenuView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null,
defStyleAttr: Int = 0) : ConstraintLayout(context, attrs, defStyleAttr) {

var listener: Listener? = null

private var isFabMenuOpened = false

init {
inflate(context, R.layout.merge_fab_menu_view, this)
}

override fun onFinishInflate() {
super.onFinishInflate()

// Collapse
ConstraintSet().also {
it.clone(context, R.layout.constraint_set_fab_menu_close)
it.applyTo(this)
}

createRoomItemChat.isVisible = false
createRoomItemChatLabel.isVisible = false
createRoomItemGroup.isVisible = false
createRoomItemGroupLabel.isVisible = false
// Collapse end

// Tint label background
listOf(createRoomItemChatLabel, createRoomItemGroupLabel)
.forEach {
it.setBackgroundResource(ThemeUtils.getResourceId(context, R.drawable.vector_label_background_light))
}

createRoomButton.setOnClickListener {
toggleFabMenu()
}

listOf(createRoomItemChat, createRoomItemChatLabel)
.forEach {
it.setOnClickListener {
closeFabMenu()
listener?.createDirectChat()
}
}
listOf(createRoomItemGroup, createRoomItemGroupLabel)
.forEach {
it.setOnClickListener {
closeFabMenu()
listener?.openRoomDirectory()
}
}

createRoomTouchGuard.setOnClickListener {
closeFabMenu()
}
}

fun show() {
createRoomButton.show()
}

fun hide() {
createRoomButton.hide()
}

private fun openFabMenu() {
if (isFabMenuOpened) {
return
}

toggleFabMenu()
}

private fun closeFabMenu() {
if (!isFabMenuOpened) {
return
}

toggleFabMenu()
}

private fun toggleFabMenu() {
isFabMenuOpened = !isFabMenuOpened

TransitionManager.beginDelayedTransition(parent as? ViewGroup ?: this,
VectorFullTransitionSet().apply {
duration = ANIMATION_DURATION_SHORT
ChangeTransform()
addListener(object : SimpleTransitionListener() {
override fun onTransitionEnd(transition: Transition) {
// Hide the view after the transition for a better visual effect
createRoomItemChat.isVisible = isFabMenuOpened
createRoomItemChatLabel.isVisible = isFabMenuOpened
createRoomItemGroup.isVisible = isFabMenuOpened
createRoomItemGroupLabel.isVisible = isFabMenuOpened
}
})
})

if (isFabMenuOpened) {
// Animate manually the rotation for a better effect
createRoomButton.animate().setDuration(ANIMATION_DURATION_SHORT).rotation(135f)


ConstraintSet().also {
it.clone(context, R.layout.constraint_set_fab_menu_open)
it.applyTo(this)
}
} else {
createRoomButton.animate().setDuration(ANIMATION_DURATION_SHORT).rotation(0f)

ConstraintSet().also {
it.clone(context, R.layout.constraint_set_fab_menu_close)
it.applyTo(this)
}
}
}

fun onBackPressed(): Boolean {
if (isFabMenuOpened) {
closeFabMenu()
return true
}

return false
}

interface Listener {
fun createDirectChat()
fun openRoomDirectory()
}

}

View File

@ -29,6 +29,7 @@ import im.vector.matrix.android.api.auth.data.HomeServerConnectionConfig
import im.vector.matrix.android.api.session.Session import im.vector.matrix.android.api.session.Session
import im.vector.matrix.android.api.session.sync.FilterService import im.vector.matrix.android.api.session.sync.FilterService
import im.vector.riotredesign.R import im.vector.riotredesign.R
import im.vector.riotredesign.core.extensions.showPassword
import im.vector.riotredesign.core.platform.VectorBaseActivity import im.vector.riotredesign.core.platform.VectorBaseActivity
import im.vector.riotredesign.features.home.HomeActivity import im.vector.riotredesign.features.home.HomeActivity
import io.reactivex.Observable import io.reactivex.Observable
@ -44,14 +45,20 @@ class LoginActivity : VectorBaseActivity() {


private val authenticator = Matrix.getInstance().authenticator() private val authenticator = Matrix.getInstance().authenticator()


private var passwordShown = false

override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_login) setContentView(R.layout.activity_login)
setupAuthButton() setupAuthButton()
setupPasswordReveal()
homeServerField.setText(DEFAULT_HOME_SERVER_URI) homeServerField.setText(DEFAULT_HOME_SERVER_URI)
} }


private fun authenticate() { private fun authenticate() {
passwordShown = false
renderPasswordField()

val login = loginField.text?.trim().toString() val login = loginField.text?.trim().toString()
val password = passwordField.text?.trim().toString() val password = passwordField.text?.trim().toString()
buildHomeServerConnectionConfig().fold( buildHomeServerConnectionConfig().fold(
@ -105,6 +112,24 @@ class LoginActivity : VectorBaseActivity() {
authenticateButton.setOnClickListener { authenticate() } authenticateButton.setOnClickListener { authenticate() }
} }


private fun setupPasswordReveal() {
passwordShown = false

passwordReveal.setOnClickListener {
passwordShown = !passwordShown

renderPasswordField()
}

renderPasswordField()
}

private fun renderPasswordField() {
passwordField.showPassword(passwordShown)

passwordReveal.setImageResource(if (passwordShown) R.drawable.ic_eye_closed_black else R.drawable.ic_eye_black)
}

private fun goToHome() { private fun goToHome() {
val intent = HomeActivity.newIntent(this) val intent = HomeActivity.newIntent(this)
startActivity(intent) startActivity(intent)

View File

@ -20,6 +20,7 @@ import android.app.Activity
import android.content.Intent import android.content.Intent
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import im.vector.matrix.android.api.session.room.model.roomdirectory.PublicRoom import im.vector.matrix.android.api.session.room.model.roomdirectory.PublicRoom
import im.vector.riotredesign.features.debug.DebugMenuActivity
import im.vector.riotredesign.features.home.room.detail.RoomDetailActivity import im.vector.riotredesign.features.home.room.detail.RoomDetailActivity
import im.vector.riotredesign.features.home.room.detail.RoomDetailArgs import im.vector.riotredesign.features.home.room.detail.RoomDetailArgs
import im.vector.riotredesign.features.roomdirectory.RoomDirectoryActivity import im.vector.riotredesign.features.roomdirectory.RoomDirectoryActivity
@ -50,4 +51,8 @@ class DefaultNavigator(private val fraqment: Fragment) : Navigator {
val intent = VectorSettingsActivity.getIntent(activity, "TODO") val intent = VectorSettingsActivity.getIntent(activity, "TODO")
activity.startActivity(intent) activity.startActivity(intent)
} }

override fun openDebug() {
activity.startActivity(Intent(activity, DebugMenuActivity::class.java))
}
} }

View File

@ -28,4 +28,6 @@ interface Navigator {


fun openSettings() fun openSettings()


fun openDebug()

} }

View File

@ -32,6 +32,7 @@ import im.vector.riotredesign.core.error.ErrorFormatter
import im.vector.riotredesign.core.extensions.addFragmentToBackstack import im.vector.riotredesign.core.extensions.addFragmentToBackstack
import im.vector.riotredesign.core.platform.VectorBaseFragment import im.vector.riotredesign.core.platform.VectorBaseFragment
import im.vector.riotredesign.features.roomdirectory.picker.RoomDirectoryPickerFragment import im.vector.riotredesign.features.roomdirectory.picker.RoomDirectoryPickerFragment
import im.vector.riotredesign.features.themes.ThemeUtils
import io.reactivex.rxkotlin.subscribeBy import io.reactivex.rxkotlin.subscribeBy
import kotlinx.android.synthetic.main.fragment_public_rooms.* import kotlinx.android.synthetic.main.fragment_public_rooms.*
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
@ -58,13 +59,15 @@ class PublicRoomsFragment : VectorBaseFragment(), PublicRoomsController.Callback
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)


vectorBaseActivity.setSupportActionBar(toolbar) vectorBaseActivity.setSupportActionBar(publicRoomsToolbar)


vectorBaseActivity.supportActionBar?.let { vectorBaseActivity.supportActionBar?.let {
it.setDisplayShowHomeEnabled(true) it.setDisplayShowHomeEnabled(true)
it.setDisplayHomeAsUpEnabled(true) it.setDisplayHomeAsUpEnabled(true)
} }


publicRoomsFilter.setBackgroundResource(ThemeUtils.getResourceId(requireContext(), R.drawable.bg_search_edit_text_light))

RxTextView.textChanges(publicRoomsFilter) RxTextView.textChanges(publicRoomsFilter)
.debounce(500, TimeUnit.MILLISECONDS) .debounce(500, TimeUnit.MILLISECONDS)
.subscribeBy { .subscribeBy {

View File

@ -28,7 +28,6 @@ import im.vector.riotredesign.R
import im.vector.riotredesign.core.platform.VectorBaseFragment import im.vector.riotredesign.core.platform.VectorBaseFragment
import im.vector.riotredesign.features.roomdirectory.RoomDirectoryModule import im.vector.riotredesign.features.roomdirectory.RoomDirectoryModule
import im.vector.riotredesign.features.roomdirectory.RoomDirectoryViewModel import im.vector.riotredesign.features.roomdirectory.RoomDirectoryViewModel
import kotlinx.android.synthetic.main.fragment_public_rooms.toolbar
import kotlinx.android.synthetic.main.fragment_room_directory_picker.* import kotlinx.android.synthetic.main.fragment_room_directory_picker.*
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
import org.koin.android.scope.ext.android.bindScope import org.koin.android.scope.ext.android.bindScope

View File

@ -54,6 +54,7 @@ import im.vector.riotredesign.core.preference.UserAvatarPreference
import im.vector.riotredesign.core.preference.VectorPreference import im.vector.riotredesign.core.preference.VectorPreference
import im.vector.riotredesign.core.utils.* import im.vector.riotredesign.core.utils.*
import im.vector.riotredesign.features.MainActivity import im.vector.riotredesign.features.MainActivity
import im.vector.riotredesign.features.configuration.VectorConfiguration
import im.vector.riotredesign.features.themes.ThemeUtils import im.vector.riotredesign.features.themes.ThemeUtils
import org.koin.android.ext.android.inject import org.koin.android.ext.android.inject
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
@ -99,6 +100,8 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
// used to avoid requesting to enter the password for each deletion // used to avoid requesting to enter the password for each deletion
private var mAccountPassword: String? = null private var mAccountPassword: String? = null


private val vectorConfiguration by inject<VectorConfiguration>()

// current publicised group list // current publicised group list
private var mPublicisedGroups: MutableSet<String>? = null private var mPublicisedGroups: MutableSet<String>? = null


@ -366,8 +369,10 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
findPreference(ThemeUtils.APPLICATION_THEME_KEY) findPreference(ThemeUtils.APPLICATION_THEME_KEY)
.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> .onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
if (newValue is String) { if (newValue is String) {
// TODO VectorApp.updateApplicationTheme(newValue) vectorConfiguration.updateApplicationTheme(newValue)
// Restart the Activity
activity?.let { activity?.let {
// Note: recreate does not apply the color correctly
it.startActivity(it.intent) it.startActivity(it.intent)
it.finish() it.finish()
} }
@ -1359,7 +1364,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref


if (resultCode == Activity.RESULT_OK) { if (resultCode == Activity.RESULT_OK) {
when (requestCode) { when (requestCode) {
REQUEST_CALL_RINGTONE -> { REQUEST_CALL_RINGTONE -> {
val callRingtoneUri: Uri? = data?.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI) val callRingtoneUri: Uri? = data?.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI)
val thisActivity = activity val thisActivity = activity
if (callRingtoneUri != null && thisActivity != null) { if (callRingtoneUri != null && thisActivity != null) {
@ -1368,9 +1373,9 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
} }
} }
REQUEST_E2E_FILE_REQUEST_CODE -> importKeys(data) REQUEST_E2E_FILE_REQUEST_CODE -> importKeys(data)
REQUEST_NEW_PHONE_NUMBER -> refreshPhoneNumbersList() REQUEST_NEW_PHONE_NUMBER -> refreshPhoneNumbersList()
REQUEST_PHONEBOOK_COUNTRY -> onPhonebookCountryUpdate(data) REQUEST_PHONEBOOK_COUNTRY -> onPhonebookCountryUpdate(data)
REQUEST_LOCALE -> { REQUEST_LOCALE -> {
activity?.let { activity?.let {
startActivity(it.intent) startActivity(it.intent)
it.finish() it.finish()

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */


package im.vector.ui.themes package im.vector.riotredesign.features.themes


import androidx.annotation.StyleRes import androidx.annotation.StyleRes
import im.vector.riotredesign.R import im.vector.riotredesign.R
@ -33,45 +33,4 @@ sealed class ActivityOtherThemes(@StyleRes val dark: Int,
R.style.AppTheme_Status R.style.AppTheme_Status
) )


object NoActionBarFullscreen : ActivityOtherThemes(
R.style.AppTheme_NoActionBar_FullScreen_Dark,
R.style.AppTheme_NoActionBar_FullScreen_Black,
R.style.AppTheme_NoActionBar_FullScreen_Status
)

object Home : ActivityOtherThemes(
R.style.HomeActivityTheme_Dark,
R.style.HomeActivityTheme_Black,
R.style.HomeActivityTheme_Status
)

object Group : ActivityOtherThemes(
R.style.GroupAppTheme_Dark,
R.style.GroupAppTheme_Black,
R.style.GroupAppTheme_Status
)

object Picker : ActivityOtherThemes(
R.style.CountryPickerTheme_Dark,
R.style.CountryPickerTheme_Black,
R.style.CountryPickerTheme_Status
)

object Lock : ActivityOtherThemes(
R.style.Theme_Vector_Lock_Dark,
R.style.Theme_Vector_Lock_Light,
R.style.Theme_Vector_Lock_Status
)

object Search : ActivityOtherThemes(
R.style.SearchesAppTheme_Dark,
R.style.SearchesAppTheme_Black,
R.style.SearchesAppTheme_Status
)

object Call : ActivityOtherThemes(
R.style.CallActivityTheme_Dark,
R.style.CallActivityTheme_Black,
R.style.CallActivityTheme_Status
)
} }

View File

@ -20,7 +20,6 @@ package im.vector.riotredesign.features.themes
import android.app.Activity import android.app.Activity
import android.content.Context import android.content.Context
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.text.TextUtils
import android.util.TypedValue import android.util.TypedValue
import android.view.Menu import android.view.Menu
import androidx.annotation.AttrRes import androidx.annotation.AttrRes
@ -29,7 +28,6 @@ import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.DrawableCompat import androidx.core.graphics.drawable.DrawableCompat
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import im.vector.riotredesign.R import im.vector.riotredesign.R
import im.vector.ui.themes.ActivityOtherThemes
import timber.log.Timber import timber.log.Timber
import java.util.* import java.util.*


@ -56,7 +54,7 @@ object ThemeUtils {
*/ */
fun getApplicationTheme(context: Context): String { fun getApplicationTheme(context: Context): String {
return PreferenceManager.getDefaultSharedPreferences(context) return PreferenceManager.getDefaultSharedPreferences(context)
.getString(APPLICATION_THEME_KEY, THEME_LIGHT_VALUE) .getString(APPLICATION_THEME_KEY, THEME_LIGHT_VALUE)!!
} }


/** /**
@ -65,20 +63,14 @@ object ThemeUtils {
* @param aTheme the new theme * @param aTheme the new theme
*/ */
fun setApplicationTheme(context: Context, aTheme: String) { fun setApplicationTheme(context: Context, aTheme: String) {
PreferenceManager.getDefaultSharedPreferences(context)
.edit()
.putString(APPLICATION_THEME_KEY, aTheme)
.apply()

/* TODO
when (aTheme) { when (aTheme) {
THEME_DARK_VALUE -> VectorApp.getInstance().setTheme(R.style.AppTheme_Dark) THEME_DARK_VALUE -> context.setTheme(R.style.AppTheme_Dark)
THEME_BLACK_VALUE -> VectorApp.getInstance().setTheme(R.style.AppTheme_Black) THEME_BLACK_VALUE -> context.setTheme(R.style.AppTheme_Black)
THEME_STATUS_VALUE -> VectorApp.getInstance().setTheme(R.style.AppTheme_Status) THEME_STATUS_VALUE -> context.setTheme(R.style.AppTheme_Status)
else -> VectorApp.getInstance().setTheme(R.style.AppTheme_Light) else -> context.setTheme(R.style.AppTheme_Light)
} }
*/


// Clear the cache
mColorByAttr.clear() mColorByAttr.clear()
} }


@ -89,8 +81,8 @@ object ThemeUtils {
*/ */
fun setActivityTheme(activity: Activity, otherThemes: ActivityOtherThemes) { fun setActivityTheme(activity: Activity, otherThemes: ActivityOtherThemes) {
when (getApplicationTheme(activity)) { when (getApplicationTheme(activity)) {
THEME_DARK_VALUE -> activity.setTheme(otherThemes.dark) THEME_DARK_VALUE -> activity.setTheme(otherThemes.dark)
THEME_BLACK_VALUE -> activity.setTheme(otherThemes.black) THEME_BLACK_VALUE -> activity.setTheme(otherThemes.black)
THEME_STATUS_VALUE -> activity.setTheme(otherThemes.status) THEME_STATUS_VALUE -> activity.setTheme(otherThemes.status)
} }


@ -164,7 +156,7 @@ object ThemeUtils {
try { try {
val typedValue = TypedValue() val typedValue = TypedValue()
c.theme.resolveAttribute(attribute, typedValue, true) c.theme.resolveAttribute(attribute, typedValue, true)
return typedValue return typedValue
} catch (e: Exception) { } catch (e: Exception) {
Timber.e(e, "Unable to get color") Timber.e(e, "Unable to get color")
} }
@ -175,19 +167,41 @@ object ThemeUtils {
* Get the resource Id applied to the current theme * Get the resource Id applied to the current theme
* *
* @param c the context * @param c the context
* @param resourceId the resource id * @param resourceId the resource id in the light theme
* @return the resource Id for the current theme * @return the resource Id for the current theme
*/ */
fun getResourceId(c: Context, resourceId: Int): Int { fun getResourceId(c: Context, resourceId: Int): Int {
if (TextUtils.equals(getApplicationTheme(c), THEME_LIGHT_VALUE) val theme = getApplicationTheme(c)
|| TextUtils.equals(getApplicationTheme(c), THEME_STATUS_VALUE)) {
return when (resourceId) { return when (theme) {
R.drawable.line_divider_dark -> R.drawable.line_divider_light THEME_LIGHT_VALUE -> resourceId
R.style.Floating_Actions_Menu -> R.style.Floating_Actions_Menu_Light THEME_DARK_VALUE -> {
else -> resourceId return when (resourceId) {
R.drawable.bg_search_edit_text_light -> R.drawable.bg_search_edit_text_dark
R.drawable.bg_unread_notification_light -> R.drawable.bg_unread_notification_dark
R.drawable.vector_label_background_light -> R.drawable.vector_label_background_dark
else -> {
Timber.w("Warning, missing case for wanted drawable in dark theme")
resourceId
}
}
}
THEME_BLACK_VALUE -> {
return when (resourceId) {
R.drawable.bg_search_edit_text_light -> R.drawable.bg_search_edit_text_black
R.drawable.bg_unread_notification_light -> R.drawable.bg_unread_notification_black
R.drawable.vector_label_background_light -> R.drawable.vector_label_background_black
else -> {
Timber.w("Warning, missing case for wanted drawable in black theme")
resourceId
}
}
}
else -> {
Timber.w("Warning, missing theme: $theme")
resourceId
} }
} }
return resourceId
} }


/** /**

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/black" android:state_checked="true" />
<item android:color="@color/bluey_grey_two" />

</selector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/riotx_search_background_mobile_black" />
<corners android:radius="4dp" />
</shape>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/light_blue_grey" /> <solid android:color="@color/riotx_search_background_mobile_dark" />
<corners android:radius="4dp" /> <corners android:radius="4dp" />
</shape> </shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/riotx_search_background_mobile_light" />
<corners android:radius="4dp" />
</shape>

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
<item>
<shape>
<solid android:color="@android:color/white" />
</shape>
</item>

<item android:gravity="top">
<shape android:shape="rectangle">
<size android:height="80dp" />
<!--<solid android:color="?colorPrimary" />-->
<solid android:color="@color/dark" />
</shape>
</item>
</layer-list>

View File

@ -4,5 +4,5 @@


<corners android:radius="40dp" /> <corners android:radius="40dp" />


<solid android:color="@color/rosy_pink" /> <solid android:color="@color/riotx_notice" />
</shape> </shape>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<corners android:radius="40dp" />

<solid android:color="@color/riotx_unread_room_badge_black" />
</shape>

View File

@ -5,5 +5,5 @@


<corners android:radius="40dp" /> <corners android:radius="40dp" />


<solid android:color="@color/grey_lynch" /> <solid android:color="@color/riotx_unread_room_badge_dark" />
</shape> </shape>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<corners android:radius="40dp" />

<solid android:color="@color/riotx_unread_room_badge_light" />
</shape>

View File

@ -2,5 +2,5 @@


<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"> android:shape="oval">
<solid android:color="@color/pale_grey" /> <solid android:color="#FFF2F5F8" />
</shape> </shape>

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_selected="true">
<shape android:shape="oval">
<solid android:color="@android:color/transparent" />
<stroke android:width="3dp" android:color="@color/pale_teal" />
</shape>

</item>
<item android:drawable="@android:color/transparent" />

</selector>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<corners android:radius="3dp" />

<solid android:color="@color/riotx_fab_label_bg_black" />

<stroke
android:width="0.5dp"
android:color="@color/black" />

</shape>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<corners android:radius="3dp" />

<solid android:color="@color/riotx_fab_label_bg_dark" />

<stroke
android:width="0.5dp"
android:color="@color/black" />

</shape>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<corners android:radius="3dp" />

<solid android:color="@color/riotx_fab_label_bg_light" />

<stroke
android:width="0.5dp"
android:color="#1EFFFFFF" />

</shape>

View File

@ -7,9 +7,9 @@


<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/bugReportToolbar" android:id="@+id/bugReportToolbar"
style="@style/VectorToolbarStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:elevation="4dp" />


<LinearLayout <LinearLayout
android:id="@+id/bug_report_body_view" android:id="@+id/bug_report_body_view"
@ -68,6 +68,7 @@
android:text="@string/send_bug_report_description" /> android:text="@string/send_bug_report_description" />


<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
style="@style/VectorTextInputLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
@ -83,7 +84,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/send_bug_report_placeholder" android:hint="@string/send_bug_report_placeholder"
android:minHeight="40dp" android:minHeight="40dp"
android:textColor="?android:textColorPrimary" /> android:textColor="?riotx_text_primary" />


</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>



View File

@ -26,8 +26,7 @@
android:elevation="4dp" android:elevation="4dp"
android:minHeight="0dp" android:minHeight="0dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar" android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap|enterAlways" app:layout_scrollFlags="scroll|exitUntilCollapsed|snap|enterAlways" />
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />


<com.google.android.material.tabs.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/tabs" android:id="@+id/tabs"

View File

@ -7,12 +7,9 @@


<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/imageMediaViewerToolbar" android:id="@+id/imageMediaViewerToolbar"
style="@style/VectorToolbarStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:elevation="4dp" />
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />


<com.github.piasy.biv.view.BigImageView <com.github.piasy.biv.view.BigImageView
android:id="@+id/imageMediaViewerImageView" android:id="@+id/imageMediaViewerImageView"

View File

@ -1,5 +1,6 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">


@ -29,6 +30,7 @@
android:src="@drawable/logo_login" /> android:src="@drawable/logo_login" />


<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
style="@style/VectorTextInputLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
@ -42,23 +44,45 @@
android:maxLines="1" /> android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>



<FrameLayout
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:orientation="horizontal">
android:hint="@string/auth_password_placeholder">


<com.google.android.material.textfield.TextInputEditText <com.google.android.material.textfield.TextInputLayout
android:id="@+id/passwordField" style="@style/VectorTextInputLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ems="10" android:layout_marginTop="16dp"
android:inputType="textPassword" android:hint="@string/auth_password_placeholder">
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout> <com.google.android.material.textfield.TextInputEditText
android:id="@+id/passwordField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword"
android:maxLines="1"
android:paddingEnd="48dp"
android:paddingRight="48dp"
tools:ignore="RtlSymmetry" />
</com.google.android.material.textfield.TextInputLayout>

<ImageView
android:id="@+id/passwordReveal"
android:layout_width="@dimen/layout_touch_size"
android:layout_height="@dimen/layout_touch_size"
android:layout_gravity="end"
android:layout_marginTop="24dp"
android:background="?attr/selectableItemBackground"
android:scaleType="center"
android:src="@drawable/ic_eye_black"
android:tint="?attr/colorAccent" />

</FrameLayout>


<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
style="@style/VectorTextInputLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"

View File

@ -11,9 +11,9 @@


<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/settingsToolbar" android:id="@+id/settingsToolbar"
style="@style/VectorToolbarStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:elevation="4dp" />


<FrameLayout <FrameLayout
android:id="@+id/vector_settings_page" android:id="@+id/vector_settings_page"

View File

@ -15,19 +15,15 @@
--> -->


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">


<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/videoMediaViewerToolbar" android:id="@+id/videoMediaViewerToolbar"
style="@style/VectorToolbarStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" android:elevation="4dp" />
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />


<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -21,8 +21,8 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
tools:src="@drawable/ic_delete" android:tint="?riotx_text_secondary"
android:tint="?android:attr/textColorTertiary" /> tools:src="@drawable/ic_delete" />


<TextView <TextView
android:id="@+id/action_title" android:id="@+id/action_title"
@ -31,6 +31,7 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:textColor="?riotx_text_secondary"
android:textSize="17sp" android:textSize="17sp"
tools:text="@string/delete" /> tools:text="@string/delete" />



View File

@ -52,6 +52,7 @@
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:text="@string/reactions_agree" android:text="@string/reactions_agree"
android:textAlignment="center" android:textAlignment="center"
android:textColor="?riotx_text_secondary"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/center_guideline" app:layout_constraintEnd_toStartOf="@id/center_guideline"
@ -108,6 +109,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/reactions_like" android:text="@string/reactions_like"
android:textAlignment="center" android:textAlignment="center"
android:textColor="?riotx_text_secondary"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/quick_react_agree_text" app:layout_constraintBottom_toBottomOf="@id/quick_react_agree_text"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View File

@ -16,6 +16,7 @@
android:layout_marginEnd="@dimen/layout_horizontal_margin" android:layout_marginEnd="@dimen/layout_horizontal_margin"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:text="@string/action_sign_out" android:text="@string/action_sign_out"
android:textColor="?riotx_text_primary"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" /> android:textStyle="bold" />


@ -26,7 +27,7 @@
android:layout_marginStart="@dimen/layout_horizontal_margin" android:layout_marginStart="@dimen/layout_horizontal_margin"
android:layout_marginEnd="@dimen/layout_horizontal_margin" android:layout_marginEnd="@dimen/layout_horizontal_margin"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:textColor="?android:attr/textColorSecondary" android:textColor="?riotx_text_secondary"
tools:text="@string/sign_out_bottom_sheet_warning_no_backup" /> tools:text="@string/sign_out_bottom_sheet_warning_no_backup" />


<LinearLayout <LinearLayout
@ -63,6 +64,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:textColor="?riotx_text_secondary"
tools:text="@string/keys_backup_info_keys_all_backup_up" /> tools:text="@string/keys_backup_info_keys_all_backup_up" />


</LinearLayout> </LinearLayout>
@ -95,6 +97,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:text="@string/keys_backup_setup" android:text="@string/keys_backup_setup"
android:textColor="?riotx_text_secondary"
android:textSize="17sp" /> android:textSize="17sp" />


</LinearLayout> </LinearLayout>
@ -128,6 +131,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:textColor="?riotx_text_secondary"
android:text="@string/keys_backup_activate" android:text="@string/keys_backup_activate"
android:textSize="17sp" /> android:textSize="17sp" />


@ -155,14 +159,14 @@
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:src="@drawable/ic_material_leave" android:src="@drawable/ic_material_leave"
android:tint="@color/vector_error_color" /> android:tint="@color/riotx_notice" />


<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:text="@string/sign_out_bottom_sheet_dont_want_secure_messages" android:text="@string/sign_out_bottom_sheet_dont_want_secure_messages"
android:textColor="@color/vector_error_color" android:textColor="@color/riotx_notice"
android:textSize="17sp" /> android:textSize="17sp" />
</LinearLayout> </LinearLayout>


@ -188,14 +192,14 @@
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:src="@drawable/ic_material_exit_to_app" android:src="@drawable/ic_material_exit_to_app"
android:tint="@color/vector_error_color" /> android:tint="@color/riotx_notice" />


<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:text="@string/action_sign_out" android:text="@string/action_sign_out"
android:textColor="@color/vector_error_color" android:textColor="@color/riotx_notice"
android:textSize="17sp" /> android:textSize="17sp" />
</LinearLayout> </LinearLayout>



View File

@ -42,6 +42,7 @@
android:ellipsize="end" android:ellipsize="end"
android:fontFamily="sans-serif-bold" android:fontFamily="sans-serif-bold"
android:singleLine="true" android:singleLine="true"
android:textColor="?riotx_text_primary"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -49,8 +50,7 @@
app:layout_constraintTop_toTopOf="@id/bottom_sheet_message_preview_avatar" app:layout_constraintTop_toTopOf="@id/bottom_sheet_message_preview_avatar"
tools:text="@tools:sample/full_names" /> tools:text="@tools:sample/full_names" />


<TextView xmlns:android="http://schemas.android.com/apk/res/android" <TextView

android:id="@+id/bottom_sheet_message_preview_body" android:id="@+id/bottom_sheet_message_preview_body"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -62,7 +62,7 @@
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="3" android:maxLines="3"
android:textColor="?android:textColorSecondary" android:textColor="?riotx_text_secondary"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="14sp" android:textSize="14sp"
app:layout_constraintBottom_toTopOf="@id/bottom_sheet_message_preview_timestamp" app:layout_constraintBottom_toTopOf="@id/bottom_sheet_message_preview_timestamp"
@ -77,9 +77,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/layout_horizontal_margin" android:layout_marginEnd="@dimen/layout_horizontal_margin"
android:layout_marginRight="@dimen/layout_horizontal_margin" android:layout_marginRight="@dimen/layout_horizontal_margin"
android:textColor="?android:textColorSecondary"
android:textSize="12sp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:textColor="?riotx_text_secondary"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/bottom_sheet_message_preview_body" app:layout_constraintTop_toBottomOf="@id/bottom_sheet_message_preview_body"

View File

@ -88,10 +88,11 @@
android:layout_height="22dp" android:layout_height="22dp"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_close_round" android:src="@drawable/ic_close_round"
android:tint="@color/rosy_pink" android:tint="@color/riotx_notice"
android:visibility="invisible" android:visibility="invisible"
app:layout_constraintBottom_toTopOf="parent" app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintStart_toEndOf="parent" /> app:layout_constraintStart_toEndOf="parent"
tools:visibility="visible" />


<ImageView <ImageView
android:id="@+id/composer_avatar_view" android:id="@+id/composer_avatar_view"
@ -159,6 +160,5 @@
app:layout_constraintStart_toEndOf="@+id/composer_avatar_view" app:layout_constraintStart_toEndOf="@+id/composer_avatar_view"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="@tools:sample/lorem/random" /> tools:text="@tools:sample/lorem/random" />
<!--tools:text="@tools:sample/lorem/random"-->


</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -96,7 +96,7 @@
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_close_round" android:src="@drawable/ic_close_round"
android:tint="@color/rosy_pink" android:tint="@color/riotx_notice"
app:layout_constraintBottom_toBottomOf="@id/composer_related_message_preview" app:layout_constraintBottom_toBottomOf="@id/composer_related_message_preview"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/composer_related_message_preview" /> app:layout_constraintTop_toTopOf="@id/composer_related_message_preview" />

View File

@ -0,0 +1,81 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">

<View
android:id="@+id/createRoomTouchGuard"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?riotx_touch_guard_bg"
android:visibility="gone" />

<!-- Sub menu item 2 -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/createRoomItemGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:src="@drawable/ic_fab_add_room"
app:backgroundTint="#FFFFFF"
app:fabCustomSize="48dp"
app:layout_constraintBottom_toBottomOf="@+id/createRoomButton"
app:layout_constraintEnd_toEndOf="@+id/createRoomButton"
app:layout_constraintStart_toStartOf="@+id/createRoomButton"
app:layout_constraintTop_toTopOf="@+id/createRoomButton"
app:maxImageSize="26dp"
app:tint="@color/black" />

<TextView
android:id="@+id/createRoomItemGroupLabel"
style="@style/VectorLabel"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="@string/fab_menu_create_room"
app:layout_constraintBottom_toBottomOf="@+id/createRoomItemChat"
app:layout_constraintEnd_toEndOf="@+id/createRoomItemChat"
app:layout_constraintTop_toTopOf="@+id/createRoomItemChat" />

<!-- Sub menu item 1 -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/createRoomItemChat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:src="@drawable/ic_fab_add_chat"
app:backgroundTint="#FFFFFF"
app:fabCustomSize="48dp"
app:layout_constraintBottom_toBottomOf="@+id/createRoomButton"
app:layout_constraintEnd_toEndOf="@+id/createRoomButton"
app:layout_constraintStart_toStartOf="@+id/createRoomButton"
app:layout_constraintTop_toTopOf="@+id/createRoomButton"
app:maxImageSize="29dp"
app:tint="@color/black" />

<TextView
android:id="@+id/createRoomItemChatLabel"
style="@style/VectorLabel"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="@string/fab_menu_create_chat"
app:layout_constraintBottom_toBottomOf="@+id/createRoomItemChat"
app:layout_constraintEnd_toEndOf="@+id/createRoomItemChat"
app:layout_constraintTop_toTopOf="@+id/createRoomItemChat" />

<!-- Menu -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/createRoomButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_fab_add"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:maxImageSize="14dp" />

</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,76 @@
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">

<View
android:id="@+id/createRoomTouchGuard"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?riotx_touch_guard_bg" />

<!-- Sub menu item 2 -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/createRoomItemGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="14dp"
android:src="@drawable/ic_fab_add_room"
app:backgroundTint="#FFFFFF"
app:fabCustomSize="48dp"
app:layout_constraintBottom_toTopOf="@+id/createRoomItemChat"
app:layout_constraintEnd_toEndOf="@+id/createRoomButton"
app:layout_constraintStart_toStartOf="@+id/createRoomButton"
app:maxImageSize="26dp"
app:tint="@color/black" />

<TextView
android:id="@+id/createRoomItemGroupLabel"
style="@style/VectorLabel"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="@string/fab_menu_create_room"
app:layout_constraintBottom_toBottomOf="@+id/createRoomItemGroup"
app:layout_constraintEnd_toStartOf="@+id/createRoomItemGroup"
app:layout_constraintTop_toTopOf="@+id/createRoomItemGroup" />

<!-- Sub menu item 1 -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/createRoomItemChat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="25dp"
android:src="@drawable/ic_fab_add_chat"
app:backgroundTint="#FFFFFF"
app:fabCustomSize="48dp"
app:layout_constraintBottom_toTopOf="@+id/createRoomButton"
app:layout_constraintEnd_toEndOf="@+id/createRoomButton"
app:layout_constraintStart_toStartOf="@+id/createRoomButton"
app:maxImageSize="29dp"
app:tint="@color/black" />

<TextView
android:id="@+id/createRoomItemChatLabel"
style="@style/VectorLabel"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="@string/fab_menu_create_chat"
app:layout_constraintBottom_toBottomOf="@+id/createRoomItemChat"
app:layout_constraintEnd_toStartOf="@+id/createRoomItemChat"
app:layout_constraintTop_toTopOf="@+id/createRoomItemChat" />

<!-- Menu -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/createRoomButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_fab_add"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:maxImageSize="14dp" />

</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -37,6 +37,7 @@


<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/change_password_old_pwd_til" android:id="@+id/change_password_old_pwd_til"
style="@style/VectorTextInputLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">


@ -50,6 +51,7 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>


<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
style="@style/VectorTextInputLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">


@ -64,6 +66,7 @@


<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/change_password_confirm_new_pwd_til" android:id="@+id/change_password_confirm_new_pwd_til"
style="@style/VectorTextInputLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:errorEnabled="true"> app:errorEnabled="true">

View File

@ -8,15 +8,12 @@


<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/groupToolbar" android:id="@+id/groupToolbar"
style="@style/VectorToolbarStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="#FFFFFF" android:elevation="4dp"
app:contentInsetStartWithNavigation="0dp" app:contentInsetStartWithNavigation="0dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent">
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">


<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -38,7 +35,7 @@
android:layout_marginEnd="32dp" android:layout_marginEnd="32dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="@color/dark_grey" android:textColor="?riotx_text_primary"
android:textSize="20sp" android:textSize="20sp"
android:textStyle="bold" android:textStyle="bold"
tools:text="@tools:sample/lorem/random" /> tools:text="@tools:sample/lorem/random" />
@ -51,7 +48,7 @@
android:id="@+id/roomListContainer" android:id="@+id/roomListContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:background="#F3F8FD" android:background="?riotx_header_panel_background"
app:layout_constraintBottom_toTopOf="@+id/bottomNavigationView" app:layout_constraintBottom_toTopOf="@+id/bottomNavigationView"
app:layout_constraintTop_toBottomOf="@+id/groupToolbar" /> app:layout_constraintTop_toBottomOf="@+id/groupToolbar" />


@ -59,10 +56,8 @@
android:id="@+id/bottomNavigationView" android:id="@+id/bottomNavigationView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="48dp" android:layout_height="48dp"
android:background="#FFFFFF" android:background="?riotx_background"
app:itemIconSize="20dp" app:itemIconSize="20dp"
app:itemIconTint="@color/home_bottom_nav_view_tint"
app:itemTextColor="@color/home_bottom_nav_view_tint"
app:labelVisibilityMode="unlabeled" app:labelVisibilityMode="unlabeled"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View File

@ -11,11 +11,22 @@
android:id="@+id/homeDrawerHeader" android:id="@+id/homeDrawerHeader"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/colorPrimary" android:background="?riotx_base"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">


<ImageView
android:id="@+id/homeDrawerHeaderDebugView"
style="@style/VectorDebug"
android:layout_width="@dimen/layout_touch_size"
android:layout_height="@dimen/layout_touch_size"
android:scaleType="center"
android:src="@drawable/ic_settings_x"
android:tint="@color/riotx_accent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView <ImageView
android:id="@+id/homeDrawerHeaderAvatarView" android:id="@+id/homeDrawerHeaderAvatarView"
android:layout_width="64dp" android:layout_width="64dp"
@ -72,7 +83,7 @@
android:id="@+id/homeDrawerGroupListContainer" android:id="@+id/homeDrawerGroupListContainer"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:background="#FAFAFA" android:background="?riotx_header_panel_background"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@ -6,30 +6,23 @@
android:id="@+id/publicRoomsCoordinator" android:id="@+id/publicRoomsCoordinator"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/pale_grey"> android:background="?riotx_header_panel_background">


<com.airbnb.epoxy.EpoxyRecyclerView <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/publicRoomsList"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent">
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:listitem="@layout/item_public_room" />

<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">


<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/publicRoomsToolbar"
style="@style/VectorToolbarStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/colorPrimary" android:elevation="4dp"
app:contentInsetStartWithNavigation="0dp" app:contentInsetStartWithNavigation="0dp"
app:layout_scrollFlags="noScroll" app:layout_constraintEnd_toEndOf="parent"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:layout_constraintStart_toStartOf="parent"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> app:layout_constraintTop_toTopOf="parent">


<!-- Note: Background is modified in the code for other themes -->
<EditText <EditText
android:id="@+id/publicRoomsFilter" android:id="@+id/publicRoomsFilter"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -40,11 +33,11 @@
android:layout_marginEnd="@dimen/layout_horizontal_margin" android:layout_marginEnd="@dimen/layout_horizontal_margin"
android:layout_marginRight="@dimen/layout_horizontal_margin" android:layout_marginRight="@dimen/layout_horizontal_margin"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:background="@drawable/bg_search_edit_text" android:background="@drawable/bg_search_edit_text_light"
android:drawableStart="@drawable/ic_search_white" android:drawableStart="@drawable/ic_search_white"
android:drawableLeft="@drawable/ic_search_white" android:drawableLeft="@drawable/ic_search_white"
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:drawableTint="#9fa9ba" android:drawableTint="?riotx_text_secondary"
android:hint="@string/home_filter_placeholder_rooms" android:hint="@string/home_filter_placeholder_rooms"
android:lines="1" android:lines="1"
android:paddingLeft="8dp" android:paddingLeft="8dp"
@ -52,20 +45,32 @@


</androidx.appcompat.widget.Toolbar> </androidx.appcompat.widget.Toolbar>


<Button <com.google.android.material.button.MaterialButton
android:id="@+id/publicRoomsCreateNewRoom" android:id="@+id/publicRoomsCreateNewRoom"
style="@style/VectorButtonStyleFlat" style="@style/VectorButtonStyleFlat"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="48dp" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:drawableStart="@drawable/ic_plus_circle" android:minHeight="@dimen/layout_touch_size"
android:drawableLeft="@drawable/ic_plus_circle"
android:drawablePadding="13dp"
android:text="@string/create_new_room" android:text="@string/create_new_room"
app:layout_scrollFlags="scroll|enterAlways|snap" /> app:icon="@drawable/ic_plus_circle"
app:iconPadding="13dp"
app:iconTint="@color/riotx_accent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/publicRoomsToolbar" />


</com.google.android.material.appbar.AppBarLayout> <com.airbnb.epoxy.EpoxyRecyclerView
android:id="@+id/publicRoomsList"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/publicRoomsCreateNewRoom"
tools:listitem="@layout/item_public_room" />

</androidx.constraintlayout.widget.ConstraintLayout>


</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -8,16 +8,13 @@


<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/roomToolbar" android:id="@+id/roomToolbar"
style="@style/VectorToolbarStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="?actionBarSize" android:layout_height="?actionBarSize"
android:background="?attr/colorPrimary" android:elevation="4dp"
app:contentInsetStartWithNavigation="0dp" app:contentInsetStartWithNavigation="0dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent">
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">


<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -49,7 +46,7 @@
app:layout_constraintHorizontal_bias="0.0" app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/roomToolbarAvatarImageView" app:layout_constraintStart_toEndOf="@+id/roomToolbarAvatarImageView"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="@tools:sample/full_names" /> tools:text="@sample/matrix.json/data/roomName" />


<TextView <TextView
android:id="@+id/roomToolbarSubtitleView" android:id="@+id/roomToolbarSubtitleView"
@ -66,7 +63,7 @@
app:layout_constraintHorizontal_bias="0.0" app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/roomToolbarAvatarImageView" app:layout_constraintStart_toEndOf="@+id/roomToolbarAvatarImageView"
app:layout_constraintTop_toBottomOf="@+id/roomToolbarTitleView" app:layout_constraintTop_toBottomOf="@+id/roomToolbarTitleView"
tools:text="@tools:sample/date/day_of_week" /> tools:text="@sample/matrix.json/data/roomTopic" />




</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -5,7 +5,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/pale_grey"> android:background="?riotx_header_panel_background">


<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -16,6 +16,7 @@
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:elevation="4dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />

View File

@ -1,68 +1,22 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>


<im.vector.riotredesign.core.platform.StateView xmlns:android="http://schemas.android.com/apk/res/android" <im.vector.riotredesign.core.platform.StateView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/stateView" android:id="@+id/stateView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/pale_grey"> android:background="?riotx_header_panel_background">


<com.airbnb.epoxy.EpoxyRecyclerView <com.airbnb.epoxy.EpoxyRecyclerView
android:id="@+id/epoxyRecyclerView" android:id="@+id/epoxyRecyclerView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />


<!-- Create several FABs to manage different icon size. maxImageSize cannot be set programmatically --> <im.vector.riotredesign.features.home.room.list.widget.FabMenuView

android:id="@+id/createChatFabMenu"
<View
android:id="@+id/createRoomTouchGuard"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:alpha="0"
android:background="@android:color/background_dark" />

<!-- Sub menu item 2 -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/createRoomItemGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:src="@drawable/ic_fab_add_room"
android:visibility="gone" android:visibility="gone"
app:maxImageSize="32dp"
tools:fab_colorNormal="?attr/colorAccent"
tools:fab_colorPressed="?attr/colorAccent"
tools:translationY="-146dp"
tools:visibility="visible" />

<!-- Sub menu item 1 -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/createRoomItemChat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:src="@drawable/ic_fab_add_chat"
android:visibility="gone"
app:maxImageSize="34dp"
tools:fab_colorNormal="?attr/colorAccent"
tools:fab_colorPressed="?attr/colorAccent"
tools:translationY="-76dp"
tools:visibility="visible" />

<!-- Menu -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/createRoomButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:src="@drawable/ic_fab_add"
android:visibility="gone"
app:maxImageSize="14dp"
tools:visibility="visible" /> tools:visibility="visible" />


<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
@ -70,12 +24,14 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_margin="16dp" android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:scaleType="center" android:scaleType="center"
android:src="@drawable/ic_fab_add_chat" android:src="@drawable/ic_fab_add_chat"
android:visibility="gone" android:visibility="gone"
app:maxImageSize="34dp" app:maxImageSize="34dp"
tools:layout_margin="76dp" tools:layout_marginEnd="80dp"
tools:visibility="visible" /> tools:visibility="visible" />


<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
@ -83,11 +39,13 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_margin="16dp" android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:src="@drawable/ic_fab_add_room" android:src="@drawable/ic_fab_add_room"
android:visibility="gone" android:visibility="gone"
app:maxImageSize="32dp" app:maxImageSize="32dp"
tools:layout_margin="136dp" tools:layout_marginEnd="144dp"
tools:visibility="visible" /> tools:visibility="visible" />


</im.vector.riotredesign.core.platform.StateView> </im.vector.riotredesign.core.platform.StateView>

View File

@ -13,13 +13,10 @@


<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/roomPreviewNoPreviewToolbar" android:id="@+id/roomPreviewNoPreviewToolbar"
style="@style/VectorToolbarStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?actionBarSize" android:layout_height="?actionBarSize"
android:background="?attr/colorPrimary" android:elevation="4dp"
app:contentInsetStartWithNavigation="0dp" app:contentInsetStartWithNavigation="0dp">
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">


<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -115,7 +112,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_vertical_margin" android:layout_marginTop="@dimen/layout_vertical_margin"
android:gravity="center" android:gravity="center"
android:textColor="@color/vector_error_color" android:textColor="@color/riotx_notice"
android:textSize="15sp" android:textSize="15sp"
android:visibility="gone" android:visibility="gone"
tools:text="Error" tools:text="Error"

View File

@ -49,7 +49,7 @@
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:textColor="?android:attr/textColorSecondary" android:textColor="?riotx_text_secondary"
tools:text="@string/settings_troubleshoot_diagnostic_running_status" /> tools:text="@string/settings_troubleshoot_diagnostic_running_status" />


<LinearLayout <LinearLayout
@ -61,7 +61,7 @@
<Button <Button
android:id="@+id/troubleshoot_run_button" android:id="@+id/troubleshoot_run_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="36dp" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_margin="16dp" android:layout_margin="16dp"
android:background="?attr/colorAccent" android:background="?attr/colorAccent"
@ -75,7 +75,7 @@
<Button <Button
android:id="@+id/troubleshoot_summ_button" android:id="@+id/troubleshoot_summ_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="36dp" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_margin="16dp" android:layout_margin="16dp"
android:background="?attr/colorAccent" android:background="?attr/colorAccent"

View File

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?riotx_background"
android:padding="6dp"> android:padding="6dp">


<TextView <TextView
@ -12,6 +13,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:maxLines="1" android:maxLines="1"
android:textColor="?riotx_text_primary"
android:textSize="12sp" android:textSize="12sp"
android:textStyle="bold" android:textStyle="bold"
tools:text="/invite" /> tools:text="/invite" />
@ -26,6 +28,7 @@
android:layout_toEndOf="@+id/commandName" android:layout_toEndOf="@+id/commandName"
android:layout_toRightOf="@+id/commandName" android:layout_toRightOf="@+id/commandName"
android:maxLines="1" android:maxLines="1"
android:textColor="?riotx_text_secondary"
android:textSize="12sp" android:textSize="12sp"
android:textStyle="italic" android:textStyle="italic"
tools:text="&lt;user-id&gt;" /> tools:text="&lt;user-id&gt;" />
@ -39,7 +42,7 @@
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:maxLines="1" android:maxLines="1"
android:textColor="?android:attr/textColorSecondary" android:textColor="?riotx_text_secondary"
android:textSize="12sp" android:textSize="12sp"
tools:text="@string/command_description_invite_user" /> tools:text="@string/command_description_invite_user" />



View File

@ -17,7 +17,6 @@


<Button <Button
android:id="@+id/itemErrorRetryButton" android:id="@+id/itemErrorRetryButton"
style="@style/VectorButtonStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"

View File

@ -8,8 +8,7 @@
android:background="@drawable/bg_group_item" android:background="@drawable/bg_group_item"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:foreground="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground">
tools:background="#FAFAFA">


<ImageView <ImageView
android:id="@+id/groupAvatarImageView" android:id="@+id/groupAvatarImageView"
@ -32,7 +31,7 @@
android:layout_marginEnd="@dimen/layout_horizontal_margin" android:layout_marginEnd="@dimen/layout_horizontal_margin"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="@color/dark_grey" android:textColor="?riotx_text_primary"
android:textSize="15sp" android:textSize="15sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/groupBottomSeparator" app:layout_constraintBottom_toTopOf="@+id/groupBottomSeparator"
@ -41,7 +40,6 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="@tools:sample/lorem/random" /> tools:text="@tools:sample/lorem/random" />


<!-- TODO Design Picto -->
<ImageView <ImageView
android:id="@+id/groupAvatarChevron" android:id="@+id/groupAvatarChevron"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -49,6 +47,7 @@
android:layout_marginEnd="21dp" android:layout_marginEnd="21dp"
android:layout_marginRight="21dp" android:layout_marginRight="21dp"
android:src="@drawable/ic_arrow_right" android:src="@drawable/ic_arrow_right"
android:tint="?riotx_text_primary"
app:layout_constraintBottom_toTopOf="@+id/groupBottomSeparator" app:layout_constraintBottom_toTopOf="@+id/groupBottomSeparator"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@ -57,7 +56,7 @@
android:id="@+id/groupBottomSeparator" android:id="@+id/groupBottomSeparator"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="1dp" android:layout_height="1dp"
android:background="#E9EDF1" android:background="?riotx_header_panel_border_mobile"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />

View File

@ -3,4 +3,5 @@
android:id="@+id/progressBar" android:id="@+id/progressBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="80dp" android:layout_height="80dp"
android:background="?riotx_background"
android:padding="16dp" /> android:padding="16dp" />

View File

@ -49,7 +49,7 @@
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:paddingTop="4dp" android:paddingTop="4dp"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:textColor="?android:attr/textColorSecondary" android:textColor="?riotx_text_secondary"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/troubleshootTestButton" app:layout_constraintBottom_toTopOf="@id/troubleshootTestButton"
app:layout_constraintEnd_toStartOf="@+id/troubleshootStatusIcon" app:layout_constraintEnd_toStartOf="@+id/troubleshootStatusIcon"
@ -62,7 +62,7 @@
<Button <Button
android:id="@+id/troubleshootTestButton" android:id="@+id/troubleshootTestButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="36dp" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"

View File

@ -6,9 +6,9 @@
android:id="@+id/itemPublicRoomLayout" android:id="@+id/itemPublicRoomLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?riotx_background"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:foreground="?attr/selectableItemBackground"
android:minHeight="97dp"> android:minHeight="97dp">


<ImageView <ImageView
@ -32,33 +32,54 @@
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" android:maxLines="2"
android:textColor="#2E2F3E" android:textColor="?riotx_text_primary"
android:textSize="15sp" android:textSize="15sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/itemPublicRoomMembersCount" app:layout_constraintBottom_toTopOf="@+id/itemPublicRoomTopic"
app:layout_constraintEnd_toStartOf="@+id/itemPublicRoomButtonState" app:layout_constraintEnd_toStartOf="@+id/itemPublicRoomButtonState"
app:layout_constraintStart_toEndOf="@id/itemPublicRoomAvatar" app:layout_constraintStart_toEndOf="@id/itemPublicRoomAvatar"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" app:layout_constraintVertical_chainStyle="packed"
tools:text="@sample/matrix.json/data/roomName" /> tools:text="@sample/matrix.json/data/roomName" />


<TextView
android:id="@+id/itemPublicRoomTopic"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginEnd="22dp"
android:layout_marginRight="22dp"
android:gravity="center_vertical"
android:maxLines="1"
android:singleLine="true"
android:textColor="?riotx_text_primary"
android:textSize="15sp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/itemPublicRoomMembersCount"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/itemPublicRoomName"
app:layout_constraintTop_toBottomOf="@+id/itemPublicRoomName"
tools:text="@sample/matrix.json/data/roomTopic"
tools:visibility="visible" />

<TextView <TextView
android:id="@+id/itemPublicRoomMembersCount" android:id="@+id/itemPublicRoomMembersCount"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="2dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:drawableStart="@drawable/ic_user" android:drawableStart="@drawable/ic_user"
android:drawableLeft="@drawable/ic_user" android:drawableLeft="@drawable/ic_user"
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:drawableTint="?riotx_text_secondary"
android:gravity="center_vertical" android:gravity="center_vertical"
android:minWidth="56dp" android:minWidth="56dp"
android:textColor="#7E899C" android:textColor="?riotx_text_secondary"
android:textSize="15sp" android:textSize="15sp"
app:layout_constraintBottom_toTopOf="@+id/itemPublicRoomTopic" app:layout_constraintBottom_toTopOf="@+id/itemPublicRoomBottomSeparator"
app:layout_constraintStart_toStartOf="@+id/itemPublicRoomName" app:layout_constraintStart_toStartOf="@+id/itemPublicRoomName"
app:layout_constraintTop_toBottomOf="@+id/itemPublicRoomName" app:layout_constraintTop_toBottomOf="@+id/itemPublicRoomTopic"
tools:text="148" /> tools:text="148" />


<TextView <TextView
@ -67,38 +88,19 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_marginRight="8dp" android:layout_marginEnd="22dp"
android:layout_marginRight="22dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:maxLines="1" android:maxLines="1"
android:minWidth="40dp" android:minWidth="40dp"
android:singleLine="true" android:singleLine="true"
android:textColor="#7E899C" android:textColor="?riotx_text_secondary"
android:textSize="15sp" android:textSize="15sp"
app:layout_constraintBaseline_toBaselineOf="@+id/itemPublicRoomMembersCount" app:layout_constraintBaseline_toBaselineOf="@+id/itemPublicRoomMembersCount"
app:layout_constraintEnd_toStartOf="@+id/itemPublicRoomButtonState" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/itemPublicRoomMembersCount" app:layout_constraintStart_toEndOf="@+id/itemPublicRoomMembersCount"
tools:text="@sample/matrix.json/data/roomAlias" /> tools:text="@sample/matrix.json/data/roomAlias" />


<TextView
android:id="@+id/itemPublicRoomTopic"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:gravity="center_vertical"
android:maxLines="1"
android:singleLine="true"
android:textColor="#2E2F3E"
android:textSize="15sp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/itemPublicRoomBottomSeparator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/itemPublicRoomName"
app:layout_constraintTop_toBottomOf="@+id/itemPublicRoomMembersCount"
tools:text="@sample/matrix.json/data/roomTopic"
tools:visibility="visible" />

<im.vector.riotredesign.core.platform.ButtonStateView <im.vector.riotredesign.core.platform.ButtonStateView
android:id="@+id/itemPublicRoomButtonState" android:id="@+id/itemPublicRoomButtonState"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -116,7 +118,7 @@
android:id="@+id/itemPublicRoomBottomSeparator" android:id="@+id/itemPublicRoomBottomSeparator"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="1dp" android:layout_height="1dp"
android:background="#E9EDF1" android:background="?riotx_header_panel_border_mobile"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />

View File

@ -5,10 +5,9 @@
android:id="@+id/itemRoomLayout" android:id="@+id/itemRoomLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?riotx_background"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true">
tools:background="@color/pale_grey">


<ImageView <ImageView
android:id="@+id/roomAvatarImageView" android:id="@+id/roomAvatarImageView"
@ -42,7 +41,7 @@
android:duplicateParentState="true" android:duplicateParentState="true"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="@color/black_87" android:textColor="?riotx_text_primary"
android:textSize="15sp" android:textSize="15sp"
app:layout_constrainedWidth="true" app:layout_constrainedWidth="true"
app:layout_constraintEnd_toStartOf="@+id/roomUnreadCounterBadgeView" app:layout_constraintEnd_toStartOf="@+id/roomUnreadCounterBadgeView"
@ -78,7 +77,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:textColor="@color/black_38" android:textColor="?riotx_text_secondary"
android:textSize="15sp" android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="@+id/roomNameView" app:layout_constraintBottom_toBottomOf="@+id/roomNameView"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -94,7 +93,7 @@
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" android:maxLines="2"
android:textColor="@color/black_38" android:textColor="?riotx_text_secondary"
android:textSize="15sp" android:textSize="15sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/roomNameView" app:layout_constraintStart_toStartOf="@+id/roomNameView"
@ -121,7 +120,7 @@
android:id="@+id/roomDividerView" android:id="@+id/roomDividerView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="1dp" android:layout_height="1dp"
android:background="#1e000000" android:background="?riotx_header_panel_border_mobile"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View File

@ -4,7 +4,7 @@
android:id="@+id/roomCategoryRootView" android:id="@+id/roomCategoryRootView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?riotx_header_panel_background"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:gravity="center_vertical" android:gravity="center_vertical"
@ -14,7 +14,7 @@
android:paddingTop="@dimen/layout_vertical_margin" android:paddingTop="@dimen/layout_vertical_margin"
android:paddingEnd="@dimen/layout_horizontal_margin" android:paddingEnd="@dimen/layout_horizontal_margin"
android:paddingRight="@dimen/layout_horizontal_margin" android:paddingRight="@dimen/layout_horizontal_margin"
tools:background="@color/pale_grey"> android:paddingBottom="8dp">


<TextView <TextView
android:id="@+id/roomCategoryTitleView" android:id="@+id/roomCategoryTitleView"
@ -24,11 +24,11 @@
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:drawableStart="@drawable/ic_expand_more_white" android:drawableStart="@drawable/ic_expand_more_white"
android:drawableLeft="@drawable/ic_expand_more_white" android:drawableLeft="@drawable/ic_expand_more_white"
android:drawableTint="@color/bluey_grey_two" android:drawableTint="?riotx_text_secondary"
android:ellipsize="end" android:ellipsize="end"
android:gravity="center_vertical" android:gravity="center_vertical"
android:maxLines="1" android:maxLines="1"
android:textColor="#7E899C" android:textColor="?riotx_text_secondary"
android:textSize="14sp" android:textSize="14sp"
tools:text="@string/room_participants_header_direct_chats" /> tools:text="@string/room_participants_header_direct_chats" />



View File

@ -32,7 +32,7 @@
android:ellipsize="end" android:ellipsize="end"
android:lines="1" android:lines="1"
android:maxLines="2" android:maxLines="2"
android:textColor="#2E2F3E" android:textColor="?riotx_text_primary"
android:textSize="15sp" android:textSize="15sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/itemRoomDirectoryDescription" app:layout_constraintBottom_toTopOf="@+id/itemRoomDirectoryDescription"
@ -51,7 +51,7 @@
android:ellipsize="end" android:ellipsize="end"
android:lines="1" android:lines="1"
android:maxLines="2" android:maxLines="2"
android:textColor="#2E2F3E" android:textColor="?riotx_text_primary"
android:textSize="15sp" android:textSize="15sp"
app:layout_constraintBottom_toTopOf="@+id/itemRoomDirectoryBottomSeparator" app:layout_constraintBottom_toTopOf="@+id/itemRoomDirectoryBottomSeparator"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -63,7 +63,7 @@
android:id="@+id/itemRoomDirectoryBottomSeparator" android:id="@+id/itemRoomDirectoryBottomSeparator"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="1dp" android:layout_height="1dp"
android:background="#E9EDF1" android:background="?riotx_header_panel_border_mobile"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />

View File

@ -36,6 +36,7 @@
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="?riotx_text_primary"
android:textSize="15sp" android:textSize="15sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constrainedWidth="true" app:layout_constrainedWidth="true"
@ -53,7 +54,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:textColor="@color/brown_grey" android:textColor="?riotx_text_secondary"
android:textSize="12sp" android:textSize="12sp"
app:layout_constraintBaseline_toBaselineOf="@id/messageMemberNameView" app:layout_constraintBaseline_toBaselineOf="@id/messageMemberNameView"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View File

@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?riotx_background"
android:padding="8dp"> android:padding="8dp">


<View <View
@ -16,7 +17,7 @@
android:layout_marginEnd="32dp" android:layout_marginEnd="32dp"
android:layout_marginRight="32dp" android:layout_marginRight="32dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:background="@color/pale_grey_two" android:background="?riotx_header_panel_background"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/itemDayTextView" app:layout_constraintEnd_toStartOf="@+id/itemDayTextView"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -28,7 +29,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:textColor="@color/light_grey_blue" android:textColor="?riotx_header_panel_text_primary"
android:textSize="15sp" android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -46,7 +47,7 @@
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:background="@color/pale_grey_two" android:background="?riotx_header_panel_background"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/itemDayTextView" app:layout_constraintStart_toEndOf="@id/itemDayTextView"

View File

@ -50,7 +50,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:textColor="?android:textColorSecondary" android:textColor="?riotx_text_secondary"
android:textIsSelectable="false" android:textIsSelectable="false"
android:textSize="14sp" android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View File

@ -22,7 +22,7 @@
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:textColor="@color/slate_grey" android:textColor="?riotx_text_secondary"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="italic" android:textStyle="italic"
tools:text="John doe changed their avatar" /> tools:text="John doe changed their avatar" />

View File

@ -4,6 +4,6 @@
android:id="@+id/messageTextView" android:id="@+id/messageTextView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/dark_grey" android:textColor="?riotx_text_primary"
android:textSize="14sp" android:textSize="14sp"
tools:text="@sample/matrix.json/data/message" /> tools:text="@sample/matrix.json/data/message" />

View File

@ -72,7 +72,7 @@
android:layout_height="22dp" android:layout_height="22dp"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
android:src="@drawable/ic_close_round" android:src="@drawable/ic_close_round"
android:tint="@color/rosy_pink" android:tint="@color/riotx_notice"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />





View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?><!-- Create several FABs to manage different icon size. maxImageSize cannot be set programmatically -->
<merge 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:id="@+id/createRoomContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:constraintSet="@layout/constraint_set_fab_menu_open"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">

<View
android:id="@+id/createRoomTouchGuard"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?riotx_touch_guard_bg" />

<!-- Sub menu item 2 -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/createRoomItemGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:src="@drawable/ic_fab_add_room"
android:visibility="gone"
app:backgroundTint="?riotx_fab_secondary_bg"
app:fabCustomSize="48dp"
app:maxImageSize="26dp"
app:tint="?riotx_fab_secondary_color"
tools:ignore="MissingConstraints"
tools:visibility="visible" />

<TextView
android:id="@+id/createRoomItemGroupLabel"
style="@style/VectorLabel"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="@string/fab_menu_create_room" />

<!-- Sub menu item 1 -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/createRoomItemChat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:src="@drawable/ic_fab_add_chat"
android:visibility="gone"
app:backgroundTint="?riotx_fab_secondary_bg"
app:fabCustomSize="48dp"
app:maxImageSize="29dp"
app:tint="?riotx_fab_secondary_color"
tools:ignore="MissingConstraints"
tools:visibility="visible" />

<TextView
android:id="@+id/createRoomItemChatLabel"
style="@style/VectorLabel"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:text="@string/fab_menu_create_chat" />

<!-- Menu -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/createRoomButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:src="@drawable/ic_fab_add"
android:visibility="gone"
app:maxImageSize="14dp"
tools:ignore="MissingConstraints"
tools:visibility="visible" />

</merge>

Some files were not shown because too many files have changed in this diff Show More