mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Refactor layout.
This commit is contained in:
parent
ad208a0819
commit
aacf2ba8a6
@ -3345,8 +3345,10 @@
|
||||
<string name="qr_code_login_new_device_instruction_2">Go to Settings -> Security & Privacy</string>
|
||||
<string name="qr_code_login_new_device_instruction_3">Are you on web? -> Select \'Show QR code\'</string>
|
||||
<string name="qr_code_login_new_device_instruction_4">Are you on a mobile device? -> Select \'Scan QR code\' and then \'Show QR code\'</string>
|
||||
<string name="qr_code_login_link_a_device_instruction_1">Open ${app_name} on your other device</string>
|
||||
<string name="qr_code_login_link_a_device_instruction_2">Select \'Sign in with QR code\'</string>
|
||||
<string name="qr_code_login_show_qr_code_button">Show QR code in this device</string>
|
||||
<string name="qr_code_login_need_an_alternative_method">Need an alternative method?</string>
|
||||
<string name="qr_code_login_signing_in_a_mobile_device">Signing in a mobile device?</string>
|
||||
<string name="qr_code_login_scan_qr_code_button">Scan QR code</string>
|
||||
<string name="qr_code_login_connecting_to_device">Connecting to device</string>
|
||||
<string name="qr_code_login_signing_in">Signing you in</string>
|
||||
|
@ -20,6 +20,8 @@ import android.content.Context
|
||||
import android.content.res.TypedArray
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.res.use
|
||||
import androidx.core.view.isVisible
|
||||
@ -63,4 +65,20 @@ class QrCodeLoginInstructionsView @JvmOverloads constructor(
|
||||
binding.instruction3TextView.text = instruction3
|
||||
binding.instruction4TextView.text = instruction4
|
||||
}
|
||||
|
||||
fun setInstructions(instructions: List<String>) {
|
||||
setInstruction(binding.instructions1Layout, binding.instruction1TextView, instructions.getOrNull(0))
|
||||
setInstruction(binding.instructions2Layout, binding.instruction2TextView, instructions.getOrNull(1))
|
||||
setInstruction(binding.instructions3Layout, binding.instruction3TextView, instructions.getOrNull(2))
|
||||
setInstruction(binding.instructions4Layout, binding.instruction4TextView, instructions.getOrNull(3))
|
||||
}
|
||||
|
||||
private fun setInstruction(instructionLayout: LinearLayout, instructionTextView: TextView, instruction: String?) {
|
||||
instruction?.let {
|
||||
instructionLayout.isVisible = true
|
||||
instructionTextView.text = instruction
|
||||
} ?: run {
|
||||
instructionLayout.isVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:background="?android:colorBackground"
|
||||
android:paddingHorizontal="12dp"
|
||||
android:text="@string/qr_code_login_need_an_alternative_method"
|
||||
android:text="@string/qr_code_login_signing_in_a_mobile_device"
|
||||
app:drawableLeftCompat="@drawable/divider_horizontal"
|
||||
app:drawableTint="@color/alert_default_error_background" />
|
||||
</FrameLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user