Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actual gym plan branch other onewas prs #3

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,8 @@ dependencies {

implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"

implementation 'androidx.recyclerview:recyclerview-selection:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'

}
9 changes: 9 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
android:supportsRtl="true"
android:theme="@style/Theme.MyApplication"
tools:targetApi="31">
<activity
android:name=".deleteUser"
android:exported="false" />
<activity
android:name=".PersonalRecordsPage"
android:exported="false" />
<activity
android:name=".adminHome"
android:exported="false" />
<activity
android:name=".landingPage"
android:exported="false" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@
import androidx.room.RoomDatabase;
import androidx.room.TypeConverters;

import com.example.myapplication.PRs;
import com.example.myapplication.Plans;
import com.example.myapplication.User;

@Database(entities = {User.class}, version = 2)
@Database(entities = {User.class, Plans.class, PRs.class}, version = 4)
@TypeConverters({DateTypeConverter.class})

public abstract class AppDataBase extends RoomDatabase {

public static final String DATABASE_NAME = "GymLog.db";
//public static final String GYMLOG_TABLE = "gymlog_table";
public static final String WORKOUT_PLANS = "WORKOUT_PLANS";
public static final String USER_TABLE = "USER_TABLE";
public static final String PERSONAL_RECORDS = "PERSONAL_RECORDS";

private static volatile AppDataBase instance;
private static final Object LOCK = new Object();

public abstract GymExerciseDAO GymLogDAO();
public abstract WorkoutPlans WorkoutPlanDAO();
public abstract PersonalRecordsDAO mPersonalRecordsDAO();

public static AppDataBase getInstance(Context context) {
if(instance == null) {
Expand Down
18 changes: 0 additions & 18 deletions app/src/main/java/com/example/myapplication/DB/GymExerciseDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,6 @@
@Dao
public interface GymExerciseDAO {

// @Insert
// void insert(GymLog ... gymLogs);
//
// @Update
// void update(GymLog... gymLogs);
//
// @Delete
// void delete(GymLog... gymLogs);
//
// @Query("SELECT * FROM " + AppDataBase.GYMLOG_TABLE + " ORDER BY mDate desc")
// List<GymLog> getAllGymLogs();
//
// @Query("SELECT * FROM " + AppDataBase.GYMLOG_TABLE + " WHERE mLogId = :logId")
// List<GymLog> getLogById(int logId);

// @Query("SELECT * FROM " + AppDataBase.GYMLOG_TABLE + " WHERE mUserId = :userId ORDER BY mDate DESC")
// List<GymLog> getGymLogsByUserId(int userId);

@Insert
void insert(User... users);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.example.myapplication.DB;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.example.myapplication.PRs;

import java.util.List;

@Dao
public interface PersonalRecordsDAO {

@Insert
void insert(PRs... pRs);

@Update
void update(PRs... pRs);

@Delete
void delete(PRs... pRs);

@Query("SELECT * FROM " + AppDataBase.PERSONAL_RECORDS + " WHERE user_id= :userId ORDER BY mDate DESC")
List<PRs> getAllPRs(int userId);

}

28 changes: 28 additions & 0 deletions app/src/main/java/com/example/myapplication/DB/WorkoutPlans.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.example.myapplication.DB;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.example.myapplication.Plans;

import java.util.List;

@Dao
public interface WorkoutPlans {

@Insert
void insert(Plans... plans);

@Update
void update(Plans... plans);

@Delete
void delete(Plans... plans);

@Query("SELECT * FROM " + AppDataBase.WORKOUT_PLANS + " WHERE mTitle = :Title")
Plans getPlans(String Title);

}
151 changes: 147 additions & 4 deletions app/src/main/java/com/example/myapplication/GymPlan.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package com.example.myapplication;

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

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;

Expand All @@ -15,16 +21,153 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gym_plan);

Button mBackButton = findViewById(R.id.backButton);
mBackButton.setOnClickListener(new View.OnClickListener() {
Button mPushDayButton = findViewById(R.id.pushDayButton);
mPushDayButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(GymPlan.this, LoginActivity.class);
startActivity(intent);
AlertDialog.Builder builder = new AlertDialog.Builder(GymPlan.this);

builder.setMessage("EACH SET WILL BE 4 SETS EACH, 1ST SET 10-12 REPS THE REST OF THE SETS 6-8 AND LAST SET IS TO FAILURE" + "\n" +
"===---===---CHEST---===---===" + "\n" +
"~ Chest Flies w/ pec deck or cables" + "\n" +
"~ Incline Dumbbell Bench" + "\n" +
"~ Decline Cables" + "\n" +
"===---===---SHOULDERS---===---===" + "\n" +
"~ Dumbbell Shoulder Press" + "\n" +
"~ Side Lateral Raise w/ cables or dumbbells" + "\n" +
"~ Rear Delts w/ cables" + "\n" +
"===---===---TRICEPS---===---===" + "\n" +
"~ Cross Cable Dual Extension" + "\n" +
"~ SkullCrushers w/ EZ bar" + "\n" +
"~ Overhead Cable Extension");
builder.setPositiveButton("Push Day", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {

}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
});

Button mPullDayButton = findViewById(R.id.pullDayButton);
mPullDayButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(GymPlan.this);

builder.setMessage("EACH SET WILL BE 4 SETS EACH, 1ST SET 10-12 REPS THE REST OF THE SETS 6-8 AND LAST SET IS TO FAILURE" + "\n" +
"===---===---BACK---===---===" + "\n" +
"~ Lat Pulldown" + "\n" +
"~ Close Grip Seated Row" + "\n" +
"~ Pull Ups" + "\n" +
"===---===---MORE BACK---===---===" + "\n" +
"~ Chest Supported Row" + "\n" +
"~ Lat Pull Down w/ bar or rope" + "\n" +
"~ Rear Delts w/ cables" + "\n" +
"===---===---BICEPS---===---===" + "\n" +
"~ Dumbbell Curls" + "\n" +
"~ Hammer Curls w/ dumbbells or rope" + "\n" +
"~ Cable Curls w/ EZ bar");
builder.setNegativeButton("Pull Day", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {

}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
});

Button mLegDayButton = findViewById(R.id.legDayButton);
mLegDayButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(GymPlan.this);

builder.setMessage("EACH SET WILL BE 4 SETS EACH, 1ST SET 10-12 REPS THE REST OF THE SETS 6-8 AND LAST SET IS TO FAILURE" + "\n" +
"===---===---LEGS WARMUP---===---===" + "\n" +
"~ Leg Extension" + "\n" +
"~ Adductor Machine" + "\n" +
"~ Abductor Machine" + "\n" +
"~ Hamstring Curl Machine" + "\n" +
"===---===---MORE LEGS---===---===" + "\n" +
"~ Leg Press" + "\n" +
"~ Romanian Dead Lifts" + "\n" +
"~ Bulgarian Split Squats" + "\n" +
"===---===---STRETCH!---===---===" + "\n");
builder.setNegativeButton("Leg Day", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {

}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
});

Button mCoreDayButton = findViewById(R.id.coreDayButton);
mCoreDayButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(GymPlan.this);

builder.setMessage("EACH SET WILL BE 4 SETS EACH, AND DO 10-12 REPS EACH SET FOCUS ON CONTRACTION" + "\n" +
"===---===---CORE---===---===" + "\n" +
"~ Crunch" + "\n" +
"~ Flutter Kicks" + "\n" +
"~ Russian Twists" + "\n" +
"===---===---MORE CORE---===---===" + "\n" +
"~ V Crunch" + "\n" +
"~ Plank" + "\n" +
"~ Bridge" + "\n" +
"===---===---EVEN MORE CORE---===---===" + "\n" +
"~ Sit ups" + "\n" +
"~ Bicycle Kicks" + "\n" +
"~ Hip Lift Crunches");
builder.setNegativeButton("Core Day", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {

}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
});

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.popup_menu, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();

if (id == R.id.item1) {
Intent intent = new Intent(this, LoginActivity.class);
startActivity(intent);
return true;
}
else if (id == R.id.item2) {
Intent intent = new Intent(this, landingPage.class);
startActivity(intent);
return true;
}
else if (id == R.id.item3) {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
return true;
}
return super.onOptionsItemSelected(item);
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.example.myapplication;

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

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
Expand Down Expand Up @@ -91,9 +95,9 @@ private void getDataBase(){
if (mGymLogDAO.getAllUsers().size() <= 0) {
User admin2 = new User("admin2", "admin2", true);
mGymLogDAO.insert(admin2);
User testUser1 = new User("testUser1", "testUser1", false);
mGymLogDAO.insert(testUser1);
}
User testUser1 = new User("testUser1", "testUser1", false);
mGymLogDAO.insert(testUser1);
}

public static Intent intentFactory(Context context, int userId){
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/java/com/example/myapplication/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
package com.example.myapplication;

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

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;


public class MainActivity extends AppCompatActivity {



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -34,6 +41,8 @@ public void onClick(View view) {
}
});



}

public static Intent intentFactory(Context context, int userId){
Expand Down
Loading