-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 78a910d
Showing
104 changed files
with
10,257 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Log/OS Files | ||
*.log | ||
|
||
# Android Studio generated files and folders | ||
captures/ | ||
.externalNativeBuild/ | ||
.cxx/ | ||
*.apk | ||
output.json | ||
|
||
# IntelliJ | ||
*.iml | ||
.idea/ | ||
|
||
# Keystore files | ||
*.jks | ||
*.keystore | ||
|
||
# Google Services (e.g. APIs or Firebase) | ||
google-services.json | ||
|
||
# Android Profiling | ||
*.hprof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
plugins { | ||
id 'com.android.application' | ||
} | ||
|
||
android { | ||
compileSdk 32 | ||
|
||
defaultConfig { | ||
applicationId "com.falyrion.gymtonicapp" | ||
minSdk 26 | ||
targetSdk 32 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.appcompat:appcompat:1.4.1' | ||
implementation 'com.google.android.material:material:1.6.0' | ||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.3' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/falyrion/gymtonicapp/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.falyrion.gymtonicapp; | ||
|
||
import android.content.Context; | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry; | ||
import androidx.test.ext.junit.runners.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); | ||
assertEquals("com.falyrion.gymtonicapp", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.falyrion.gymtonicapp"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.GymtonicApp"> | ||
|
||
<activity | ||
android:name="com.falyrion.gymtonicapp.activities.Activity_Workout_EditRoutines" | ||
android:exported="false" | ||
android:screenOrientation="sensorPortrait" | ||
android:parentActivityName="com.falyrion.gymtonicapp.Activity_Main" /> | ||
<activity | ||
android:name="com.falyrion.gymtonicapp.activities.Activity_Workout_EditPlans" | ||
android:exported="false" | ||
android:screenOrientation="sensorPortrait" | ||
android:parentActivityName="com.falyrion.gymtonicapp.Activity_Main" /> | ||
<activity | ||
android:name="com.falyrion.gymtonicapp.activities.Activity_Meals_MealsOfDay" | ||
android:exported="false" | ||
android:screenOrientation="sensorPortrait" | ||
android:parentActivityName="com.falyrion.gymtonicapp.Activity_Main" /> | ||
<activity | ||
android:name="com.falyrion.gymtonicapp.activities.Activity_Workout_CreateEditExercise" | ||
android:exported="false" | ||
android:screenOrientation="sensorPortrait" | ||
android:parentActivityName="com.falyrion.gymtonicapp.Activity_Main" /> | ||
<activity | ||
android:name="com.falyrion.gymtonicapp.activities.Activity_Meals_AddDailyEntry" | ||
android:exported="false" | ||
android:screenOrientation="sensorPortrait" | ||
android:parentActivityName="com.falyrion.gymtonicapp.Activity_Main" /> | ||
<activity | ||
android:name="com.falyrion.gymtonicapp.activities.Activity_Meals_CreateEditPreset" | ||
android:exported="false" | ||
android:screenOrientation="sensorPortrait" | ||
android:parentActivityName="com.falyrion.gymtonicapp.activities.Activity_Meals_AddDailyEntry" /> | ||
<activity | ||
android:name="com.falyrion.gymtonicapp.activities.Activity_Calendar" | ||
android:exported="false" | ||
android:screenOrientation="sensorPortrait" | ||
android:parentActivityName="com.falyrion.gymtonicapp.Activity_Main" /> | ||
<activity | ||
android:name="com.falyrion.gymtonicapp.activities.Activity_EditBodyStats" | ||
android:exported="false" | ||
android:screenOrientation="sensorPortrait" | ||
android:parentActivityName="com.falyrion.gymtonicapp.Activity_Main" /> | ||
<activity | ||
android:name="com.falyrion.gymtonicapp.Activity_Main" | ||
android:screenOrientation="sensorPortrait" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
144 changes: 144 additions & 0 deletions
144
app/src/main/java/com/falyrion/gymtonicapp/Activity_Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
package com.falyrion.gymtonicapp; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.view.MenuItem; | ||
|
||
import com.falyrion.gymtonicapp.data.DatabaseHelper; | ||
import com.falyrion.gymtonicapp.fragments.Fragment_Nutrition; | ||
import com.falyrion.gymtonicapp.fragments.Fragment_Workout; | ||
import com.falyrion.gymtonicapp.fragments.Fragment_Settings; | ||
import com.google.android.material.bottomnavigation.BottomNavigationView; | ||
import com.google.android.material.navigation.NavigationBarView; | ||
|
||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
import java.util.Locale; | ||
|
||
public class Activity_Main extends AppCompatActivity { | ||
|
||
public String date; | ||
private int currentFragmentID = 0; | ||
public DatabaseHelper databaseHelper; | ||
|
||
|
||
private void setFragmentFood(String date) { | ||
Fragment_Nutrition fragment = new Fragment_Nutrition(); | ||
Bundle args = new Bundle(); | ||
args.putString("date", date); | ||
fragment.setArguments(args); | ||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, fragment).commit(); | ||
} | ||
|
||
private void setFragmentBodyStats() { | ||
// Pass | ||
} | ||
|
||
private void setFragmentWorkout() { | ||
Fragment_Workout fragment = new Fragment_Workout(); | ||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, fragment).commit(); | ||
} | ||
|
||
private void setFragmentSettings() { | ||
Fragment_Settings fragment = new Fragment_Settings(); | ||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, fragment).commit(); | ||
} | ||
|
||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
// Database | ||
databaseHelper = new DatabaseHelper(Activity_Main.this); | ||
|
||
// ----------------------------------------------------------------------------------------- | ||
// Get data if activity was started by another activity | ||
Intent intent = getIntent(); | ||
|
||
// Get current date | ||
if (getIntent().hasExtra("date")) { | ||
date = intent.getStringExtra("date"); | ||
} else { | ||
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH); | ||
date = formatter.format(new Date()); | ||
} | ||
|
||
// If there is a fragmentID submitted take it. Else keep previously set or default one (=0) | ||
if (getIntent().hasExtra("fragmentID")) { | ||
currentFragmentID = intent.getIntExtra("fragmentID", 0); | ||
} | ||
|
||
// Set current fragment based on fragmentID | ||
switch (currentFragmentID) { | ||
case 0: | ||
setFragmentFood(date); | ||
break; | ||
|
||
case 1: | ||
setFragmentBodyStats(); | ||
break; | ||
|
||
case 2: | ||
setFragmentWorkout(); | ||
break; | ||
|
||
case 3: | ||
setFragmentSettings(); | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
|
||
// ----------------------------------------------------------------------------------------- | ||
// Setup navigation bar | ||
BottomNavigationView navBar = findViewById(R.id.bottom_navigation); | ||
navBar.setOnItemSelectedListener(new NavigationBarView.OnItemSelectedListener() { | ||
@Override | ||
public boolean onNavigationItemSelected(@NonNull MenuItem item) { | ||
switch (item.getItemId()) { | ||
case R.id.nav_bar_home: | ||
if (currentFragmentID != 0) { | ||
setFragmentFood(date); | ||
currentFragmentID = 0; | ||
} | ||
return true; | ||
|
||
case R.id.nav_bar_stats: | ||
if (currentFragmentID != 1) { | ||
setFragmentBodyStats(); | ||
currentFragmentID = 1; | ||
} | ||
return true; | ||
|
||
case R.id.nav_bar_exersises: | ||
if (currentFragmentID != 2) { | ||
setFragmentWorkout(); | ||
currentFragmentID = 2; | ||
} | ||
return true; | ||
|
||
case R.id.nav_bar_settings: | ||
if (currentFragmentID != 3) { | ||
setFragmentSettings(); | ||
currentFragmentID = 3; | ||
} | ||
return true; | ||
} | ||
return false; | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
protected void onDestroy() { | ||
databaseHelper.close(); | ||
super.onDestroy(); | ||
} | ||
|
||
} |
Oops, something went wrong.