Skip to content

Massively simplify styling #696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/main/res/layout/auth_ui_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@
android:id="@+id/default_theme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/default_theme"/>

<RadioButton
android:id="@+id/purple_theme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/purple_theme"/>

<RadioButton
Expand Down
48 changes: 4 additions & 44 deletions app/src/main/res/values-v21/styles.xml
Original file line number Diff line number Diff line change
@@ -1,61 +1,20 @@
<resources>
<style name="PurpleTheme" parent="FirebaseUI">
<item name="android:textColor">#000000</item>
<item name="android:textColorPrimary">@color/material_deep_purple_50</item>

<style name="PurpleTheme">
<item name="colorPrimary">@color/material_deep_purple_500</item>
<item name="android:colorPrimary">@color/material_deep_purple_500</item>

<item name="colorPrimaryDark">@color/material_deep_purple_700</item>
<item name="android:colorPrimaryDark">@color/material_deep_purple_700</item>

<item name="colorAccent">@color/material_lime_a700</item>
<item name="android:colorAccent">@color/material_lime_a700</item>

<item name="colorControlNormal">@color/material_deep_purple_500</item>
<item name="android:colorControlNormal">@color/material_deep_purple_500</item>

<item name="colorButtonNormal">@color/material_deep_purple_500</item>
<item name="android:colorButtonNormal">@color/material_deep_purple_500</item>

<item name="colorControlActivated">@color/material_deep_purple_a200</item>
<item name="android:colorControlActivated">@color/material_deep_purple_a200</item>

<item name="colorControlHighlight">@color/material_lime_a700</item>
<item name="android:colorControlHighlight">@color/material_lime_a700</item>

<item name="android:windowBackground">@color/material_purple_50</item>
</style>

<style name="GreenTheme" parent="FirebaseUI">
<item name="android:textColor">@color/material_green_500</item>
<item name="android:textColorPrimary">@color/material_green_50</item>

<style name="GreenTheme">
<item name="colorPrimary">@color/material_green_500</item>
<item name="android:colorPrimary">@color/material_green_500</item>

<item name="android:colorPrimaryDark">@color/material_green_700</item>
<item name="colorPrimaryDark">@color/material_green_700</item>

<item name="colorAccent">@color/material_purple_a700</item>
<item name="android:colorAccent">@color/material_purple_a700</item>

<item name="colorButtonNormal">@color/material_purple_a700</item>
<item name="android:colorButtonNormal">@color/material_purple_a700</item>

<item name="colorControlNormal">@color/material_green_500</item>
<item name="android:colorControlNormal">@color/material_green_500</item>

<item name="colorControlActivated">@color/material_lime_a700</item>
<item name="android:colorControlActivated">@color/material_lime_a700</item>

<item name="colorControlHighlight">@color/material_green_a200</item>
<item name="android:colorControlHighlight">@color/material_green_a200</item>

<item name="android:windowBackground">@color/material_green_50</item>
</style>

<style name="DarkTheme" parent="FirebaseUI">
<style name="DarkTheme">
<item name="colorPrimary">@color/material_gray_900</item>
<item name="colorPrimaryDark">@android:color/black</item>
<item name="colorAccent">@color/material_deep_teal_a200</item>
Expand All @@ -75,4 +34,5 @@
<item name="android:colorButtonNormal">@color/material_red_a200</item>
<item name="android:textColor">@android:color/white</item>
</style>

</resources>
2 changes: 0 additions & 2 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
<color name="material_deep_purple_50">#EDE7F6</color>
<color name="material_deep_purple_500">#673AB7</color>
<color name="material_deep_purple_700">#512DA8</color>
<color name="material_deep_purple_a200">#E040FB</color>

<color name="material_green_50">#E8F5E9</color>
<color name="material_green_500">#4CAF50</color>
<color name="material_green_700">#388E3C</color>
<color name="material_green_300">#AED581</color>
<color name="material_green_a200">#69F0AE</color>

<color name="material_gray_300">#E0E0E0</color>
<color name="material_gray_850">#ff303030</color>
Expand Down
20 changes: 5 additions & 15 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="PurpleTheme" parent="FirebaseUI">
<style name="PurpleTheme">
<item name="colorPrimary">@color/material_deep_purple_500</item>
<item name="colorPrimaryDark">@color/material_deep_purple_700</item>
<item name="colorAccent">@color/material_lime_a700</item>
<item name="colorControlNormal">@color/material_deep_purple_500</item>
<item name="colorControlActivated">@color/material_deep_purple_a200</item>
<item name="colorControlHighlight">@color/material_lime_a700</item>
<item name="android:windowBackground">@color/material_deep_purple_50</item>
<item name="android:textColor">@color/material_gray_900</item>
<item name="android:textColorPrimary">@color/material_deep_purple_50</item>
<item name="colorButtonNormal">@color/material_deep_purple_500</item>
</style>

<style name="GreenTheme" parent="FirebaseUI">
<style name="GreenTheme">
<item name="colorPrimary">@color/material_green_500</item>
<item name="colorPrimaryDark">@color/material_green_700</item>
<item name="colorAccent">@color/material_purple_a700</item>
<item name="colorControlNormal">@color/material_green_500</item>
<item name="colorControlActivated">@color/material_lime_a700</item>
<item name="colorControlHighlight">@color/material_green_a200</item>
<item name="android:windowBackground">@color/material_green_50</item>
<item name="android:textColor">@color/material_gray_900</item>
<item name="android:textColorPrimary">@color/material_deep_purple_50</item>
<item name="colorButtonNormal">@color/material_green_500</item>
</style>

<style name="DarkTheme" parent="FirebaseUI">
<style name="DarkTheme">
<item name="colorPrimary">@color/material_gray_900</item>
<item name="colorPrimaryDark">@android:color/black</item>
<item name="colorAccent">@android:color/black</item>
Expand All @@ -50,4 +39,5 @@
<item name="colorButtonNormal">@color/material_red_a200</item>
<item name="android:textColor">@android:color/white</item>
</style>

</resources>
44 changes: 24 additions & 20 deletions auth/src/main/java/com/firebase/ui/auth/KickoffActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@ public void onCancel(DialogInterface dialog) {
});

if (isPlayServicesAvailable) {
final FlowParameters flowParams = mActivityHelper.getFlowParams();
if (flowParams.isReauth) {
showReauthDialog();
} else {
SignInDelegate.delegate(this, flowParams);
}
start();
} else {
mIsWaitingForPlayServices = true;
}
Expand All @@ -79,7 +74,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_PLAY_SERVICES) {
if (resultCode == ResultCodes.OK) {
SignInDelegate.delegate(this, mActivityHelper.getFlowParams());
start();
} else {
finish(ResultCodes.CANCELED,
IdpResponse.getErrorCodeIntent(ErrorCodes.UNKNOWN_ERROR));
Expand All @@ -90,23 +85,18 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
}

/**
* Check if there is an active or soon-to-be-active network connection.
*
* @return true if there is no network connection, false otherwise.
*/
private boolean isOffline() {
ConnectivityManager manager =
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);

return !(manager != null
&& manager.getActiveNetworkInfo() != null
&& manager.getActiveNetworkInfo().isConnectedOrConnecting());
private void start() {
FlowParameters flowParams = mActivityHelper.getFlowParams();
if (flowParams.isReauth) {
showReauthDialog();
} else {
SignInDelegate.delegate(this, flowParams);
}
}

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

builder.create().show();
}

/**
* Check if there is an active or soon-to-be-active network connection.
*
* @return true if there is no network connection, false otherwise.
*/
private boolean isOffline() {
ConnectivityManager manager =
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);

return !(manager != null
&& manager.getActiveNetworkInfo() != null
&& manager.getActiveNetworkInfo().isConnectedOrConnecting());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void show(String email, FragmentManager manager) {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getContext(), R.style.FirebaseUI_Dialog)
return new AlertDialog.Builder(getContext())
.setTitle(R.string.title_confirm_recover_password)
.setMessage(getString(R.string.confirm_recovery_body,
getArguments().getString(ExtraConstants.EXTRA_EMAIL)))
Expand Down
12 changes: 5 additions & 7 deletions auth/src/main/res/layout/check_email_layout.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
style="@style/FirebaseUI.WrapperStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.design.widget.TextInputLayout
android:id="@+id/email_layout"
style="@style/FirebaseUI.Text.TextInputLayout"
style="@style/FirebaseUI.TextInputLayout.EmailField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:transitionGroup="true"
android:transitionName="email_field"
app:errorTextAppearance="@style/FirebaseUI.Text.ErrorText"
app:hintTextAppearance="@style/FirebaseUI.Text.HintText"
tools:ignore="UnusedAttribute">

<android.support.design.widget.TextInputEditText
android:id="@+id/email"
style="@style/FirebaseUI.EditText.EmailField" />
style="@style/FirebaseUI.TextInputEditText.EmailField"/>

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

Expand All @@ -30,6 +28,6 @@
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@id/email_layout"
android:text="@string/next_default" />
android:text="@string/next_default"/>

</RelativeLayout>
23 changes: 10 additions & 13 deletions auth/src/main/res/layout/forgot_password_layout.xml
Original file line number Diff line number Diff line change
@@ -1,40 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
style="@style/FirebaseUI.WrapperStyle">
style="@style/FirebaseUI.WrapperStyle"
android:orientation="vertical">

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

<android.support.design.widget.TextInputLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/email_layout"
style="@style/FirebaseUI.Text.TextInputLayout"
android:paddingTop="16dp"
style="@style/FirebaseUI.TextInputLayout.EmailField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/body_text"
app:errorTextAppearance="@style/FirebaseUI.Text.ErrorText"
app:hintTextAppearance="@style/FirebaseUI.Text.HintText">
android:paddingTop="16dp">

<android.support.design.widget.TextInputEditText
style="@style/FirebaseUI.EditText.EmailField"
android:id="@+id/email"/>
android:id="@+id/email"
style="@style/FirebaseUI.TextInputEditText.EmailField"/>

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

<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:gravity="end"
android:paddingTop="194dp">
android:layout_height="wrap_content"
android:paddingTop="194dp"
android:gravity="end">

<Button
style="@style/FirebaseUI.Button"
android:id="@+id/button_done"
style="@style/FirebaseUI.Button"
android:text="@string/button_text_send"/>

</LinearLayout>
Expand Down
Loading