Skip to content

Commit

Permalink
Merge pull request #43 from Modarb-Ai-Trainer/pose_correction_and_det…
Browse files Browse the repository at this point in the history
…ection

Populate nutrition programs correctly
  • Loading branch information
amrhossamdev authored Jun 23, 2024
2 parents 0d6fe64 + b1c0612 commit 5718648
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/modarb/android/network/ApiService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ interface ApiService {
@Header("Authorization") token: String,
): Response<MyMealPlanResponse>

@GET("api/v1/user/mealPlans")
@GET("api/v1/user/mealPlans?limit=200")
suspend fun getAllMealsPlan(
@Header("Authorization") token: String,
): Response<AllMealsPlansResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ class AboutNutritionPlanActivity : AppCompatActivity() {
}
}

if (keyFeature.isNotEmpty()) binding.desKeyFeaturesTextView1.text = keyFeature
if (keyFeature != null && keyFeature.isNotEmpty()) binding.desKeyFeaturesTextView1.text =
keyFeature
else binding.keyFeaturesTextView.visibility = View.GONE
if (NutritionHelper.selectedMyProgram.your_journey != null) binding.desYourJourneyTextView.text =
NutritionHelper.selectedMyProgram.your_journey
Expand All @@ -130,8 +131,11 @@ class AboutNutritionPlanActivity : AppCompatActivity() {
}
}

if (keyFeature.isNotEmpty()) binding.desKeyFeaturesTextView1.text = keyFeature
if (NutritionHelper.selectedProgram.your_journey.isNotEmpty()) binding.desYourJourneyTextView.text =
if (keyFeature != null && keyFeature.isNotEmpty()) binding.desKeyFeaturesTextView1.text =
keyFeature
else binding.keyFeaturesTextView.visibility = View.GONE
if (NutritionHelper.selectedProgram.your_journey != null) binding.desYourJourneyTextView.text =
NutritionHelper.selectedProgram.your_journey
else binding.yourJourneyTextView.visibility = View.GONE
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,10 @@ class NutritionViewPagerAdapter(
private fun initPlansPrograms() {
binding.recycleView.layoutManager =
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)

val data = allMealsResponse.data.asReversed()
val programsAdapter =
NutritionProgramsAdapter(allMealsResponse.data, this@NutritionViewPagerAdapter)
NutritionProgramsAdapter(data, this@NutritionViewPagerAdapter)
binding.recycleView.adapter = programsAdapter
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/item_customworkout_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:textColor="@color/white_700"
tools:text="50 kg" />
android:text="0 kg" />

</LinearLayout>

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/layout/item_nutrition_program.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@
android:layout_marginTop="16dp"
android:layout_marginEnd="32dp"
android:layout_marginBottom="16dp"
android:maxLines="1"
android:textColor="@color/white"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="@+id/image"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.14"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/image"
app:layout_constraintVertical_bias="0.39999998"
tools:text="Plan Name" />

<TextView
Expand All @@ -56,6 +58,7 @@
android:layout_marginBottom="16dp"
android:textColor="@color/white"
android:textSize="16sp"
android:maxLines="2"
app:layout_constraintBottom_toBottomOf="@+id/image"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.14"
Expand Down

0 comments on commit 5718648

Please sign in to comment.