From 8a445436f7bb08ef1d5b148628ce39caeb796fa2 Mon Sep 17 00:00:00 2001 From: Yuichi Araki Date: Wed, 22 May 2019 15:34:48 +0900 Subject: [PATCH] Several minor improvements The credential list dodges the bottom app bar when the list is long. The top bar shows the configured hostname. Use proper constants for the Base64 flag. Change-Id: Ic20a21a21ff3d6600ebedfb4d7f500e182dafc6a --- android/app-start/build.gradle | 1 + .../java/com/example/android/fido2/Base64Ext.kt | 6 ++++-- .../src/main/res/layout/home_fragment.xml | 5 +++-- .../src/main/res/layout/main_activity.xml | 15 ++++++++++++++- android/app-start/src/main/res/values/dimens.xml | 1 + android/app/build.gradle | 1 + .../java/com/example/android/fido2/Base64Ext.kt | 6 ++++-- android/app/src/main/res/layout/home_fragment.xml | 5 +++-- android/app/src/main/res/layout/main_activity.xml | 15 ++++++++++++++- android/app/src/main/res/values/dimens.xml | 1 + 10 files changed, 46 insertions(+), 10 deletions(-) diff --git a/android/app-start/build.gradle b/android/app-start/build.gradle index 29f5600..a048b48 100644 --- a/android/app-start/build.gradle +++ b/android/app-start/build.gradle @@ -29,6 +29,7 @@ android { testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' vectorDrawables.useSupportLibrary = true buildConfigField 'String', 'API_BASE_URL', "\"${getProperty('host')}/auth\"" + resValue 'string', 'host', getProperty('host') resValue 'string', 'asset_statements', """ [{ "include": "${getProperty('host')}/.well-known/assetlinks.json" diff --git a/android/app-start/src/main/java/com/example/android/fido2/Base64Ext.kt b/android/app-start/src/main/java/com/example/android/fido2/Base64Ext.kt index d633051..94f36bd 100644 --- a/android/app-start/src/main/java/com/example/android/fido2/Base64Ext.kt +++ b/android/app-start/src/main/java/com/example/android/fido2/Base64Ext.kt @@ -18,10 +18,12 @@ package com.example.android.fido2 import android.util.Base64 +private const val BASE64_FLAG = Base64.NO_PADDING or Base64.NO_WRAP or Base64.URL_SAFE + fun ByteArray.toBase64(): String { - return Base64.encodeToString(this, 11) + return Base64.encodeToString(this, BASE64_FLAG) } fun String.decodeBase64(): ByteArray { - return Base64.decode(this, 11) + return Base64.decode(this, BASE64_FLAG) } diff --git a/android/app-start/src/main/res/layout/home_fragment.xml b/android/app-start/src/main/res/layout/home_fragment.xml index f25fd2c..c365bad 100644 --- a/android/app-start/src/main/res/layout/home_fragment.xml +++ b/android/app-start/src/main/res/layout/home_fragment.xml @@ -67,11 +67,12 @@ android:layout_height="0dp" android:clipToPadding="false" android:paddingTop="@dimen/spacing_medium" - android:paddingBottom="@dimen/spacing_medium" + android:paddingBottom="@dimen/dodge_app_bar" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/credentials_caption" /> + app:layout_constraintTop_toBottomOf="@id/credentials_caption" + tools:listitem="@layout/credential_item" /> + tools:targetApi="21"> + + + + 16dp 24dp 32dp + 64dp diff --git a/android/app/build.gradle b/android/app/build.gradle index 29f5600..a048b48 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -29,6 +29,7 @@ android { testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' vectorDrawables.useSupportLibrary = true buildConfigField 'String', 'API_BASE_URL', "\"${getProperty('host')}/auth\"" + resValue 'string', 'host', getProperty('host') resValue 'string', 'asset_statements', """ [{ "include": "${getProperty('host')}/.well-known/assetlinks.json" diff --git a/android/app/src/main/java/com/example/android/fido2/Base64Ext.kt b/android/app/src/main/java/com/example/android/fido2/Base64Ext.kt index d633051..94f36bd 100644 --- a/android/app/src/main/java/com/example/android/fido2/Base64Ext.kt +++ b/android/app/src/main/java/com/example/android/fido2/Base64Ext.kt @@ -18,10 +18,12 @@ package com.example.android.fido2 import android.util.Base64 +private const val BASE64_FLAG = Base64.NO_PADDING or Base64.NO_WRAP or Base64.URL_SAFE + fun ByteArray.toBase64(): String { - return Base64.encodeToString(this, 11) + return Base64.encodeToString(this, BASE64_FLAG) } fun String.decodeBase64(): ByteArray { - return Base64.decode(this, 11) + return Base64.decode(this, BASE64_FLAG) } diff --git a/android/app/src/main/res/layout/home_fragment.xml b/android/app/src/main/res/layout/home_fragment.xml index f25fd2c..c365bad 100644 --- a/android/app/src/main/res/layout/home_fragment.xml +++ b/android/app/src/main/res/layout/home_fragment.xml @@ -67,11 +67,12 @@ android:layout_height="0dp" android:clipToPadding="false" android:paddingTop="@dimen/spacing_medium" - android:paddingBottom="@dimen/spacing_medium" + android:paddingBottom="@dimen/dodge_app_bar" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/credentials_caption" /> + app:layout_constraintTop_toBottomOf="@id/credentials_caption" + tools:listitem="@layout/credential_item" /> + tools:targetApi="21"> + + + + 16dp 24dp 32dp + 64dp