Skip to content

Update README.md to include app_name and color requirements #862

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
Aug 10, 2017
Merged
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
49 changes: 36 additions & 13 deletions auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ startActivityForResult(
RC_SIGN_IN);
```

If a terms of service URL, privacy policy URL, and a custom theme are required:
If a terms of service URL and privacy policy URL are required:

```java
startActivityForResult(
Expand All @@ -213,7 +213,6 @@ startActivityForResult(
.setAvailableProviders(...)
.setTosUrl("https://superapp.example.com/terms-of-service.html")
.setPrivacyPolicyUrl("https://superapp.example.com/privacy-policy.html")
.setTheme(R.style.SuperAppTheme)
.build(),
RC_SIGN_IN);
```
Expand Down Expand Up @@ -397,16 +396,38 @@ represented in the following diagram:

## UI customization

To provide customization of the visual style of the activities that implement
the flow, a new theme can be declared. Standard material design color
and typography properties will take effect as expected. For example, to define
a green theme:
To use FirebaseUI Auth's sign-in flows, you must provide an `app_name` string and use the
AppCompat color attributes in your app.

First, ensure an `app_name` resource is defined your `strings.xml` file like so:

```xml
<resources>
<string name="app_name">My App</string>
<!-- ... -->
</resources>
```

Second, ensure the three standard AppCompat color resources are defined with your own values:

```xml
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Required for sign-in flow styling -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

If you would like more control over FirebaseUI's styling, you can define your own custom style
to override certain or all styling attributes. For example, a green sign-in theme:

```xml
<style name="GreenTheme" parent="FirebaseUI">
<!-- Required for sign-in flow styling -->
<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>
Expand Down Expand Up @@ -435,21 +456,23 @@ startActivityForResult(
.build());
```

Your application theme could also simply be used, rather than defining a new
one.
Your application theme could also simply be used, rather than defining a new one.

If you wish to change the string messages, the existing strings can be
easily overridden by name in your application. See
[the built-in strings.xml](src/main/res/values/strings.xml) and simply
redefine a string to change it, for example:
If you wish to change the string messages, the existing strings can be overridden
by name in your application. See the module's [strings.xml](src/main/res/values/strings.xml) file
and simply redefine a string to change it:

```xml
<resources>
<!-- was "Signing up..." -->
<string name="progress_dialog_signing_up">Creating your shiny new account...</string>
<string name="fui_progress_dialog_signing_up">Creating your shiny new account...</string>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

</resources>
```

**Note:** String resource names aren't considered part of the public API and might
therefore change and break your app between library updates. We recommend looking
at a diff of the `strings.xml` file before updating FirebaseUI.

### OAuth Scope Customization

#### Google
Expand Down