Skip to content

Commit 49ca5e1

Browse files
WillieCubedsamtstern
authored andcommitted
Update README.md to include app_name and color requirements (#862)
1 parent 8c23dae commit 49ca5e1

File tree

1 file changed

+36
-13
lines changed

1 file changed

+36
-13
lines changed

auth/README.md

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ startActivityForResult(
204204
RC_SIGN_IN);
205205
```
206206

207-
If a terms of service URL, privacy policy URL, and a custom theme are required:
207+
If a terms of service URL and privacy policy URL are required:
208208

209209
```java
210210
startActivityForResult(
@@ -213,7 +213,6 @@ startActivityForResult(
213213
.setAvailableProviders(...)
214214
.setTosUrl("https://superapp.example.com/terms-of-service.html")
215215
.setPrivacyPolicyUrl("https://superapp.example.com/privacy-policy.html")
216-
.setTheme(R.style.SuperAppTheme)
217216
.build(),
218217
RC_SIGN_IN);
219218
```
@@ -397,16 +396,38 @@ represented in the following diagram:
397396

398397
## UI customization
399398

400-
To provide customization of the visual style of the activities that implement
401-
the flow, a new theme can be declared. Standard material design color
402-
and typography properties will take effect as expected. For example, to define
403-
a green theme:
399+
To use FirebaseUI Auth's sign-in flows, you must provide an `app_name` string and use the
400+
AppCompat color attributes in your app.
401+
402+
First, ensure an `app_name` resource is defined your `strings.xml` file like so:
403+
404+
```xml
405+
<resources>
406+
<string name="app_name">My App</string>
407+
<!-- ... -->
408+
</resources>
409+
```
410+
411+
Second, ensure the three standard AppCompat color resources are defined with your own values:
412+
413+
```xml
414+
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
415+
<!-- Required for sign-in flow styling -->
416+
<item name="colorPrimary">@color/colorPrimary</item>
417+
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
418+
<item name="colorAccent">@color/colorAccent</item>
419+
</style>
420+
421+
If you would like more control over FirebaseUI's styling, you can define your own custom style
422+
to override certain or all styling attributes. For example, a green sign-in theme:
404423

405424
```xml
406425
<style name="GreenTheme" parent="FirebaseUI">
426+
<!-- Required for sign-in flow styling -->
407427
<item name="colorPrimary">@color/material_green_500</item>
408428
<item name="colorPrimaryDark">@color/material_green_700</item>
409429
<item name="colorAccent">@color/material_purple_a700</item>
430+
410431
<item name="colorControlNormal">@color/material_green_500</item>
411432
<item name="colorControlActivated">@color/material_lime_a700</item>
412433
<item name="colorControlHighlight">@color/material_green_a200</item>
@@ -435,21 +456,23 @@ startActivityForResult(
435456
.build());
436457
```
437458

438-
Your application theme could also simply be used, rather than defining a new
439-
one.
459+
Your application theme could also simply be used, rather than defining a new one.
440460

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

446465
```xml
447466
<resources>
448467
<!-- was "Signing up..." -->
449-
<string name="progress_dialog_signing_up">Creating your shiny new account...</string>
468+
<string name="fui_progress_dialog_signing_up">Creating your shiny new account...</string>
450469
</resources>
451470
```
452471

472+
**Note:** String resource names aren't considered part of the public API and might
473+
therefore change and break your app between library updates. We recommend looking
474+
at a diff of the `strings.xml` file before updating FirebaseUI.
475+
453476
### OAuth Scope Customization
454477

455478
#### Google

0 commit comments

Comments
 (0)