Skip to content

Commit

Permalink
Commit Complete #8
Browse files Browse the repository at this point in the history
  • Loading branch information
leuterkil committed Nov 5, 2018
1 parent be0eabe commit 4747c9e
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
4 changes: 3 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ dependencies {
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.facebook.android:facebook-android-sdk:4.38.1'
implementation 'com.facebook.android:facebook-android-sdk:4.5.0'
implementation 'com.firebase:firebase-client-android:2.5.2'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'



Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />
<activity android:name=".MainMenuActivity"></activity>
<activity android:name=".RegisterActivity"></activity>
</application>

Expand Down
33 changes: 31 additions & 2 deletions app/src/main/java/aahmf/notepad/LogInActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.facebook.AccessToken;
import com.facebook.*;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
Expand Down Expand Up @@ -160,12 +160,40 @@ public void onComplete(@NonNull Task<AuthResult> task) {
if(!task.isSuccessful()){
Toast.makeText(getApplicationContext(),R.string.firebase_error_login, Toast.LENGTH_LONG).show();
}

else
{
startActivity(new Intent(LogInActivity.this,MainMenuActivity.class));
}
}
});
}

private void signIn(String email, String password)
{
if(Name.getText().toString().isEmpty())
{
Name.setError("Give An Email");
Name.requestFocus();
Name.setText("");
return;
}

if(Password.getText().toString().isEmpty())
{
Password.setError("Give A Password");
Password.requestFocus();
Password.setText("");
return;
}

if(Password.getText().toString().length()<6)
{
Password.setError("The password must be 6 Characters long");
Password.requestFocus();
Password.setText("");
return;
}

progressBarLogin.setVisibility(View.VISIBLE);
mAuth.signInWithEmailAndPassword(email, password)
Expand All @@ -181,7 +209,7 @@ public void onComplete(@NonNull Task<AuthResult> task) {
progressBarLogin.setVisibility(View.INVISIBLE);

Toast.makeText(LogInActivity.this, "Login Successfull", Toast.LENGTH_LONG).show();
startActivity(new Intent(LogInActivity.this, RegisterActivity.class));
startActivity(new Intent(LogInActivity.this, MainMenuActivity.class));


} else
Expand Down Expand Up @@ -210,6 +238,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data)
protected void onStart()
{
super.onStart();

mAuth.addAuthStateListener(firebaseAuthListner);
}

Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/main_menu_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@


<TextView
android:id="@+id/textViewTitle"
android:textSize="20dp"
android:id="@+id/textView"
android:layout_width="166dp"
android:layout_height="63dp"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@id/imageView"
android:text="Note Title"
android:textColor="#000000"

android:textColor="#000000" />
android:textSize="20dp" />

<Button
android:id="@+id/EditButton"
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
Expand Down

0 comments on commit 4747c9e

Please sign in to comment.