mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Fix ID divider color
This commit is contained in:
parent
a8e77659b3
commit
ff124b8edc
@ -1,70 +0,0 @@
|
|||||||
package org.thoughtcrime.securesms.components
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Canvas
|
|
||||||
import android.graphics.Paint
|
|
||||||
import android.graphics.Path
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.widget.RelativeLayout
|
|
||||||
import network.loki.messenger.R
|
|
||||||
import network.loki.messenger.databinding.ViewSeparatorBinding
|
|
||||||
import org.thoughtcrime.securesms.util.toPx
|
|
||||||
import org.session.libsession.utilities.ThemeUtil
|
|
||||||
|
|
||||||
class LabeledSeparatorView : RelativeLayout {
|
|
||||||
|
|
||||||
private lateinit var binding: ViewSeparatorBinding
|
|
||||||
private val path = Path()
|
|
||||||
|
|
||||||
private val paint: Paint by lazy {
|
|
||||||
val result = Paint()
|
|
||||||
result.style = Paint.Style.STROKE
|
|
||||||
result.color = ThemeUtil.getThemedColor(context, R.attr.dividerHorizontal)
|
|
||||||
result.strokeWidth = toPx(1, resources).toFloat()
|
|
||||||
result.isAntiAlias = true
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
// region Lifecycle
|
|
||||||
constructor(context: Context) : super(context) {
|
|
||||||
setUpViewHierarchy()
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
|
||||||
setUpViewHierarchy()
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
|
||||||
setUpViewHierarchy()
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
|
|
||||||
setUpViewHierarchy()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setUpViewHierarchy() {
|
|
||||||
binding = ViewSeparatorBinding.inflate(LayoutInflater.from(context))
|
|
||||||
val layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
|
|
||||||
addView(binding.root, layoutParams)
|
|
||||||
setWillNotDraw(false)
|
|
||||||
}
|
|
||||||
// endregion
|
|
||||||
|
|
||||||
// region Updating
|
|
||||||
override fun onDraw(c: Canvas) {
|
|
||||||
super.onDraw(c)
|
|
||||||
val w = width.toFloat()
|
|
||||||
val h = height.toFloat()
|
|
||||||
val hMargin = toPx(16, resources).toFloat()
|
|
||||||
path.reset()
|
|
||||||
path.moveTo(0.0f, h / 2)
|
|
||||||
path.lineTo(binding.titleTextView.left - hMargin, h / 2)
|
|
||||||
path.addRoundRect(binding.titleTextView.left - hMargin, toPx(1, resources).toFloat(), binding.titleTextView.right + hMargin, h - toPx(1, resources).toFloat(), h / 2, h / 2, Path.Direction.CCW)
|
|
||||||
path.moveTo(binding.titleTextView.right + hMargin, h / 2)
|
|
||||||
path.lineTo(w, h / 2)
|
|
||||||
path.close()
|
|
||||||
c.drawPath(path, paint)
|
|
||||||
}
|
|
||||||
// endregion
|
|
||||||
}
|
|
6
app/src/main/res/drawable/view_separator.xml
Normal file
6
app/src/main/res/drawable/view_separator.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||||
|
<stroke android:color="?colorDividerBackground" android:width="1px"/>
|
||||||
|
<corners android:radius="16dp"/>
|
||||||
|
<solid android:color="?colorPrimary"/>
|
||||||
|
</shape>
|
@ -61,7 +61,7 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.LabeledSeparatorView
|
<include layout="@layout/view_separator"
|
||||||
android:id="@+id/separatorView"
|
android:id="@+id/separatorView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="32dp"
|
android:layout_height="32dp"
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/promptTextView">
|
app:layout_constraintTop_toBottomOf="@id/promptTextView">
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.LabeledSeparatorView
|
<include layout="@layout/view_separator"
|
||||||
android:id="@+id/separatorView"
|
android:id="@+id/separatorView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="32dp"
|
android:layout_height="32dp"
|
||||||
|
@ -1,17 +1,31 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout
|
<FrameLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="?colorDividerBackground"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1px"/>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@drawable/view_separator"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/titleTextView"
|
android:id="@+id/titleTextView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textColor="?android:textColorTertiary"
|
android:textColor="?android:textColorTertiary"
|
||||||
android:textSize="@dimen/small_font_size"
|
android:textSize="@dimen/small_font_size"
|
||||||
android:text="@string/your_session_id" />
|
android:text="@string/your_session_id" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</FrameLayout>
|
Loading…
Reference in New Issue
Block a user