Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2b633ed authored by Arnau Mora's avatar Arnau Mora Committed by Ricki Hirner
Browse files

Updated Google login button (bitfireAT/davx5#332)



* Updated Google login button

Signed-off-by: default avatarArnau Mora <arnyminerz@proton.me>

* Moved Google G logo file

Signed-off-by: default avatarArnau Mora <arnyminerz@proton.me>

* Changed background color

Signed-off-by: default avatarArnau Mora <arnyminerz@proton.me>

* Amend warning sign [skip CI]

---------

Signed-off-by: default avatarArnau Mora <arnyminerz@proton.me>
Co-authored-by: default avatarRicki Hirner <hirner@bitfire.at>
parent e6125dd6
Loading
Loading
Loading
Loading
+34 −13
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.KeyboardOptions
@@ -38,8 +39,11 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.tooling.preview.Preview
@@ -230,7 +234,8 @@ fun GoogleLogin(
            Card(Modifier.fillMaxWidth()) {
                Column(Modifier.padding(8.dp)) {
                    Row {
                        Image(Icons.Default.Warning, contentDescription = "", modifier = Modifier.padding(top = 8.dp, end = 8.dp, bottom = 8.dp))
                        Image(Icons.Default.Warning, colorFilter = ColorFilter.tint(MaterialTheme.colors.onSurface), contentDescription = "",
                            modifier = Modifier.padding(top = 8.dp, end = 8.dp, bottom = 8.dp))
                        Text(stringResource(R.string.login_google_see_tested_with))
                    }
                    Text(stringResource(R.string.login_google_unexpected_warnings), modifier = Modifier.padding(vertical = 8.dp))
@@ -278,7 +283,8 @@ fun GoogleLogin(
                    .padding(top = 8.dp)
            )

            Button({
            Button(
                onClick = {
                    val validEmail = email.value.contains('@')
                    emailError.value = !validEmail

@@ -286,10 +292,23 @@ fun GoogleLogin(
                        val clientId = StringUtils.trimToNull(userClientId.value.trim())
                        onLogin(email.value, clientId)
                    }
            }, modifier = Modifier
                },
                modifier = Modifier
                    .padding(top = 8.dp)
                .wrapContentSize()) {
                Text(stringResource(R.string.login_login))
                    .wrapContentSize(),
                colors = ButtonDefaults.buttonColors(
                    backgroundColor = MaterialTheme.colors.surface
                )
            ) {
                Image(
                    painter = painterResource(R.drawable.google_g_logo),
                    contentDescription = stringResource(R.string.login_google),
                    modifier = Modifier.size(18.dp)
                )
                Text(
                    text = stringResource(R.string.login_google),
                    modifier = Modifier.padding(start = 12.dp)
                )
            }

            AndroidView({ context ->
@@ -316,7 +335,9 @@ fun GoogleLogin(
}

@Composable
@Preview
@Preview(
    showBackground = true
)
fun PreviewGoogleLogin() {
    GoogleLogin(null) { _, _ -> }
}
+18 −0
Original line number Diff line number Diff line
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="705.6dp"
    android:height="720dp"
    android:viewportWidth="186.69"
    android:viewportHeight="190.5">
  <path
      android:pathData="M95.25,77.93v36.89h51.26c-2.25,11.86 -9.01,21.91 -19.14,28.66l30.91,23.99c18.01,-16.63 28.4,-41.04 28.4,-70.05 0,-6.75 -0.61,-13.25 -1.73,-19.48z"
      android:fillColor="#4285f4"/>
  <path
      android:pathData="M41.87,113.38l-6.97,5.34 -24.68,19.22h0c15.67,31.09 47.8,52.56 85.03,52.56 25.72,0 47.28,-8.49 63.04,-23.03l-30.91,-23.99c-8.49,5.72 -19.31,9.18 -32.13,9.18 -24.76,0 -45.81,-16.71 -53.34,-39.23z"
      android:fillColor="#34a853"/>
  <path
      android:pathData="M10.22,52.56c-6.49,12.81 -10.22,27.28 -10.22,42.69s3.72,29.87 10.22,42.69c0,0.09 31.69,-24.59 31.69,-24.59 -1.9,-5.72 -3.03,-11.78 -3.03,-18.1s1.13,-12.38 3.03,-18.1z"
      android:fillColor="#fbbc05"/>
  <path
      android:pathData="M95.25,37.93c14.03,0 26.5,4.85 36.46,14.2l27.28,-27.28c-16.54,-15.41 -38.01,-24.85 -63.73,-24.85 -37.23,0 -69.36,21.39 -85.03,52.56l31.69,24.59c7.53,-22.51 28.58,-39.23 53.34,-39.23z"
      android:fillColor="#ea4335"/>
</vector>
+1 −0
Original line number Diff line number Diff line
@@ -293,6 +293,7 @@
    <string name="login_google_see_tested_with">Please see our \"Tested with Google\" page for up-to-date information.</string>
    <string name="login_google_unexpected_warnings">You may experience unexpected warnings and/or have to create your own client ID.</string>
    <string name="login_google_account">Google account</string>
    <string name="login_google">Sign in with Google</string>
    <string name="login_google_client_id">Client ID (optional)</string>
    <string name="login_google_client_privacy_policy"><![CDATA[%1$s transfers your Google Contacts and Calendar data solely for synchronization with this device. See our <a href="%2$s">Privacy policy</a> for details.]]></string>
    <string name="login_google_client_limited_use"><![CDATA[%1$s complies with the <a href="%2$s">Google API Services User Data Policy</a>, including the Limited Use requirements.]]></string>