mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 19:36:08 +03:00
Merge pull request #164 from vector-im/feature/cleanup
Theme integration
This commit is contained in:
commit
b782e5e8af
128 changed files with 2604 additions and 1038 deletions
|
@ -16,7 +16,6 @@
|
|||
|
||||
package im.vector.matrix.android.api
|
||||
|
||||
import java.util.*
|
||||
import java.util.regex.Pattern
|
||||
|
||||
/**
|
||||
|
@ -25,53 +24,53 @@ import java.util.regex.Pattern
|
|||
object MatrixPatterns {
|
||||
|
||||
// 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.
|
||||
// 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"
|
||||
val PATTERN_CONTAIN_MATRIX_USER_IDENTIFIER = Pattern.compile(MATRIX_USER_IDENTIFIER_REGEX, Pattern.CASE_INSENSITIVE)
|
||||
private const val MATRIX_USER_IDENTIFIER_REGEX = "@[A-Z0-9\\x21-\\x39\\x3B-\\x7F]+$DOMAIN_REGEX"
|
||||
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.
|
||||
private 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 const val MATRIX_ROOM_IDENTIFIER_REGEX = "![A-Z0-9]+$DOMAIN_REGEX"
|
||||
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.
|
||||
private 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 const val MATRIX_ROOM_ALIAS_REGEX = "#[A-Z0-9._%#@=+-]+$DOMAIN_REGEX"
|
||||
private val PATTERN_CONTAIN_MATRIX_ALIAS = Pattern.compile(MATRIX_ROOM_ALIAS_REGEX, Pattern.CASE_INSENSITIVE)
|
||||
|
||||
// regex pattern to find message ids in a string.
|
||||
private 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 const val MATRIX_EVENT_IDENTIFIER_REGEX = "\\$[A-Z0-9]+$DOMAIN_REGEX"
|
||||
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.
|
||||
private 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 const val MATRIX_EVENT_IDENTIFIER_V3_REGEX = "\\$[A-Z0-9/+]+"
|
||||
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.
|
||||
private 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 const val MATRIX_GROUP_IDENTIFIER_REGEX = "\\+[A-Z0-9=_\\-./]+$DOMAIN_REGEX"
|
||||
private val PATTERN_CONTAIN_MATRIX_GROUP_IDENTIFIER = Pattern.compile(MATRIX_GROUP_IDENTIFIER_REGEX, Pattern.CASE_INSENSITIVE)
|
||||
|
||||
// regex pattern to find permalink with message id.
|
||||
// Android does not support in URL so extract it.
|
||||
private val PERMALINK_BASE_REGEX = "https://matrix\\.to/#/"
|
||||
private val APP_BASE_REGEX = "https://[A-Z0-9.-]+\\.[A-Z]{2,}/[A-Z]{3,}/#/room/"
|
||||
val SEP_REGEX = "/"
|
||||
private const val PERMALINK_BASE_REGEX = "https://matrix\\.to/#/"
|
||||
private const val APP_BASE_REGEX = "https://[A-Z0-9.-]+\\.[A-Z]{2,}/[A-Z]{3,}/#/room/"
|
||||
const val SEP_REGEX = "/"
|
||||
|
||||
private 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 const val LINK_TO_ROOM_ID_REGEXP = PERMALINK_BASE_REGEX + MATRIX_ROOM_IDENTIFIER_REGEX + SEP_REGEX + MATRIX_EVENT_IDENTIFIER_REGEX
|
||||
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
|
||||
val PATTERN_CONTAIN_MATRIX_TO_PERMALINK_ROOM_ALIAS = Pattern.compile(LINK_TO_ROOM_ALIAS_REGEXP, Pattern.CASE_INSENSITIVE)
|
||||
private const val LINK_TO_ROOM_ALIAS_REGEXP = PERMALINK_BASE_REGEX + MATRIX_ROOM_ALIAS_REGEX + SEP_REGEX + MATRIX_EVENT_IDENTIFIER_REGEX
|
||||
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
|
||||
val PATTERN_CONTAIN_APP_LINK_PERMALINK_ROOM_ID = Pattern.compile(LINK_TO_APP_ROOM_ID_REGEXP, Pattern.CASE_INSENSITIVE)
|
||||
private const val LINK_TO_APP_ROOM_ID_REGEXP = APP_BASE_REGEX + MATRIX_ROOM_IDENTIFIER_REGEX + SEP_REGEX + MATRIX_EVENT_IDENTIFIER_REGEX
|
||||
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
|
||||
val PATTERN_CONTAIN_APP_LINK_PERMALINK_ROOM_ALIAS = Pattern.compile(LINK_TO_APP_ROOM_ALIAS_REGEXP, Pattern.CASE_INSENSITIVE)
|
||||
private const val LINK_TO_APP_ROOM_ALIAS_REGEXP = APP_BASE_REGEX + MATRIX_ROOM_ALIAS_REGEX + SEP_REGEX + MATRIX_EVENT_IDENTIFIER_REGEX
|
||||
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.
|
||||
val MATRIX_PATTERNS = Arrays.asList(
|
||||
val MATRIX_PATTERNS = listOf(
|
||||
PATTERN_CONTAIN_MATRIX_TO_PERMALINK_ROOM_ID,
|
||||
PATTERN_CONTAIN_MATRIX_TO_PERMALINK_ROOM_ALIAS,
|
||||
PATTERN_CONTAIN_APP_LINK_PERMALINK_ROOM_ID,
|
||||
|
@ -133,4 +132,4 @@ object MatrixPatterns {
|
|||
fun isGroupId(str: String?): Boolean {
|
||||
return str != null && PATTERN_CONTAIN_MATRIX_GROUP_IDENTIFIER.matcher(str).matches()
|
||||
}
|
||||
}// Cannot be instantiated
|
||||
}
|
||||
|
|
|
@ -18,16 +18,16 @@ package im.vector.matrix.android.api.session.room.model.message
|
|||
|
||||
object MessageType {
|
||||
|
||||
val MSGTYPE_TEXT = "m.text"
|
||||
val MSGTYPE_EMOTE = "m.emote"
|
||||
val MSGTYPE_NOTICE = "m.notice"
|
||||
val MSGTYPE_IMAGE = "m.image"
|
||||
val MSGTYPE_AUDIO = "m.audio"
|
||||
val MSGTYPE_VIDEO = "m.video"
|
||||
val MSGTYPE_LOCATION = "m.location"
|
||||
val MSGTYPE_FILE = "m.file"
|
||||
val FORMAT_MATRIX_HTML = "org.matrix.custom.html"
|
||||
const val MSGTYPE_TEXT = "m.text"
|
||||
const val MSGTYPE_EMOTE = "m.emote"
|
||||
const val MSGTYPE_NOTICE = "m.notice"
|
||||
const val MSGTYPE_IMAGE = "m.image"
|
||||
const val MSGTYPE_AUDIO = "m.audio"
|
||||
const val MSGTYPE_VIDEO = "m.video"
|
||||
const val MSGTYPE_LOCATION = "m.location"
|
||||
const val MSGTYPE_FILE = "m.file"
|
||||
const val FORMAT_MATRIX_HTML = "org.matrix.custom.html"
|
||||
// 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
|
||||
val MSGTYPE_STICKER_LOCAL = "org.matrix.android.sdk.sticker"
|
||||
const val MSGTYPE_STICKER_LOCAL = "org.matrix.android.sdk.sticker"
|
||||
}
|
14
vector/src/debug/AndroidManifest.xml
Normal file
14
vector/src/debug/AndroidManifest.xml
Normal 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>
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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()
|
|
@ -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()
|
|
@ -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))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
8
vector/src/debug/res/drawable/linear_divider.xml
Normal file
8
vector/src/debug/res/drawable/linear_divider.xml
Normal 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>
|
54
vector/src/debug/res/layout/activity_debug_menu.xml
Normal file
54
vector/src/debug/res/layout/activity_debug_menu.xml
Normal 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>
|
31
vector/src/debug/res/layout/activity_test_linkify.xml
Normal file
31
vector/src/debug/res/layout/activity_test_linkify.xml
Normal 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>
|
168
vector/src/debug/res/layout/activity_test_material_theme.xml
Normal file
168
vector/src/debug/res/layout/activity_test_material_theme.xml
Normal 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>
|
31
vector/src/debug/res/layout/demo_store_listing.xml
Normal file
31
vector/src/debug/res/layout/demo_store_listing.xml
Normal 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>
|
28
vector/src/debug/res/layout/demo_theme_sample.xml
Normal file
28
vector/src/debug/res/layout/demo_theme_sample.xml
Normal 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>
|
54
vector/src/debug/res/layout/demo_themes.xml
Normal file
54
vector/src/debug/res/layout/demo_themes.xml
Normal 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>
|
43
vector/src/debug/res/layout/item_test_linkify.xml
Normal file
43
vector/src/debug/res/layout/item_test_linkify.xml
Normal 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>
|
59
vector/src/debug/res/values/styles.xml
Normal file
59
vector/src/debug/res/values/styles.xml
Normal 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>
|
|
@ -46,6 +46,7 @@
|
|||
<activity android:name=".features.roomdirectory.RoomDirectoryActivity" />
|
||||
<activity android:name=".features.roomdirectory.roompreview.RoomPreviewActivity" />
|
||||
<activity android:name=".features.home.room.detail.RoomDetailActivity" />
|
||||
<activity android:name=".features.debug.DebugMenuActivity" />
|
||||
|
||||
<service
|
||||
android:name=".core.services.CallService"
|
||||
|
|
|
@ -18,6 +18,7 @@ package im.vector.riotredesign
|
|||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import androidx.multidex.MultiDex
|
||||
import com.airbnb.epoxy.EpoxyAsyncUtil
|
||||
import com.airbnb.epoxy.EpoxyController
|
||||
|
@ -27,10 +28,12 @@ import com.github.piasy.biv.loader.glide.GlideImageLoader
|
|||
import com.jakewharton.threetenabp.AndroidThreeTen
|
||||
import im.vector.matrix.android.api.Matrix
|
||||
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.rageshake.VectorFileLogger
|
||||
import im.vector.riotredesign.features.rageshake.VectorUncaughtExceptionHandler
|
||||
import im.vector.riotredesign.features.roomdirectory.RoomDirectoryModule
|
||||
import org.koin.android.ext.android.inject
|
||||
import org.koin.log.EmptyLogger
|
||||
import org.koin.standalone.StandAloneContext.startKoin
|
||||
import timber.log.Timber
|
||||
|
@ -38,6 +41,8 @@ import timber.log.Timber
|
|||
|
||||
class VectorApplication : Application() {
|
||||
|
||||
val vectorConfiguration: VectorConfiguration by inject()
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
|
@ -61,6 +66,8 @@ class VectorApplication : Application() {
|
|||
startKoin(listOf(appModule, homeModule, roomDirectoryModule), logger = EmptyLogger())
|
||||
|
||||
Matrix.getInstance().setApplicationFlavor(BuildConfig.FLAVOR_DESCRIPTION)
|
||||
|
||||
vectorConfiguration.initConfiguration()
|
||||
}
|
||||
|
||||
override fun attachBaseContext(base: Context) {
|
||||
|
@ -68,4 +75,10 @@ class VectorApplication : Application() {
|
|||
MultiDex.install(this)
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration?) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
|
||||
vectorConfiguration.onConfigurationChanged(newConfig)
|
||||
}
|
||||
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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))
|
||||
}
|
||||
|
||||
}
|
|
@ -24,6 +24,7 @@ import im.vector.riotredesign.core.error.ErrorFormatter
|
|||
import im.vector.riotredesign.core.resources.LocaleProvider
|
||||
import im.vector.riotredesign.core.resources.StringArrayProvider
|
||||
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.group.SelectedGroupStore
|
||||
import im.vector.riotredesign.features.home.room.list.AlphabeticalRoomComparator
|
||||
|
@ -37,6 +38,10 @@ class AppModule(private val context: Context) {
|
|||
|
||||
val definition = module {
|
||||
|
||||
single {
|
||||
VectorConfiguration(context)
|
||||
}
|
||||
|
||||
single {
|
||||
LocaleProvider(context.resources)
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package im.vector.riotredesign.core.platform
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
|
@ -24,6 +25,8 @@ import android.view.View
|
|||
import androidx.annotation.*
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import butterknife.BindView
|
||||
import butterknife.ButterKnife
|
||||
import butterknife.Unbinder
|
||||
|
@ -33,14 +36,16 @@ import com.google.android.material.snackbar.Snackbar
|
|||
import im.vector.riotredesign.BuildConfig
|
||||
import im.vector.riotredesign.R
|
||||
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.BugReporter
|
||||
import im.vector.riotredesign.features.rageshake.RageShake
|
||||
import im.vector.riotredesign.features.themes.ThemeUtils
|
||||
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.Disposable
|
||||
import org.koin.android.ext.android.inject
|
||||
import timber.log.Timber
|
||||
|
||||
|
||||
|
@ -58,6 +63,10 @@ abstract class VectorBaseActivity : BaseMvRxActivity() {
|
|||
* DATA
|
||||
* ========================================================================================== */
|
||||
|
||||
private val vectorConfiguration: VectorConfiguration by inject()
|
||||
|
||||
private lateinit var configurationViewModel: ConfigurationViewModel
|
||||
|
||||
private var unBinder: Unbinder? = null
|
||||
|
||||
private var savedInstanceState: Bundle? = null
|
||||
|
@ -70,6 +79,10 @@ abstract class VectorBaseActivity : BaseMvRxActivity() {
|
|||
|
||||
private var rageShake: RageShake? = null
|
||||
|
||||
override fun attachBaseContext(base: Context) {
|
||||
super.attachBaseContext(vectorConfiguration.getLocalisedContext(base))
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
restorables.forEach { it.onSaveInstanceState(outState) }
|
||||
|
@ -95,6 +108,16 @@ abstract class VectorBaseActivity : BaseMvRxActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
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
|
||||
rageShake = RageShake(this)
|
||||
|
||||
|
@ -136,6 +159,8 @@ abstract class VectorBaseActivity : BaseMvRxActivity() {
|
|||
|
||||
Timber.d("onResume Activity ${this.javaClass.simpleName}")
|
||||
|
||||
configurationViewModel.onActivityResumed()
|
||||
|
||||
if (this !is BugReportActivity) {
|
||||
rageShake?.start()
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
|
@ -45,9 +45,9 @@ object AvatarRenderer {
|
|||
private const val THUMBNAIL_SIZE = 250
|
||||
|
||||
private val AVATAR_COLOR_LIST = listOf(
|
||||
R.color.avatar_color_1,
|
||||
R.color.avatar_color_2,
|
||||
R.color.avatar_color_3
|
||||
R.color.riotx_avatar_fill_1,
|
||||
R.color.riotx_avatar_fill_2,
|
||||
R.color.riotx_avatar_fill_3
|
||||
)
|
||||
|
||||
@UiThread
|
||||
|
@ -118,33 +118,4 @@ object AvatarRenderer {
|
|||
.load(resolvedUrl)
|
||||
.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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -56,5 +56,10 @@ class HomeDrawerFragment : VectorBaseFragment() {
|
|||
homeDrawerHeaderSettingsView.setOnClickListener {
|
||||
navigator.openSettings()
|
||||
}
|
||||
|
||||
// Debug menu
|
||||
homeDrawerHeaderDebugView.setOnClickListener {
|
||||
navigator.openDebug()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -75,6 +75,7 @@ import im.vector.riotredesign.features.command.Command
|
|||
import im.vector.riotredesign.features.home.AvatarRenderer
|
||||
import im.vector.riotredesign.features.home.HomeModule
|
||||
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.TextComposerView
|
||||
import im.vector.riotredesign.features.home.room.detail.composer.TextComposerViewModel
|
||||
|
@ -223,8 +224,7 @@ class RoomDetailFragment :
|
|||
//switch to expanded bar
|
||||
composerLayout.composerRelatedMessageTitle.apply {
|
||||
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?
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
package im.vector.riotredesign.features.home.room.detail.timeline.action
|
||||
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import com.airbnb.mvrx.MvRx
|
||||
import com.airbnb.mvrx.MvRxView
|
||||
import com.airbnb.mvrx.MvRxViewModelStore
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
|
@ -51,6 +53,10 @@ abstract class BaseMvRxBottomSheetDialog : BottomSheetDialogFragment(), MvRxView
|
|||
// subscribe to a ViewModel.
|
||||
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"
|
|
@ -144,15 +144,15 @@ class MessageActionsBottomSheet : BaseMvRxBottomSheetDialog() {
|
|||
|
||||
companion object {
|
||||
fun newInstance(roomId: String, informationData: MessageInformationData): MessageActionsBottomSheet {
|
||||
val args = Bundle()
|
||||
val parcelableArgs = ParcelableArgs(
|
||||
informationData.eventId,
|
||||
roomId,
|
||||
informationData
|
||||
)
|
||||
args.putParcelable(MvRx.KEY_ARG, parcelableArgs)
|
||||
return MessageActionsBottomSheet().apply { arguments = args }
|
||||
|
||||
return MessageActionsBottomSheet().apply {
|
||||
setArguments(
|
||||
ParcelableArgs(
|
||||
informationData.eventId,
|
||||
roomId,
|
||||
informationData
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,6 +41,7 @@ import im.vector.riotredesign.core.resources.ColorProvider
|
|||
import im.vector.riotredesign.core.resources.StringProvider
|
||||
import im.vector.riotredesign.core.utils.DebouncedClickListener
|
||||
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.helper.TimelineDateFormatter
|
||||
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 memberName = event.senderName ?: event.root.sender ?: ""
|
||||
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
|
||||
|
@ -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? {
|
||||
return MessageFileItem_()
|
||||
.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? {
|
||||
return MessageFileItem_()
|
||||
.informationData(informationData)
|
||||
|
@ -198,7 +201,8 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
|||
return DefaultItem_().text(text)
|
||||
}
|
||||
|
||||
private fun buildImageMessageItem(messageContent: MessageImageContent, informationData: MessageInformationData,
|
||||
private fun buildImageMessageItem(messageContent: MessageImageContent,
|
||||
informationData: MessageInformationData,
|
||||
callback: TimelineEventController.Callback?): MessageImageVideoItem? {
|
||||
|
||||
val (maxWidth, maxHeight) = timelineMediaSizeProvider.getMaxSize()
|
||||
|
@ -233,14 +237,14 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
|||
DebouncedClickListener(View.OnClickListener { view ->
|
||||
callback?.onEventCellClicked(informationData, messageContent, view)
|
||||
}))
|
||||
|
||||
.longClickListener { view ->
|
||||
return@longClickListener callback?.onEventLongClicked(informationData, messageContent, view)
|
||||
?: false
|
||||
}
|
||||
}
|
||||
|
||||
private fun buildVideoMessageItem(messageContent: MessageVideoContent, informationData: MessageInformationData,
|
||||
private fun buildVideoMessageItem(messageContent: MessageVideoContent,
|
||||
informationData: MessageInformationData,
|
||||
callback: TimelineEventController.Callback?): MessageImageVideoItem? {
|
||||
|
||||
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,
|
||||
hasBeenEdited: Boolean,
|
||||
editSummary: EditAggregatedSummary?,
|
||||
|
@ -335,6 +340,7 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
|||
editSummary: EditAggregatedSummary?): SpannableStringBuilder {
|
||||
val spannable = SpannableStringBuilder()
|
||||
spannable.append(linkifiedBody)
|
||||
// TODO i18n
|
||||
val editedSuffix = "(edited)"
|
||||
spannable.append(" ").append(editedSuffix)
|
||||
val color = colorProvider.getColorFromAttribute(R.attr.vctr_list_header_secondary_text_color)
|
||||
|
@ -362,13 +368,14 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
|||
return spannable
|
||||
}
|
||||
|
||||
private fun buildNoticeMessageItem(messageContent: MessageNoticeContent, informationData: MessageInformationData,
|
||||
private fun buildNoticeMessageItem(messageContent: MessageNoticeContent,
|
||||
informationData: MessageInformationData,
|
||||
callback: TimelineEventController.Callback?): MessageTextItem? {
|
||||
|
||||
val message = messageContent.body.let {
|
||||
val formattedBody = span {
|
||||
text = it
|
||||
textColor = colorProvider.getColor(R.color.slate_grey)
|
||||
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)
|
||||
textStyle = "italic"
|
||||
}
|
||||
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,
|
||||
editSummary: EditAggregatedSummary?,
|
||||
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_()
|
||||
.informationData(informationData)
|
||||
.avatarClickListener(
|
||||
|
@ -456,32 +465,4 @@ class MessageItemFactory(private val colorProvider: ColorProvider,
|
|||
VectorLinkify.addLinks(spannable, true)
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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.VectorEpoxyModel
|
||||
import im.vector.riotredesign.features.home.room.detail.timeline.TimelineEventController
|
||||
import timber.log.Timber
|
||||
|
||||
class TimelineItemFactory(private val messageItemFactory: MessageItemFactory,
|
||||
private val noticeItemFactory: NoticeItemFactory,
|
||||
|
@ -32,8 +33,10 @@ class TimelineItemFactory(private val messageItemFactory: MessageItemFactory,
|
|||
|
||||
val computedModel = try {
|
||||
when (event.root.type) {
|
||||
// Message
|
||||
EventType.MESSAGE -> messageItemFactory.create(event, nextEvent, callback)
|
||||
|
||||
// State and call
|
||||
EventType.STATE_ROOM_NAME,
|
||||
EventType.STATE_ROOM_TOPIC,
|
||||
EventType.STATE_ROOM_MEMBER,
|
||||
|
@ -42,12 +45,16 @@ class TimelineItemFactory(private val messageItemFactory: MessageItemFactory,
|
|||
EventType.CALL_HANGUP,
|
||||
EventType.CALL_ANSWER -> noticeItemFactory.create(event)
|
||||
|
||||
// Unhandled event types (yet)
|
||||
EventType.ENCRYPTED,
|
||||
EventType.ENCRYPTION,
|
||||
EventType.STATE_ROOM_THIRD_PARTY_INVITE,
|
||||
EventType.STICKER,
|
||||
EventType.STATE_ROOM_CREATE -> defaultItemFactory.create(event)
|
||||
else -> null
|
||||
else -> {
|
||||
Timber.w("Ignored event (type: ${event.root.type}")
|
||||
null
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
defaultItemFactory.create(event, e)
|
||||
|
|
|
@ -40,6 +40,6 @@ abstract class DefaultItem : BaseEventItem<DefaultItem.Holder>() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
private val STUB_ID = R.id.messageContentDefaultStub
|
||||
private const val STUB_ID = R.id.messageContentDefaultStub
|
||||
}
|
||||
}
|
|
@ -57,6 +57,6 @@ abstract class NoticeItem : BaseEventItem<NoticeItem.Holder>() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
private val STUB_ID = R.id.messageContentNoticeStub
|
||||
private const val STUB_ID = R.id.messageContentNoticeStub
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@ import com.airbnb.epoxy.EpoxyModelClass
|
|||
import im.vector.riotredesign.R
|
||||
import im.vector.riotredesign.core.epoxy.VectorEpoxyHolder
|
||||
import im.vector.riotredesign.core.epoxy.VectorEpoxyModel
|
||||
import im.vector.riotredesign.features.themes.ThemeUtils
|
||||
|
||||
@EpoxyModelClass(layout = R.layout.item_room_category)
|
||||
abstract class RoomCategoryItem : VectorEpoxyModel<RoomCategoryItem.Holder>() {
|
||||
|
@ -36,7 +37,7 @@ abstract class RoomCategoryItem : VectorEpoxyModel<RoomCategoryItem.Holder>() {
|
|||
@EpoxyAttribute var listener: (() -> Unit)? = null
|
||||
|
||||
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 expandedArrowDrawable = ContextCompat.getDrawable(holder.rootView.context, expandedArrowDrawableRes)?.also {
|
||||
DrawableCompat.setTint(it, tintColor)
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package im.vector.riotredesign.features.home.room.list
|
||||
|
||||
import android.animation.Animator
|
||||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import androidx.annotation.StringRes
|
||||
|
@ -25,18 +24,16 @@ import androidx.core.view.isVisible
|
|||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
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.session.room.model.Membership
|
||||
import im.vector.matrix.android.api.session.room.model.RoomSummary
|
||||
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.extensions.observeEvent
|
||||
import im.vector.riotredesign.core.platform.OnBackPressed
|
||||
import im.vector.riotredesign.core.platform.StateView
|
||||
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.synthetic.main.fragment_room_list.*
|
||||
import org.koin.android.ext.android.inject
|
||||
|
@ -47,11 +44,7 @@ data class RoomListParams(
|
|||
) : Parcelable
|
||||
|
||||
|
||||
class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, OnBackPressed {
|
||||
|
||||
lateinit var fabButton: FloatingActionButton
|
||||
|
||||
private var isFabMenuOpened = false
|
||||
class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, OnBackPressed, FabMenuView.Listener {
|
||||
|
||||
enum class DisplayMode(@StringRes val titleRes: Int) {
|
||||
HOME(R.string.bottom_action_home),
|
||||
|
@ -82,21 +75,16 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, O
|
|||
navigator.openRoom(it)
|
||||
}
|
||||
|
||||
isFabMenuOpened = false
|
||||
createChatFabMenu.listener = this
|
||||
}
|
||||
|
||||
private fun setupCreateRoomButton() {
|
||||
fabButton = when (roomListParams.displayMode) {
|
||||
DisplayMode.HOME -> createRoomButton
|
||||
DisplayMode.PEOPLE -> createChatRoomButton
|
||||
else -> createGroupRoomButton
|
||||
when (roomListParams.displayMode) {
|
||||
DisplayMode.HOME -> createChatFabMenu.isVisible = true
|
||||
DisplayMode.PEOPLE -> createChatRoomButton.isVisible = true
|
||||
else -> createGroupRoomButton.isVisible = true
|
||||
}
|
||||
|
||||
fabButton.isVisible = true
|
||||
|
||||
createRoomButton.setOnClickListener {
|
||||
toggleFabMenu()
|
||||
}
|
||||
createChatRoomButton.setOnClickListener {
|
||||
createDirectChat()
|
||||
}
|
||||
|
@ -104,93 +92,34 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, O
|
|||
openRoomDirectory()
|
||||
}
|
||||
|
||||
createRoomItemChat.setOnClickListener {
|
||||
toggleFabMenu()
|
||||
createDirectChat()
|
||||
}
|
||||
createRoomItemGroup.setOnClickListener {
|
||||
toggleFabMenu()
|
||||
openRoomDirectory()
|
||||
}
|
||||
|
||||
createRoomTouchGuard.setOnClickListener {
|
||||
toggleFabMenu()
|
||||
}
|
||||
|
||||
createRoomTouchGuard.isClickable = false
|
||||
|
||||
// Hide FAB when list is scrolling
|
||||
epoxyRecyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
||||
fabButton.removeCallbacks(showFabRunnable)
|
||||
createChatFabMenu.removeCallbacks(showFabRunnable)
|
||||
|
||||
when (newState) {
|
||||
RecyclerView.SCROLL_STATE_IDLE -> {
|
||||
fabButton.postDelayed(showFabRunnable, 1000)
|
||||
createChatFabMenu.postDelayed(showFabRunnable, 1000)
|
||||
}
|
||||
RecyclerView.SCROLL_STATE_DRAGGING,
|
||||
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) {
|
||||
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() {
|
||||
override fun openRoomDirectory() {
|
||||
navigator.openRoomDirectory()
|
||||
}
|
||||
|
||||
private fun createDirectChat() {
|
||||
override fun createDirectChat() {
|
||||
vectorBaseActivity.notImplemented("creating direct chat")
|
||||
}
|
||||
|
||||
|
@ -206,7 +135,13 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, O
|
|||
}
|
||||
|
||||
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) {
|
||||
|
@ -278,8 +213,7 @@ class RoomListFragment : VectorBaseFragment(), RoomSummaryController.Callback, O
|
|||
}
|
||||
|
||||
override fun onBackPressed(): Boolean {
|
||||
if (isFabMenuOpened) {
|
||||
toggleFabMenu()
|
||||
if (createChatFabMenu.onBackPressed()) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.util.AttributeSet
|
|||
import android.view.View
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import im.vector.riotredesign.R
|
||||
import im.vector.riotredesign.features.themes.ThemeUtils
|
||||
|
||||
class UnreadCounterBadgeView : AppCompatTextView {
|
||||
|
||||
|
@ -37,7 +38,7 @@ class UnreadCounterBadgeView : AppCompatTextView {
|
|||
val bgRes = if (state.highlighted) {
|
||||
R.drawable.bg_unread_highlight
|
||||
} else {
|
||||
R.drawable.bg_unread_notification
|
||||
ThemeUtils.getResourceId(context, R.drawable.bg_unread_notification_light)
|
||||
}
|
||||
setBackgroundResource(bgRes)
|
||||
text = RoomSummaryFormatter.formatUnreadMessagesCounter(state.count)
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
}
|
|
@ -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.sync.FilterService
|
||||
import im.vector.riotredesign.R
|
||||
import im.vector.riotredesign.core.extensions.showPassword
|
||||
import im.vector.riotredesign.core.platform.VectorBaseActivity
|
||||
import im.vector.riotredesign.features.home.HomeActivity
|
||||
import io.reactivex.Observable
|
||||
|
@ -44,14 +45,20 @@ class LoginActivity : VectorBaseActivity() {
|
|||
|
||||
private val authenticator = Matrix.getInstance().authenticator()
|
||||
|
||||
private var passwordShown = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_login)
|
||||
setupAuthButton()
|
||||
setupPasswordReveal()
|
||||
homeServerField.setText(DEFAULT_HOME_SERVER_URI)
|
||||
}
|
||||
|
||||
private fun authenticate() {
|
||||
passwordShown = false
|
||||
renderPasswordField()
|
||||
|
||||
val login = loginField.text?.trim().toString()
|
||||
val password = passwordField.text?.trim().toString()
|
||||
buildHomeServerConnectionConfig().fold(
|
||||
|
@ -105,6 +112,24 @@ class LoginActivity : VectorBaseActivity() {
|
|||
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() {
|
||||
val intent = HomeActivity.newIntent(this)
|
||||
startActivity(intent)
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.app.Activity
|
|||
import android.content.Intent
|
||||
import androidx.fragment.app.Fragment
|
||||
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.RoomDetailArgs
|
||||
import im.vector.riotredesign.features.roomdirectory.RoomDirectoryActivity
|
||||
|
@ -50,4 +51,8 @@ class DefaultNavigator(private val fraqment: Fragment) : Navigator {
|
|||
val intent = VectorSettingsActivity.getIntent(activity, "TODO")
|
||||
activity.startActivity(intent)
|
||||
}
|
||||
|
||||
override fun openDebug() {
|
||||
activity.startActivity(Intent(activity, DebugMenuActivity::class.java))
|
||||
}
|
||||
}
|
|
@ -28,4 +28,6 @@ interface Navigator {
|
|||
|
||||
fun openSettings()
|
||||
|
||||
fun openDebug()
|
||||
|
||||
}
|
|
@ -32,6 +32,7 @@ import im.vector.riotredesign.core.error.ErrorFormatter
|
|||
import im.vector.riotredesign.core.extensions.addFragmentToBackstack
|
||||
import im.vector.riotredesign.core.platform.VectorBaseFragment
|
||||
import im.vector.riotredesign.features.roomdirectory.picker.RoomDirectoryPickerFragment
|
||||
import im.vector.riotredesign.features.themes.ThemeUtils
|
||||
import io.reactivex.rxkotlin.subscribeBy
|
||||
import kotlinx.android.synthetic.main.fragment_public_rooms.*
|
||||
import org.koin.android.ext.android.inject
|
||||
|
@ -58,13 +59,15 @@ class PublicRoomsFragment : VectorBaseFragment(), PublicRoomsController.Callback
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
vectorBaseActivity.setSupportActionBar(toolbar)
|
||||
vectorBaseActivity.setSupportActionBar(publicRoomsToolbar)
|
||||
|
||||
vectorBaseActivity.supportActionBar?.let {
|
||||
it.setDisplayShowHomeEnabled(true)
|
||||
it.setDisplayHomeAsUpEnabled(true)
|
||||
}
|
||||
|
||||
publicRoomsFilter.setBackgroundResource(ThemeUtils.getResourceId(requireContext(), R.drawable.bg_search_edit_text_light))
|
||||
|
||||
RxTextView.textChanges(publicRoomsFilter)
|
||||
.debounce(500, TimeUnit.MILLISECONDS)
|
||||
.subscribeBy {
|
||||
|
|
|
@ -28,7 +28,6 @@ import im.vector.riotredesign.R
|
|||
import im.vector.riotredesign.core.platform.VectorBaseFragment
|
||||
import im.vector.riotredesign.features.roomdirectory.RoomDirectoryModule
|
||||
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 org.koin.android.ext.android.inject
|
||||
import org.koin.android.scope.ext.android.bindScope
|
||||
|
|
|
@ -54,6 +54,7 @@ import im.vector.riotredesign.core.preference.UserAvatarPreference
|
|||
import im.vector.riotredesign.core.preference.VectorPreference
|
||||
import im.vector.riotredesign.core.utils.*
|
||||
import im.vector.riotredesign.features.MainActivity
|
||||
import im.vector.riotredesign.features.configuration.VectorConfiguration
|
||||
import im.vector.riotredesign.features.themes.ThemeUtils
|
||||
import org.koin.android.ext.android.inject
|
||||
import java.lang.ref.WeakReference
|
||||
|
@ -99,6 +100,8 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
|
|||
// used to avoid requesting to enter the password for each deletion
|
||||
private var mAccountPassword: String? = null
|
||||
|
||||
private val vectorConfiguration by inject<VectorConfiguration>()
|
||||
|
||||
// current publicised group list
|
||||
private var mPublicisedGroups: MutableSet<String>? = null
|
||||
|
||||
|
@ -366,8 +369,10 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
|
|||
findPreference(ThemeUtils.APPLICATION_THEME_KEY)
|
||||
.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
|
||||
if (newValue is String) {
|
||||
// TODO VectorApp.updateApplicationTheme(newValue)
|
||||
vectorConfiguration.updateApplicationTheme(newValue)
|
||||
// Restart the Activity
|
||||
activity?.let {
|
||||
// Note: recreate does not apply the color correctly
|
||||
it.startActivity(it.intent)
|
||||
it.finish()
|
||||
}
|
||||
|
@ -1359,7 +1364,7 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
|
|||
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
when (requestCode) {
|
||||
REQUEST_CALL_RINGTONE -> {
|
||||
REQUEST_CALL_RINGTONE -> {
|
||||
val callRingtoneUri: Uri? = data?.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI)
|
||||
val thisActivity = activity
|
||||
if (callRingtoneUri != null && thisActivity != null) {
|
||||
|
@ -1368,9 +1373,9 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref
|
|||
}
|
||||
}
|
||||
REQUEST_E2E_FILE_REQUEST_CODE -> importKeys(data)
|
||||
REQUEST_NEW_PHONE_NUMBER -> refreshPhoneNumbersList()
|
||||
REQUEST_PHONEBOOK_COUNTRY -> onPhonebookCountryUpdate(data)
|
||||
REQUEST_LOCALE -> {
|
||||
REQUEST_NEW_PHONE_NUMBER -> refreshPhoneNumbersList()
|
||||
REQUEST_PHONEBOOK_COUNTRY -> onPhonebookCountryUpdate(data)
|
||||
REQUEST_LOCALE -> {
|
||||
activity?.let {
|
||||
startActivity(it.intent)
|
||||
it.finish()
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.ui.themes
|
||||
package im.vector.riotredesign.features.themes
|
||||
|
||||
import androidx.annotation.StyleRes
|
||||
import im.vector.riotredesign.R
|
||||
|
@ -33,45 +33,4 @@ sealed class ActivityOtherThemes(@StyleRes val dark: Int,
|
|||
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
|
||||
)
|
||||
}
|
|
@ -20,7 +20,6 @@ package im.vector.riotredesign.features.themes
|
|||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.text.TextUtils
|
||||
import android.util.TypedValue
|
||||
import android.view.Menu
|
||||
import androidx.annotation.AttrRes
|
||||
|
@ -29,7 +28,6 @@ import androidx.core.content.ContextCompat
|
|||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
import im.vector.riotredesign.R
|
||||
import im.vector.ui.themes.ActivityOtherThemes
|
||||
import timber.log.Timber
|
||||
import java.util.*
|
||||
|
||||
|
@ -56,7 +54,7 @@ object ThemeUtils {
|
|||
*/
|
||||
fun getApplicationTheme(context: Context): String {
|
||||
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
|
||||
*/
|
||||
fun setApplicationTheme(context: Context, aTheme: String) {
|
||||
PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.edit()
|
||||
.putString(APPLICATION_THEME_KEY, aTheme)
|
||||
.apply()
|
||||
|
||||
/* TODO
|
||||
when (aTheme) {
|
||||
THEME_DARK_VALUE -> VectorApp.getInstance().setTheme(R.style.AppTheme_Dark)
|
||||
THEME_BLACK_VALUE -> VectorApp.getInstance().setTheme(R.style.AppTheme_Black)
|
||||
THEME_STATUS_VALUE -> VectorApp.getInstance().setTheme(R.style.AppTheme_Status)
|
||||
else -> VectorApp.getInstance().setTheme(R.style.AppTheme_Light)
|
||||
THEME_DARK_VALUE -> context.setTheme(R.style.AppTheme_Dark)
|
||||
THEME_BLACK_VALUE -> context.setTheme(R.style.AppTheme_Black)
|
||||
THEME_STATUS_VALUE -> context.setTheme(R.style.AppTheme_Status)
|
||||
else -> context.setTheme(R.style.AppTheme_Light)
|
||||
}
|
||||
*/
|
||||
|
||||
// Clear the cache
|
||||
mColorByAttr.clear()
|
||||
}
|
||||
|
||||
|
@ -89,8 +81,8 @@ object ThemeUtils {
|
|||
*/
|
||||
fun setActivityTheme(activity: Activity, otherThemes: ActivityOtherThemes) {
|
||||
when (getApplicationTheme(activity)) {
|
||||
THEME_DARK_VALUE -> activity.setTheme(otherThemes.dark)
|
||||
THEME_BLACK_VALUE -> activity.setTheme(otherThemes.black)
|
||||
THEME_DARK_VALUE -> activity.setTheme(otherThemes.dark)
|
||||
THEME_BLACK_VALUE -> activity.setTheme(otherThemes.black)
|
||||
THEME_STATUS_VALUE -> activity.setTheme(otherThemes.status)
|
||||
}
|
||||
|
||||
|
@ -164,7 +156,7 @@ object ThemeUtils {
|
|||
try {
|
||||
val typedValue = TypedValue()
|
||||
c.theme.resolveAttribute(attribute, typedValue, true)
|
||||
return typedValue
|
||||
return typedValue
|
||||
} catch (e: Exception) {
|
||||
Timber.e(e, "Unable to get color")
|
||||
}
|
||||
|
@ -175,19 +167,41 @@ object ThemeUtils {
|
|||
* Get the resource Id applied to the current theme
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
fun getResourceId(c: Context, resourceId: Int): Int {
|
||||
if (TextUtils.equals(getApplicationTheme(c), THEME_LIGHT_VALUE)
|
||||
|| TextUtils.equals(getApplicationTheme(c), THEME_STATUS_VALUE)) {
|
||||
return when (resourceId) {
|
||||
R.drawable.line_divider_dark -> R.drawable.line_divider_light
|
||||
R.style.Floating_Actions_Menu -> R.style.Floating_Actions_Menu_Light
|
||||
else -> resourceId
|
||||
val theme = getApplicationTheme(c)
|
||||
|
||||
return when (theme) {
|
||||
THEME_LIGHT_VALUE -> resourceId
|
||||
THEME_DARK_VALUE -> {
|
||||
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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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" />
|
||||
</shape>
|
|
@ -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>
|
|
@ -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>
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
<corners android:radius="40dp" />
|
||||
|
||||
<solid android:color="@color/rosy_pink" />
|
||||
<solid android:color="@color/riotx_notice" />
|
||||
</shape>
|
|
@ -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>
|
|
@ -5,5 +5,5 @@
|
|||
|
||||
<corners android:radius="40dp" />
|
||||
|
||||
<solid android:color="@color/grey_lynch" />
|
||||
<solid android:color="@color/riotx_unread_room_badge_dark" />
|
||||
</shape>
|
|
@ -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>
|
|
@ -2,5 +2,5 @@
|
|||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<solid android:color="@color/pale_grey" />
|
||||
<solid android:color="#FFF2F5F8" />
|
||||
</shape>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/bugReportToolbar"
|
||||
style="@style/VectorToolbarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:elevation="4dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bug_report_body_view"
|
||||
|
@ -68,6 +68,7 @@
|
|||
android:text="@string/send_bug_report_description" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/VectorTextInputLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
|
@ -83,7 +84,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:hint="@string/send_bug_report_placeholder"
|
||||
android:minHeight="40dp"
|
||||
android:textColor="?android:textColorPrimary" />
|
||||
android:textColor="?riotx_text_primary" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
android:elevation="4dp"
|
||||
android:minHeight="0dp"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap|enterAlways"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap|enterAlways" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
|
|
|
@ -7,12 +7,9 @@
|
|||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/imageMediaViewerToolbar"
|
||||
style="@style/VectorToolbarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
android:elevation="4dp" />
|
||||
|
||||
<com.github.piasy.biv.view.BigImageView
|
||||
android:id="@+id/imageMediaViewerImageView"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
@ -29,6 +30,7 @@
|
|||
android:src="@drawable/logo_login" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/VectorTextInputLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
|
@ -42,23 +44,45 @@
|
|||
android:maxLines="1" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:hint="@string/auth_password_placeholder">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/passwordField"
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/VectorTextInputLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="textPassword"
|
||||
android:maxLines="1" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
android:layout_marginTop="16dp"
|
||||
android:hint="@string/auth_password_placeholder">
|
||||
|
||||
<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
|
||||
style="@style/VectorTextInputLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/settingsToolbar"
|
||||
style="@style/VectorToolbarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:elevation="4dp" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/vector_settings_page"
|
||||
|
|
|
@ -15,19 +15,15 @@
|
|||
-->
|
||||
|
||||
<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_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/videoMediaViewerToolbar"
|
||||
style="@style/VectorToolbarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
android:elevation="4dp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
tools:src="@drawable/ic_delete"
|
||||
android:tint="?android:attr/textColorTertiary" />
|
||||
android:tint="?riotx_text_secondary"
|
||||
tools:src="@drawable/ic_delete" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/action_title"
|
||||
|
@ -31,6 +31,7 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textSize="17sp"
|
||||
tools:text="@string/delete" />
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
android:layout_marginTop="4dp"
|
||||
android:text="@string/reactions_agree"
|
||||
android:textAlignment="center"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/center_guideline"
|
||||
|
@ -108,6 +109,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/reactions_like"
|
||||
android:textAlignment="center"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@id/quick_react_agree_text"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
android:layout_marginEnd="@dimen/layout_horizontal_margin"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="@string/action_sign_out"
|
||||
android:textColor="?riotx_text_primary"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
@ -26,7 +27,7 @@
|
|||
android:layout_marginStart="@dimen/layout_horizontal_margin"
|
||||
android:layout_marginEnd="@dimen/layout_horizontal_margin"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
tools:text="@string/sign_out_bottom_sheet_warning_no_backup" />
|
||||
|
||||
<LinearLayout
|
||||
|
@ -63,6 +64,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
tools:text="@string/keys_backup_info_keys_all_backup_up" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -95,6 +97,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/keys_backup_setup"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textSize="17sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -128,6 +131,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:text="@string/keys_backup_activate"
|
||||
android:textSize="17sp" />
|
||||
|
||||
|
@ -155,14 +159,14 @@
|
|||
android:layout_marginRight="16dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_material_leave"
|
||||
android:tint="@color/vector_error_color" />
|
||||
android:tint="@color/riotx_notice" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
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" />
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -188,14 +192,14 @@
|
|||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:src="@drawable/ic_material_exit_to_app"
|
||||
android:tint="@color/vector_error_color" />
|
||||
android:tint="@color/riotx_notice" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/action_sign_out"
|
||||
android:textColor="@color/vector_error_color"
|
||||
android:textColor="@color/riotx_notice"
|
||||
android:textSize="17sp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
android:ellipsize="end"
|
||||
android:fontFamily="sans-serif-bold"
|
||||
android:singleLine="true"
|
||||
android:textColor="?riotx_text_primary"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -49,8 +50,7 @@
|
|||
app:layout_constraintTop_toTopOf="@id/bottom_sheet_message_preview_avatar"
|
||||
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:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -62,7 +62,7 @@
|
|||
android:layout_marginBottom="4dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="3"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textIsSelectable="false"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toTopOf="@id/bottom_sheet_message_preview_timestamp"
|
||||
|
@ -77,9 +77,9 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/layout_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/layout_horizontal_margin"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="12sp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/bottom_sheet_message_preview_body"
|
||||
|
|
|
@ -88,10 +88,11 @@
|
|||
android:layout_height="22dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:src="@drawable/ic_close_round"
|
||||
android:tint="@color/rosy_pink"
|
||||
android:tint="@color/riotx_notice"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintBottom_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="parent" />
|
||||
app:layout_constraintStart_toEndOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/composer_avatar_view"
|
||||
|
@ -159,6 +160,5 @@
|
|||
app:layout_constraintStart_toEndOf="@+id/composer_avatar_view"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@tools:sample/lorem/random" />
|
||||
<!--tools:text="@tools:sample/lorem/random"-->
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -96,7 +96,7 @@
|
|||
android:layout_marginRight="8dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
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_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/composer_related_message_preview" />
|
||||
|
|
81
vector/src/main/res/layout/constraint_set_fab_menu_close.xml
Normal file
81
vector/src/main/res/layout/constraint_set_fab_menu_close.xml
Normal 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>
|
76
vector/src/main/res/layout/constraint_set_fab_menu_open.xml
Normal file
76
vector/src/main/res/layout/constraint_set_fab_menu_open.xml
Normal 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>
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/change_password_old_pwd_til"
|
||||
style="@style/VectorTextInputLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
@ -50,6 +51,7 @@
|
|||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/VectorTextInputLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
@ -64,6 +66,7 @@
|
|||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/change_password_confirm_new_pwd_til"
|
||||
style="@style/VectorTextInputLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:errorEnabled="true">
|
||||
|
|
|
@ -8,15 +8,12 @@
|
|||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/groupToolbar"
|
||||
style="@style/VectorToolbarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="#FFFFFF"
|
||||
android:elevation="4dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -38,7 +35,7 @@
|
|||
android:layout_marginEnd="32dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/dark_grey"
|
||||
android:textColor="?riotx_text_primary"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="@tools:sample/lorem/random" />
|
||||
|
@ -51,7 +48,7 @@
|
|||
android:id="@+id/roomListContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="#F3F8FD"
|
||||
android:background="?riotx_header_panel_background"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bottomNavigationView"
|
||||
app:layout_constraintTop_toBottomOf="@+id/groupToolbar" />
|
||||
|
||||
|
@ -59,10 +56,8 @@
|
|||
android:id="@+id/bottomNavigationView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:background="#FFFFFF"
|
||||
android:background="?riotx_background"
|
||||
app:itemIconSize="20dp"
|
||||
app:itemIconTint="@color/home_bottom_nav_view_tint"
|
||||
app:itemTextColor="@color/home_bottom_nav_view_tint"
|
||||
app:labelVisibilityMode="unlabeled"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
|
@ -11,11 +11,22 @@
|
|||
android:id="@+id/homeDrawerHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:background="?riotx_base"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="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
|
||||
android:id="@+id/homeDrawerHeaderAvatarView"
|
||||
android:layout_width="64dp"
|
||||
|
@ -72,7 +83,7 @@
|
|||
android:id="@+id/homeDrawerGroupListContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="#FAFAFA"
|
||||
android:background="?riotx_header_panel_background"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
@ -6,30 +6,23 @@
|
|||
android:id="@+id/publicRoomsCoordinator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/pale_grey">
|
||||
android:background="?riotx_header_panel_background">
|
||||
|
||||
<com.airbnb.epoxy.EpoxyRecyclerView
|
||||
android:id="@+id/publicRoomsList"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
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">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/VectorToolbarStyle"
|
||||
android:id="@+id/publicRoomsToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:elevation="4dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:layout_scrollFlags="noScroll"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<!-- Note: Background is modified in the code for other themes -->
|
||||
<EditText
|
||||
android:id="@+id/publicRoomsFilter"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -40,11 +33,11 @@
|
|||
android:layout_marginEnd="@dimen/layout_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/layout_horizontal_margin"
|
||||
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:drawableLeft="@drawable/ic_search_white"
|
||||
android:drawablePadding="8dp"
|
||||
android:drawableTint="#9fa9ba"
|
||||
android:drawableTint="?riotx_text_secondary"
|
||||
android:hint="@string/home_filter_placeholder_rooms"
|
||||
android:lines="1"
|
||||
android:paddingLeft="8dp"
|
||||
|
@ -52,20 +45,32 @@
|
|||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
<Button
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/publicRoomsCreateNewRoom"
|
||||
style="@style/VectorButtonStyleFlat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:drawableStart="@drawable/ic_plus_circle"
|
||||
android:drawableLeft="@drawable/ic_plus_circle"
|
||||
android:drawablePadding="13dp"
|
||||
android:minHeight="@dimen/layout_touch_size"
|
||||
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>
|
|
@ -8,16 +8,13 @@
|
|||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/roomToolbar"
|
||||
style="@style/VectorToolbarStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="?actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:elevation="4dp"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -49,7 +46,7 @@
|
|||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/roomToolbarAvatarImageView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@tools:sample/full_names" />
|
||||
tools:text="@sample/matrix.json/data/roomName" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/roomToolbarSubtitleView"
|
||||
|
@ -66,7 +63,7 @@
|
|||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/roomToolbarAvatarImageView"
|
||||
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>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/pale_grey">
|
||||
android:background="?riotx_header_panel_background">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -16,6 +16,7 @@
|
|||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:elevation="4dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
|
|
@ -1,68 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
|
||||
<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:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/stateView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/pale_grey">
|
||||
android:background="?riotx_header_panel_background">
|
||||
|
||||
<com.airbnb.epoxy.EpoxyRecyclerView
|
||||
android:id="@+id/epoxyRecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<!-- Create several FABs to manage different icon size. maxImageSize cannot be set programmatically -->
|
||||
|
||||
<View
|
||||
android:id="@+id/createRoomTouchGuard"
|
||||
<im.vector.riotredesign.features.home.room.list.widget.FabMenuView
|
||||
android:id="@+id/createChatFabMenu"
|
||||
android:layout_width="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"
|
||||
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" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
|
@ -70,12 +24,14 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
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:src="@drawable/ic_fab_add_chat"
|
||||
android:visibility="gone"
|
||||
app:maxImageSize="34dp"
|
||||
tools:layout_margin="76dp"
|
||||
tools:layout_marginEnd="80dp"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
|
@ -83,11 +39,13 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
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:visibility="gone"
|
||||
app:maxImageSize="32dp"
|
||||
tools:layout_margin="136dp"
|
||||
tools:layout_marginEnd="144dp"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</im.vector.riotredesign.core.platform.StateView>
|
||||
|
|
|
@ -13,13 +13,10 @@
|
|||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/roomPreviewNoPreviewToolbar"
|
||||
style="@style/VectorToolbarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:contentInsetStartWithNavigation="0dp"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
android:elevation="4dp"
|
||||
app:contentInsetStartWithNavigation="0dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -115,7 +112,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/layout_vertical_margin"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/vector_error_color"
|
||||
android:textColor="@color/riotx_notice"
|
||||
android:textSize="15sp"
|
||||
android:visibility="gone"
|
||||
tools:text="Error"
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
tools:text="@string/settings_troubleshoot_diagnostic_running_status" />
|
||||
|
||||
<LinearLayout
|
||||
|
@ -61,7 +61,7 @@
|
|||
<Button
|
||||
android:id="@+id/troubleshoot_run_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="36dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_margin="16dp"
|
||||
android:background="?attr/colorAccent"
|
||||
|
@ -75,7 +75,7 @@
|
|||
<Button
|
||||
android:id="@+id/troubleshoot_summ_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="36dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_margin="16dp"
|
||||
android:background="?attr/colorAccent"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?riotx_background"
|
||||
android:padding="6dp">
|
||||
|
||||
<TextView
|
||||
|
@ -12,6 +13,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:textColor="?riotx_text_primary"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="/invite" />
|
||||
|
@ -26,6 +28,7 @@
|
|||
android:layout_toEndOf="@+id/commandName"
|
||||
android:layout_toRightOf="@+id/commandName"
|
||||
android:maxLines="1"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="italic"
|
||||
tools:text="<user-id>" />
|
||||
|
@ -39,7 +42,7 @@
|
|||
android:layout_alignParentLeft="true"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textSize="12sp"
|
||||
tools:text="@string/command_description_invite_user" />
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/itemErrorRetryButton"
|
||||
style="@style/VectorButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
android:background="@drawable/bg_group_item"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
tools:background="#FAFAFA">
|
||||
android:foreground="?attr/selectableItemBackground">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/groupAvatarImageView"
|
||||
|
@ -32,7 +31,7 @@
|
|||
android:layout_marginEnd="@dimen/layout_horizontal_margin"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/dark_grey"
|
||||
android:textColor="?riotx_text_primary"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toTopOf="@+id/groupBottomSeparator"
|
||||
|
@ -41,7 +40,6 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@tools:sample/lorem/random" />
|
||||
|
||||
<!-- TODO Design Picto -->
|
||||
<ImageView
|
||||
android:id="@+id/groupAvatarChevron"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -49,6 +47,7 @@
|
|||
android:layout_marginEnd="21dp"
|
||||
android:layout_marginRight="21dp"
|
||||
android:src="@drawable/ic_arrow_right"
|
||||
android:tint="?riotx_text_primary"
|
||||
app:layout_constraintBottom_toTopOf="@+id/groupBottomSeparator"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
@ -57,7 +56,7 @@
|
|||
android:id="@+id/groupBottomSeparator"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:background="#E9EDF1"
|
||||
android:background="?riotx_header_panel_border_mobile"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
android:id="@+id/progressBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:background="?riotx_background"
|
||||
android:padding="16dp" />
|
|
@ -49,7 +49,7 @@
|
|||
android:layout_marginRight="16dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@id/troubleshootTestButton"
|
||||
app:layout_constraintEnd_toStartOf="@+id/troubleshootStatusIcon"
|
||||
|
@ -62,7 +62,7 @@
|
|||
<Button
|
||||
android:id="@+id/troubleshootTestButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="36dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
android:id="@+id/itemPublicRoomLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?riotx_background"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
android:minHeight="97dp">
|
||||
|
||||
<ImageView
|
||||
|
@ -32,33 +32,54 @@
|
|||
android:layout_marginRight="16dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:textColor="#2E2F3E"
|
||||
android:textColor="?riotx_text_primary"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toTopOf="@+id/itemPublicRoomMembersCount"
|
||||
app:layout_constraintBottom_toTopOf="@+id/itemPublicRoomTopic"
|
||||
app:layout_constraintEnd_toStartOf="@+id/itemPublicRoomButtonState"
|
||||
app:layout_constraintStart_toEndOf="@id/itemPublicRoomAvatar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
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
|
||||
android:id="@+id/itemPublicRoomMembersCount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:drawableStart="@drawable/ic_user"
|
||||
android:drawableLeft="@drawable/ic_user"
|
||||
android:drawablePadding="8dp"
|
||||
android:drawableTint="?riotx_text_secondary"
|
||||
android:gravity="center_vertical"
|
||||
android:minWidth="56dp"
|
||||
android:textColor="#7E899C"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/itemPublicRoomTopic"
|
||||
app:layout_constraintBottom_toTopOf="@+id/itemPublicRoomBottomSeparator"
|
||||
app:layout_constraintStart_toStartOf="@+id/itemPublicRoomName"
|
||||
app:layout_constraintTop_toBottomOf="@+id/itemPublicRoomName"
|
||||
app:layout_constraintTop_toBottomOf="@+id/itemPublicRoomTopic"
|
||||
tools:text="148" />
|
||||
|
||||
<TextView
|
||||
|
@ -67,38 +88,19 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginEnd="22dp"
|
||||
android:layout_marginRight="22dp"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:minWidth="40dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="#7E899C"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/itemPublicRoomMembersCount"
|
||||
app:layout_constraintEnd_toStartOf="@+id/itemPublicRoomButtonState"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/itemPublicRoomMembersCount"
|
||||
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
|
||||
android:id="@+id/itemPublicRoomButtonState"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -116,7 +118,7 @@
|
|||
android:id="@+id/itemPublicRoomBottomSeparator"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:background="#E9EDF1"
|
||||
android:background="?riotx_header_panel_border_mobile"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
android:id="@+id/itemRoomLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:background="?riotx_background"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
tools:background="@color/pale_grey">
|
||||
android:focusable="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/roomAvatarImageView"
|
||||
|
@ -42,7 +41,7 @@
|
|||
android:duplicateParentState="true"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/black_87"
|
||||
android:textColor="?riotx_text_primary"
|
||||
android:textSize="15sp"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintEnd_toStartOf="@+id/roomUnreadCounterBadgeView"
|
||||
|
@ -78,7 +77,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:textColor="@color/black_38"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/roomNameView"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -94,7 +93,7 @@
|
|||
android:layout_marginRight="8dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:textColor="@color/black_38"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/roomNameView"
|
||||
|
@ -121,7 +120,7 @@
|
|||
android:id="@+id/roomDividerView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:background="#1e000000"
|
||||
android:background="?riotx_header_panel_border_mobile"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:id="@+id/roomCategoryRootView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:background="?riotx_header_panel_background"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical"
|
||||
|
@ -14,7 +14,7 @@
|
|||
android:paddingTop="@dimen/layout_vertical_margin"
|
||||
android:paddingEnd="@dimen/layout_horizontal_margin"
|
||||
android:paddingRight="@dimen/layout_horizontal_margin"
|
||||
tools:background="@color/pale_grey">
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/roomCategoryTitleView"
|
||||
|
@ -24,11 +24,11 @@
|
|||
android:layout_marginRight="8dp"
|
||||
android:drawableStart="@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:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:textColor="#7E899C"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textSize="14sp"
|
||||
tools:text="@string/room_participants_header_direct_chats" />
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:maxLines="2"
|
||||
android:textColor="#2E2F3E"
|
||||
android:textColor="?riotx_text_primary"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toTopOf="@+id/itemRoomDirectoryDescription"
|
||||
|
@ -51,7 +51,7 @@
|
|||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:maxLines="2"
|
||||
android:textColor="#2E2F3E"
|
||||
android:textColor="?riotx_text_primary"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/itemRoomDirectoryBottomSeparator"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -63,7 +63,7 @@
|
|||
android:id="@+id/itemRoomDirectoryBottomSeparator"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="1dp"
|
||||
android:background="#E9EDF1"
|
||||
android:background="?riotx_header_panel_border_mobile"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
android:layout_marginRight="8dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?riotx_text_primary"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constrainedWidth="true"
|
||||
|
@ -53,7 +54,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:textColor="@color/brown_grey"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBaseline_toBaselineOf="@id/messageMemberNameView"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?riotx_background"
|
||||
android:padding="8dp">
|
||||
|
||||
<View
|
||||
|
@ -16,7 +17,7 @@
|
|||
android:layout_marginEnd="32dp"
|
||||
android:layout_marginRight="32dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@color/pale_grey_two"
|
||||
android:background="?riotx_header_panel_background"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/itemDayTextView"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
@ -28,7 +29,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/light_grey_blue"
|
||||
android:textColor="?riotx_header_panel_text_primary"
|
||||
android:textSize="15sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -46,7 +47,7 @@
|
|||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@color/pale_grey_two"
|
||||
android:background="?riotx_header_panel_background"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/itemDayTextView"
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textIsSelectable="false"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textColor="@color/slate_grey"
|
||||
android:textColor="?riotx_text_secondary"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="italic"
|
||||
tools:text="John doe changed their avatar" />
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
android:id="@+id/messageTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/dark_grey"
|
||||
android:textColor="?riotx_text_primary"
|
||||
android:textSize="14sp"
|
||||
tools:text="@sample/matrix.json/data/message" />
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
android:layout_height="22dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:src="@drawable/ic_close_round"
|
||||
android:tint="@color/rosy_pink"
|
||||
android:tint="@color/riotx_notice"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
|
||||
|
|
73
vector/src/main/res/layout/merge_fab_menu_view.xml
Normal file
73
vector/src/main/res/layout/merge_fab_menu_view.xml
Normal 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
Loading…
Reference in a new issue