Code review + Completion layout res

This commit is contained in:
Valere 2020-12-04 09:03:38 +01:00 committed by Benoit Marty
parent 42d1bf57f6
commit 26c01d46a7
4 changed files with 26 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 New Vector Ltd
* Copyright 2020 The Matrix.org Foundation C.I.C.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -85,7 +85,9 @@ class LoginServerUrlFormFragment @Inject constructor() : AbstractLoginFragment()
}
}
val completions = state.knownCustomHomeServersUrls
loginServerUrlFormHomeServerUrl.setAdapter(ArrayAdapter(requireContext(), android.R.layout.select_dialog_item,
loginServerUrlFormHomeServerUrl.setAdapter( ArrayAdapter(
requireContext(),
R.layout.item_completion_homeserver,
completions
))
loginServerUrlFormHomeServerUrlTil.endIconMode = TextInputLayout.END_ICON_DROPDOWN_MENU

View File

@ -85,19 +85,19 @@ class SocialLoginButtonsView @JvmOverloads constructor(context: Context, attrs:
// Use some heuristic to render buttons according to branding guidelines
val button: MaterialButton = cachedViews[identityProvider.id]
?: when (identityProvider.id) {
"google" -> {
"google" -> {
MaterialButton(context, null, R.attr.vctr_social_login_button_google_style)
}
"github" -> {
"github" -> {
MaterialButton(context, null, R.attr.vctr_social_login_button_github_style)
}
"apple" -> {
"apple" -> {
MaterialButton(context, null, R.attr.vctr_social_login_button_apple_style)
}
"facebook" -> {
MaterialButton(context, null, R.attr.vctr_social_login_button_facebook_style)
}
"twitter" -> {
"twitter" -> {
MaterialButton(context, null, R.attr.vctr_social_login_button_twitter_style)
}
else -> {
@ -143,9 +143,9 @@ class SocialLoginButtonsView @JvmOverloads constructor(context: Context, attrs:
val typedArray = context.theme.obtainStyledAttributes(attrs, R.styleable.SocialLoginButtonsView, 0, 0)
val modeAttr = typedArray.getInt(R.styleable.SocialLoginButtonsView_signMode, 2)
mode = when (modeAttr) {
0 -> Mode.MODE_SIGN_IN
1 -> Mode.MODE_SIGN_UP
else -> Mode.MODE_CONTINUE
0 -> Mode.MODE_SIGN_IN
1 -> Mode.MODE_SIGN_UP
else -> Mode.MODE_CONTINUE
}
typedArray.recycle()
update()

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="?android:attr/textColorAlertDialogListItem"
android:textSize="14sp"
tools:text="https://matrix.org" />