Skip to content

Commit 22a78b0

Browse files
committed
README Clean-up
1 parent 3efc44f commit 22a78b0

File tree

1 file changed

+37
-32
lines changed

1 file changed

+37
-32
lines changed

README.md

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
# FirebaseUI for Android — UI Bindings for Firebase
22

3-
FirebaseUI is an open-source library for Android that allows you to quickly connect common UI elements to the [Firebase](https://www.firebase.com) database for data storage, allowing views to be updated in realtime as they change, and providing simple interfaces for common tasks like displaying lists or collections of items.
3+
FirebaseUI is an open-source library for Android that allows you to quickly connect common UI elements to the [Firebase](https://www.firebase.com) database for data storage, allowing views to be updated in realtime as they change, providing simple interfaces for common tasks like displaying lists or collections of items, and displaying prompts for user authentication.
44

55
A compatible FirebaseUI client is also available for [iOS](https://github.com/firebase/firebaseui-ios).
66

7-
## Using the library in your Android app
7+
## Table of Content
88

9-
To use the FirebaseUI library in our project, we need to do a few things:
10-
11-
1. Add the library to the list of dependencies of our project
12-
2. Create a class to represent the properties of our objects, as they are stored into the database
13-
3. Create a custom list adapter to map from Firebase to Android
9+
1. Installation
10+
2. Using FirebaseUI for Authentication
11+
3. Using FirebaseUI to Populate a ListView
12+
4. Using FirebaseUI to Populate a RecyclerView
13+
5. Contributing
1414

15-
The FirebaseUI library is most prominent in step 3. But first we have to add it to our project.
16-
17-
### Adding the library to your project (gradle.build or module dependencies dialog)
15+
## Installation
1816

1917
If your Android app already uses Firebase, you have added a dependency to the Firebase SDK to your dependencies.
2018
In this step we'll add the FirebaseUI library as another dependency.
@@ -26,10 +24,21 @@ In this step we'll add the FirebaseUI library as another dependency.
2624

2725
You can also add the library dependency directly to your app's gradle.build file:
2826

29-
![Added to gradle.build](doc-images/5-gradle-dependency-added.png "Added to gradle.build")
27+
```
28+
dependencies {
29+
compile 'com.firebaseui:firebase-ui:0.2.2'
30+
}
31+
```
3032

3133
After the project is synchronized, we're ready to start using Firebase functionality in our app.
3234

35+
## Using FirebaseUI to Populate a ListView
36+
37+
To use the FirebaseUI library in our project, we need to do a few things:
38+
39+
1. Create a class to represent the properties of our objects, as they are stored into the database
40+
2. Create a custom list adapter to map from Firebase to Android
41+
3342
### Creating a model class
3443

3544
In your app, create a class that represents the data from Firebase that you want to show in the ListView.
@@ -102,9 +111,7 @@ then read the properties that it got from the database and map them to the field
102111
But when we build our app using FirebaseUI, we often won't need to register our own EventListener. The
103112
`FirebaseListAdapter` takes care of that for us.
104113

105-
### Subclassing the FirebaseListAdapter
106-
107-
#### Look up the ListView
114+
### Find the ListView
108115

109116
We'll assume you've already added a `ListView` to your layout and have looked it up in the `onCreate` method of your activity:
110117

@@ -118,7 +125,7 @@ protected void onCreate(Bundle savedInstanceState) {
118125
}
119126
```
120127

121-
#### Set up connection to Firebase
128+
### Connect to Firebase
122129

123130
First we'll tell Firebase that we intend to use it in this activity and set up a reference to the database of chat message.
124131

@@ -135,7 +142,7 @@ protected void onCreate(Bundle savedInstanceState) {
135142
}
136143
```
137144

138-
#### Create custom FirebaseListAdapter subclass
145+
### Create custom FirebaseListAdapter subclass
139146

140147
Next, we need to create a subclass of the `FirebaseListAdapter` with the correct parameters and implement its `populateView` method:
141148

@@ -175,7 +182,7 @@ It passes us the `ChatMessage` and a `View`, which is an instance of the `androi
175182
we specified in the constructor. So what we do in our subclass is map the fields from `chatMessage` to the
176183
correct `TextView` controls from the `view`. The code is a bit verbose, but hey... that's Java and Android for you.
177184

178-
#### Clean up when the activity is destroyed
185+
### Clean up When the Activity is Destroyed
179186

180187
Finally, we need to clean up after ourselves. When the activity is destroyed, we need to call `release()`
181188
on the `ListAdapter` so that it can stop listening for changes in the Firebase database.
@@ -188,7 +195,7 @@ protected void onDestroy() {
188195
}
189196
```
190197

191-
#### Sending chat messages
198+
### Send Chat Messages
192199

193200
Remember when we showed how to use the `ChatMessage` class in `setValue()`.
194201
We can now use that in our activity to allow sending a message:
@@ -230,9 +237,9 @@ protected void onDestroy() {
230237
}
231238
```
232239

233-
Et voila: a minimal, yet fully functional, chat app in about 30 lines of code. Not bad, right?
240+
You're done! You now have a minimal, yet fully functional, chat app in about 30 lines of code. Not bad, right?
234241

235-
## Using a RecyclerView
242+
## Using FirebaseUI to Populate a RecyclerView
236243

237244
RecyclerView is the new preferred way to handle potentially long lists of items. Since Firebase collections
238245
can contain many items, there is an `FirebaseRecyclerViewAdapter` too. Here's how you use it:
@@ -284,18 +291,18 @@ recycler.setAdapter(mAdapter);
284291

285292
Like before, we get a custom RecyclerView populated with data from Firebase by setting the properties to the correct fields.
286293

287-
## Installing locally
294+
## Contributing
295+
296+
### Installing locally
288297

289298
We are still working on deploying FirebaseUI to Maven Central. In the meantime, you can download the
290299
latest release from the Releases tab on the Github repo and install it into your local Maven repository
291300
with:
292301

293302
mvn install:install-file -Dfile=/path/to/library-debug.aar -DgroupId=com.firebase -DartifactId=firebase-ui -Dversion=0.1.0 -Dpackaging=aar
294303

295-
296-
## Deployment
297-
298-
### To get the build server ready to build FirebaseUI-Android
304+
### Deployment
305+
To get the build server ready to build FirebaseUI-Android
299306

300307
* Install a JDK (if it's not installed yet):
301308
* `sudo apt-get install default-jdk`
@@ -328,7 +335,7 @@ with:
328335
sonatypeUsername=YourSonatypeJiraUsername
329336
sonatypePassword=YourSonatypeJiraPassword
330337

331-
### to build a release
338+
## to build a release
332339

333340
* build the project in Android Studio or with Gradle
334341
* this generates the main binary: `library/build/outputs/aar/library-debug.aar`
@@ -337,22 +344,20 @@ with:
337344
* this generates the javadoc: `library/build/outputs/library-javadoc.jar`
338345

339346

340-
### to tag a release on Github
347+
## to tag a release on Github
341348

342349
* ensure that all your changes are on master and that your local build is on master
343350
* ensure that the correct version number is in both `library/build.gradle` and `library/pom.xml`
344351

345352

346-
### to deploy a release to Maven Central
353+
## to deploy a release to Maven Central
347354

348355
* log onto the build box
349356
* checkout and update the master branch
350357
* `./release.sh` to build the library and update maven
351358
* close/release the repository from sonatype
352359

353-
## Contributing to FirebaseUI
354-
355-
### Contributor License Agreements
360+
## Contributor License Agreements
356361

357362
We'd love to accept your sample apps and patches! Before we can take them, we
358363
have to jump a couple of legal hurdles.
@@ -371,7 +376,7 @@ Follow either of the two links above to access the appropriate CLA and
371376
instructions for how to sign and return it. Once we receive it, we'll be able to
372377
accept your pull requests.
373378

374-
### Contribution Process
379+
## Contribution Process
375380

376381
1. Submit an issue describing your proposed change to the repo in question.
377382
1. The repo owner will respond to your issue promptly.

0 commit comments

Comments
 (0)