Skip to content

Commit d0c621a

Browse files
committed
UI cleanup
1 parent 6148882 commit d0c621a

File tree

8 files changed

+206
-119
lines changed

8 files changed

+206
-119
lines changed

app/src/main/java/com/firebase/uidemo/RecyclerViewDemoActivity.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
package com.firebase.uidemo;
22

3-
import android.graphics.Color;
4-
import android.graphics.Typeface;
53
import android.os.Bundle;
64
import android.support.v7.widget.LinearLayoutManager;
75
import android.support.v7.widget.RecyclerView;
86
import android.util.Log;
9-
import android.view.Gravity;
107
import android.view.Menu;
118
import android.view.MenuInflater;
129
import android.view.MenuItem;
@@ -71,12 +68,12 @@ protected void updateChat() {
7168
messages.setLayoutManager(manager);
7269

7370
Query recentMessages = mRef.limitToLast(50);
74-
FirebaseRecyclerViewAdapter<Chat, ChatHolder> adapter = new FirebaseRecyclerViewAdapter<Chat, ChatHolder>(Chat.class, R.layout.message, ChatHolder.class, recentMessages) {
71+
FirebaseRecyclerViewAdapter<Chat, ChatHolder> adapter = new FirebaseRecyclerViewAdapter<Chat, ChatHolder>(Chat.class, R.layout.incoming_message, ChatHolder.class, recentMessages) {
7572
@Override
7673
public void populateViewHolder(ChatHolder chatView, Chat chat) {
7774
chatView.textView.setText(chat.getText());
7875
// chatView.textView.setPadding(30, 30, 30, 0);
79-
// chatView.nameView.setText(chat.getName());
76+
chatView.nameView.setText(chat.getName());
8077
// chatView.nameView.setPadding(30, 0, 30, 30);
8178
// chatView.textView.setTextColor(Color.parseColor("#000000"));
8279
// chatView.textView.setTypeface(null, Typeface.NORMAL);
@@ -207,7 +204,7 @@ public static class ChatHolder extends RecyclerView.ViewHolder {
207204
public ChatHolder(View itemView) {
208205
super(itemView);
209206
this.itemView = itemView;
210-
//nameView = (TextView) itemView.findViewById(android.R.id.text2);
207+
nameView = (TextView) itemView.findViewById(R.id.name_text);
211208
textView = (TextView) itemView.findViewById(R.id.message_text);
212209
}
213210
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
3+
<item >
4+
<rotate
5+
android:fromDegrees="45"
6+
android:toDegrees="45"
7+
android:pivotX="-40%"
8+
android:pivotY="87%" >
9+
<shape
10+
android:shape="rectangle" >
11+
<stroke android:color="@android:color/transparent" android:width="10dp"/>
12+
<solid
13+
android:color="#BEE1ED" />
14+
</shape>
15+
</rotate>
16+
</item>
17+
</layer-list>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
3+
<item>
4+
<shape android:shape="rectangle">
5+
<corners android:radius="4dp" android:topLeftRadius="0dp"/>
6+
<solid android:color="#BEE1ED" />
7+
</shape>
8+
</item>
9+
</layer-list>

app/src/main/res/drawable/ic_send.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_height="wrap_content"
4+
android:layout_width="match_parent">
5+
6+
<ImageView
7+
android:layout_width="38dp"
8+
android:layout_height="38dp"
9+
android:id="@+id/profile_image"
10+
android:scaleType="fitXY"/>
11+
12+
<RelativeLayout
13+
android:id="@+id/arrow"
14+
android:layout_width="50dp"
15+
android:layout_height="50dp"
16+
android:background="@drawable/chat_message_arrow"
17+
android:rotation="180"
18+
android:layout_marginLeft="6dp"/>
19+
20+
<LinearLayout
21+
android:layout_height="match_parent"
22+
android:layout_width="wrap_content"
23+
android:orientation="vertical"
24+
android:background="@drawable/chat_message_background"
25+
android:id="@+id/message"
26+
android:padding="10dp"
27+
android:layout_marginLeft="26dp"
28+
android:layout_marginRight="26dp"
29+
android:layout_marginBottom="10dp">
30+
31+
<!--<TextView android:id="@+id/text1"-->
32+
<!--android:textStyle="bold"-->
33+
<!--android:layout_width="fill_parent"-->
34+
<!--android:layout_height="0dp"-->
35+
<!--android:layout_weight="1"/>-->
36+
37+
<TextView android:id="@+id/message_text"
38+
android:layout_width="fill_parent"
39+
android:layout_height="0dp"
40+
android:layout_weight="1"
41+
android:textStyle="bold"/>
42+
43+
<TextView android:id="@+id/name_text"
44+
android:textStyle="normal"
45+
android:layout_width="fill_parent"
46+
android:layout_height="0dp"
47+
android:layout_weight="1" />
48+
</LinearLayout>
49+
50+
</RelativeLayout>

app/src/main/res/layout/recycler_view_demo.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@
3636
android:layout_height="wrap_content"
3737
android:text="Send"
3838
android:id="@+id/sendButton"
39-
android:layout_gravity="bottom|right"
40-
android:drawableRight="@drawable/ic_send"
41-
android:drawablePadding="6dp"
42-
android:paddingLeft="18dp" />
39+
android:layout_gravity="bottom|right"/>
4340
</LinearLayout>
4441

4542
</RelativeLayout>

library/src/main/java/com/firebase/ui/FirebaseLoginDialog.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public class FirebaseLoginDialog extends DialogFragment {
1717
FirebaseAuthHelper mGoogleAuthHelper;
1818
FirebaseAuthHelper mPasswordAuthHelper;
1919
View mView;
20-
2120
@Override
2221
public Dialog onCreateDialog(Bundle savedInstanceState) {
2322
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
@@ -44,6 +43,8 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
4443
}
4544
else mView.findViewById(R.id.password_section).setVisibility(View.GONE);
4645

46+
mView.findViewById(R.id.loading_section).setVisibility(View.GONE);
47+
4748
builder.setView(mView);
4849
return builder.create();
4950
}
@@ -70,14 +71,17 @@ private void showLoginOption(final FirebaseAuthHelper helper, int id) {
7071
mView.findViewById(id).setOnClickListener(new View.OnClickListener() {
7172
@Override
7273
public void onClick(View view) {
73-
if (helper.getProviderName() == "password") {
74+
if (helper.getProviderName().equals("password")) {
7475
EditText emailText = (EditText) mView.findViewById(R.id.email);
7576
EditText passwordText = (EditText) mView.findViewById(R.id.password);
7677
helper.login(emailText.getText().toString(), passwordText.getText().toString());
7778
} else {
7879
helper.login();
7980
}
81+
mView.findViewById(R.id.login_section).setVisibility(View.GONE);
82+
mView.findViewById(R.id.loading_section).setVisibility(View.VISIBLE);
8083
}
8184
});
85+
8286
}
8387
}

0 commit comments

Comments
 (0)