Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #28 from jerrychong25/dev
Browse files Browse the repository at this point in the history
Added more debug logs
  • Loading branch information
jerrychong25 committed Jan 5, 2020
2 parents 2e59620 + 337df31 commit c4a3ca7
Show file tree
Hide file tree
Showing 12 changed files with 156 additions and 101 deletions.
Binary file modified Android/.gradle/4.4/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified Android/.gradle/4.4/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified Android/.gradle/4.4/javaCompile/classAnalysis.bin
Binary file not shown.
Binary file modified Android/.gradle/4.4/javaCompile/javaCompile.lock
Binary file not shown.
Binary file modified Android/.gradle/4.4/javaCompile/taskHistory.bin
Binary file not shown.
Binary file modified Android/.gradle/4.4/taskHistory/taskHistory.bin
Binary file not shown.
Binary file modified Android/.gradle/4.4/taskHistory/taskHistory.lock
Binary file not shown.
Binary file modified Android/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
207 changes: 115 additions & 92 deletions Android/.idea/workspace.xml

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions Android/app/src/main/java/com/handcycle/DisplayActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public class DisplayActivity extends YouTubeBaseActivity implements YouTubePlaye
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Log.d("DisplayActivity", "Display Screen Start");

setContentView(R.layout.activity_display);

DatabaseRehabilitationDetails = FirebaseDatabase.getInstance().getReference();
Expand All @@ -76,7 +79,7 @@ protected void onCreate(Bundle savedInstanceState) {
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot child: dataSnapshot.getChildren()){
UserPushID = child.getKey();
Log.d("Key", UserPushID);
Log.d("DisplayActivity", "Key: " + UserPushID);
}
}

Expand Down Expand Up @@ -118,14 +121,22 @@ public void handleMessage(android.os.Message msg) {
buttonStart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d("DisplayActivity", "Start Button Pressed");

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter == null) {
Log.d("DisplayActivity", "Bluetooth Not Supported");

// Device does not support Bluetooth
Toast.makeText(DisplayActivity.this, "Bluetooth not supported on this device!", Toast.LENGTH_LONG).show();
} else if (!mBluetoothAdapter.isEnabled()) {
Log.d("DisplayActivity", "Bluetooth Not Enabled");

// Bluetooth is not enabled :)
Toast.makeText(DisplayActivity.this, "Bluetooth not enabled on this device!", Toast.LENGTH_LONG).show();
} else {
Log.d("DisplayActivity", "Bluetooth Is Enabled");

// Bluetooth is enabled
Toast.makeText(DisplayActivity.this, "Bluetooth is enabled on this device!", Toast.LENGTH_LONG).show();
// Hide Start Button
Expand All @@ -140,6 +151,8 @@ public void onClick(View v) {
buttonStop.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d("DisplayActivity", "Stop Button Pressed");

// Hide Stop Button
buttonStop.setVisibility(View.GONE);
// Show Start Button
Expand Down Expand Up @@ -331,7 +344,6 @@ public void onClick(DialogInterface dialog, int id) {
// removes the dialog from the screen
}
})

.show();

}
Expand Down
27 changes: 21 additions & 6 deletions Android/app/src/main/java/com/handcycle/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import androidx.annotation.NonNull;

import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
Expand Down Expand Up @@ -38,6 +40,9 @@ public class LoginActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Log.d("LoginActivity", "Login Screen Start");

setContentView(R.layout.activity_login);

final EditText EmailText = (EditText) findViewById(R.id.EmailField);
Expand All @@ -58,9 +63,13 @@ protected void onCreate(Bundle savedInstanceState) {
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
Log.d("LoginActivity", "User Signed In");

// User is signed in
// Toast.makeText(LoginActivity.this, "User have signed in", Toast.LENGTH_LONG).show();
} else {
Log.d("LoginActivity", "User Signed Out");

// User is signed out
// Toast.makeText(LoginActivity.this, "User have signed out", Toast.LENGTH_LONG).show();
}
Expand All @@ -74,38 +83,44 @@ public void onClick(View v) {
String Password = PasswordText.getText().toString();

if (TextUtils.isEmpty(Email)) {
Log.d("LoginActivity", "No Email Entered");

EmailText.setError("Please enter your email");
Toast.makeText(LoginActivity.this, "Please enter your email", Toast.LENGTH_LONG).show();
return;
}
else if (TextUtils.isEmpty(Password)) {
Log.d("LoginActivity", "No Password Entered");

PasswordText.setError("Please enter your password");
Toast.makeText(LoginActivity.this, "Please enter your password", Toast.LENGTH_LONG).show();
return;
}
else {
Log.d("LoginActivity", "Email and Password Are Entered");

mAuth.signInWithEmailAndPassword(Email, Password)
.addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
// Log.d(TAG, "signInWithEmail:onComplete:" + task.isSuccessful());

// If sign in fails, display a message to the user. If sign in succeeds
// the auth state listener will be notified and logic to handle the
// signed in user can be handled in the listener.
if(task.isSuccessful()){
//display some message here
Toast.makeText(LoginActivity.this, "LoginActivity success", Toast.LENGTH_LONG).show();
Log.d("LoginActivity", "Login Success!");
Toast.makeText(LoginActivity.this, "Login success", Toast.LENGTH_LONG).show();

EmailText.getText().clear();
PasswordText.getText().clear();

Intent displayIntent = new Intent(LoginActivity.this, DisplayActivity.class);
startActivity(displayIntent);

Log.d("LoginActivity", "Login Screen End");
}
else{
// Log.w(TAG, "signInWithEmail:failed", task.getException());
Toast.makeText(LoginActivity.this, "LoginActivity failed", Toast.LENGTH_LONG).show();
Log.d("LoginActivity", "Login Failed!");
Toast.makeText(LoginActivity.this, "Login failed", Toast.LENGTH_LONG).show();
}
}
});
Expand Down
7 changes: 6 additions & 1 deletion Android/app/src/main/java/com/handcycle/SplashActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@
import android.os.Handler;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

public class SplashActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Log.d("SplashActivity", "Splash Screen Start");

new Handler().postDelayed(new Runnable() {

@Override
public void run() {
// This method will be executed once the timer is over
Log.d("SplashActivity", "Splash Screen End");

// Jump to Login Page After 3 Seconds
Intent i = new Intent(SplashActivity.this, LoginActivity.class);
startActivity(i);
finish();
Expand Down

0 comments on commit c4a3ca7

Please sign in to comment.