Loading presentation/src/main/java/com/moez/QKSMS/common/widget/AvatarView.kt +7 −7 Original line number Diff line number Diff line Loading @@ -52,17 +52,17 @@ class AvatarView @JvmOverloads constructor( private var fullName: String? = null private var photoUri: String? = null private var lastUpdated: Long? = null private var theme: Colors.Theme //private var theme: Colors.Theme init { if (!isInEditMode) { appComponent.inject(this) } theme = colors.theme() // theme = colors.theme() View.inflate(context, R.layout.avatar_view, this) setBackgroundResource(R.drawable.circle) setBackgroundResource(R.drawable.circle_avatar_view) clipToOutline = true } Loading @@ -74,7 +74,7 @@ class AvatarView @JvmOverloads constructor( fullName = recipient?.contact?.name photoUri = recipient?.contact?.photoUri lastUpdated = recipient?.contact?.lastUpdate theme = colors.theme(recipient) // theme = colors.theme(recipient) updateView() } Loading @@ -88,9 +88,9 @@ class AvatarView @JvmOverloads constructor( private fun updateView() { // Apply theme setBackgroundTint(theme.theme) initial.setTextColor(ContextCompat.getColor(context, R.color.colorPrimaryDark)) icon.setTint(ContextCompat.getColor(context, R.color.colorPrimaryDark)) // setBackgroundTint(theme.theme) initial.setTextColor(ContextCompat.getColor(context, R.color.textPrimary)) icon.setTint(ContextCompat.getColor(context, R.color.textPrimary)) val initials = fullName ?.substringBefore(',') ?.split(" ").orEmpty() Loading presentation/src/main/res/drawable/circle_avatar_view.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com> ~ ~ This file is part of QKSMS. ~ ~ QKSMS is free software: you can redistribute it and/or modify ~ it under the terms of the GNU General Public License as published by ~ the Free Software Foundation, either version 3 of the License, or ~ (at your option) any later version. ~ ~ QKSMS is distributed in the hope that it will be useful, ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ~ GNU General Public License for more details. ~ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>. --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:radius="1000dp" /> <solid android:color="@color/foreground_color" /> </shape> Loading
presentation/src/main/java/com/moez/QKSMS/common/widget/AvatarView.kt +7 −7 Original line number Diff line number Diff line Loading @@ -52,17 +52,17 @@ class AvatarView @JvmOverloads constructor( private var fullName: String? = null private var photoUri: String? = null private var lastUpdated: Long? = null private var theme: Colors.Theme //private var theme: Colors.Theme init { if (!isInEditMode) { appComponent.inject(this) } theme = colors.theme() // theme = colors.theme() View.inflate(context, R.layout.avatar_view, this) setBackgroundResource(R.drawable.circle) setBackgroundResource(R.drawable.circle_avatar_view) clipToOutline = true } Loading @@ -74,7 +74,7 @@ class AvatarView @JvmOverloads constructor( fullName = recipient?.contact?.name photoUri = recipient?.contact?.photoUri lastUpdated = recipient?.contact?.lastUpdate theme = colors.theme(recipient) // theme = colors.theme(recipient) updateView() } Loading @@ -88,9 +88,9 @@ class AvatarView @JvmOverloads constructor( private fun updateView() { // Apply theme setBackgroundTint(theme.theme) initial.setTextColor(ContextCompat.getColor(context, R.color.colorPrimaryDark)) icon.setTint(ContextCompat.getColor(context, R.color.colorPrimaryDark)) // setBackgroundTint(theme.theme) initial.setTextColor(ContextCompat.getColor(context, R.color.textPrimary)) icon.setTint(ContextCompat.getColor(context, R.color.textPrimary)) val initials = fullName ?.substringBefore(',') ?.split(" ").orEmpty() Loading
presentation/src/main/res/drawable/circle_avatar_view.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2019 Moez Bhatti <moez.bhatti@gmail.com> ~ ~ This file is part of QKSMS. ~ ~ QKSMS is free software: you can redistribute it and/or modify ~ it under the terms of the GNU General Public License as published by ~ the Free Software Foundation, either version 3 of the License, or ~ (at your option) any later version. ~ ~ QKSMS is distributed in the hope that it will be useful, ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ~ GNU General Public License for more details. ~ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>. --> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:radius="1000dp" /> <solid android:color="@color/foreground_color" /> </shape>