Sign in with Google (3)

This commit is contained in:
M66B 2022-07-12 20:47:29 +02:00
parent 22c8dd619f
commit 64733c1448
7 changed files with 72 additions and 50 deletions

View File

@ -29,6 +29,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
@ -195,17 +196,24 @@ public class FragmentOAuth extends FragmentBase {
if ("gmail".equals(id)) {
final Context context = getContext();
int dp6 = Helper.dp2pixels(context, 6);
int dp12 = Helper.dp2pixels(context, 12);
int dp24 = Helper.dp2pixels(context, 24);
Drawable g = context.getDrawable(R.drawable.btn_google_light_normal);
g.setBounds(0, 0, dp24, dp24);
Drawable g = context.getDrawable(R.drawable.google_logo);
g.setBounds(0, 0, g.getIntrinsicWidth(), g.getIntrinsicHeight());
btnOAuth.setCompoundDrawablesRelative(g, null, null, null);
btnOAuth.setText(R.string.title_setup_google_sign_in);
btnOAuth.setCompoundDrawablePadding(dp6);
btnOAuth.setCompoundDrawablePadding(dp12);
btnOAuth.setPaddingRelative(dp12, 0, dp12, 0);
btnOAuth.setTextColor(Color.DKGRAY);
btnOAuth.setBackground(context.getDrawable(R.drawable.btn_google_background));
btnOAuth.setTextColor(new ColorStateList(
new int[][]{
new int[]{android.R.attr.state_enabled},
new int[]{-android.R.attr.state_enabled},
},
new int[]{
Color.DKGRAY, // 0xff444444
Color.LTGRAY // 0xffcccccc
}
));
btnOAuth.setBackground(context.getDrawable(R.drawable.google_signin_background));
}
btnOAuth.setOnClickListener(new View.OnClickListener() {

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF" />
<stroke
android:width="1dp"
android:color="#C0C0C0" />
</shape>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/google_logo_enabled" android:state_enabled="true" />
<item android:drawable="@drawable/google_logo_disabled" android:state_enabled="false" />
</selector>

View File

@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:alpha="0.5"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#4285F4"
android:pathData="M23.745,12.27C23.745,11.48 23.675,10.73 23.555,10L12.255,10L12.255,14.51L18.725,14.51C18.435,15.99 17.585,17.24 16.325,18.09L16.325,21.09L20.185,21.09C22.445,19 23.745,15.92 23.745,12.27Z" />
<path
android:fillColor="#34A853"
android:pathData="M12.255,24C15.495,24 18.205,22.92 20.185,21.09L16.325,18.09C15.245,18.81 13.875,19.25 12.255,19.25C9.125,19.25 6.475,17.14 5.525,14.29L1.545,14.29L1.545,17.38C3.515,21.3 7.565,24 12.255,24Z" />
<path
android:fillColor="#FBBC05"
android:pathData="M5.525,14.29C5.275,13.57 5.145,12.8 5.145,12C5.145,11.2 5.285,10.43 5.525,9.71L5.525,6.62L1.545,6.62C0.725,8.24 0.255,10.06 0.255,12C0.255,13.94 0.725,15.76 1.545,17.38L5.525,14.29Z" />
<path
android:fillColor="#EA4335"
android:pathData="M12.255,4.75C14.025,4.75 15.605,5.36 16.855,6.55L20.275,3.13C18.205,1.19 15.495,0 12.255,0C7.565,0 3.515,2.7 1.545,6.62L5.525,9.71C6.475,6.86 9.125,4.75 12.255,4.75Z" />
</vector>

View File

@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#4285F4"
android:pathData="M23.745,12.27C23.745,11.48 23.675,10.73 23.555,10L12.255,10L12.255,14.51L18.725,14.51C18.435,15.99 17.585,17.24 16.325,18.09L16.325,21.09L20.185,21.09C22.445,19 23.745,15.92 23.745,12.27Z" />
<path
android:fillColor="#34A853"
android:pathData="M12.255,24C15.495,24 18.205,22.92 20.185,21.09L16.325,18.09C15.245,18.81 13.875,19.25 12.255,19.25C9.125,19.25 6.475,17.14 5.525,14.29L1.545,14.29L1.545,17.38C3.515,21.3 7.565,24 12.255,24Z" />
<path
android:fillColor="#FBBC05"
android:pathData="M5.525,14.29C5.275,13.57 5.145,12.8 5.145,12C5.145,11.2 5.285,10.43 5.525,9.71L5.525,6.62L1.545,6.62C0.725,8.24 0.255,10.06 0.255,12C0.255,13.94 0.725,15.76 1.545,17.38L5.525,14.29Z" />
<path
android:fillColor="#EA4335"
android:pathData="M12.255,4.75C14.025,4.75 15.605,5.36 16.855,6.55L20.275,3.13C18.205,1.19 15.495,0 12.255,0C7.565,0 3.515,2.7 1.545,6.62L5.525,9.71C6.475,6.86 9.125,4.75 12.255,4.75Z" />
</vector>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false">
<shape>
<solid android:color="#FFFFFF" />
<stroke android:width="1dp" android:color="#CCCCCC" />
</shape>
</item>
<item android:state_pressed="true">
<shape>
<solid android:color="#FFFFFF" />
<stroke android:width="1dp" android:color="#000000" />
</shape>
</item>
</selector>

View File

@ -1,36 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="46dp"
android:height="46dp"
android:viewportWidth="46"
android:viewportHeight="46">
<group
android:pivotX="23"
android:pivotY="23"
android:scaleX="2"
android:scaleY="2">
<path
android:fillColor="#4285F4"
android:fillType="evenOdd"
android:pathData="M31.64,23.205C31.64,22.566 31.583,21.953 31.476,21.364L23,21.364L23,24.845L27.844,24.845C27.635,25.97 27.001,26.923 26.048,27.561L26.048,29.82L28.956,29.82C30.658,28.253 31.64,25.945 31.64,23.205L31.64,23.205Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
<path
android:fillColor="#34A853"
android:fillType="evenOdd"
android:pathData="M23,32C25.43,32 27.467,31.194 28.956,29.82L26.048,27.561C25.242,28.101 24.211,28.42 23,28.42C20.656,28.42 18.672,26.837 17.964,24.71L14.957,24.71L14.957,27.042C16.438,29.983 19.482,32 23,32L23,32Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
<path
android:fillColor="#FBBC05"
android:fillType="evenOdd"
android:pathData="M17.964,24.71C17.784,24.17 17.682,23.593 17.682,23C17.682,22.407 17.784,21.83 17.964,21.29L17.964,18.958L14.957,18.958C14.348,20.173 14,21.548 14,23C14,24.452 14.348,25.827 14.957,27.042L17.964,24.71L17.964,24.71Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
<path
android:fillColor="#EA4335"
android:fillType="evenOdd"
android:pathData="M23,17.58C24.321,17.58 25.508,18.034 26.44,18.925L29.022,16.344C27.463,14.892 25.426,14 23,14C19.482,14 16.438,16.017 14.957,18.958L17.964,21.29C18.672,19.163 20.656,17.58 23,17.58L23,17.58Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</group>
</vector>