UI improvements after feedback on the app preview
This commit is contained in:
parent
2668970b11
commit
4d9b93f4ea
|
@ -55,8 +55,7 @@ class ReceiveFragment : BaseFragment() {
|
|||
text_address_part_8
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
|
@ -65,7 +64,11 @@ class ReceiveFragment : BaseFragment() {
|
|||
}
|
||||
|
||||
private fun onAddressLoaded(address: String) {
|
||||
qrecycler.load(address).into(receive_qr_code)
|
||||
qrecycler.load(address)
|
||||
.withQuietZoneSize(3)
|
||||
.withCorrectionLevel(QRecycler.CorrectionLevel.MEDIUM)
|
||||
.into(receive_qr_code)
|
||||
|
||||
address.chunked(address.length/8).forEachIndexed { i, part ->
|
||||
setAddressPart(i, part)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="358dp"
|
||||
android:height="418dp"
|
||||
android:viewportWidth="358"
|
||||
android:viewportHeight="418">
|
||||
<path
|
||||
android:pathData="M179,0C207.069,11.901 236.599,23.2 267.591,33.897C298.582,44.595 328.719,53.128 358,59.497C354.385,162.895 337.225,240.396 306.519,292C275.814,343.603 233.307,385.603 179,418C124.693,385.603 82.186,343.603 51.481,292C20.775,240.396 3.615,162.895 0,59.497C29.281,53.128 59.418,44.595 90.409,33.897C121.401,23.2 150.931,11.901 179,0Z"
|
||||
android:strokeAlpha="0.2"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#000000"
|
||||
android:fillType="nonZero"
|
||||
android:strokeColor="#00000000"
|
||||
android:fillAlpha="0.2"/>
|
||||
</vector>
|
Binary file not shown.
Before Width: | Height: | Size: 9.7 KiB |
|
@ -22,14 +22,14 @@
|
|||
<ImageView
|
||||
android:id="@+id/image_shield"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/shield"
|
||||
android:layout_height="0dp"
|
||||
android:scaleType="fitXY"
|
||||
app:srcCompat="@drawable/ic_shield"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.491"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/include_toolbar"
|
||||
app:layout_constraintDimensionRatio="H,1:1.1676"
|
||||
app:layout_constraintVertical_bias="0.062"
|
||||
app:layout_constraintWidth_default="percent"
|
||||
app:layout_constraintWidth_percent="0.84988" />
|
||||
|
@ -45,9 +45,9 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/image_shield"
|
||||
app:layout_constraintVertical_bias="0.318"
|
||||
app:layout_constraintVertical_bias="0.272"
|
||||
app:layout_constraintWidth_default="percent"
|
||||
app:layout_constraintWidth_percent="0.58111" />
|
||||
app:layout_constraintWidth_percent="0.59" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
android:background="@color/home_transaction_item_background"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:elevation="1dp"
|
||||
tools:ignore="RtlSymmetry">
|
||||
|
||||
<View
|
||||
|
|
|
@ -8,7 +8,8 @@ import com.google.zxing.BarcodeFormat
|
|||
import com.google.zxing.EncodeHintType.ERROR_CORRECTION
|
||||
import com.google.zxing.EncodeHintType.MARGIN
|
||||
import com.google.zxing.qrcode.QRCodeWriter
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel.Q
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel.*
|
||||
|
||||
|
||||
class QRecycler {
|
||||
|
@ -21,7 +22,7 @@ class QRecycler {
|
|||
builder.target.doOnLayout { measuredView ->
|
||||
val w = measuredView.width
|
||||
val h = measuredView.height
|
||||
val hints = mapOf(ERROR_CORRECTION to Q, MARGIN to 2)
|
||||
val hints = mapOf(ERROR_CORRECTION to builder.errorCorrection, MARGIN to builder.quietZone)
|
||||
val bitMatrix = QRCodeWriter().encode(builder.content, BarcodeFormat.QR_CODE, w, h, hints)
|
||||
val pixels = IntArray(w * h)
|
||||
for (y in 0 until h) {
|
||||
|
@ -39,9 +40,23 @@ class QRecycler {
|
|||
|
||||
inner class Builder(val content: String) {
|
||||
lateinit var target: ImageView
|
||||
var errorCorrection: ErrorCorrectionLevel = Q
|
||||
var quietZone: Int = 4
|
||||
fun into(imageView: ImageView) {
|
||||
target = imageView
|
||||
encode(this)
|
||||
}
|
||||
fun withQuietZoneSize(customQuietZone: Int): Builder {
|
||||
quietZone = customQuietZone
|
||||
return this
|
||||
}
|
||||
fun withCorrectionLevel(level: CorrectionLevel): Builder {
|
||||
errorCorrection = level.errorCorrectionLevel
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
enum class CorrectionLevel(val errorCorrectionLevel: ErrorCorrectionLevel) {
|
||||
LOW(L), DEFAULT(M), MEDIUM(Q), HIGH(H);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue