Showing
25 changed files
with
481 additions
and
19 deletions
.idea/vcs.xml
0 → 100644
... | @@ -27,10 +27,13 @@ dependencies { | ... | @@ -27,10 +27,13 @@ dependencies { |
27 | compile 'com.android.support:appcompat-v7:25.3.1' | 27 | compile 'com.android.support:appcompat-v7:25.3.1' |
28 | compile 'com.android.support.constraint:constraint-layout:1.0.2' | 28 | compile 'com.android.support.constraint:constraint-layout:1.0.2' |
29 | compile 'com.google.firebase:firebase-auth:10.2.6' | 29 | compile 'com.google.firebase:firebase-auth:10.2.6' |
30 | + compile 'com.google.android.gms:play-services-auth:10.2.6' | ||
30 | compile 'com.google.firebase:firebase-database:10.2.6' | 31 | compile 'com.google.firebase:firebase-database:10.2.6' |
32 | + compile 'com.android.support:design:25.3.1' | ||
31 | testCompile 'junit:junit:4.12' | 33 | testCompile 'junit:junit:4.12' |
32 | } | 34 | } |
33 | 35 | ||
34 | 36 | ||
35 | 37 | ||
38 | + | ||
36 | apply plugin: 'com.google.gms.google-services' | 39 | apply plugin: 'com.google.gms.google-services' |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -4,7 +4,6 @@ | ... | @@ -4,7 +4,6 @@ |
4 | 4 | ||
5 | <user-permission android:name="android.permission.INTERNET" /> | 5 | <user-permission android:name="android.permission.INTERNET" /> |
6 | 6 | ||
7 | - | ||
8 | <application | 7 | <application |
9 | android:allowBackup="true" | 8 | android:allowBackup="true" |
10 | android:icon="@mipmap/ic_launcher" | 9 | android:icon="@mipmap/ic_launcher" |
... | @@ -20,8 +19,11 @@ | ... | @@ -20,8 +19,11 @@ |
20 | </intent-filter> | 19 | </intent-filter> |
21 | </activity> | 20 | </activity> |
22 | <activity android:name=".LoginActivity" /> | 21 | <activity android:name=".LoginActivity" /> |
23 | - <activity android:name=".ProfileActivity"></activity> | 22 | + <activity android:name=".ProfileActivity" /> |
23 | + <activity | ||
24 | + android:name=".Main2Activity" | ||
25 | + android:label="@string/title_activity_main2" | ||
26 | + android:theme="@style/AppTheme.NoActionBar"></activity> | ||
24 | </application> | 27 | </application> |
25 | 28 | ||
26 | - | 29 | +</manifest> |
27 | -</manifest> | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -6,26 +6,44 @@ import android.support.annotation.NonNull; | ... | @@ -6,26 +6,44 @@ import android.support.annotation.NonNull; |
6 | import android.support.v7.app.AppCompatActivity; | 6 | import android.support.v7.app.AppCompatActivity; |
7 | import android.os.Bundle; | 7 | import android.os.Bundle; |
8 | import android.text.TextUtils; | 8 | import android.text.TextUtils; |
9 | +import android.util.Log; | ||
9 | import android.view.View; | 10 | import android.view.View; |
10 | import android.widget.Button; | 11 | import android.widget.Button; |
11 | import android.widget.EditText; | 12 | import android.widget.EditText; |
12 | import android.widget.TextView; | 13 | import android.widget.TextView; |
13 | import android.widget.Toast; | 14 | import android.widget.Toast; |
14 | 15 | ||
16 | +import com.google.android.gms.auth.api.Auth; | ||
17 | +import com.google.android.gms.auth.api.signin.GoogleSignInAccount; | ||
18 | +import com.google.android.gms.auth.api.signin.GoogleSignInOptions; | ||
19 | +import com.google.android.gms.auth.api.signin.GoogleSignInResult; | ||
20 | +import com.google.android.gms.common.ConnectionResult; | ||
21 | +import com.google.android.gms.common.SignInButton; | ||
22 | +import com.google.android.gms.common.api.GoogleApiClient; | ||
15 | import com.google.android.gms.tasks.OnCompleteListener; | 23 | import com.google.android.gms.tasks.OnCompleteListener; |
16 | import com.google.android.gms.tasks.Task; | 24 | import com.google.android.gms.tasks.Task; |
25 | +import com.google.firebase.auth.AuthCredential; | ||
17 | import com.google.firebase.auth.AuthResult; | 26 | import com.google.firebase.auth.AuthResult; |
18 | import com.google.firebase.auth.FirebaseAuth; | 27 | import com.google.firebase.auth.FirebaseAuth; |
28 | +import com.google.firebase.auth.FirebaseUser; | ||
29 | +import com.google.firebase.auth.GoogleAuthProvider; | ||
19 | 30 | ||
20 | public class LoginActivity extends AppCompatActivity implements View.OnClickListener { | 31 | public class LoginActivity extends AppCompatActivity implements View.OnClickListener { |
21 | 32 | ||
22 | private Button buttonSignIn; | 33 | private Button buttonSignIn; |
34 | + private Button buttonGoogleSignIn; | ||
23 | private EditText editTextEmail; | 35 | private EditText editTextEmail; |
24 | private EditText editTextPassword; | 36 | private EditText editTextPassword; |
25 | private TextView textViewSignUp; | 37 | private TextView textViewSignUp; |
26 | 38 | ||
27 | private ProgressDialog progressDialog; | 39 | private ProgressDialog progressDialog; |
28 | private FirebaseAuth firebaseAuth; | 40 | private FirebaseAuth firebaseAuth; |
41 | + private FirebaseAuth.AuthStateListener mAuthListener; | ||
42 | + | ||
43 | + private static final int RC_SIGN_IN = 1; | ||
44 | + private static final String TAG = "LOGIN_ACTIVITY"; | ||
45 | + | ||
46 | + private GoogleApiClient mGoogleApiClient; | ||
29 | 47 | ||
30 | @Override | 48 | @Override |
31 | protected void onCreate(Bundle savedInstanceState) { | 49 | protected void onCreate(Bundle savedInstanceState) { |
... | @@ -33,21 +51,110 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList | ... | @@ -33,21 +51,110 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList |
33 | setContentView(R.layout.activity_login); | 51 | setContentView(R.layout.activity_login); |
34 | 52 | ||
35 | firebaseAuth = firebaseAuth.getInstance(); | 53 | firebaseAuth = firebaseAuth.getInstance(); |
54 | + mAuthListener = new FirebaseAuth.AuthStateListener(){ | ||
55 | + @Override | ||
56 | + public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { | ||
57 | + if(firebaseAuth.getCurrentUser() != null){ | ||
58 | + startActivity(new Intent(LoginActivity.this, Main2Activity.class)); | ||
59 | + } | ||
60 | + } | ||
61 | + }; | ||
36 | 62 | ||
37 | if(firebaseAuth.getCurrentUser() != null){ | 63 | if(firebaseAuth.getCurrentUser() != null){ |
38 | //profile activity here | 64 | //profile activity here |
39 | finish(); | 65 | finish(); |
40 | - startActivity(new Intent(getApplicationContext(), ProfileActivity.class)); | 66 | + startActivity(new Intent(getApplicationContext(), Main2Activity.class)); |
41 | } | 67 | } |
42 | 68 | ||
43 | editTextEmail = (EditText)findViewById(R.id.editTextEmail); | 69 | editTextEmail = (EditText)findViewById(R.id.editTextEmail); |
44 | editTextPassword = (EditText)findViewById(R.id.editTextPassword); | 70 | editTextPassword = (EditText)findViewById(R.id.editTextPassword); |
45 | buttonSignIn = (Button) findViewById(R.id.buttonSignIn); | 71 | buttonSignIn = (Button) findViewById(R.id.buttonSignIn); |
72 | + SignInButton buttonGoogleSignIn = (SignInButton) findViewById(R.id.buttonGoogleSignIn); | ||
46 | textViewSignUp = (TextView)findViewById(R.id.textViewSignUp); | 73 | textViewSignUp = (TextView)findViewById(R.id.textViewSignUp); |
47 | 74 | ||
48 | progressDialog = new ProgressDialog(this); | 75 | progressDialog = new ProgressDialog(this); |
49 | buttonSignIn.setOnClickListener(this); | 76 | buttonSignIn.setOnClickListener(this); |
50 | textViewSignUp.setOnClickListener(this); | 77 | textViewSignUp.setOnClickListener(this); |
78 | + | ||
79 | + | ||
80 | + // Configure Google Sign In | ||
81 | + GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) | ||
82 | + .requestIdToken(getString(R.string.default_web_client_id)) | ||
83 | + .requestEmail() | ||
84 | + .build(); | ||
85 | + | ||
86 | + mGoogleApiClient = new GoogleApiClient.Builder(getApplicationContext()) | ||
87 | + .enableAutoManage(this, new GoogleApiClient.OnConnectionFailedListener() { | ||
88 | + @Override | ||
89 | + public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { | ||
90 | + Toast.makeText(LoginActivity.this, "Error!", Toast.LENGTH_LONG).show(); | ||
91 | + } | ||
92 | + }) | ||
93 | + .addApi(Auth.GOOGLE_SIGN_IN_API, gso) | ||
94 | + .build(); | ||
95 | + | ||
96 | + buttonGoogleSignIn.setOnClickListener(new View.OnClickListener(){ | ||
97 | + | ||
98 | + @Override | ||
99 | + public void onClick(View v) { | ||
100 | + signIn(); | ||
101 | + } | ||
102 | + }); | ||
103 | + } | ||
104 | + | ||
105 | + @Override | ||
106 | + protected void onStart() { | ||
107 | + super.onStart(); | ||
108 | + firebaseAuth.addAuthStateListener(mAuthListener); | ||
109 | + } | ||
110 | + | ||
111 | + private void signIn() { | ||
112 | + Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient); | ||
113 | + startActivityForResult(signInIntent, RC_SIGN_IN); | ||
114 | + } | ||
115 | + | ||
116 | + @Override | ||
117 | + public void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
118 | + super.onActivityResult(requestCode, resultCode, data); | ||
119 | + | ||
120 | + // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...); | ||
121 | + if (requestCode == RC_SIGN_IN) { | ||
122 | + GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data); | ||
123 | + if (result.isSuccess()) { | ||
124 | + // Google Sign In was successful, authenticate with Firebase | ||
125 | + GoogleSignInAccount account = result.getSignInAccount(); | ||
126 | + firebaseAuthWithGoogle(account); | ||
127 | + } else { | ||
128 | + // Google Sign In failed, update UI appropriately | ||
129 | + // ... | ||
130 | + } | ||
131 | + } | ||
132 | + } | ||
133 | + | ||
134 | + private void firebaseAuthWithGoogle(GoogleSignInAccount account) { | ||
135 | + Log.d(TAG, "firebaseAuthWithGoogle:" + account.getId()); | ||
136 | + | ||
137 | + AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(), null); | ||
138 | + firebaseAuth.signInWithCredential(credential) | ||
139 | + .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { | ||
140 | + @Override | ||
141 | + public void onComplete(@NonNull Task<AuthResult> task) { | ||
142 | + if (task.isSuccessful()) { | ||
143 | + // Sign in success, update UI with the signed-in user's information | ||
144 | + Log.d(TAG, "signInWithCredential:success"); | ||
145 | + FirebaseUser user = firebaseAuth.getCurrentUser(); | ||
146 | + //updateUI(user); | ||
147 | + } else { | ||
148 | + // If sign in fails, display a message to the user. | ||
149 | + Log.w(TAG, "signInWithCredential:failure", task.getException()); | ||
150 | + Toast.makeText(LoginActivity.this, "Authentication failed.", | ||
151 | + Toast.LENGTH_SHORT).show(); | ||
152 | + //updateUI(null); | ||
153 | + } | ||
154 | + | ||
155 | + // ... | ||
156 | + } | ||
157 | + }); | ||
51 | } | 158 | } |
52 | 159 | ||
53 | private void userLogin(){ | 160 | private void userLogin(){ |
... | @@ -83,7 +190,7 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList | ... | @@ -83,7 +190,7 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList |
83 | if(task.isSuccessful()){ | 190 | if(task.isSuccessful()){ |
84 | //start the profile activity | 191 | //start the profile activity |
85 | finish(); | 192 | finish(); |
86 | - startActivity(new Intent(getApplicationContext(), ProfileActivity.class)); | 193 | + startActivity(new Intent(getApplicationContext(), Main2Activity.class)); |
87 | } | 194 | } |
88 | } | 195 | } |
89 | }); | 196 | }); | ... | ... |
1 | +package com.example.user.firebaseauthdemo; | ||
2 | + | ||
3 | +import android.os.Bundle; | ||
4 | +import android.support.design.widget.FloatingActionButton; | ||
5 | +import android.support.design.widget.Snackbar; | ||
6 | +import android.view.View; | ||
7 | +import android.support.design.widget.NavigationView; | ||
8 | +import android.support.v4.view.GravityCompat; | ||
9 | +import android.support.v4.widget.DrawerLayout; | ||
10 | +import android.support.v7.app.ActionBarDrawerToggle; | ||
11 | +import android.support.v7.app.AppCompatActivity; | ||
12 | +import android.support.v7.widget.Toolbar; | ||
13 | +import android.view.Menu; | ||
14 | +import android.view.MenuItem; | ||
15 | + | ||
16 | +public class Main2Activity extends AppCompatActivity | ||
17 | + implements NavigationView.OnNavigationItemSelectedListener { | ||
18 | + | ||
19 | + @Override | ||
20 | + protected void onCreate(Bundle savedInstanceState) { | ||
21 | + super.onCreate(savedInstanceState); | ||
22 | + setContentView(R.layout.activity_main2); | ||
23 | + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
24 | + setSupportActionBar(toolbar); | ||
25 | + | ||
26 | + FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | ||
27 | + fab.setOnClickListener(new View.OnClickListener() { | ||
28 | + @Override | ||
29 | + public void onClick(View view) { | ||
30 | + Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) | ||
31 | + .setAction("Action", null).show(); | ||
32 | + } | ||
33 | + }); | ||
34 | + | ||
35 | + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); | ||
36 | + ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( | ||
37 | + this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); | ||
38 | + drawer.setDrawerListener(toggle); | ||
39 | + toggle.syncState(); | ||
40 | + | ||
41 | + NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); | ||
42 | + navigationView.setNavigationItemSelectedListener(this); | ||
43 | + } | ||
44 | + | ||
45 | + @Override | ||
46 | + public void onBackPressed() { | ||
47 | + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); | ||
48 | + if (drawer.isDrawerOpen(GravityCompat.START)) { | ||
49 | + drawer.closeDrawer(GravityCompat.START); | ||
50 | + } else { | ||
51 | + super.onBackPressed(); | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
55 | + @Override | ||
56 | + public boolean onCreateOptionsMenu(Menu menu) { | ||
57 | + // Inflate the menu; this adds items to the action bar if it is present. | ||
58 | + getMenuInflater().inflate(R.menu.main2, menu); | ||
59 | + return true; | ||
60 | + } | ||
61 | + | ||
62 | + @Override | ||
63 | + public boolean onOptionsItemSelected(MenuItem item) { | ||
64 | + // Handle action bar item clicks here. The action bar will | ||
65 | + // automatically handle clicks on the Home/Up button, so long | ||
66 | + // as you specify a parent activity in AndroidManifest.xml. | ||
67 | + int id = item.getItemId(); | ||
68 | + | ||
69 | + //noinspection SimplifiableIfStatement | ||
70 | + if (id == R.id.action_settings) { | ||
71 | + return true; | ||
72 | + } | ||
73 | + | ||
74 | + return super.onOptionsItemSelected(item); | ||
75 | + } | ||
76 | + | ||
77 | + @SuppressWarnings("StatementWithEmptyBody") | ||
78 | + @Override | ||
79 | + public boolean onNavigationItemSelected(MenuItem item) { | ||
80 | + // Handle navigation view item clicks here. | ||
81 | + int id = item.getItemId(); | ||
82 | + | ||
83 | + if (id == R.id.nav_map) { | ||
84 | + // Handle the camera action | ||
85 | + } else if (id == R.id.nav_route) { | ||
86 | + | ||
87 | + } else if (id == R.id.nav_community) { | ||
88 | + | ||
89 | + } else if (id == R.id.nav_manage) { | ||
90 | + | ||
91 | + } | ||
92 | + | ||
93 | + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); | ||
94 | + drawer.closeDrawer(GravityCompat.START); | ||
95 | + return true; | ||
96 | + } | ||
97 | +} |
... | @@ -21,6 +21,7 @@ import com.google.firebase.auth.FirebaseAuth; | ... | @@ -21,6 +21,7 @@ import com.google.firebase.auth.FirebaseAuth; |
21 | public class MainActivity extends AppCompatActivity implements View.OnClickListener{ | 21 | public class MainActivity extends AppCompatActivity implements View.OnClickListener{ |
22 | 22 | ||
23 | private Button buttonRegister; | 23 | private Button buttonRegister; |
24 | + | ||
24 | private EditText editTextEmail; | 25 | private EditText editTextEmail; |
25 | private EditText editTextPassword; | 26 | private EditText editTextPassword; |
26 | private TextView textViewSignIn; | 27 | private TextView textViewSignIn; | ... | ... |
1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
2 | + android:width="24dp" | ||
3 | + android:height="24dp" | ||
4 | + android:viewportHeight="24.0" | ||
5 | + android:viewportWidth="24.0"> | ||
6 | + <path | ||
7 | + android:fillColor="#FF000000" | ||
8 | + android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" /> | ||
9 | + <path | ||
10 | + android:fillColor="#FF000000" | ||
11 | + android:pathData="M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zm3,15c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" /> | ||
12 | +</vector> |
1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
2 | + android:width="24dp" | ||
3 | + android:height="24dp" | ||
4 | + android:viewportHeight="24.0" | ||
5 | + android:viewportWidth="24.0"> | ||
6 | + <path | ||
7 | + android:fillColor="#FF000000" | ||
8 | + android:pathData="M22,16V4c0,-1.1 -0.9,-2 -2,-2H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2zm-11,-4l2.03,2.71L16,11l4,5H8l3,-4zM2,6v14c0,1.1 0.9,2 2,2h14v-2H4V6H2z" /> | ||
9 | +</vector> |
1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
2 | + android:width="24dp" | ||
3 | + android:height="24dp" | ||
4 | + android:viewportHeight="24.0" | ||
5 | + android:viewportWidth="24.0"> | ||
6 | + <path | ||
7 | + android:fillColor="#FF000000" | ||
8 | + android:pathData="M22.7,19l-9.1,-9.1c0.9,-2.3 0.4,-5 -1.5,-6.9 -2,-2 -5,-2.4 -7.4,-1.3L9,6 6,9 1.6,4.7C0.4,7.1 0.9,10.1 2.9,12.1c1.9,1.9 4.6,2.4 6.9,1.5l9.1,9.1c0.4,0.4 1,0.4 1.4,0l2.3,-2.3c0.5,-0.4 0.5,-1.1 0.1,-1.4z" /> | ||
9 | +</vector> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
2 | + android:width="24dp" | ||
3 | + android:height="24dp" | ||
4 | + android:viewportHeight="24.0" | ||
5 | + android:viewportWidth="24.0"> | ||
6 | + <path | ||
7 | + android:fillColor="#FF000000" | ||
8 | + android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z" /> | ||
9 | +</vector> |
1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
2 | + android:width="24dp" | ||
3 | + android:height="24dp" | ||
4 | + android:viewportHeight="24.0" | ||
5 | + android:viewportWidth="24.0"> | ||
6 | + <path | ||
7 | + android:fillColor="#FF000000" | ||
8 | + android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z" /> | ||
9 | +</vector> |
1 | +<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
2 | + android:width="24dp" | ||
3 | + android:height="24dp" | ||
4 | + android:viewportHeight="24.0" | ||
5 | + android:viewportWidth="24.0"> | ||
6 | + <path | ||
7 | + android:fillColor="#FF000000" | ||
8 | + android:pathData="M4,6H2v14c0,1.1 0.9,2 2,2h14v-2H4V6zm16,-4H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zm-8,12.5v-9l6,4.5 -6,4.5z" /> | ||
9 | +</vector> |
app/src/main/res/drawable/side_nav_bar.xml
0 → 100644
1 | +<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
2 | + android:shape="rectangle"> | ||
3 | + <gradient | ||
4 | + android:angle="135" | ||
5 | + android:centerColor="#4CAF50" | ||
6 | + android:endColor="#2E7D32" | ||
7 | + android:startColor="#81C784" | ||
8 | + android:type="linear" /> | ||
9 | +</shape> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -16,13 +16,13 @@ | ... | @@ -16,13 +16,13 @@ |
16 | tools:layout_editor_absoluteX="8dp" > | 16 | tools:layout_editor_absoluteX="8dp" > |
17 | 17 | ||
18 | <TextView | 18 | <TextView |
19 | - android:layout_margin="30dp" | ||
20 | - android:text="User Login" | ||
21 | android:id="@+id/textView" | 19 | android:id="@+id/textView" |
22 | android:layout_width="wrap_content" | 20 | android:layout_width="wrap_content" |
23 | - android:textAppearance="?android:attr/textAppearanceLarge" | ||
24 | android:layout_height="wrap_content" | 21 | android:layout_height="wrap_content" |
25 | - android:layout_gravity="center_horizontal"/> | 22 | + android:layout_gravity="center_horizontal" |
23 | + android:layout_margin="30dp" | ||
24 | + android:text="User Login" | ||
25 | + android:textAppearance="?android:attr/textAppearanceLarge" /> | ||
26 | 26 | ||
27 | <EditText | 27 | <EditText |
28 | android:layout_margin="15dp" | 28 | android:layout_margin="15dp" |
... | @@ -45,18 +45,25 @@ | ... | @@ -45,18 +45,25 @@ |
45 | tools:layout_editor_absoluteX="8dp" /> | 45 | tools:layout_editor_absoluteX="8dp" /> |
46 | 46 | ||
47 | <Button | 47 | <Button |
48 | - android:layout_margin="15dp" | ||
49 | android:id="@+id/buttonSignIn" | 48 | android:id="@+id/buttonSignIn" |
50 | - android:text="SignUp" | ||
51 | android:layout_width="match_parent" | 49 | android:layout_width="match_parent" |
52 | - android:layout_height="wrap_content" /> | 50 | + android:layout_height="wrap_content" |
51 | + android:layout_margin="15dp" | ||
52 | + android:text="Sign in" /> | ||
53 | + | ||
54 | + <com.google.android.gms.common.SignInButton | ||
55 | + android:layout_width="match_parent" | ||
56 | + android:layout_height="wrap_content" | ||
57 | + android:id="@+id/buttonGoogleSignIn"> | ||
58 | + </com.google.android.gms.common.SignInButton> | ||
53 | 59 | ||
54 | <TextView | 60 | <TextView |
55 | android:textAlignment="center" | 61 | android:textAlignment="center" |
56 | - android:text="Not have an account? Signup Here" | ||
57 | android:id="@+id/textViewSignUp" | 62 | android:id="@+id/textViewSignUp" |
58 | android:layout_width="match_parent" | 63 | android:layout_width="match_parent" |
59 | - android:layout_height="wrap_content" /> | 64 | + android:layout_height="wrap_content" |
65 | + android:layout_margin="15dp" | ||
66 | + android:text="Not have an account? Signup Here" /> | ||
60 | 67 | ||
61 | </LinearLayout> | 68 | </LinearLayout> |
62 | </android.support.constraint.ConstraintLayout> | 69 | </android.support.constraint.ConstraintLayout> | ... | ... |
app/src/main/res/layout/activity_main2.xml
0 → 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | + xmlns:tools="http://schemas.android.com/tools" | ||
5 | + android:id="@+id/drawer_layout" | ||
6 | + android:layout_width="match_parent" | ||
7 | + android:layout_height="match_parent" | ||
8 | + android:fitsSystemWindows="true" | ||
9 | + tools:openDrawer="start"> | ||
10 | + | ||
11 | + <include | ||
12 | + layout="@layout/app_bar_main2" | ||
13 | + android:layout_width="match_parent" | ||
14 | + android:layout_height="match_parent" /> | ||
15 | + | ||
16 | + <android.support.design.widget.NavigationView | ||
17 | + android:id="@+id/nav_view" | ||
18 | + android:layout_width="wrap_content" | ||
19 | + android:layout_height="match_parent" | ||
20 | + android:layout_gravity="start" | ||
21 | + android:fitsSystemWindows="true" | ||
22 | + app:headerLayout="@layout/nav_header_main2" | ||
23 | + app:menu="@menu/activity_main2_drawer" /> | ||
24 | + | ||
25 | +</android.support.v4.widget.DrawerLayout> |
... | @@ -23,14 +23,14 @@ | ... | @@ -23,14 +23,14 @@ |
23 | android:layout_gravity="center_horizontal"/> | 23 | android:layout_gravity="center_horizontal"/> |
24 | 24 | ||
25 | <EditText | 25 | <EditText |
26 | - android:id="@+id/editTextAddress" | 26 | + android:id="@+id/editTextName" |
27 | - android:hint="Enter Address" | 27 | + android:hint="Enter your Name" |
28 | android:layout_width="match_parent" | 28 | android:layout_width="match_parent" |
29 | android:layout_height="wrap_content" /> | 29 | android:layout_height="wrap_content" /> |
30 | 30 | ||
31 | <EditText | 31 | <EditText |
32 | - android:id="@+id/editTextName" | 32 | + android:id="@+id/editTextAddress" |
33 | - android:hint="Enter your Name" | 33 | + android:hint="Enter your Address" |
34 | android:layout_width="match_parent" | 34 | android:layout_width="match_parent" |
35 | android:layout_height="wrap_content" /> | 35 | android:layout_height="wrap_content" /> |
36 | 36 | ... | ... |
app/src/main/res/layout/app_bar_main2.xml
0 → 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | + xmlns:tools="http://schemas.android.com/tools" | ||
5 | + android:layout_width="match_parent" | ||
6 | + android:layout_height="match_parent" | ||
7 | + tools:context="com.example.user.firebaseauthdemo.Main2Activity"> | ||
8 | + | ||
9 | + <android.support.design.widget.AppBarLayout | ||
10 | + android:layout_width="match_parent" | ||
11 | + android:layout_height="wrap_content" | ||
12 | + android:theme="@style/AppTheme.AppBarOverlay"> | ||
13 | + | ||
14 | + <android.support.v7.widget.Toolbar | ||
15 | + android:id="@+id/toolbar" | ||
16 | + android:layout_width="match_parent" | ||
17 | + android:layout_height="?attr/actionBarSize" | ||
18 | + android:background="?attr/colorPrimary" | ||
19 | + app:popupTheme="@style/AppTheme.PopupOverlay" /> | ||
20 | + | ||
21 | + </android.support.design.widget.AppBarLayout> | ||
22 | + | ||
23 | + <include layout="@layout/content_main2" /> | ||
24 | + | ||
25 | + <android.support.design.widget.FloatingActionButton | ||
26 | + android:id="@+id/fab" | ||
27 | + android:layout_width="wrap_content" | ||
28 | + android:layout_height="wrap_content" | ||
29 | + android:layout_gravity="bottom|end" | ||
30 | + android:layout_margin="@dimen/fab_margin" | ||
31 | + app:srcCompat="@android:drawable/ic_dialog_email" /> | ||
32 | + | ||
33 | +</android.support.design.widget.CoordinatorLayout> |
app/src/main/res/layout/content_main2.xml
0 → 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | + xmlns:tools="http://schemas.android.com/tools" | ||
5 | + android:layout_width="match_parent" | ||
6 | + android:layout_height="match_parent" | ||
7 | + app:layout_behavior="@string/appbar_scrolling_view_behavior" | ||
8 | + tools:context="com.example.user.firebaseauthdemo.Main2Activity" | ||
9 | + tools:showIn="@layout/app_bar_main2"> | ||
10 | + | ||
11 | +</android.support.constraint.ConstraintLayout> |
app/src/main/res/layout/nav_header_main2.xml
0 → 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | + android:layout_width="match_parent" | ||
5 | + android:layout_height="@dimen/nav_header_height" | ||
6 | + android:background="@drawable/side_nav_bar" | ||
7 | + android:gravity="bottom" | ||
8 | + android:orientation="vertical" | ||
9 | + android:paddingBottom="@dimen/activity_vertical_margin" | ||
10 | + android:paddingLeft="@dimen/activity_horizontal_margin" | ||
11 | + android:paddingRight="@dimen/activity_horizontal_margin" | ||
12 | + android:paddingTop="@dimen/activity_vertical_margin" | ||
13 | + android:theme="@style/ThemeOverlay.AppCompat.Dark"> | ||
14 | + | ||
15 | + <ImageView | ||
16 | + android:id="@+id/imageView" | ||
17 | + android:layout_width="wrap_content" | ||
18 | + android:layout_height="wrap_content" | ||
19 | + android:paddingTop="@dimen/nav_header_vertical_spacing" | ||
20 | + app:srcCompat="@android:drawable/sym_def_app_icon" /> | ||
21 | + | ||
22 | + <TextView | ||
23 | + android:layout_width="match_parent" | ||
24 | + android:layout_height="wrap_content" | ||
25 | + android:paddingTop="@dimen/nav_header_vertical_spacing" | ||
26 | + android:text="HelpList" | ||
27 | + android:textAppearance="@style/TextAppearance.AppCompat.Body2" /> | ||
28 | + | ||
29 | + <TextView | ||
30 | + android:id="@+id/textView" | ||
31 | + android:layout_width="wrap_content" | ||
32 | + android:layout_height="wrap_content" | ||
33 | + android:text="hanorang2@gmail.com" /> | ||
34 | + | ||
35 | + <TextView | ||
36 | + android:id="@+id/gitURL" | ||
37 | + android:layout_width="wrap_content" | ||
38 | + android:layout_height="wrap_content" | ||
39 | + android:text="https://github.com/Cradirow/FirebaseAuth" /> | ||
40 | + | ||
41 | +</LinearLayout> |
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<menu xmlns:android="http://schemas.android.com/apk/res/android"> | ||
3 | + | ||
4 | + <group android:checkableBehavior="single"> | ||
5 | + <item | ||
6 | + android:id="@+id/nav_map" | ||
7 | + android:icon="@drawable/ic_menu_camera" | ||
8 | + android:title="Map" /> | ||
9 | + <item | ||
10 | + android:id="@+id/nav_route" | ||
11 | + android:icon="@drawable/ic_menu_gallery" | ||
12 | + android:title="Route" /> | ||
13 | + <item | ||
14 | + android:id="@+id/nav_community" | ||
15 | + android:icon="@drawable/ic_menu_slideshow" | ||
16 | + android:title="Community" /> | ||
17 | + <item | ||
18 | + android:id="@+id/nav_manage" | ||
19 | + android:icon="@drawable/ic_menu_manage" | ||
20 | + android:title="Settings" /> | ||
21 | + </group> | ||
22 | + | ||
23 | +</menu> |
app/src/main/res/menu/main2.xml
0 → 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<menu xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
4 | + <item | ||
5 | + android:id="@+id/action_settings" | ||
6 | + android:orderInCategory="100" | ||
7 | + android:title="@string/action_settings" | ||
8 | + app:showAsAction="never" /> | ||
9 | +</menu> |
app/src/main/res/values/dimens.xml
0 → 100644
1 | +<resources> | ||
2 | + <!-- Default screen margins, per the Android Design guidelines. --> | ||
3 | + <dimen name="activity_horizontal_margin">16dp</dimen> | ||
4 | + <dimen name="activity_vertical_margin">16dp</dimen> | ||
5 | + <dimen name="nav_header_vertical_spacing">16dp</dimen> | ||
6 | + <dimen name="nav_header_height">160dp</dimen> | ||
7 | + <dimen name="fab_margin">16dp</dimen> | ||
8 | +</resources> |
app/src/main/res/values/drawables.xml
0 → 100644
1 | +<resources xmlns:android="http://schemas.android.com/apk/res/android"> | ||
2 | + <item name="ic_menu_camera" type="drawable">@android:drawable/ic_menu_camera</item> | ||
3 | + <item name="ic_menu_gallery" type="drawable">@android:drawable/ic_menu_gallery</item> | ||
4 | + <item name="ic_menu_slideshow" type="drawable">@android:drawable/ic_menu_slideshow</item> | ||
5 | + <item name="ic_menu_manage" type="drawable">@android:drawable/ic_menu_manage</item> | ||
6 | + <item name="ic_menu_share" type="drawable">@android:drawable/ic_menu_share</item> | ||
7 | + <item name="ic_menu_send" type="drawable">@android:drawable/ic_menu_send</item> | ||
8 | +</resources> |
1 | <resources> | 1 | <resources> |
2 | <string name="app_name">FirebaseAuthDemo</string> | 2 | <string name="app_name">FirebaseAuthDemo</string> |
3 | + <string name="title_activity_main2">Main2Activity</string> | ||
4 | + | ||
5 | + <string name="navigation_drawer_open">Open navigation drawer</string> | ||
6 | + <string name="navigation_drawer_close">Close navigation drawer</string> | ||
7 | + | ||
8 | + <string name="action_settings">Settings</string> | ||
3 | </resources> | 9 | </resources> | ... | ... |
... | @@ -8,4 +8,13 @@ | ... | @@ -8,4 +8,13 @@ |
8 | <item name="colorAccent">@color/colorAccent</item> | 8 | <item name="colorAccent">@color/colorAccent</item> |
9 | </style> | 9 | </style> |
10 | 10 | ||
11 | + <style name="AppTheme.NoActionBar"> | ||
12 | + <item name="windowActionBar">false</item> | ||
13 | + <item name="windowNoTitle">true</item> | ||
14 | + </style> | ||
15 | + | ||
16 | + <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> | ||
17 | + | ||
18 | + <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> | ||
19 | + | ||
11 | </resources> | 20 | </resources> | ... | ... |
-
Please register or login to post a comment