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

handle workout insights #22

Merged
merged 1 commit into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@
<activity
android:name=".ui.onboarding.activities.OnBoardingActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="false" />

<activity
android:name=".ui.onboarding.activities.SplashActivity"
android:exported="true">
Expand Down
11 changes: 0 additions & 11 deletions app/src/main/java/com/modarb/android/MainActivity.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class MyPlanFragment : Fragment() {
binding.progress.progressOverlay.visibility = View.VISIBLE

planViewModel.getPlanPage(
WorkoutData.workoutId, "Bearer " + UserPrefUtil.getUserData(requireContext())!!.token
WorkoutData.workoutId, "Bear`er " + UserPrefUtil.getUserData(requireContext())!!.token
)

lifecycleScope.launch {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.modarb.android.ui.workout.activities

import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.Toast
Expand Down Expand Up @@ -39,7 +40,7 @@ class WorkoutActivity : AppCompatActivity(), ExerciseListener {
}

private fun incrementSetCount() {
// TODO handle this when they fix the api
// TODO uncomment / handle this when they fix the api
//if (adapter.isTimedExercise(currentPosition)) return
binding.incButton.setOnClickListener {
val currentPosition = binding.exercisePager.currentItem
Expand All @@ -56,14 +57,17 @@ class WorkoutActivity : AppCompatActivity(), ExerciseListener {
is Result.Failure -> handleFailure(result.exception)
else -> {}
}
binding.progress.progressOverlay.visibility = View.GONE
}
}


}

private fun handleSuccess(data: BaseResponse) {
Toast.makeText(this, data.message, Toast.LENGTH_SHORT).show()

val i = Intent(this, WorkoutInsightsActivity::class.java)
startActivity(i)

finish()
}

Expand All @@ -78,6 +82,7 @@ class WorkoutActivity : AppCompatActivity(), ExerciseListener {
}

private fun markWorkoutDone() {
binding.progress.progressOverlay.visibility = View.VISIBLE
val myWorkoutId = WorkoutData.workoutId
val week = WorkoutData.getCurrentWeek()!!.week_number
val day = WorkoutData.getTodayWorkout()!!.day_number
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.modarb.android.ui.workout.activities

import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.modarb.android.databinding.ActivityWorkoutInsightsBinding
import com.modarb.android.ui.home.HomeActivity

class WorkoutInsightsActivity : AppCompatActivity() {

Expand All @@ -12,7 +14,16 @@ class WorkoutInsightsActivity : AppCompatActivity() {
binding = ActivityWorkoutInsightsBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
handleOnFinish()

// TODO init adapter for post meals and design the item meal
}


private fun handleOnFinish() {
binding.finistBtn.setOnClickListener {
startActivity(Intent(this, HomeActivity::class.java))
finish()
}
}
}
4 changes: 4 additions & 0 deletions app/src/main/res/layout/activity_workout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
android:background="@color/grey_900"
android:orientation="vertical">

<include
android:id="@+id/progress"
layout="@layout/progress" />

<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
Expand Down Expand Up @@ -85,4 +88,5 @@

</androidx.constraintlayout.widget.ConstraintLayout>


</LinearLayout>
15 changes: 2 additions & 13 deletions app/src/main/res/layout/activity_workout_insights.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,18 @@
tools:context=".ui.workout.activities.WorkoutInsightsActivity">


<ImageView
android:id="@+id/backImg"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:importantForAccessibility="no"
android:src="@drawable/baseline_arrow_back_24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="32dp"
android:layout_marginTop="64dp"
android:text="@string/workout_n_insights"
android:textColor="@color/white"
android:textSize="28sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/backImg" />
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/dayDetails"
Expand Down
Loading