Skip to content

Commit

Permalink
Initial Commit 03
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhenkar-KC committed Jun 13, 2021
1 parent f8864ab commit e521ade
Show file tree
Hide file tree
Showing 14 changed files with 185 additions and 112 deletions.
43 changes: 43 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions app/src/main/java/com/example/pando/InformationActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.database.annotations.NotNull;

import java.util.ArrayList;

public class InformationActivity extends AppCompatActivity {

private RecyclerView recyclerView;
FirebaseDatabase database;
DatabaseReference myRef;
private UserHealthInfoAdapter userHealthInfoAdapter;
Expand All @@ -30,7 +28,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main_information);


recyclerView = (RecyclerView) findViewById(R.id.recycledview);
RecyclerView recyclerView = findViewById(R.id.recycledview);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(this));

Expand All @@ -44,7 +42,7 @@ protected void onCreate(Bundle savedInstanceState) {
myRef = database.getReference().child("UserHealthInfo");
myRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NotNull DataSnapshot snapshot) {
public void onDataChange(@NonNull DataSnapshot snapshot) {

for (DataSnapshot dataSnapshot : snapshot.getChildren()){
UserHealthInfo userHealthInfo = dataSnapshot.getValue(UserHealthInfo.class);
Expand All @@ -54,7 +52,7 @@ public void onDataChange(@NotNull DataSnapshot snapshot) {
}

@Override
public void onCancelled(@NotNull DatabaseError error) {
public void onCancelled(@NonNull DatabaseError error) {

}
});
Expand Down
37 changes: 14 additions & 23 deletions app/src/main/java/com/example/pando/RegisterActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,24 @@
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;

public class RegisterActivity extends AppCompatActivity {
private Button details_submit;
private TextView passwordTV, emailTV;
private FirebaseAuth auth;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_register);
details_submit = (Button) findViewById(R.id.submit_details);
passwordTV = (EditText) findViewById(R.id.passwordTextView);
emailTV = (EditText) findViewById(R.id.emailTextView);
Button details_submit = findViewById(R.id.submit_details);
passwordTV = findViewById(R.id.passwordTextView);
emailTV = findViewById(R.id.emailTextView);
auth = FirebaseAuth.getInstance();
//Button
details_submit.setOnClickListener(v -> {
Expand All @@ -54,20 +48,17 @@ protected void onCreate(Bundle savedInstanceState) {

//create user
auth.createUserWithEmailAndPassword(email, password)
.addOnCompleteListener(RegisterActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Toast.makeText(RegisterActivity.this, "createUserWithEmail:onComplete:" + task.isSuccessful(), Toast.LENGTH_SHORT).show();
// 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()) {
Toast.makeText(RegisterActivity.this, "Authentication failed." + task.getException(),
Toast.LENGTH_SHORT).show();
} else {
startActivity(new Intent(RegisterActivity.this, SignInActivity.class));
finish();
}
.addOnCompleteListener(RegisterActivity.this, task -> {
Toast.makeText(RegisterActivity.this, "createUserWithEmail:onComplete:" + task.isSuccessful(), Toast.LENGTH_SHORT).show();
// 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()) {
Toast.makeText(RegisterActivity.this, "Authentication failed." + task.getException(),
Toast.LENGTH_SHORT).show();
} else {
startActivity(new Intent(RegisterActivity.this, SignInActivity.class));
finish();
}
});
});
Expand Down
22 changes: 11 additions & 11 deletions app/src/main/java/com/example/pando/UserHealthInfoAdaptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ public static class UserHealthInfoViewHolder extends RecyclerView.ViewHolder{

TextView Name,LastPeriodDate,UpcomingPeriodDate,WarningPeriodDate,Height,Weight,BloodPressure,HeartRate,Age;

public UserHealthInfoViewHolder(@NonNull View itemView) {
super(itemView);
public UserHealthInfoViewHolder(@NonNull View textview) {
super(textview);

Name = itemView.findViewById(R.id.usernameCardView);
LastPeriodDate = itemView.findViewById(R.id.last_period_dateCardView);
UpcomingPeriodDate = itemView.findViewById(R.id.upcomingPeriodDateCardView);
WarningPeriodDate = itemView.findViewById(R.id.warningPeriodDateCardView);
Height = itemView.findViewById(R.id.heightCardView);
Weight = itemView.findViewById(R.id.weightCardView);
BloodPressure = itemView.findViewById(R.id.blood_pressureCardView);
HeartRate = itemView.findViewById(R.id.heart_rateCardView);
Age = itemView.findViewById(R.id.ageCardView);
Name = textview.findViewById(R.id.usernameCardView);
LastPeriodDate = textview.findViewById(R.id.last_period_dateCardView);
UpcomingPeriodDate = textview.findViewById(R.id.upcomingPeriodDateCardView);
WarningPeriodDate = textview.findViewById(R.id.warningPeriodDateCardView);
Height = textview.findViewById(R.id.heightCardView);
Weight = textview.findViewById(R.id.weightCardView);
BloodPressure = textview.findViewById(R.id.blood_pressureCardView);
HeartRate = textview.findViewById(R.id.heart_rateCardView);
Age = textview.findViewById(R.id.ageCardView);
}
}
}
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_about_us_scrolling.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
android:layout_margin="@dimen/fab_margin"
app:layout_anchor="@id/app_bar"
app:layout_anchorGravity="bottom|end"
app:srcCompat="@android:drawable/ic_dialog_email" />
app:srcCompat="@android:drawable/ic_dialog_email"
android:contentDescription="TODO" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
9 changes: 5 additions & 4 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
android:layout_marginTop="88dp"
android:layout_marginEnd="48dp"
android:background="@drawable/rounded_corner"
android:text="Home"
android:textSize="18dp"
android:text="@string/home"
android:textSize="18sp"
app:backgroundTint ="#3C8BEB"
android:textColor="#032E44"
app:layout_constraintEnd_toEndOf="parent"
Expand All @@ -33,14 +33,15 @@
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/splashscreen" />
app:srcCompat="@drawable/splashscreen"
android:contentDescription="@string/todo" />

<TextView
android:id="@+id/user_view"
android:layout_width="171dp"
android:layout_height="41dp"
android:layout_marginTop="16dp"
android:text="TextView"
android:text="@string/textview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
Expand Down
38 changes: 23 additions & 15 deletions app/src/main/res/layout/activity_main_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,40 @@
android:layout_marginStart="24dp"
android:layout_marginTop="100dp"
android:layout_marginEnd="24dp"
android:hint="Username"
android:hint="@string/username"
android:inputType="textCapCharacters"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
android:autofillHints="" />

<EditText
android:id="@+id/weight"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:hint="Weight"

android:hint="@string/weight"
android:imeOptions="actionDone"
android:inputType="number"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/Dateofbirth" />
app:layout_constraintTop_toBottomOf="@+id/Dateofbirth"
tools:ignore="HardcodedText"
android:autofillHints="" />

<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/Dateofbirth"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:hint="Date of Birth"
android:hint="@string/date_of_birth"
android:imeOptions="actionDone"
android:inputType="date"
android:selectAllOnFocus="true"
Expand All @@ -58,13 +62,14 @@
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:hint="Heart Rate"
android:hint="@string/heart_rate"
android:inputType="number"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/last_period_date" />
app:layout_constraintTop_toBottomOf="@+id/last_period_date"
android:autofillHints="" />

<EditText
android:id="@+id/blood_pressure"
Expand All @@ -73,14 +78,15 @@
android:layout_marginStart="24dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="24dp"
android:hint="Blood Pressure"
android:hint="@string/blood_pressure"
android:imeOptions="actionDone"
android:inputType="number"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/heart_rate" />
app:layout_constraintTop_toBottomOf="@+id/heart_rate"
android:autofillHints="" />

<EditText
android:id="@+id/last_period_date"
Expand All @@ -89,28 +95,30 @@
android:layout_marginStart="24dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="24dp"
android:hint="Last Period Date"
android:hint="@string/last_period_date"
android:imeOptions="actionDone"
android:inputType="date"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/height" />
app:layout_constraintTop_toBottomOf="@+id/height"
android:autofillHints="" />

<EditText
android:id="@+id/height"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:hint="Height"
android:hint="@string/height"
android:inputType="number"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/weight" />
app:layout_constraintTop_toBottomOf="@+id/weight"
android:autofillHints="" />


<Button
Expand All @@ -121,9 +129,9 @@
android:layout_marginStart="48dp"
android:layout_marginEnd="48dp"
android:background="@drawable/rounded_corner"
android:text="Submit Details"
android:text="@string/submit_details"
android:textColor="#032E44"
android:textSize="24dp"
android:textSize="24sp"
android:enabled="true"
app:backgroundTint="#3C8BEB"
app:layout_constraintBottom_toBottomOf="parent"
Expand Down
Loading

0 comments on commit e521ade

Please sign in to comment.