Skip to content

Commit 857851f

Browse files
committed
Merge branch 'master' of github.com:firebase/FirebaseUI-Android
* 'master' of github.com:firebase/FirebaseUI-Android: Initial demo app Add a DemoApplication and RecyclerViewDemoActivity as sample applications.
2 parents ac95828 + 218832d commit 857851f

File tree

9 files changed

+194
-12
lines changed

9 files changed

+194
-12
lines changed

app/app.iml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
7373
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
7474
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/jars" />
75-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" />
75+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.2.1/jars" />
76+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/jars" />
7677
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
7778
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
7879
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
@@ -90,8 +91,16 @@
9091
</content>
9192
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
9293
<orderEntry type="sourceFolder" forTests="false" />
93-
<orderEntry type="library" exported="" name="support-v4-22.2.0" level="project" />
94-
<orderEntry type="library" exported="" name="support-annotations-22.2.0" level="project" />
94+
<orderEntry type="library" exported="" name="jackson-core-2.2.2" level="project" />
95+
<orderEntry type="library" exported="" name="jackson-databind-2.2.2" level="project" />
96+
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
97+
<orderEntry type="library" exported="" name="firebase-client-jvm-2.3.1" level="project" />
98+
<orderEntry type="library" exported="" name="recyclerview-v7-22.2.1" level="project" />
99+
<orderEntry type="library" exported="" name="tubesock-0.0.11" level="project" />
100+
<orderEntry type="library" exported="" name="jackson-annotations-2.2.2" level="project" />
101+
<orderEntry type="library" exported="" name="firebase-client-android-2.3.1" level="project" />
102+
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
95103
<orderEntry type="library" exported="" name="appcompat-v7-22.2.0" level="project" />
104+
<orderEntry type="module" module-name="library" exported="" />
96105
</component>
97106
</module>

app/build.gradle

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ apply plugin: 'com.android.application'
22

33
android {
44
compileSdkVersion 22
5-
buildToolsVersion "22.0.1"
5+
buildToolsVersion "23.0.0"
66

77
defaultConfig {
8-
applicationId "com.firebase.firebaseui_android"
8+
applicationId "com.firebase.uidemo"
99
minSdkVersion 10
1010
targetSdkVersion 22
1111
versionCode 1
@@ -17,9 +17,19 @@ android {
1717
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1818
}
1919
}
20+
packagingOptions {
21+
exclude 'META-INF/LICENSE'
22+
exclude 'META-INF/NOTICE'
23+
exclude 'META-INF/NOTICE.txt'
24+
}
25+
2026
}
2127

2228
dependencies {
2329
compile fileTree(dir: 'libs', include: ['*.jar'])
2430
compile 'com.android.support:appcompat-v7:22.2.0'
31+
compile 'com.firebase:firebase-client-android:2.3.1'
32+
compile 'com.android.support:recyclerview-v7:22.2.1'
33+
compile project(':library')
2534
}
35+

app/src/androidTest/java/com/firebase/firebaseui_android/ApplicationTest.java renamed to app/src/androidTest/java/com/firebase/uidemo/ApplicationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.firebase.firebaseui_android;
1+
package com.firebase.uidemo;
22

33
import android.app.Application;
44
import android.test.ApplicationTestCase;
@@ -10,4 +10,4 @@ public class ApplicationTest extends ApplicationTestCase<Application> {
1010
public ApplicationTest() {
1111
super(Application.class);
1212
}
13-
}
13+
}

app/src/main/AndroidManifest.xml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.firebase.firebaseui_android">
2+
package="com.firebase.uidemo">
33

4-
<application android:allowBackup="true" android:label="@string/app_name"
5-
android:icon="@mipmap/ic_launcher" android:theme="@style/AppTheme">
4+
<uses-permission android:name="android.permission.INTERNET" />
65

6+
<application
7+
android:allowBackup="true"
8+
android:name=".DemoApplication"
9+
android:label="@string/app_name"
10+
android:icon="@mipmap/ic_launcher"
11+
android:theme="@style/Theme.AppCompat.Light">
12+
13+
<activity
14+
android:name=".RecyclerViewDemoActivity"
15+
android:label="@string/app_name">
16+
<intent-filter>
17+
<action android:name="android.intent.action.MAIN" />
18+
19+
<category android:name="android.intent.category.LAUNCHER" />
20+
</intent-filter>
21+
</activity>
722
</application>
823

924
</manifest>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.firebase.uidemo;
2+
3+
import com.firebase.client.Firebase;
4+
5+
public class DemoApplication extends android.app.Application {
6+
@Override
7+
public void onCreate() {
8+
super.onCreate();
9+
Firebase.setAndroidContext(this);
10+
}
11+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
package com.firebase.uidemo;
2+
3+
import android.app.Activity;
4+
import android.graphics.Color;
5+
import android.os.Bundle;
6+
import android.support.v7.app.AppCompatActivity;
7+
import android.support.v7.widget.LinearLayoutManager;
8+
import android.support.v7.widget.RecyclerView;
9+
import android.util.Log;
10+
import android.view.Gravity;
11+
import android.view.View;
12+
import android.widget.Button;
13+
import android.widget.EditText;
14+
import android.widget.TextView;
15+
16+
import com.firebase.client.Firebase;
17+
import com.firebase.ui.FirebaseRecyclerViewAdapter;
18+
19+
20+
public class RecyclerViewDemoActivity extends AppCompatActivity {
21+
@Override
22+
protected void onCreate(Bundle savedInstanceState) {
23+
super.onCreate(savedInstanceState);
24+
setContentView(R.layout.recycler_view_demo);
25+
26+
final Firebase ref = new Firebase("https://nanochat.firebaseio.com");
27+
28+
final String name = "Android User";
29+
final Button sendButton = (Button) findViewById(R.id.sendButton);
30+
final EditText messageEdit = (EditText) findViewById(R.id.messageEdit);
31+
final RecyclerView messages = (RecyclerView) findViewById(R.id.messagesList);
32+
messages.setHasFixedSize(true);
33+
messages.setLayoutManager(new LinearLayoutManager(this));
34+
35+
sendButton.setOnClickListener(new View.OnClickListener() {
36+
@Override
37+
public void onClick(View v) {
38+
Chat chat = new Chat(name, messageEdit.getText().toString());
39+
ref.push().setValue(chat);
40+
messageEdit.setText("");
41+
}
42+
});
43+
44+
FirebaseRecyclerViewAdapter<Chat, ChatHolder> adapter = new FirebaseRecyclerViewAdapter<Chat, ChatHolder>(Chat.class, android.R.layout.two_line_list_item, ChatHolder.class, ref) {
45+
@Override
46+
public void populateViewHolder(ChatHolder chatView, Chat chat) {
47+
chatView.messageText.setText(chat.getMessage());
48+
chatView.messageText.setPadding(10, 0, 10, 0);
49+
chatView.nameText.setText(chat.getName());
50+
chatView.nameText.setPadding(10, 0, 10, 15);
51+
if (chat.getName().equals(name)) {
52+
chatView.messageText.setGravity(Gravity.END);
53+
chatView.nameText.setGravity(Gravity.END);
54+
chatView.nameText.setTextColor(Color.parseColor("#8BC34A"));
55+
} else {
56+
chatView.nameText.setTextColor(Color.parseColor("#00BCD4"));
57+
}
58+
}
59+
};
60+
61+
messages.setAdapter(adapter);
62+
63+
}
64+
65+
66+
static class Chat {
67+
String name;
68+
String message;
69+
70+
public Chat() {
71+
}
72+
73+
public Chat(String name, String message) {
74+
this.name = name;
75+
this.message = message;
76+
}
77+
78+
public String getName() {
79+
return name;
80+
}
81+
82+
public String getMessage() {
83+
return message;
84+
}
85+
}
86+
87+
static class ChatHolder extends RecyclerView.ViewHolder {
88+
TextView nameText, messageText;
89+
90+
public ChatHolder(View itemView) {
91+
super(itemView);
92+
nameText = (TextView) itemView.findViewById(android.R.id.text2);
93+
messageText = (TextView) itemView.findViewById(android.R.id.text1);
94+
}
95+
}
96+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
tools:context=".RecyclerViewDemoActivity">
7+
8+
<android.support.v7.widget.RecyclerView
9+
android:layout_width="wrap_content"
10+
android:layout_height="wrap_content"
11+
android:id="@+id/messagesList"
12+
android:layout_alignParentLeft="true"
13+
android:layout_alignParentStart="true"
14+
android:layout_alignParentTop="true"
15+
android:layout_above="@+id/linearLayout" />
16+
17+
<LinearLayout
18+
android:orientation="horizontal"
19+
android:layout_width="match_parent"
20+
android:layout_height="wrap_content"
21+
android:layout_alignParentLeft="true"
22+
android:layout_alignParentStart="true"
23+
android:layout_alignParentBottom="true"
24+
android:id="@+id/linearLayout">
25+
26+
<EditText
27+
android:layout_width="wrap_content"
28+
android:layout_height="wrap_content"
29+
android:id="@+id/messageEdit"
30+
android:layout_weight="1" />
31+
32+
<Button
33+
android:layout_width="wrap_content"
34+
android:layout_height="wrap_content"
35+
android:text="Send"
36+
android:id="@+id/sendButton"
37+
android:layout_gravity="bottom|right" />
38+
</LinearLayout>
39+
40+
</RelativeLayout>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<resources>
2-
<string name="app_name">FirebaseUI-Android</string>
2+
<string name="app_name">FirebaseUI Chat</string>
33
</resources>

library/library.iml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,16 @@
6565
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
6666
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
6767
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
68-
<excludeFolder url="file://$MODULE_DIR$/build/docs" />
6968
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
7069
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
7170
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
7271
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
7372
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
7473
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
7574
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
75+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/jars" />
7676
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/22.2.0/jars" />
77+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" />
7778
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
7879
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
7980
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />

0 commit comments

Comments
 (0)