From e8a63c6bf30862943fce9249bbd7526299900a59 Mon Sep 17 00:00:00 2001 From: David Daudelin Date: Mon, 23 Mar 2020 15:15:44 -0400 Subject: [PATCH 1/2] Fixes Drop In UI for Dark Theme - issue #1281 (#1527) --- .../mobile/auth/userpools/FormView.java | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/aws-android-sdk-auth-userpools/src/main/java/com/amazonaws/mobile/auth/userpools/FormView.java b/aws-android-sdk-auth-userpools/src/main/java/com/amazonaws/mobile/auth/userpools/FormView.java index c1919835f34..84a64677e87 100644 --- a/aws-android-sdk-auth-userpools/src/main/java/com/amazonaws/mobile/auth/userpools/FormView.java +++ b/aws-android-sdk-auth-userpools/src/main/java/com/amazonaws/mobile/auth/userpools/FormView.java @@ -18,6 +18,7 @@ package com.amazonaws.mobile.auth.userpools; import android.content.Context; +import android.content.res.Configuration; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; @@ -42,15 +43,7 @@ public class FormView extends LinearLayout { private static final int FIELD_LEFT_RIGHT_MARGIN = dp(20); /** Background Drawables for the form. */ - private final Drawable[] backgroundDrawables = new Drawable[] { - // Border Shadow - createRoundedRectShape(FORM_CORNER_RADIUS, Color.DKGRAY, 10), - createRoundedRectShape(FORM_CORNER_RADIUS, Color.DKGRAY, 20), - createRoundedRectShape(FORM_CORNER_RADIUS, Color.DKGRAY, 30), - createRoundedRectShape(FORM_CORNER_RADIUS, Color.DKGRAY, 50), - createRoundedRectShape(FORM_CORNER_RADIUS, Color.DKGRAY, 80), - // Background Color - createRoundedRectShape(FORM_CORNER_RADIUS, Color.WHITE, 100)}; + private final Drawable[] backgroundDrawables; public FormView(final Context context) { this(context, null); @@ -62,6 +55,24 @@ public FormView(final Context context, @Nullable final AttributeSet attrs) { public FormView(final Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); + + boolean isDarkModeOn = (context.getResources().getConfiguration().uiMode & + Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES; + + backgroundDrawables = new Drawable[] { + // Border Shadow + createRoundedRectShape(FORM_CORNER_RADIUS, Color.DKGRAY, 10), + createRoundedRectShape(FORM_CORNER_RADIUS, Color.DKGRAY, 20), + createRoundedRectShape(FORM_CORNER_RADIUS, Color.DKGRAY, 30), + createRoundedRectShape(FORM_CORNER_RADIUS, Color.DKGRAY, 50), + createRoundedRectShape(FORM_CORNER_RADIUS, Color.DKGRAY, 80), + // Background color + createRoundedRectShape(FORM_CORNER_RADIUS, + isDarkModeOn + ? Color.BLACK + : Color.WHITE + , 100)}; + this.setOrientation(VERTICAL); this.setBackgroundDrawable(getFormBackground()); } From 25495527e3fef6439bc659b0b9c8157feba10842 Mon Sep 17 00:00:00 2001 From: David Daudelin Date: Thu, 26 Mar 2020 09:37:22 -0400 Subject: [PATCH 2/2] Fixes sign in method caching issues #1469 and #1262 (#1531) --- .../main/java/com/amazonaws/mobile/client/AWSMobileClient.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aws-android-sdk-mobile-client/src/main/java/com/amazonaws/mobile/client/AWSMobileClient.java b/aws-android-sdk-mobile-client/src/main/java/com/amazonaws/mobile/client/AWSMobileClient.java index 6a6365c997d..b417dbc2e1a 100644 --- a/aws-android-sdk-mobile-client/src/main/java/com/amazonaws/mobile/client/AWSMobileClient.java +++ b/aws-android-sdk-mobile-client/src/main/java/com/amazonaws/mobile/client/AWSMobileClient.java @@ -1129,6 +1129,7 @@ private Runnable _signIn(final String username, this.signInCallback = callback; signInState = null; + mStore.set(SIGN_IN_MODE, SignInMode.SIGN_IN.toString()); return new Runnable() { @Override @@ -1594,6 +1595,8 @@ private Runnable _federatedSignIn(final String providerKey, final boolean assignState) { final Map loginsMap = new HashMap(); + mStore.set(SIGN_IN_MODE, SignInMode.FEDERATED_SIGN_IN.toString()); + try { loginsMap.put(providerKey, token);