Skip to content

Commit f2a78b2

Browse files
SUPERCILEXsamtstern
authored andcommitted
Massively simplify styling (#696)
* Massively simplify styling * Animate TextInputLayout hints * Cleanup * Remove demo app styling that's no longer necessary
1 parent 8a9a8e8 commit f2a78b2

File tree

13 files changed

+103
-239
lines changed

13 files changed

+103
-239
lines changed

app/src/main/res/layout/auth_ui_layout.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@
5454
android:id="@+id/default_theme"
5555
android:layout_width="wrap_content"
5656
android:layout_height="wrap_content"
57+
android:checked="true"
5758
android:text="@string/default_theme"/>
5859

5960
<RadioButton
6061
android:id="@+id/purple_theme"
6162
android:layout_width="wrap_content"
6263
android:layout_height="wrap_content"
63-
android:checked="true"
6464
android:text="@string/purple_theme"/>
6565

6666
<RadioButton
Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,20 @@
11
<resources>
2-
<style name="PurpleTheme" parent="FirebaseUI">
3-
<item name="android:textColor">#000000</item>
4-
<item name="android:textColorPrimary">@color/material_deep_purple_50</item>
52

3+
<style name="PurpleTheme">
64
<item name="colorPrimary">@color/material_deep_purple_500</item>
7-
<item name="android:colorPrimary">@color/material_deep_purple_500</item>
8-
95
<item name="colorPrimaryDark">@color/material_deep_purple_700</item>
10-
<item name="android:colorPrimaryDark">@color/material_deep_purple_700</item>
11-
126
<item name="colorAccent">@color/material_lime_a700</item>
13-
<item name="android:colorAccent">@color/material_lime_a700</item>
14-
15-
<item name="colorControlNormal">@color/material_deep_purple_500</item>
16-
<item name="android:colorControlNormal">@color/material_deep_purple_500</item>
17-
18-
<item name="colorButtonNormal">@color/material_deep_purple_500</item>
19-
<item name="android:colorButtonNormal">@color/material_deep_purple_500</item>
20-
21-
<item name="colorControlActivated">@color/material_deep_purple_a200</item>
22-
<item name="android:colorControlActivated">@color/material_deep_purple_a200</item>
23-
24-
<item name="colorControlHighlight">@color/material_lime_a700</item>
25-
<item name="android:colorControlHighlight">@color/material_lime_a700</item>
26-
277
<item name="android:windowBackground">@color/material_purple_50</item>
288
</style>
299

30-
<style name="GreenTheme" parent="FirebaseUI">
31-
<item name="android:textColor">@color/material_green_500</item>
32-
<item name="android:textColorPrimary">@color/material_green_50</item>
33-
10+
<style name="GreenTheme">
3411
<item name="colorPrimary">@color/material_green_500</item>
35-
<item name="android:colorPrimary">@color/material_green_500</item>
36-
3712
<item name="android:colorPrimaryDark">@color/material_green_700</item>
38-
<item name="colorPrimaryDark">@color/material_green_700</item>
39-
4013
<item name="colorAccent">@color/material_purple_a700</item>
41-
<item name="android:colorAccent">@color/material_purple_a700</item>
42-
43-
<item name="colorButtonNormal">@color/material_purple_a700</item>
44-
<item name="android:colorButtonNormal">@color/material_purple_a700</item>
45-
46-
<item name="colorControlNormal">@color/material_green_500</item>
47-
<item name="android:colorControlNormal">@color/material_green_500</item>
48-
49-
<item name="colorControlActivated">@color/material_lime_a700</item>
50-
<item name="android:colorControlActivated">@color/material_lime_a700</item>
51-
52-
<item name="colorControlHighlight">@color/material_green_a200</item>
53-
<item name="android:colorControlHighlight">@color/material_green_a200</item>
54-
5514
<item name="android:windowBackground">@color/material_green_50</item>
5615
</style>
5716

58-
<style name="DarkTheme" parent="FirebaseUI">
17+
<style name="DarkTheme">
5918
<item name="colorPrimary">@color/material_gray_900</item>
6019
<item name="colorPrimaryDark">@android:color/black</item>
6120
<item name="colorAccent">@color/material_deep_teal_a200</item>
@@ -75,4 +34,5 @@
7534
<item name="android:colorButtonNormal">@color/material_red_a200</item>
7635
<item name="android:textColor">@android:color/white</item>
7736
</style>
37+
7838
</resources>

app/src/main/res/values/colors.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@
1212
<color name="material_deep_purple_50">#EDE7F6</color>
1313
<color name="material_deep_purple_500">#673AB7</color>
1414
<color name="material_deep_purple_700">#512DA8</color>
15-
<color name="material_deep_purple_a200">#E040FB</color>
1615

1716
<color name="material_green_50">#E8F5E9</color>
1817
<color name="material_green_500">#4CAF50</color>
1918
<color name="material_green_700">#388E3C</color>
2019
<color name="material_green_300">#AED581</color>
21-
<color name="material_green_a200">#69F0AE</color>
2220

2321
<color name="material_gray_300">#E0E0E0</color>
2422
<color name="material_gray_850">#ff303030</color>

app/src/main/res/values/styles.xml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,27 @@
11
<resources>
2+
23
<!-- Base application theme. -->
34
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
45
<item name="colorPrimary">@color/colorPrimary</item>
56
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
67
<item name="colorAccent">@color/colorAccent</item>
78
</style>
89

9-
<style name="PurpleTheme" parent="FirebaseUI">
10+
<style name="PurpleTheme">
1011
<item name="colorPrimary">@color/material_deep_purple_500</item>
1112
<item name="colorPrimaryDark">@color/material_deep_purple_700</item>
1213
<item name="colorAccent">@color/material_lime_a700</item>
13-
<item name="colorControlNormal">@color/material_deep_purple_500</item>
14-
<item name="colorControlActivated">@color/material_deep_purple_a200</item>
15-
<item name="colorControlHighlight">@color/material_lime_a700</item>
1614
<item name="android:windowBackground">@color/material_deep_purple_50</item>
17-
<item name="android:textColor">@color/material_gray_900</item>
18-
<item name="android:textColorPrimary">@color/material_deep_purple_50</item>
19-
<item name="colorButtonNormal">@color/material_deep_purple_500</item>
2015
</style>
2116

22-
<style name="GreenTheme" parent="FirebaseUI">
17+
<style name="GreenTheme">
2318
<item name="colorPrimary">@color/material_green_500</item>
2419
<item name="colorPrimaryDark">@color/material_green_700</item>
2520
<item name="colorAccent">@color/material_purple_a700</item>
26-
<item name="colorControlNormal">@color/material_green_500</item>
27-
<item name="colorControlActivated">@color/material_lime_a700</item>
28-
<item name="colorControlHighlight">@color/material_green_a200</item>
2921
<item name="android:windowBackground">@color/material_green_50</item>
30-
<item name="android:textColor">@color/material_gray_900</item>
31-
<item name="android:textColorPrimary">@color/material_deep_purple_50</item>
32-
<item name="colorButtonNormal">@color/material_green_500</item>
3322
</style>
3423

35-
<style name="DarkTheme" parent="FirebaseUI">
24+
<style name="DarkTheme">
3625
<item name="colorPrimary">@color/material_gray_900</item>
3726
<item name="colorPrimaryDark">@android:color/black</item>
3827
<item name="colorAccent">@android:color/black</item>
@@ -50,4 +39,5 @@
5039
<item name="colorButtonNormal">@color/material_red_a200</item>
5140
<item name="android:textColor">@android:color/white</item>
5241
</style>
42+
5343
</resources>

auth/src/main/java/com/firebase/ui/auth/KickoffActivity.java

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,7 @@ public void onCancel(DialogInterface dialog) {
5454
});
5555

5656
if (isPlayServicesAvailable) {
57-
final FlowParameters flowParams = mActivityHelper.getFlowParams();
58-
if (flowParams.isReauth) {
59-
showReauthDialog();
60-
} else {
61-
SignInDelegate.delegate(this, flowParams);
62-
}
57+
start();
6358
} else {
6459
mIsWaitingForPlayServices = true;
6560
}
@@ -79,7 +74,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
7974
super.onActivityResult(requestCode, resultCode, data);
8075
if (requestCode == RC_PLAY_SERVICES) {
8176
if (resultCode == ResultCodes.OK) {
82-
SignInDelegate.delegate(this, mActivityHelper.getFlowParams());
77+
start();
8378
} else {
8479
finish(ResultCodes.CANCELED,
8580
IdpResponse.getErrorCodeIntent(ErrorCodes.UNKNOWN_ERROR));
@@ -90,23 +85,18 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
9085
}
9186
}
9287

93-
/**
94-
* Check if there is an active or soon-to-be-active network connection.
95-
*
96-
* @return true if there is no network connection, false otherwise.
97-
*/
98-
private boolean isOffline() {
99-
ConnectivityManager manager =
100-
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
101-
102-
return !(manager != null
103-
&& manager.getActiveNetworkInfo() != null
104-
&& manager.getActiveNetworkInfo().isConnectedOrConnecting());
88+
private void start() {
89+
FlowParameters flowParams = mActivityHelper.getFlowParams();
90+
if (flowParams.isReauth) {
91+
showReauthDialog();
92+
} else {
93+
SignInDelegate.delegate(this, flowParams);
94+
}
10595
}
10696

10797
private void showReauthDialog() {
10898
final FlowParameters flowParams = mActivityHelper.getFlowParams();
109-
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.FirebaseUI_Dialog)
99+
AlertDialog.Builder builder = new AlertDialog.Builder(this)
110100
.setTitle(R.string.reauth_dialog_title)
111101
.setOnCancelListener(new DialogInterface.OnCancelListener() {
112102
@Override
@@ -133,4 +123,18 @@ public void onClick(DialogInterface dialog, int which) {
133123

134124
builder.create().show();
135125
}
126+
127+
/**
128+
* Check if there is an active or soon-to-be-active network connection.
129+
*
130+
* @return true if there is no network connection, false otherwise.
131+
*/
132+
private boolean isOffline() {
133+
ConnectivityManager manager =
134+
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
135+
136+
return !(manager != null
137+
&& manager.getActiveNetworkInfo() != null
138+
&& manager.getActiveNetworkInfo().isConnectedOrConnecting());
139+
}
136140
}

auth/src/main/java/com/firebase/ui/auth/ui/email/RecoveryEmailSentDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static void show(String email, FragmentManager manager) {
2929
@NonNull
3030
@Override
3131
public Dialog onCreateDialog(Bundle savedInstanceState) {
32-
return new AlertDialog.Builder(getContext(), R.style.FirebaseUI_Dialog)
32+
return new AlertDialog.Builder(getContext())
3333
.setTitle(R.string.title_confirm_recover_password)
3434
.setMessage(getString(R.string.confirm_recovery_body,
3535
getArguments().getString(ExtraConstants.EXTRA_EMAIL)))
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:app="http://schemas.android.com/apk/res-auto"
2+
<RelativeLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
44
xmlns:tools="http://schemas.android.com/tools"
55
style="@style/FirebaseUI.WrapperStyle"
66
android:layout_width="match_parent"
77
android:layout_height="wrap_content">
88

99
<android.support.design.widget.TextInputLayout
1010
android:id="@+id/email_layout"
11-
style="@style/FirebaseUI.Text.TextInputLayout"
11+
style="@style/FirebaseUI.TextInputLayout.EmailField"
1212
android:layout_width="match_parent"
1313
android:layout_height="wrap_content"
1414
android:paddingTop="16dp"
1515
android:transitionGroup="true"
1616
android:transitionName="email_field"
17-
app:errorTextAppearance="@style/FirebaseUI.Text.ErrorText"
18-
app:hintTextAppearance="@style/FirebaseUI.Text.HintText"
1917
tools:ignore="UnusedAttribute">
2018

2119
<android.support.design.widget.TextInputEditText
2220
android:id="@+id/email"
23-
style="@style/FirebaseUI.EditText.EmailField" />
21+
style="@style/FirebaseUI.TextInputEditText.EmailField"/>
2422

2523
</android.support.design.widget.TextInputLayout>
2624

@@ -30,6 +28,6 @@
3028
android:layout_alignParentEnd="true"
3129
android:layout_alignParentRight="true"
3230
android:layout_below="@id/email_layout"
33-
android:text="@string/next_default" />
31+
android:text="@string/next_default"/>
3432

3533
</RelativeLayout>

auth/src/main/res/layout/forgot_password_layout.xml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,37 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout
33
xmlns:android="http://schemas.android.com/apk/res/android"
4-
android:orientation="vertical"
5-
style="@style/FirebaseUI.WrapperStyle">
4+
style="@style/FirebaseUI.WrapperStyle"
5+
android:orientation="vertical">
66

77
<TextView
88
android:id="@+id/body_text"
99
style="@style/FirebaseUI.Text.BodyText"
1010
android:text="@string/password_recovery_body"/>
1111

1212
<android.support.design.widget.TextInputLayout
13-
xmlns:app="http://schemas.android.com/apk/res-auto"
1413
android:id="@+id/email_layout"
15-
style="@style/FirebaseUI.Text.TextInputLayout"
16-
android:paddingTop="16dp"
14+
style="@style/FirebaseUI.TextInputLayout.EmailField"
1715
android:layout_width="match_parent"
1816
android:layout_height="wrap_content"
1917
android:layout_below="@+id/body_text"
20-
app:errorTextAppearance="@style/FirebaseUI.Text.ErrorText"
21-
app:hintTextAppearance="@style/FirebaseUI.Text.HintText">
18+
android:paddingTop="16dp">
2219

2320
<android.support.design.widget.TextInputEditText
24-
style="@style/FirebaseUI.EditText.EmailField"
25-
android:id="@+id/email"/>
21+
android:id="@+id/email"
22+
style="@style/FirebaseUI.TextInputEditText.EmailField"/>
2623

2724
</android.support.design.widget.TextInputLayout>
2825

2926
<LinearLayout
30-
android:layout_height="wrap_content"
3127
android:layout_width="match_parent"
32-
android:gravity="end"
33-
android:paddingTop="194dp">
28+
android:layout_height="wrap_content"
29+
android:paddingTop="194dp"
30+
android:gravity="end">
3431

3532
<Button
36-
style="@style/FirebaseUI.Button"
3733
android:id="@+id/button_done"
34+
style="@style/FirebaseUI.Button"
3835
android:text="@string/button_text_send"/>
3936

4037
</LinearLayout>

0 commit comments

Comments
 (0)