Skip to content

Commit 1bef15a

Browse files
committed
Cleans up FirebaseLoginDialog layout
1 parent f29b575 commit 1bef15a

File tree

3 files changed

+121
-125
lines changed

3 files changed

+121
-125
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ public void populateViewHolder(ChatHolder chatView, Chat chat) {
9595
messages.setAdapter(adapter);
9696
}
9797

98-
public static final int LOGIN = Menu.FIRST;
99-
public static final int LOGOUT = LOGIN+1;
100-
10198
@Override
10299
public boolean onCreateOptionsMenu(Menu menu) {
103100
MenuInflater inflater = getMenuInflater();

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
3737
if (mTwitterAuthHelper != null) showLoginOption(mTwitterAuthHelper, R.id.twitter_button);
3838
else mView.findViewById(R.id.twitter_button).setVisibility(View.GONE);
3939

40-
if (mPasswordAuthHelper != null) showLoginOption(mPasswordAuthHelper, R.id.password_button);
40+
if (mPasswordAuthHelper != null) {
41+
showLoginOption(mPasswordAuthHelper, R.id.password_button);
42+
if (mFacebookAuthHelper == null && mGoogleAuthHelper == null && mTwitterAuthHelper == null)
43+
mView.findViewById(R.id.or_section).setVisibility(View.GONE);
44+
}
4145
else mView.findViewById(R.id.password_section).setVisibility(View.GONE);
4246

4347
builder.setView(mView);
Lines changed: 116 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,133 @@
1-
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
3-
android:layout_height="match_parent" tools:context="com.firebase.ui.FirebaseLogin">
1+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:orientation="vertical" android:layout_width="match_parent"
3+
android:layout_height="match_parent"
4+
android:paddingLeft="20dp"
5+
android:paddingRight="20dp"
6+
android:foreground="#ffffff"
7+
android:background="#f5f5f5"
8+
android:paddingBottom="6dp"
9+
android:layout_marginTop="5dp"
10+
android:paddingTop="8dp">
411

12+
<LinearLayout
13+
android:orientation="vertical"
14+
android:layout_width="match_parent"
15+
android:layout_height="wrap_content"
16+
android:layout_gravity="center_horizontal"
17+
android:id="@+id/password_section">
518

6-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
7-
android:orientation="vertical" android:layout_width="match_parent"
8-
android:layout_height="match_parent"
9-
android:paddingLeft="20dp"
10-
android:paddingRight="20dp"
11-
android:foreground="#ffffff"
12-
android:background="#f5f5f5"
13-
android:paddingBottom="14dp"
14-
android:layout_marginTop="5dp">
15-
16-
<LinearLayout
17-
android:orientation="vertical"
19+
<EditText
1820
android:layout_width="match_parent"
1921
android:layout_height="wrap_content"
20-
android:layout_gravity="center_horizontal"
21-
android:id="@+id/password_section">
22-
23-
<EditText
24-
android:layout_width="match_parent"
25-
android:layout_height="wrap_content"
26-
android:id="@+id/email"
27-
android:ems="10"
28-
android:hint="Email"
29-
android:paddingTop="20dp"
30-
style="@style/FirebaseEditTextTheme"
31-
android:theme="@style/FirebaseEditTextTheme"/>
22+
android:id="@+id/email"
23+
android:ems="10"
24+
android:hint="Email"
25+
android:paddingTop="20dp"
26+
style="@style/FirebaseEditTextTheme"
27+
android:theme="@style/FirebaseEditTextTheme"/>
3228

33-
<EditText
34-
android:layout_width="match_parent"
35-
android:layout_height="wrap_content"
36-
android:id="@+id/password"
37-
android:ems="10"
38-
android:hint="Password"
39-
android:paddingTop="20dp"
40-
android:password="true"
41-
style="@style/FirebaseEditTextTheme"
42-
android:theme="@style/FirebaseEditTextTheme"/>
43-
44-
<Button
45-
android:layout_width="match_parent"
46-
android:layout_height="wrap_content"
47-
android:text="Login"
48-
android:id="@+id/password_button"
49-
android:textColor="#ffffff"
50-
android:typeface="normal"
51-
android:layout_marginTop="10dp"
52-
android:background="#1194F6"
53-
android:textStyle="bold" />
54-
55-
<FrameLayout
56-
android:layout_width="match_parent"
57-
android:layout_height="wrap_content"
58-
android:layout_gravity="center_horizontal"
59-
android:background="@drawable/or_line"
60-
android:layout_marginBottom="0dp"
61-
android:layout_marginTop="15dp">
29+
<EditText
30+
android:layout_width="match_parent"
31+
android:layout_height="wrap_content"
32+
android:id="@+id/password"
33+
android:ems="10"
34+
android:hint="Password"
35+
android:paddingTop="16dp"
36+
android:password="true"
37+
style="@style/FirebaseEditTextTheme"
38+
android:theme="@style/FirebaseEditTextTheme"/>
6239

63-
<TextView
64-
android:layout_width="wrap_content"
65-
android:layout_height="wrap_content"
66-
android:text="or"
67-
android:textColor="#CCCCCC"
68-
android:typeface="normal"
69-
android:textAlignment="center"
70-
android:layout_marginTop="0dp"
71-
android:layout_marginBottom="0dp"
72-
android:gravity="center"
73-
android:background="#F5f5f5"
74-
android:paddingLeft="15dp"
75-
android:paddingRight="15dp"
76-
android:layout_gravity="center" />
77-
</FrameLayout>
78-
</LinearLayout>
40+
<Button
41+
android:layout_width="match_parent"
42+
android:layout_height="wrap_content"
43+
android:text="Login"
44+
android:id="@+id/password_button"
45+
android:textColor="#ffffff"
46+
android:typeface="normal"
47+
android:layout_marginTop="10dp"
48+
android:background="@drawable/password_button"
49+
android:textStyle="bold" />
7950

80-
<LinearLayout
81-
android:orientation="vertical"
51+
<FrameLayout
8252
android:layout_width="match_parent"
83-
android:layout_height="match_parent"
84-
android:id="@+id/social_section"
85-
android:layout_marginTop="15dp"
86-
android:layout_marginBottom="8dp">
53+
android:layout_height="wrap_content"
54+
android:layout_gravity="center_horizontal"
55+
android:background="@drawable/or_line"
56+
android:id="@+id/or_section"
57+
android:layout_marginBottom="0dp"
58+
android:layout_marginTop="15dp">
8759

88-
<Button
89-
android:layout_width="match_parent"
60+
<TextView
61+
android:layout_width="wrap_content"
9062
android:layout_height="wrap_content"
91-
android:text="Login with Facebook"
92-
android:id="@+id/facebook_button"
93-
android:background="@drawable/facebook_button"
94-
android:textColor="#ffffff"
63+
android:text="or"
64+
android:textColor="#CCCCCC"
9565
android:typeface="normal"
9666
android:textAlignment="center"
97-
android:drawableLeft="@drawable/ic_facebook"
98-
android:drawablePadding="10dp"
99-
android:gravity="left|center"
100-
android:textStyle="bold"
101-
android:paddingLeft="12dp"
102-
android:layout_marginBottom="10dp" />
67+
android:layout_marginTop="0dp"
68+
android:layout_marginBottom="0dp"
69+
android:gravity="center"
70+
android:background="#F5f5f5"
71+
android:paddingLeft="15dp"
72+
android:paddingRight="15dp"
73+
android:layout_gravity="center" />
74+
</FrameLayout>
75+
</LinearLayout>
10376

104-
<Button
105-
android:layout_width="match_parent"
106-
android:layout_height="wrap_content"
107-
android:text="Login with Google+"
108-
android:id="@+id/google_button"
109-
android:background="@drawable/google_button"
110-
android:textColor="#ffffff"
111-
android:typeface="normal"
112-
android:textAlignment="center"
113-
android:drawableLeft="@drawable/ic_google"
114-
android:drawablePadding="10dp"
115-
android:gravity="left|center"
116-
android:textStyle="bold"
117-
android:paddingLeft="12dp"
118-
android:layout_marginBottom="10dp" />
77+
<LinearLayout
78+
android:orientation="vertical"
79+
android:layout_width="match_parent"
80+
android:layout_height="match_parent"
81+
android:id="@+id/social_section"
82+
android:layout_marginTop="15dp"
83+
android:layout_marginBottom="6dp">
11984

120-
<Button
121-
android:layout_width="match_parent"
122-
android:layout_height="wrap_content"
123-
android:text="Login with Twitter"
124-
android:id="@+id/twitter_button"
125-
android:background="@drawable/twitter_button"
126-
android:textColor="#ffffff"
127-
android:typeface="normal"
128-
android:textAlignment="center"
129-
android:drawableLeft="@drawable/ic_twitter"
130-
android:drawablePadding="10dp"
131-
android:gravity="left|center"
132-
android:textStyle="bold"
133-
android:paddingLeft="12dp" />
134-
</LinearLayout>
85+
<Button
86+
android:layout_width="match_parent"
87+
android:layout_height="wrap_content"
88+
android:text="Login with Facebook"
89+
android:id="@+id/facebook_button"
90+
android:background="@drawable/facebook_button"
91+
android:textColor="#ffffff"
92+
android:typeface="normal"
93+
android:textAlignment="center"
94+
android:drawableLeft="@drawable/ic_facebook"
95+
android:drawablePadding="10dp"
96+
android:gravity="left|center"
97+
android:textStyle="bold"
98+
android:paddingLeft="12dp"
99+
android:layout_marginBottom="10dp" />
135100

101+
<Button
102+
android:layout_width="match_parent"
103+
android:layout_height="wrap_content"
104+
android:text="Login with Google+"
105+
android:id="@+id/google_button"
106+
android:background="@drawable/google_button"
107+
android:textColor="#ffffff"
108+
android:typeface="normal"
109+
android:textAlignment="center"
110+
android:drawableLeft="@drawable/ic_google"
111+
android:drawablePadding="10dp"
112+
android:gravity="left|center"
113+
android:textStyle="bold"
114+
android:paddingLeft="12dp"
115+
android:layout_marginBottom="10dp" />
136116

117+
<Button
118+
android:layout_width="match_parent"
119+
android:layout_height="wrap_content"
120+
android:text="Login with Twitter"
121+
android:id="@+id/twitter_button"
122+
android:background="@drawable/twitter_button"
123+
android:textColor="#ffffff"
124+
android:typeface="normal"
125+
android:textAlignment="center"
126+
android:drawableLeft="@drawable/ic_twitter"
127+
android:drawablePadding="10dp"
128+
android:gravity="left|center"
129+
android:textStyle="bold"
130+
android:paddingLeft="12dp"
131+
android:layout_marginBottom="10dp" />
137132
</LinearLayout>
138-
</FrameLayout>
133+
</LinearLayout>

0 commit comments

Comments
 (0)