From e098d8d288de78567307aa83219a4206c6a1b98b Mon Sep 17 00:00:00 2001 From: Franjo Lukezic Date: Mon, 13 Feb 2023 16:22:18 +0100 Subject: [PATCH 01/16] FIX typos --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 658b37b..cbbb8b9 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ https://www.fitness-gesundheit.uni-wuppertal.de/fileadmin/fitness-gesundheit/pdf ### API Reference -Mininum SDK: 21 +Minimum SDK: 21 Target SDK: 32 ## License @@ -59,7 +59,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . -The icons used in the nagivation drawer are licensed under the [CC BY 2.5](http://creativecommons.org/licenses/by/2.5/). In addition to them the app uses icons from [Google Design Material Icons](https://design.google.com/icons/index.html) licensed under Apache License Version 2.0. All other images (the logo of Privacy Friendly Apps, the SECUSO logo, the app icons and the splash icon) copyright [Technische Universtität Darmstadt](www.tu-darmstadt.de) (2017). +The icons used in the navigation drawer are licensed under the [CC BY 2.5](http://creativecommons.org/licenses/by/2.5/). In addition to them the app uses icons from [Google Design Material Icons](https://design.google.com/icons/index.html) licensed under Apache License Version 2.0. All other images (the logo of Privacy Friendly Apps, the SECUSO logo, the app icons and the splash icon) copyright [Technische Universtität Darmstadt](www.tu-darmstadt.de) (2017). ## Contributors From 0d4eddd6db7a130bdc11528ae7a3e4cfd69b1816 Mon Sep 17 00:00:00 2001 From: Franjo Lukezic Date: Mon, 13 Feb 2023 17:39:01 +0100 Subject: [PATCH 02/16] FIX bug that cannot start without Exercise Sets enabled; FEAT add new translation tag --- .../activities/MainActivity.java | 8 ++++++-- app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java index 2344712..82b22fb 100644 --- a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java @@ -275,8 +275,12 @@ public void onClick(View view) { setsPerRound = sets; } - if (setsPerRound == 0 || ExerciseIdsForRounds.size() == 0) { - Toast.makeText(this, R.string.exercise_set_has_no_exercises, Toast.LENGTH_SHORT).show(); + if (setsPerRound == 0) { + if (isExerciseMode && ExerciseIdsForRounds.size() == 0) { + Toast.makeText(this, R.string.exercise_set_has_no_exercises, Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(this, R.string.exercise_set_has_no_sets, Toast.LENGTH_SHORT).show(); + } return; } diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 71f506b..28b889e 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -228,5 +228,6 @@ Möchten Sie die ausgewählten Elemente löschen? Das gewählte Übungsset enthält keine Übungen. Um Ihnen Motivationsbenachrichtigungen senden zu können, wird die Erlaubnis benötigt, einen Alarm einzustellen. Möchten Sie die Erlaubnis jetzt erteilen? + Das gewählte Übungsset hat keine sets. diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 81ec1f9..c97fa89 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -233,6 +233,7 @@ Please choose an exercise Do you want to delete the selected items? Chosen exercise set has no exercises. + Chosen exercise set has no sets. In order to send you motivation alerts, the permission to set an alarm is needed. Do you want to grant the permission now? From e49af418e79291332a17aedab406f154eab04afa Mon Sep 17 00:00:00 2001 From: DeflateAwning <11021263+DeflateAwning@users.noreply.github.com> Date: Sun, 30 Jul 2023 11:55:12 -0600 Subject: [PATCH 03/16] Fix documentation genders --- CHANGELOG.md | 2 +- README.md | 2 +- .../privacyfriendlycircuittraining/activities/MainActivity.java | 2 +- app/src/main/res/values/strings.xml | 2 +- fastlane/metadata/android/en-US/full_description.txt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30703dd..0f0d7d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ ## [Privacy Friendly Circuit Training v1.0 (v1.0)](https://github.com/SecUSo/privacy-friendly-circuit-training-exercises/releases/tag/v1.0) - 29 Mar 2018 -Privacy Friendly Circuit Trainer is an Android App that supports the user during his/her circuit training session. It provides a configurable set of timers for the exercises and the rest phases as well as multiple other features. +Privacy Friendly Circuit Trainer is an Android App that supports the user during their circuit training session. It provides a configurable set of timers for the exercises and the rest phases as well as multiple other features. [Changes][v1.0] diff --git a/README.md b/README.md index 658b37b..0a1e6d6 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ This Android application manages the time during interval based training sessions, eg circuit training. It provides a configurable set of timers for the exercises and the rest phases. -The user can create his own exercises and combine them into exercise set which can be used for circuit training. +The user can create their own exercises and combine them into exercise set which can be used for circuit training. The app can remind the user about planned training sessions and offers statistics such as the time spend training or calories burnt. Privacy Friendly Circuit Trainer belongs to the group of Privacy Friendly Apps developed by the research group SECUSO at Technische Universität Darmstadt. diff --git a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java index 2344712..26631f3 100644 --- a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java @@ -162,7 +162,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { } }); - //Suggest the user to enter his body data + //Suggest the user to enter their body data PrefManager.performMigrations(getBaseContext()); if(PrefManager.isFirstTimeLaunch(getBaseContext())){ PrefManager.setFirstTimeLaunch(getBaseContext(), false); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 81ec1f9..d7791b9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -75,7 +75,7 @@ Help What is Privacy Friendly Training? - Privacy Friendly Training supports the user during his/her circuit training session. It provides a configurable set of timers for the exercises and the rest phases as well as multiple other features. + Privacy Friendly Training supports the user during their circuit training session. It provides a configurable set of timers for the exercises and the rest phases as well as multiple other features. Feature: Workokut timer After configuring the set of timers in the main menu you can start the workout routine by pressing the start button. The workout view has animations and sound output features which can be turned on and off inside the settings menu. Feature: Motivation alert diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt index 6bf72e6..a4ea3f1 100644 --- a/fastlane/metadata/android/en-US/full_description.txt +++ b/fastlane/metadata/android/en-US/full_description.txt @@ -1,4 +1,4 @@ -Privacy Friendly Circuit Trainer is an Android App that supports the user during his/her circuit training session. It provides a configurable set of timers for the exercises and the rest phases as well as multiple other features. +Privacy Friendly Circuit Trainer is an Android App that supports the user during their circuit training session. It provides a configurable set of timers for the exercises and the rest phases as well as multiple other features. Workout Timer After configuring the set of timers in the main menu you can start the workout routine by pressing the start button. The workout view has animations and sound output features which can be turned on and off inside the settings menu. From 0ad4537166240c061150cb5deb2889f3def33e44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=A4nge?= Date: Fri, 29 Sep 2023 14:18:30 +0200 Subject: [PATCH 04/16] Update to backup api v1.2.0 --- libs/privacy-friendly-backup-api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/privacy-friendly-backup-api b/libs/privacy-friendly-backup-api index d267b0d..2548856 160000 --- a/libs/privacy-friendly-backup-api +++ b/libs/privacy-friendly-backup-api @@ -1 +1 @@ -Subproject commit d267b0d5e899fe12f41a6b7aac2081b8d4ea71af +Subproject commit 254885602ee4501a572f56306fbf2b3712cfc834 From 2c14163e69cbab99a2eda09cb140e6cfecead801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=A4nge?= Date: Fri, 29 Sep 2023 14:26:36 +0200 Subject: [PATCH 05/16] Update dependencies and target sdk --- app/build.gradle | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0a2ef7c..d4c59e9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,12 +3,12 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' android { - compileSdkVersion 32 + compileSdkVersion 33 defaultConfig { applicationId "org.secuso.privacyfriendlycircuittraining" minSdkVersion 21 - targetSdkVersion 32 + targetSdkVersion 33 versionCode 3 versionName "1.2.0" } @@ -33,8 +33,8 @@ repositories { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.5.1' - implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.9.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' @@ -43,7 +43,7 @@ dependencies { annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' testImplementation 'junit:junit:4.13.2' - def room_version = "2.4.3" + def room_version = "2.5.2" implementation "androidx.room:room-runtime:$room_version" annotationProcessor "androidx.room:room-compiler:$room_version" kapt "androidx.room:room-compiler:$room_version" @@ -51,7 +51,7 @@ dependencies { // Backup API implementation project(':backup-api') - def work_version = '2.7.1' + def work_version = '2.8.1' implementation "androidx.work:work-runtime:$work_version" implementation "androidx.work:work-runtime-ktx:$work_version" androidTestImplementation "androidx.work:work-testing:$work_version" From ea5008dc285e72ceffe2b143df472cc9d63c0fbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=A4nge?= Date: Fri, 29 Sep 2023 15:50:53 +0200 Subject: [PATCH 06/16] Add ci workflows --- .github/workflows/android-test.yml | 51 ++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 49 ++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 .github/workflows/android-test.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/android-test.yml b/.github/workflows/android-test.yml new file mode 100644 index 0000000..aff180d --- /dev/null +++ b/.github/workflows/android-test.yml @@ -0,0 +1,51 @@ +name: Android Emulator Tests +on: [push, pull_request] + +jobs: + check-if-tests-exist: + runs-on: ubuntu-latest + outputs: + status: ${{ steps.check-androidTest.outputs.NOT_EMPTY }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: "recursive" + - name: Check if androidTest folder is not empty + run: | + echo "NOT_EMPTY=$([ "$(ls -A app/src/androidTest)" ] && echo 'true' || echo 'false')" + echo "NOT_EMPTY=$([ "$(ls -A app/src/androidTest)" ] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT + id: check-androidTest + test: + needs: check-if-tests-exist + if: needs.check-if-tests-exist.outputs.status == 'true' + runs-on: macos-latest + strategy: + matrix: + api-level: [29] + target: [default] + arch: [x86_64] + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: "recursive" + + - name: Set up JDK environment + uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: 17 + + - name: Gradle cache + uses: gradle/gradle-build-action@v2 + + - name: Run connected tests + uses: ReactiveCircus/android-emulator-runner@v2 + with: + api-level: ${{ matrix.api-level }} + target: ${{ matrix.target }} + arch: ${{ matrix.arch }} + profile: Nexus 6 + disable-animations: true + script: ./gradlew :app:connectedCheck --stacktrace diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9e60fe6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: Continuous Integration +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: "recursive" + + - name: Set up JDK environment + uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: 17 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Run local unit tests + run: bash ./gradlew test --stacktrace + + build: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: "recursive" + + - name: Set up JDK environment + uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: 17 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Build the app + run: bash ./gradlew build --stacktrace From 33e16af9123203f794be13a777ad9bc7acff6087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=A4nge?= Date: Fri, 29 Sep 2023 16:27:08 +0200 Subject: [PATCH 07/16] Fix vectorpath lint error Add leading zero to decimals --- .../main/res/drawable/ic_bell_plus_24dp.xml | 6 ++-- .../res/drawable/ic_bell_plus_white_24dp.xml | 6 ++-- .../drawable/ic_chevron_left_black_24dp.xml | 2 +- .../drawable/ic_chevron_right_black_24dp.xml | 2 +- .../drawable/ic_circletraining_logo_24dp.xml | 32 +++++++++---------- .../ic_circletraining_logo_white_24dp.xml | 32 +++++++++---------- app/src/main/res/drawable/ic_clock_24dp.xml | 2 +- app/src/main/res/drawable/ic_config_24dp.xml | 18 +++++------ app/src/main/res/drawable/ic_fire_24dp.xml | 8 ++--- .../res/drawable/ic_personalization_24dp.xml | 2 +- .../main/res/drawable/ic_statistics_24dp.xml | 2 +- .../main/res/drawable/ic_volume_loud_24dp.xml | 4 +-- .../main/res/drawable/ic_volume_mute_24dp.xml | 8 ++--- 13 files changed, 62 insertions(+), 62 deletions(-) diff --git a/app/src/main/res/drawable/ic_bell_plus_24dp.xml b/app/src/main/res/drawable/ic_bell_plus_24dp.xml index 8ee8c44..12fb603 100644 --- a/app/src/main/res/drawable/ic_bell_plus_24dp.xml +++ b/app/src/main/res/drawable/ic_bell_plus_24dp.xml @@ -9,9 +9,9 @@ android:pathData="M0 0h24v24H0V0z" /> diff --git a/app/src/main/res/drawable/ic_bell_plus_white_24dp.xml b/app/src/main/res/drawable/ic_bell_plus_white_24dp.xml index 6a15fc7..1ca2db1 100644 --- a/app/src/main/res/drawable/ic_bell_plus_white_24dp.xml +++ b/app/src/main/res/drawable/ic_bell_plus_white_24dp.xml @@ -9,9 +9,9 @@ android:pathData="M0 0h24v24H0V0z" /> diff --git a/app/src/main/res/drawable/ic_chevron_left_black_24dp.xml b/app/src/main/res/drawable/ic_chevron_left_black_24dp.xml index 535e0f0..14d9006 100644 --- a/app/src/main/res/drawable/ic_chevron_left_black_24dp.xml +++ b/app/src/main/res/drawable/ic_chevron_left_black_24dp.xml @@ -9,6 +9,6 @@ android:fillColor="#000000" android:pathData="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z" /> + android:pathData="M0-0.5h24v24H0z" /> diff --git a/app/src/main/res/drawable/ic_chevron_right_black_24dp.xml b/app/src/main/res/drawable/ic_chevron_right_black_24dp.xml index bbfa3cd..0ee587c 100644 --- a/app/src/main/res/drawable/ic_chevron_right_black_24dp.xml +++ b/app/src/main/res/drawable/ic_chevron_right_black_24dp.xml @@ -9,6 +9,6 @@ android:fillColor="#000000" android:pathData="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z" /> + android:pathData="M0-0.25h24v24H0z" /> diff --git a/app/src/main/res/drawable/ic_circletraining_logo_24dp.xml b/app/src/main/res/drawable/ic_circletraining_logo_24dp.xml index b9ecd65..89f40c8 100644 --- a/app/src/main/res/drawable/ic_circletraining_logo_24dp.xml +++ b/app/src/main/res/drawable/ic_circletraining_logo_24dp.xml @@ -10,40 +10,40 @@ android:pathData="M 28 13.7 C 29.2039807546 13.7 30.18 14.6760192454 30.18 15.88 C 30.18 17.0839807546 29.2039807546 18.06 28 18.06 C 26.7960192454 18.06 25.82 17.0839807546 25.82 15.88 C 25.82 14.6760192454 26.7960192454 13.7 28 13.7 Z" /> + android:pathData="M41.33,41.2a0.79 0.79 ,0,0,1-0.73-0.48L34,28.85l-2.29-9.19,1.16-5.88a0.62 0.62 +,0,0,0-0.17-0.56C27.94,8.59,27.27,8,27.24,7.79a0.83 0.83 ,0,0,1,0.67-1c0.33,0,0.6 0.12 +0.93 0.48 0.49 0.51 ,3.07,3,5.43,5.28h0a0.85 0.85 ,0,0,1,0.28 0.75 +l-0.45,3.5a10.84,10.84,0,0,0,0.71,5.44l7.24,17.85a0.79 0.79 ,0,0,1-0.73,1.1Z" /> + android:pathData="M28.7,26.89l-0.18,0-4.3-1.6a0.62 0.62 ,0,0,1-0.29-0.95l3.25-4.59c0.28-0.33 0.56 -0.12 0.89 +0.16s0.83,1.17 0.54 ,1.5l-2.5,2.68a0.2 0.2 ,0,0,0,0.08 0.32 l2.68 0.94 a0.79 0.79 +,0,0,1-0.17,1.56Z" /> + android:pathData="M24,41.2a21.88,21.88,0,0,1-2.7-0.33A17.21,17.21,0,0,1,23.92,6.81 0.79 +0.79,0,1,1,24,8.39a15.63,15.63,0,0,0-2.41,30.93,20.64,20.64,0,0,0,2.41 0.31 0.79 +0.79 ,0,0,1,0,1.58Z" /> + android:pathData="M14,24.63H11.45a0.63 0.63 ,0,1,1,0-1.26H14a0.63 0.63 ,0,0,1,0,1.26Z" /> diff --git a/app/src/main/res/drawable/ic_circletraining_logo_white_24dp.xml b/app/src/main/res/drawable/ic_circletraining_logo_white_24dp.xml index 7402498..ea3667b 100644 --- a/app/src/main/res/drawable/ic_circletraining_logo_white_24dp.xml +++ b/app/src/main/res/drawable/ic_circletraining_logo_white_24dp.xml @@ -10,40 +10,40 @@ android:pathData="M 28 13.7 C 29.2039807546 13.7 30.18 14.6760192454 30.18 15.88 C 30.18 17.0839807546 29.2039807546 18.06 28 18.06 C 26.7960192454 18.06 25.82 17.0839807546 25.82 15.88 C 25.82 14.6760192454 26.7960192454 13.7 28 13.7 Z" /> + android:pathData="M41.33,41.2a0.79 0.79 ,0,0,1-0.73-0.48L34,28.85l-2.29-9.19,1.16-5.88a0.62 0.62 +,0,0,0-0.17-0.56C27.94,8.59,27.27,8,27.24,7.79a0.83 0.83 ,0,0,1,0.67-1c0.33,0,0.6 0.12 +0.93 0.48 0.49 0.51 ,3.07,3,5.43,5.28h0a0.85 0.85 ,0,0,1,0.28 0.75 +l-0.45,3.5a10.84,10.84,0,0,0,0.71,5.44l7.24,17.85a0.79 0.79 ,0,0,1-0.73,1.1Z" /> + android:pathData="M28.7,26.89l-0.18,0-4.3-1.6a0.62 0.62 ,0,0,1-0.29-0.95l3.25-4.59c0.28-0.33 0.56 -0.12 0.89 +0.16s0.83,1.17 0.54 ,1.5l-2.5,2.68a0.2 0.2 ,0,0,0,0.08 0.32 l2.68 0.94 a0.79 0.79 +,0,0,1-0.17,1.56Z" /> + android:pathData="M24,41.2a21.88,21.88,0,0,1-2.7-0.33A17.21,17.21,0,0,1,23.92,6.81 0.79 +0.79,0,1,1,24,8.39a15.63,15.63,0,0,0-2.41,30.93,20.64,20.64,0,0,0,2.41 0.31 0.79 +0.79 ,0,0,1,0,1.58Z" /> + android:pathData="M14,24.63H11.45a0.63 0.63 ,0,1,1,0-1.26H14a0.63 0.63 ,0,0,1,0,1.26Z" /> diff --git a/app/src/main/res/drawable/ic_clock_24dp.xml b/app/src/main/res/drawable/ic_clock_24dp.xml index c801f2d..6699eef 100644 --- a/app/src/main/res/drawable/ic_clock_24dp.xml +++ b/app/src/main/res/drawable/ic_clock_24dp.xml @@ -13,6 +13,6 @@ android:pathData="M0 0h24v24H0z" /> + android:pathData="M12.5 7H11v6l5.25 3.15 0.75 -1.23-4.5-2.67z" /> diff --git a/app/src/main/res/drawable/ic_config_24dp.xml b/app/src/main/res/drawable/ic_config_24dp.xml index ca50303..d7f27b7 100644 --- a/app/src/main/res/drawable/ic_config_24dp.xml +++ b/app/src/main/res/drawable/ic_config_24dp.xml @@ -9,15 +9,15 @@ android:pathData="M0 0h24v24H0z" /> \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_fire_24dp.xml b/app/src/main/res/drawable/ic_fire_24dp.xml index 6014db2..b08a469 100644 --- a/app/src/main/res/drawable/ic_fire_24dp.xml +++ b/app/src/main/res/drawable/ic_fire_24dp.xml @@ -7,10 +7,10 @@ diff --git a/app/src/main/res/drawable/ic_personalization_24dp.xml b/app/src/main/res/drawable/ic_personalization_24dp.xml index 2b3f428..fe387a6 100644 --- a/app/src/main/res/drawable/ic_personalization_24dp.xml +++ b/app/src/main/res/drawable/ic_personalization_24dp.xml @@ -8,7 +8,7 @@ diff --git a/app/src/main/res/drawable/ic_statistics_24dp.xml b/app/src/main/res/drawable/ic_statistics_24dp.xml index 7c3be84..5a3a92e 100644 --- a/app/src/main/res/drawable/ic_statistics_24dp.xml +++ b/app/src/main/res/drawable/ic_statistics_24dp.xml @@ -7,7 +7,7 @@ diff --git a/app/src/main/res/drawable/ic_volume_loud_24dp.xml b/app/src/main/res/drawable/ic_volume_loud_24dp.xml index 6907812..66f7c92 100644 --- a/app/src/main/res/drawable/ic_volume_loud_24dp.xml +++ b/app/src/main/res/drawable/ic_volume_loud_24dp.xml @@ -7,8 +7,8 @@ diff --git a/app/src/main/res/drawable/ic_volume_mute_24dp.xml b/app/src/main/res/drawable/ic_volume_mute_24dp.xml index c9fcdc4..e9ee553 100644 --- a/app/src/main/res/drawable/ic_volume_mute_24dp.xml +++ b/app/src/main/res/drawable/ic_volume_mute_24dp.xml @@ -7,10 +7,10 @@ From cbe813a40d24ab4cdebbdf168b1002cdb8150579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=A4nge?= Date: Fri, 29 Sep 2023 16:34:49 +0200 Subject: [PATCH 08/16] Fix some lint errors - Replace getColumnIndex with getColumnIndexOrThrow - Replace android:tint with app:tint - Remove extraneous text from main.xml --- .../database/DatabaseExporter.java | 13 ++++--- app/src/main/res/layout/activity_workout.xml | 23 ++++++------ app/src/main/res/layout/card_dialog.xml | 18 +++++----- app/src/main/res/layout/content_main.xml | 35 +++++++++---------- app/src/main/res/layout/content_workout.xml | 12 +++---- app/src/main/res/menu/main.xml | 2 +- 6 files changed, 49 insertions(+), 54 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/database/DatabaseExporter.java b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/database/DatabaseExporter.java index e554a72..0c985d0 100644 --- a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/database/DatabaseExporter.java +++ b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/database/DatabaseExporter.java @@ -27,11 +27,10 @@ /** * @author Karola Marky * @version 20161225 - * Structure based on http://tech.sarathdr.com/android-app/convert-database-cursor-result-to-json-array-android-app-development/ - * accessed at 25th December 2016 - *

- * This class turns a database into a JSON string - * + * Structure based on http://tech.sarathdr.com/android-app/convert-database-cursor-result-to-json-array-android-app-development/ + * accessed at 25th December 2016 + *

+ * This class turns a database into a JSON string */ public class DatabaseExporter { @@ -48,6 +47,7 @@ public DatabaseExporter(String DB_PATH, String DB_NAME) { /** * Turns a single DB table into a JSON string + * * @return JSON string of the table */ public JSONArray tableToJSON(String TABLE_NAME) { @@ -114,7 +114,7 @@ public ArrayList getTableNames() { if (c.moveToFirst()) { while (!c.isAfterLast()) { - arrTblNames.add(c.getString(c.getColumnIndex("name"))); + arrTblNames.add(c.getString(c.getColumnIndexOrThrow("name"))); c.moveToNext(); } } @@ -122,7 +122,6 @@ public ArrayList getTableNames() { } /** - * * @return Entire DB as JSONObject * @throws JSONException */ diff --git a/app/src/main/res/layout/activity_workout.xml b/app/src/main/res/layout/activity_workout.xml index b8ce56b..c5c385b 100644 --- a/app/src/main/res/layout/activity_workout.xml +++ b/app/src/main/res/layout/activity_workout.xml @@ -1,6 +1,5 @@ - + app:tint="@color/white" /> - + + app:backgroundTint="@color/colorPrimary" + app:fabSize="normal" /> + android:textStyle="bold" + android:visibility="invisible" /> + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:padding="4dp"> + android:scaleType="fitXY" /> + android:src="@drawable/ic_delete_black_24px" + app:tint="@color/middlegrey" /> diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml index 4942fc4..5174ad8 100644 --- a/app/src/main/res/layout/content_main.xml +++ b/app/src/main/res/layout/content_main.xml @@ -1,6 +1,5 @@ - - + + android:visibility="gone"> + android:layout_weight="0.2"> + app:tint="@color/middlegrey" /> + app:tint="@color/darkblue" /> + android:layout_weight="0.3" + android:visibility="gone" /> @@ -129,12 +129,12 @@ android:id="@+id/workout_next" android:layout_width="wrap_content" android:layout_height="0dp" - android:layout_alignParentEnd="true" android:layout_alignTop="@+id/workout_previous" + android:layout_alignParentEnd="true" android:layout_weight="0.3" android:onClick="onClick" android:src="@drawable/ic_skip_next_24dp" - android:tint="@color/darkblue" /> + app:tint="@color/darkblue" /> z + app:showAsAction="never" /> From 24227d0325ff668efff8e302460166809a962d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=A4nge?= Date: Mon, 2 Oct 2023 11:09:06 +0200 Subject: [PATCH 09/16] Fix icons for default exercises changed after update --- .../activities/SplashActivity.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/SplashActivity.java b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/SplashActivity.java index 0c07139..175c784 100644 --- a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/SplashActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/SplashActivity.java @@ -17,6 +17,7 @@ import android.content.Intent; import android.net.Uri; import android.os.Bundle; + import androidx.appcompat.app.AppCompatActivity; import org.secuso.privacyfriendlycircuittraining.R; @@ -36,7 +37,7 @@ public class SplashActivity extends AppCompatActivity { - private PFASQLiteHelper db = new PFASQLiteHelper(this); + private final PFASQLiteHelper db = new PFASQLiteHelper(this); @Override protected void onCreate(Bundle savedInstanceState) { @@ -61,13 +62,23 @@ protected void onCreate(Bundle savedInstanceState) { Intent mainIntent = new Intent(SplashActivity.this, TutorialActivity.class); SplashActivity.this.startActivity(mainIntent); SplashActivity.this.finish(); - } - else{ + } else { + //Update icons for default exercises + Exercise defaultExercise1 = db.getExercise(1); + Exercise defaultExercise2 = db.getExercise(2); + if (defaultExercise1 != null && defaultExercise1.getImage() != null && defaultExercise1.getImage().toString().startsWith("android.resource://" + this.getPackageName() + "/")) { + defaultExercise1.setImage(Uri.parse("android.resource://" + this.getPackageName() + "/" + R.drawable.ic_exercise_squat)); + db.updateExercise(defaultExercise1); + } + if (defaultExercise2 != null && defaultExercise2.getImage() != null && defaultExercise2.getImage().toString().startsWith("android.resource://" + this.getPackageName() + "/")) { + defaultExercise2.setImage(Uri.parse("android.resource://" + this.getPackageName() + "/" + R.drawable.ic_exercise_pushup)); + db.updateExercise(defaultExercise2); + } + + Intent mainIntent = new Intent(SplashActivity.this, MainActivity.class); SplashActivity.this.startActivity(mainIntent); SplashActivity.this.finish(); } - } - } From 41a00b36f6ff27bf9005f62a8e1908fcb42eb152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=A4nge?= Date: Mon, 2 Oct 2023 15:31:11 +0200 Subject: [PATCH 10/16] Fix crash when selecting/unselecting exercise mode multiple times --- .../activities/MainActivity.java | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java index 10f45d3..e1b3b1f 100644 --- a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java @@ -133,6 +133,7 @@ protected void onCreate(Bundle savedInstanceState) { if(workoutModeSwitchState) { findViewById(R.id.exerciesetsRow).setVisibility(View.VISIBLE); + isExerciseMode = true; } //Start timer service @@ -171,30 +172,25 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { final List exerciseSetslist = db.getAllExerciseSet(); - workoutMode.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - isExerciseMode = isChecked; - workoutModeSwitchState = isChecked; - PrefManager.setWorkoutMode(getBaseContext(), isChecked); - if(isExerciseMode){ - if(exerciseSetslist.size() == 0){ - toast = Toast.makeText(getApplication(), getResources().getString(R.string.no_exercise_sets), Toast.LENGTH_LONG); - toast.setGravity(Gravity.CENTER, 0, 60); - toast.show(); - workoutMode.setChecked(false); - } - else { - buttonView.getRootView().findViewById(R.id.exerciesetsRow).setVisibility(View.VISIBLE); - sets = 1; - setsText.setText(Integer.toString(sets)); - } - } - else{ - buttonView.getRootView().findViewById(R.id.exerciesetsRow).setVisibility(View.GONE); - sets = PrefManager.setsDefault; + workoutMode.setOnCheckedChangeListener((buttonView, isChecked) -> { + isExerciseMode = isChecked; + workoutModeSwitchState = isChecked; + PrefManager.setWorkoutMode(getBaseContext(), isChecked); + if (isExerciseMode) { + if (exerciseSetslist.size() == 0) { + toast = Toast.makeText(getApplication(), getResources().getString(R.string.no_exercise_sets), Toast.LENGTH_LONG); + toast.setGravity(Gravity.CENTER, 0, 60); + toast.show(); + workoutMode.setChecked(false); + } else { + buttonView.getRootView().findViewById(R.id.exerciesetsRow).setVisibility(View.VISIBLE); + sets = 1; setsText.setText(Integer.toString(sets)); - exerciseIds = null; } + } else { + buttonView.getRootView().findViewById(R.id.exerciesetsRow).setVisibility(View.GONE); + sets = PrefManager.setsDefault; + setsText.setText(Integer.toString(sets)); } }); exerciseIds = new ArrayList<>(); From 8826d7efaf0cfc4758589c36500a91954d998d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=A4nge?= Date: Mon, 2 Oct 2023 15:38:15 +0200 Subject: [PATCH 11/16] Clean up MainActivity.java --- .../activities/MainActivity.java | 146 ++++++++---------- 1 file changed, 65 insertions(+), 81 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java index e1b3b1f..7e2c0fe 100644 --- a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java @@ -18,7 +18,6 @@ import android.app.AlertDialog; import android.content.ComponentName; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; import android.content.ServiceConnection; import android.os.Build; @@ -32,7 +31,6 @@ import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; -import android.widget.CompoundButton; import android.widget.Spinner; import android.widget.Switch; import android.widget.TextView; @@ -59,15 +57,12 @@ public class MainActivity extends BaseActivity { // CONFIGURE TIMER VARIABLES HERE // Max and min values for the workout and rest timer as well as the sets - private final int workoutMaxTime = 300; // 5 min - private final int workoutMinTime = 10; // 10 sec - private final int restMaxTime = 300; // 5 min - private final int restMinTime = 10; // 10 sec - private final int maxSets = 16; - private final int minSets = 1; - - // General - private Intent intent = null; + private static final int workoutMaxTime = 300; // 5 min + private static final int workoutMinTime = 10; // 10 sec + private static final int restMaxTime = 300; // 5 min + private static final int restMinTime = 10; // 10 sec + private static final int maxSets = 16; + private static final int minSets = 1; // Block periodization values and Button private final long blockPeriodizationTimeMax = 300; // 5:00 min @@ -77,7 +72,7 @@ public class MainActivity extends BaseActivity { private Switch blockPeriodizationSwitchButton; // Timer values - private final long startTime = 10; // Starttimer 10 sec + private static final long startTime = 10; // Starttimer 10 sec private long workoutTime = 0; private long restTime = 0; private int sets = 0; @@ -96,7 +91,7 @@ public class MainActivity extends BaseActivity { private Spinner exerciseSetSpinner; private Switch workoutMode; - private PFASQLiteHelper db = new PFASQLiteHelper(this); + private final PFASQLiteHelper db = new PFASQLiteHelper(this); ArrayList exerciseIds = null; ArrayList ExerciseIdsForRounds = null; @@ -131,7 +126,7 @@ protected void onCreate(Bundle savedInstanceState) { this.workoutMode.setChecked(workoutModeSwitchState); this.blockPeriodizationSwitchButton.setChecked(blockPeriodizationSwitchState); - if(workoutModeSwitchState) { + if (workoutModeSwitchState) { findViewById(R.id.exerciesetsRow).setVisibility(View.VISIBLE); isExerciseMode = true; } @@ -141,7 +136,7 @@ protected void onCreate(Bundle savedInstanceState) { startService(new Intent(this, TimerService.class)); //Schedule the next motivation notification (necessary if permission was not granted) - if(NotificationHelper.isMotivationAlertEnabled(this)){ + if (NotificationHelper.isMotivationAlertEnabled(this)) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { AlarmManager am = (AlarmManager) getApplicationContext().getSystemService(Context.ALARM_SERVICE); if (!am.canScheduleExactAlarms()) { //Check permission to schedule exact alarm on versions >= Android S @@ -155,17 +150,15 @@ protected void onCreate(Bundle savedInstanceState) { } //Set the change listener for the switch button to turn block periodization on and off - blockPeriodizationSwitchButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - isBlockPeriodization = isChecked; - blockPeriodizationSwitchState = isChecked; - PrefManager.setBlockPeriodizationSwitchButton(getBaseContext(), isChecked); - } + blockPeriodizationSwitchButton.setOnCheckedChangeListener((buttonView, isChecked) -> { + isBlockPeriodization = isChecked; + blockPeriodizationSwitchState = isChecked; + PrefManager.setBlockPeriodizationSwitchButton(getBaseContext(), isChecked); }); //Suggest the user to enter their body data PrefManager.performMigrations(getBaseContext()); - if(PrefManager.isFirstTimeLaunch(getBaseContext())){ + if (PrefManager.isFirstTimeLaunch(getBaseContext())) { PrefManager.setFirstTimeLaunch(getBaseContext(), false); showPersonalizationAlert(); } @@ -195,10 +188,10 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { }); exerciseIds = new ArrayList<>(); final List exerciseSetsNames = new ArrayList<>(); - for(ExerciseSet ex : exerciseSetslist){ + for (ExerciseSet ex : exerciseSetslist) { exerciseSetsNames.add(ex.getName()); } - ArrayAdapter dataAdapter = new ArrayAdapter(this, + ArrayAdapter dataAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, exerciseSetsNames); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); exerciseSetSpinner.setAdapter(dataAdapter); @@ -209,12 +202,14 @@ public void onItemSelected(AdapterView parent, View view, int pos, long id) { } @Override - public void onNothingSelected(AdapterView parentView) { } + public void onNothingSelected(AdapterView parentView) { + } }); } /** * This method connects the Activity to the menu item + * * @return ID of the menu item it belongs to */ @Override @@ -261,7 +256,7 @@ public void onClick(View view) { this.workoutMode.setChecked(!this.workoutMode.isChecked()); PrefManager.setWorkoutMode(getBaseContext(), this.workoutMode.isChecked()); } else if (id == R.id.start_workout) { - intent = new Intent(this, WorkoutActivity.class); + Intent intent = new Intent(this, WorkoutActivity.class); if (isExerciseMode) { ExerciseIdsForRounds = getExercisesForRounds(exerciseIds, sets); @@ -295,7 +290,7 @@ public void onClick(View view) { /** * Defines callbacks for service binding, passed to bindService() **/ - private ServiceConnection serviceConnection = new ServiceConnection() { + private final ServiceConnection serviceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName className, IBinder service) { @@ -311,58 +306,57 @@ public void onServiceDisconnected(ComponentName arg0) { }; - - /** - * Build an AlertDialog for the block periodization configurations - */ - private AlertDialog buildBlockAlert(){ + /** + * Build an AlertDialog for the block periodization configurations + */ + private AlertDialog buildBlockAlert() { LayoutInflater inflater = getLayoutInflater(); View dialogLayout = inflater.inflate(R.layout.block_periodization, null); - Button timeButtonPlus = (Button)dialogLayout.findViewById(R.id.main_block_periodization_time_plus); - Button timeButtonMinus = (Button)dialogLayout.findViewById(R.id.main_block_periodization_time_minus); - Button setButtonPlus = (Button)dialogLayout.findViewById(R.id.main_block_periodization_sets_plus); - Button setButtonMinus = (Button)dialogLayout.findViewById(R.id.main_block_periodization_sets_minus); + Button timeButtonPlus = (Button) dialogLayout.findViewById(R.id.main_block_periodization_time_plus); + Button timeButtonMinus = (Button) dialogLayout.findViewById(R.id.main_block_periodization_time_minus); + Button setButtonPlus = (Button) dialogLayout.findViewById(R.id.main_block_periodization_sets_plus); + Button setButtonMinus = (Button) dialogLayout.findViewById(R.id.main_block_periodization_sets_minus); - final TextView setsText = (TextView)dialogLayout.findViewById(R.id.main_block_periodization_sets_amount); - final TextView timeText = (TextView)dialogLayout.findViewById(R.id.main_block_periodization_time); - blockPeriodizationSets = (blockPeriodizationSets >= sets) ? sets-1 : blockPeriodizationSets; + final TextView setsText = (TextView) dialogLayout.findViewById(R.id.main_block_periodization_sets_amount); + final TextView timeText = (TextView) dialogLayout.findViewById(R.id.main_block_periodization_time); + blockPeriodizationSets = (blockPeriodizationSets >= sets) ? sets - 1 : blockPeriodizationSets; blockPeriodizationSets = (blockPeriodizationSets <= 0) ? 1 : blockPeriodizationSets; setsText.setText(Integer.toString(blockPeriodizationSets)); timeText.setText(formatTime(blockPeriodizationTime)); - setButtonPlus.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - if(blockPeriodizationSets < sets-1){ blockPeriodizationSets += 1; } - setsText.setText(Integer.toString(blockPeriodizationSets)); - PrefManager.setTimerPeriodizationSet(getBaseContext(), blockPeriodizationSets); + setButtonPlus.setOnClickListener(v -> { + if (blockPeriodizationSets < sets - 1) { + blockPeriodizationSets += 1; } + setsText.setText(Integer.toString(blockPeriodizationSets)); + PrefManager.setTimerPeriodizationSet(getBaseContext(), blockPeriodizationSets); }); - setButtonMinus.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - if(blockPeriodizationSets > 1){ blockPeriodizationSets -= 1; } - setsText.setText(Integer.toString(blockPeriodizationSets)); - PrefManager.setTimerPeriodizationSet(getBaseContext(), blockPeriodizationSets); + setButtonMinus.setOnClickListener(v -> { + if (blockPeriodizationSets > 1) { + blockPeriodizationSets -= 1; } + setsText.setText(Integer.toString(blockPeriodizationSets)); + PrefManager.setTimerPeriodizationSet(getBaseContext(), blockPeriodizationSets); }); - timeButtonPlus.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - if(blockPeriodizationTime < blockPeriodizationTimeMax){ blockPeriodizationTime += 10; } - timeText.setText(formatTime(blockPeriodizationTime)); - PrefManager.setTimerPeriodizationTime(getBaseContext(), (int) blockPeriodizationTime); + timeButtonPlus.setOnClickListener(v -> { + if (blockPeriodizationTime < blockPeriodizationTimeMax) { + blockPeriodizationTime += 10; } + timeText.setText(formatTime(blockPeriodizationTime)); + PrefManager.setTimerPeriodizationTime(getBaseContext(), (int) blockPeriodizationTime); }); - timeButtonMinus.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - if(blockPeriodizationTime > 10){ blockPeriodizationTime -= 10; } - timeText.setText(formatTime(blockPeriodizationTime)); - PrefManager.setTimerPeriodizationTime(getBaseContext(), (int) blockPeriodizationTime); + timeButtonMinus.setOnClickListener(v -> { + if (blockPeriodizationTime > 10) { + blockPeriodizationTime -= 10; } + timeText.setText(formatTime(blockPeriodizationTime)); + PrefManager.setTimerPeriodizationTime(getBaseContext(), (int) blockPeriodizationTime); }); @@ -370,33 +364,23 @@ public void onClick(View v) { alertBuilder.setView(dialogLayout); alertBuilder.setTitle(getResources().getString(R.string.main_block_periodization_headline)).setPositiveButton( - "Ok", - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.cancel(); - } - }); + "Ok", + (dialog, id) -> dialog.cancel()); return alertBuilder.create(); } - private void showPersonalizationAlert(){ + private void showPersonalizationAlert() { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.setTitle(R.string.alert_personalization_title); alertBuilder.setMessage(R.string.alert_personalization_message); - alertBuilder.setNegativeButton(getString(R.string.alert_confirm_dialog_negative), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.dismiss(); - } - }); - alertBuilder.setPositiveButton(getString(R.string.alert_confirm_dialog_positive), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - Intent i = new Intent( MainActivity.this, SettingsActivity.class ); - i.putExtra( PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsActivity.PersonalizationPreferenceFragment.class.getName() ); - i.putExtra( PreferenceActivity.EXTRA_NO_HEADERS, true ); - startActivity(i); - } + alertBuilder.setNegativeButton(getString(R.string.alert_confirm_dialog_negative), (dialog, id) -> dialog.dismiss()); + alertBuilder.setPositiveButton(getString(R.string.alert_confirm_dialog_positive), (dialog, id) -> { + Intent i = new Intent(MainActivity.this, SettingsActivity.class); + i.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsActivity.PersonalizationPreferenceFragment.class.getName()); + i.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true); + startActivity(i); }); alertBuilder.create().show(); } @@ -450,10 +434,10 @@ public boolean isStartTimerEnabled(Context context) { } private String formatTime(long seconds) { - long min = seconds/60; - long sec = seconds%60; + long min = seconds / 60; + long sec = seconds % 60; - return String.format("%02d : %02d", min,sec); + return String.format("%02d : %02d", min, sec); } private ArrayList getExercisesForRounds(ArrayList exerciseIds, int rounds) { From c03ed1751fc23fcc9c3604c6dfbee09be37e1253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=A4nge?= Date: Mon, 2 Oct 2023 16:04:10 +0200 Subject: [PATCH 12/16] Add exercise name and description to WorkoutActivity Closes #23, Closes #5, Closes #17 --- .../activities/WorkoutActivity.java | 239 ++++++++---------- app/src/main/res/layout/content_workout.xml | 54 ++-- 2 files changed, 147 insertions(+), 146 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/WorkoutActivity.java b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/WorkoutActivity.java index 02128e5..1bf8d5c 100644 --- a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/WorkoutActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/WorkoutActivity.java @@ -46,6 +46,7 @@ import org.secuso.privacyfriendlycircuittraining.R; import org.secuso.privacyfriendlycircuittraining.database.PFASQLiteHelper; +import org.secuso.privacyfriendlycircuittraining.models.Exercise; import org.secuso.privacyfriendlycircuittraining.services.TimerService; import org.secuso.privacyfriendlycircuittraining.tutorial.PrefManager; @@ -66,6 +67,8 @@ public class WorkoutActivity extends AppCompatActivity { private TextView workoutTimer = null; private TextView workoutTitle = null; private TextView caloriesNumber = null; + private TextView workoutName = null; + private TextView workoutDescription = null; // GUI Buttons private FloatingActionButton fab = null; @@ -83,7 +86,7 @@ public class WorkoutActivity extends AppCompatActivity { private TimerService timerService = null; private boolean serviceBound = false; - private PFASQLiteHelper db = new PFASQLiteHelper(this); + private final PFASQLiteHelper db = new PFASQLiteHelper(this); @Override @@ -111,30 +114,29 @@ protected void onCreate(Bundle savedInstanceState) { this.finishedView = findViewById(R.id.finishedView); this.finishedView.setVisibility(View.GONE); this.workoutImage = findViewById(R.id.workout_image); + this.workoutName = findViewById(R.id.workout_name); + this.workoutDescription = findViewById(R.id.workout_description); // Set the workout screen to remain on if so enabled in the settings - if(isKeepScreenOnEnabled(this)) { + if (isKeepScreenOnEnabled(this)) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } // Set the gui to workout gui colors if start timer wasn't enabled - if(!isStartTimerEnabled(this)) { + if (!isStartTimerEnabled(this)) { setWorkoutGuiColors(true); } // Register the function of the pause button fab = (FloatingActionButton) findViewById(R.id.fab_pause_resume); - fab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - fab.setSelected(!fab.isSelected()); - if (fab.isSelected() && timerService != null){ - fab.setImageResource(R.drawable.ic_play_24dp); - timerService.pauseTimer(); - } else if (timerService != null) { - fab.setImageResource(R.drawable.ic_pause_24dp); - timerService.resumeTimer(); - } + fab.setOnClickListener(view -> { + fab.setSelected(!fab.isSelected()); + if (fab.isSelected() && timerService != null) { + fab.setImageResource(R.drawable.ic_play_24dp); + timerService.pauseTimer(); + } else if (timerService != null) { + fab.setImageResource(R.drawable.ic_pause_24dp); + timerService.resumeTimer(); } }); @@ -144,17 +146,14 @@ public void onClick(View view) { volumeButton.setSelected(isSoundsMuted(this)); // Register the function of the volume button - volumeButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - volumeButton.setSelected(!volumeButton.isSelected()); - if (volumeButton.isSelected()){ - volumeButton.setImageResource(R.drawable.ic_volume_mute_24dp); - muteAllSounds(true); - } else { - volumeButton.setImageResource(R.drawable.ic_volume_loud_24dp); - muteAllSounds(false); - } + volumeButton.setOnClickListener(view -> { + volumeButton.setSelected(!volumeButton.isSelected()); + if (volumeButton.isSelected()) { + volumeButton.setImageResource(R.drawable.ic_volume_mute_24dp); + muteAllSounds(true); + } else { + volumeButton.setImageResource(R.drawable.ic_volume_loud_24dp); + muteAllSounds(false); } }); @@ -166,7 +165,7 @@ public void onClick(View view) { * Defines callbacks for service binding, passed to bindService() * Performs an initial GUI update when connection is established. **/ - private ServiceConnection serviceConnection = new ServiceConnection() { + private final ServiceConnection serviceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName className, IBinder service) { @@ -202,7 +201,7 @@ public class BroadcastReceiver extends android.content.BroadcastReceiver { /** * Updates the GUI depending on the message recived - * + *

* onTickMillis - Updates the progressBar progress according to current timer millis and makes it blink * timer_title - Updates the GUI title and switches the GUI colors accordingly * countdown_seconds - Updates the current seconds in the GUI @@ -216,7 +215,7 @@ public void onReceive(Context context, Intent intent) { if (intent.getLongExtra("onTickMillis", 0) != 0) { long millis = intent.getLongExtra("onTickMillis", 0); - progressBar.setProgress((int)millis); + progressBar.setProgress((int) millis); if (isProgressBarBlinking(millis, context)) { progressBarBlink(); @@ -237,14 +236,17 @@ public void onReceive(Context context, Intent intent) { int currentSet = intent.getIntExtra("current_set", 0); int sets = intent.getIntExtra("sets", 0); - currentSetsInfo.setText(getResources().getString(R.string.workout_info) + ": " + Integer.toString(currentSet) + "/" + Integer.toString(sets)); + currentSetsInfo.setText(getResources().getString(R.string.workout_info) + ": " + currentSet + "/" + sets); } if (intent.getBooleanExtra("workout_finished", false) != false) { showFinishedView(); } if (intent.getIntExtra("exercise_id", -1) != -1) { - Integer exercise = intent.getIntExtra("exercise_id", -1); - Glide.with(context).load(db.getExercise(exercise).getImage()).into(workoutImage); + int exerciseID = intent.getIntExtra("exercise_id", -1); + Exercise exercise = db.getExercise(exerciseID); + workoutName.setText(exercise.getName()); + workoutDescription.setText(exercise.getDescription()); + Glide.with(context).load(exercise.getImage()).into(workoutImage); } if (intent.getLongExtra("new_timer", 0) != 0) { @@ -264,11 +266,11 @@ public void onReceive(Context context, Intent intent) { /** * Check if the progressbar should be blinking * - * @param millis The current milliseconds + * @param millis The current milliseconds * @param context Context * @return Boolean if the progressbar should be blinking */ - private boolean isProgressBarBlinking(long millis, Context context){ + private boolean isProgressBarBlinking(long millis, Context context) { int buffer = 100; //Makes sure the animation has time to begin if (millis <= workoutBlinkingTime && workoutColors && isBlinkingProgressBarEnabled(context) && oldTimeStamp - buffer >= millis) { @@ -278,7 +280,7 @@ private boolean isProgressBarBlinking(long millis, Context context){ oldTimeStamp = millis; return true; } - return false; + return false; } } @@ -312,7 +314,7 @@ private void setWorkoutGuiColors(boolean guiFlip) { //progressBar.setProgressBackgroundTintList(ColorStateList.valueOf(getResources().getColor(progressBackgroundColor))); - if(guiFlip) + if (guiFlip) workoutImage.setImageAlpha(255); else workoutImage.setImageAlpha(50); @@ -324,7 +326,7 @@ private void setWorkoutGuiColors(boolean guiFlip) { private void progressBarBlink() { if (progressBar.getAlpha() == 1.0f) progressBar.animate().alpha(0.1f).setDuration(600).start(); - else if(progressBar.getAlpha() <= 0.15f) + else if (progressBar.getAlpha() <= 0.15f) progressBar.animate().alpha(1.0f).setDuration(600).start(); } @@ -335,14 +337,14 @@ else if(progressBar.getAlpha() <= 0.15f) * @param view View */ public void onClick(View view) { - switch(view.getId()) { + switch (view.getId()) { case R.id.workout_previous: - if(timerService != null){ + if (timerService != null) { timerService.prevTimer(); } break; case R.id.workout_next: - if(timerService != null){ + if (timerService != null) { timerService.nextTimer(); } break; @@ -351,10 +353,9 @@ public void onClick(View view) { finish(); break; case R.id.finish_workout: - if(isCancelDialogEnabled(this)){ + if (isCancelDialogEnabled(this)) { showCancelAlert(true); - } - else { + } else { showFinishedView(); } break; @@ -366,8 +367,8 @@ public void onClick(View view) { /** * Update all GUI elements by getting the current timer values from the TimerService */ - private void updateGUI(){ - if(timerService != null){ + private void updateGUI() { + if (timerService != null) { boolean isPaused = timerService.getIsPaused(); int currentSet = timerService.getCurrentSet(); String title = timerService.getCurrentTitle(); @@ -377,15 +378,15 @@ private void updateGUI(){ Integer currentExerciseId = timerService.getCurrentExerciseId(); - if(timerService.getisExerciseMode()){ + if (timerService.getisExerciseMode()) { float d = getApplicationContext().getResources().getDisplayMetrics().density; int margin; - if(d > 2) + if (d > 2) margin = (int) (d * 182); else margin = (int) (d * 140); RelativeLayout.LayoutParams timerlp = (RelativeLayout.LayoutParams) workoutTimer.getLayoutParams(); - timerlp.setMargins(0,0,margin,margin); + timerlp.setMargins(0, 0, margin, margin); timerlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); timerlp.addRule(RelativeLayout.ALIGN_PARENT_END); timerlp.removeRule(RelativeLayout.CENTER_HORIZONTAL); @@ -397,48 +398,49 @@ private void updateGUI(){ barlp.addRule(RelativeLayout.ALIGN_END, workoutTimer.getId()); workoutImage.setVisibility(View.VISIBLE); + workoutName.setVisibility(View.VISIBLE); + workoutDescription.setVisibility(View.VISIBLE); } - if(title.equals(getResources().getString(R.string.workout_headline_workout))){ + if (title.equals(getResources().getString(R.string.workout_headline_workout))) { timerDuration = timerService.getWorkoutTime(); setWorkoutGuiColors(true); - } - else if(title.equals(getResources().getString(R.string.workout_headline_start_timer))){ + } else if (title.equals(getResources().getString(R.string.workout_headline_start_timer))) { timerDuration = timerService.getStartTime(); setWorkoutGuiColors(false); - } - else if(title.equals(getResources().getString(R.string.workout_headline_rest))){ + } else if (title.equals(getResources().getString(R.string.workout_headline_rest))) { timerDuration = timerService.getRestTime(); setWorkoutGuiColors(false); - } - else if(title.equals(getResources().getString(R.string.workout_block_periodization_headline))){ + } else if (title.equals(getResources().getString(R.string.workout_block_periodization_headline))) { timerDuration = timerService.getBlockRestTime(); setWorkoutGuiColors(false); } String time = Long.toString((int) Math.ceil(savedTime / 1000.0)); - currentSetsInfo.setText(getResources().getString(R.string.workout_info) +": "+Integer.toString(currentSet)+"/"+Integer.toString(sets)); + currentSetsInfo.setText(getResources().getString(R.string.workout_info) + ": " + currentSet + "/" + sets); workoutTitle.setText(title); workoutTimer.setText(time); progressBar.setMax((int) timerDuration); progressBar.setProgress((int) savedTime); progressBar.setAlpha(1.0f); - if(timerService.getisExerciseMode()) { - Glide.with(this).load(db.getExercise(currentExerciseId).getImage()).into(workoutImage); + if (timerService.getisExerciseMode()) { + Exercise exercise = db.getExercise(currentExerciseId); + workoutName.setText(exercise.getName()); + workoutDescription.setText(exercise.getDescription()); + Glide.with(this).load(exercise.getImage()).into(workoutImage); } - if (isPaused){ + if (isPaused) { fab.setImageResource(R.drawable.ic_play_24dp); fab.setSelected(true); - } - else { + } else { fab.setImageResource(R.drawable.ic_pause_24dp); fab.setSelected(false); } - if(title.equals(getResources().getString(R.string.workout_headline_done))){ + if (title.equals(getResources().getString(R.string.workout_headline_done))) { showFinishedView(); } } @@ -450,8 +452,8 @@ else if(title.equals(getResources().getString(R.string.workout_block_periodizati * * @return The AlertDialog */ - private void showCancelAlert(final boolean showFinish){ - if(timerService != null){ + private void showCancelAlert(final boolean showFinish) { + if (timerService != null) { timerService.pauseTimer(); timerService.setCancelAlert(true); } @@ -460,57 +462,46 @@ private void showCancelAlert(final boolean showFinish){ final CharSequence[] item = {getResources().getString(R.string.workout_canceled_check)}; final boolean[] selection = {false}; - final ArrayList selectedItem = new ArrayList(); - - alertBuilder.setMultiChoiceItems(item, selection, new DialogInterface.OnMultiChoiceClickListener() { - @Override - public void onClick(DialogInterface dialog, int indexSelected, boolean isChecked) { - if (isChecked) { - selectedItem.add(indexSelected); - PrefManager.setCancelWorkoutCheck(getBaseContext(), false); - } else if (selectedItem.contains(indexSelected)) { - selectedItem.remove(Integer.valueOf(indexSelected)); - PrefManager.setCancelWorkoutCheck(getBaseContext(), true); - } + final ArrayList selectedItem = new ArrayList<>(); + + alertBuilder.setMultiChoiceItems(item, selection, (dialog, indexSelected, isChecked) -> { + if (isChecked) { + selectedItem.add(indexSelected); + PrefManager.setCancelWorkoutCheck(getBaseContext(), false); + } else if (selectedItem.contains(indexSelected)) { + selectedItem.remove(Integer.valueOf(indexSelected)); + PrefManager.setCancelWorkoutCheck(getBaseContext(), true); } }); alertBuilder.setTitle(R.string.workout_canceled_info); - alertBuilder.setNegativeButton(getString(R.string.alert_confirm_dialog_negative), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - if(timerService != null){ - timerService.resumeTimer(); - timerService.setCancelAlert(false); - } - updateGUI(); - dialog.dismiss(); + alertBuilder.setNegativeButton(getString(R.string.alert_confirm_dialog_negative), (dialog, id) -> { + if (timerService != null) { + timerService.resumeTimer(); + timerService.setCancelAlert(false); } + updateGUI(); + dialog.dismiss(); }); - alertBuilder.setPositiveButton(getString(R.string.alert_confirm_dialog_positive), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - if(showFinish){ - showFinishedView(); - } - else { - cleanTimerServiceFinish(); - finish(); - } + alertBuilder.setPositiveButton(getString(R.string.alert_confirm_dialog_positive), (dialog, id) -> { + if (showFinish) { + showFinishedView(); + } else { + cleanTimerServiceFinish(); + finish(); } }); - alertBuilder.setOnCancelListener(new OnCancelListener() { - - public void onCancel(DialogInterface dialog) { - if(timerService != null){ - timerService.resumeTimer(); - timerService.setCancelAlert(false); - } - updateGUI(); - dialog.dismiss(); + alertBuilder.setOnCancelListener(dialog -> { + if (timerService != null) { + timerService.resumeTimer(); + timerService.setCancelAlert(false); } + updateGUI(); + dialog.dismiss(); }); alertBuilder.create().show(); @@ -520,11 +511,11 @@ public void onCancel(DialogInterface dialog) { * Shows a transparent overlay over the workout screen. * Overlay displays that the workout is over and optionally how many calories were burned. */ - private void showFinishedView(){ + private void showFinishedView() { TextView finishButton = (TextView) this.findViewById(R.id.finish_workout); finishButton.setEnabled(false); - if(timerService != null){ + if (timerService != null) { timerService.setCurrentTitle(getString(R.string.workout_headline_done)); timerService.pauseTimer(); } @@ -533,23 +524,18 @@ private void showFinishedView(){ this.fab.hide(); this.finishedView.setVisibility(View.VISIBLE); - finishedView.setOnTouchListener(new OnTouchListener() { - @Override - public boolean onTouch(View v, MotionEvent event) { - return true; - } - }); + finishedView.setOnTouchListener((v, event) -> true); - if(isCaloriesEnabled(this)){ - TextView txt = (TextView)findViewById(R.id.workout_finished_calories_text); - TextView nmbr = (TextView)findViewById(R.id.workout_finished_calories_number); - TextView unit = (TextView)findViewById(R.id.workout_finished_calories_unit); + if (isCaloriesEnabled(this)) { + TextView txt = (TextView) findViewById(R.id.workout_finished_calories_text); + TextView nmbr = (TextView) findViewById(R.id.workout_finished_calories_number); + TextView unit = (TextView) findViewById(R.id.workout_finished_calories_unit); txt.setVisibility(View.VISIBLE); nmbr.setVisibility(View.VISIBLE); unit.setVisibility(View.VISIBLE); - if(timerService != null){ + if (timerService != null) { String caloriesBurned = Integer.toString(timerService.getCaloriesBurned()); this.caloriesNumber.setText(caloriesBurned); } @@ -574,7 +560,7 @@ protected void onStop() { public void onResume() { super.onResume(); - if(timerService != null){ + if (timerService != null) { timerService.setIsAppInBackground(false); } updateGUI(); @@ -588,7 +574,7 @@ public void onResume() { public void onPause() { super.onPause(); - if(timerService != null){ + if (timerService != null) { timerService.setIsAppInBackground(true); } unregisterReceiver(timeReceiver); @@ -599,7 +585,7 @@ public void onPause() { */ @Override public void onDestroy() { - if(timerService != null){ + if (timerService != null) { timerService.workoutClosed(); timerService.setCancelAlert(false); } @@ -611,10 +597,9 @@ public void onDestroy() { */ @Override public void onBackPressed() { - if(isCancelDialogEnabled(this)){ + if (isCancelDialogEnabled(this)) { showCancelAlert(false); - } - else{ + } else { cleanTimerServiceFinish(); finish(); } @@ -625,8 +610,8 @@ public void onBackPressed() { /** * Calls the service to stop an clear all timer */ - private void cleanTimerServiceFinish(){ - if(timerService != null) { + private void cleanTimerServiceFinish() { + if (timerService != null) { timerService.cleanTimerFinish(); } } @@ -636,15 +621,15 @@ private void cleanTimerServiceFinish(){ * * @param mute Flag to mute or unmute all sounds */ - private void muteAllSounds(boolean mute){ + private void muteAllSounds(boolean mute) { PrefManager.setSoundsMuted(getBaseContext(), mute); } /* - * Multiple checks for what was enabled inside the settings - */ - public boolean isKeepScreenOnEnabled(Context context){ - return PrefManager.getKeepScreenOnSwitchEnabled(context); + * Multiple checks for what was enabled inside the settings + */ + public boolean isKeepScreenOnEnabled(Context context) { + return PrefManager.getKeepScreenOnSwitchEnabled(context); } public boolean isStartTimerEnabled(Context context) { diff --git a/app/src/main/res/layout/content_workout.xml b/app/src/main/res/layout/content_workout.xml index 2ec6909..227fa2b 100644 --- a/app/src/main/res/layout/content_workout.xml +++ b/app/src/main/res/layout/content_workout.xml @@ -20,10 +20,8 @@ - + android:layout_centerHorizontal="true"> + + + + + + @@ -117,7 +137,7 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.2" - android:gravity="bottom|left" + android:gravity="bottom|start" android:orientation="vertical"> Date: Mon, 2 Oct 2023 17:08:37 +0200 Subject: [PATCH 13/16] Update layout for WorkoutActivity --- .../activities/WorkoutActivity.java | 31 +- app/src/main/res/layout/content_workout.xml | 311 +++++++++--------- 2 files changed, 157 insertions(+), 185 deletions(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/WorkoutActivity.java b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/WorkoutActivity.java index 1bf8d5c..c1f52a5 100644 --- a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/WorkoutActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/WorkoutActivity.java @@ -17,8 +17,6 @@ import android.app.AlertDialog; import android.content.ComponentName; import android.content.Context; -import android.content.DialogInterface; -import android.content.DialogInterface.OnCancelListener; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; @@ -27,18 +25,17 @@ import android.graphics.drawable.LayerDrawable; import android.os.Bundle; import android.os.IBinder; -import android.view.MotionEvent; import android.view.View; -import android.view.View.OnTouchListener; import android.view.WindowManager; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ProgressBar; -import android.widget.RelativeLayout; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.constraintlayout.widget.ConstraintSet; import androidx.core.content.ContextCompat; import com.bumptech.glide.Glide; @@ -379,27 +376,15 @@ private void updateGUI() { if (timerService.getisExerciseMode()) { - float d = getApplicationContext().getResources().getDisplayMetrics().density; - int margin; - if (d > 2) - margin = (int) (d * 182); - else - margin = (int) (d * 140); - RelativeLayout.LayoutParams timerlp = (RelativeLayout.LayoutParams) workoutTimer.getLayoutParams(); - timerlp.setMargins(0, 0, margin, margin); - timerlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); - timerlp.addRule(RelativeLayout.ALIGN_PARENT_END); - timerlp.removeRule(RelativeLayout.CENTER_HORIZONTAL); - workoutTimer.setLayoutParams(timerlp); - workoutTimer.setTextSize(36); - - RelativeLayout.LayoutParams barlp = (RelativeLayout.LayoutParams) progressBar.getLayoutParams(); - barlp.addRule(RelativeLayout.ALIGN_BOTTOM, workoutTimer.getId()); - barlp.addRule(RelativeLayout.ALIGN_END, workoutTimer.getId()); - workoutImage.setVisibility(View.VISIBLE); workoutName.setVisibility(View.VISIBLE); workoutDescription.setVisibility(View.VISIBLE); + } else { + ConstraintLayout constraintLayout = findViewById(R.id.workout_center_view_constraint_layout); + ConstraintSet constraintSet = new ConstraintSet(); + constraintSet.clone(constraintLayout); + constraintSet.setVerticalBias(R.id.workout_image, 1f); + constraintSet.applyTo(constraintLayout); } if (title.equals(getResources().getString(R.string.workout_headline_workout))) { diff --git a/app/src/main/res/layout/content_workout.xml b/app/src/main/res/layout/content_workout.xml index 227fa2b..fd1650c 100644 --- a/app/src/main/res/layout/content_workout.xml +++ b/app/src/main/res/layout/content_workout.xml @@ -1,192 +1,179 @@ - + tools:context="org.secuso.privacyfriendlycircuittraining.activities.WorkoutActivity"> - + + + android:layout_marginTop="16dp" + android:layout_marginBottom="16dp" + android:elevation="1dp" + app:layout_constraintBottom_toTopOf="@id/current_sets_info" + app:layout_constraintTop_toBottomOf="@id/workout_title"> - - - - - + + - - - - - - + + - - - - - - - - - - - + app:layout_constraintBottom_toTopOf="@id/workout_image" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHeight_min="75dp" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintWidth_min="75dp"> + + - - - - - - + app:autoSizeTextType="uniform" /> - + - + android:layout_gravity="center_horizontal" + android:layout_marginBottom="8dp" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintDimensionRatio="1:1" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:visibility="visible" /> - + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:layout_marginBottom="8dp" + android:text="Exercise" + android:textAlignment="center" + android:textSize="20sp" + android:textStyle="bold" + android:visibility="gone" + app:layout_constraintBottom_toTopOf="@id/workout_description" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/workout_image" + app:layout_constraintVertical_bias="0.0" + tools:visibility="visible" /> - + android:layout_height="wrap_content" + android:text="Desctiotion" + android:textSize="15sp" + android:textStyle="bold" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/workout_name" + tools:visibility="visible" /> - - - + - - - - - + + + + + + + + \ No newline at end of file From 7d216b2672131f09d0fdeed99d653a37c59f3a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=A4nge?= Date: Tue, 10 Oct 2023 11:14:59 +0200 Subject: [PATCH 14/16] Prevent exercise mode from being enabled when no exercise set exists. --- .../activities/MainActivity.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java index 7e2c0fe..930ffd0 100644 --- a/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/MainActivity.java @@ -175,6 +175,9 @@ protected void onCreate(Bundle savedInstanceState) { toast.setGravity(Gravity.CENTER, 0, 60); toast.show(); workoutMode.setChecked(false); + isExerciseMode = false; + workoutModeSwitchState = false; + PrefManager.setWorkoutMode(getBaseContext(), false); } else { buttonView.getRootView().findViewById(R.id.exerciesetsRow).setVisibility(View.VISIBLE); sets = 1; From f03abfa6c8def262ddcdccb820a638867ca242b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=A4nge?= Date: Tue, 10 Oct 2023 11:18:47 +0200 Subject: [PATCH 15/16] Bump version to 1.2.1 (4) --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d4c59e9..54f19ff 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.secuso.privacyfriendlycircuittraining" minSdkVersion 21 targetSdkVersion 33 - versionCode 3 - versionName "1.2.0" + versionCode 4 + versionName "1.2.1" } buildTypes { release { From 56e0598e1e9698182bafb484f06470f3f49d93bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=A4nge?= Date: Tue, 31 Oct 2023 15:06:16 +0100 Subject: [PATCH 16/16] Disable jetifier and increase metaspace size --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 915f0e6..acc0dfd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,10 +11,10 @@ # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true -android.enableJetifier=true android.useAndroidX=true \ No newline at end of file