Skip to content

Commit 5718648

Browse files
authored
Merge pull request #43 from Modarb-Ai-Trainer/pose_correction_and_detection
Populate nutrition programs correctly
2 parents 0d6fe64 + b1c0612 commit 5718648

5 files changed

Lines changed: 15 additions & 6 deletions

File tree

app/src/main/java/com/modarb/android/network/ApiService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ interface ApiService {
127127
@Header("Authorization") token: String,
128128
): Response<MyMealPlanResponse>
129129

130-
@GET("api/v1/user/mealPlans")
130+
@GET("api/v1/user/mealPlans?limit=200")
131131
suspend fun getAllMealsPlan(
132132
@Header("Authorization") token: String,
133133
): Response<AllMealsPlansResponse>

app/src/main/java/com/modarb/android/ui/home/ui/nutrition/activities/AboutNutritionPlanActivity.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ class AboutNutritionPlanActivity : AppCompatActivity() {
109109
}
110110
}
111111

112-
if (keyFeature.isNotEmpty()) binding.desKeyFeaturesTextView1.text = keyFeature
112+
if (keyFeature != null && keyFeature.isNotEmpty()) binding.desKeyFeaturesTextView1.text =
113+
keyFeature
113114
else binding.keyFeaturesTextView.visibility = View.GONE
114115
if (NutritionHelper.selectedMyProgram.your_journey != null) binding.desYourJourneyTextView.text =
115116
NutritionHelper.selectedMyProgram.your_journey
@@ -130,8 +131,11 @@ class AboutNutritionPlanActivity : AppCompatActivity() {
130131
}
131132
}
132133

133-
if (keyFeature.isNotEmpty()) binding.desKeyFeaturesTextView1.text = keyFeature
134-
if (NutritionHelper.selectedProgram.your_journey.isNotEmpty()) binding.desYourJourneyTextView.text =
134+
if (keyFeature != null && keyFeature.isNotEmpty()) binding.desKeyFeaturesTextView1.text =
135+
keyFeature
136+
else binding.keyFeaturesTextView.visibility = View.GONE
137+
if (NutritionHelper.selectedProgram.your_journey != null) binding.desYourJourneyTextView.text =
135138
NutritionHelper.selectedProgram.your_journey
139+
else binding.yourJourneyTextView.visibility = View.GONE
136140
}
137141
}

app/src/main/java/com/modarb/android/ui/home/ui/nutrition/adapters/NutritionViewPagerAdapter.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,10 @@ class NutritionViewPagerAdapter(
237237
private fun initPlansPrograms() {
238238
binding.recycleView.layoutManager =
239239
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
240+
241+
val data = allMealsResponse.data.asReversed()
240242
val programsAdapter =
241-
NutritionProgramsAdapter(allMealsResponse.data, this@NutritionViewPagerAdapter)
243+
NutritionProgramsAdapter(data, this@NutritionViewPagerAdapter)
242244
binding.recycleView.adapter = programsAdapter
243245
}
244246

app/src/main/res/layout/item_customworkout_template.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
android:layout_height="wrap_content"
105105
android:layout_margin="4dp"
106106
android:textColor="@color/white_700"
107-
tools:text="50 kg" />
107+
android:text="0 kg" />
108108

109109
</LinearLayout>
110110

app/src/main/res/layout/item_nutrition_program.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@
3838
android:layout_marginTop="16dp"
3939
android:layout_marginEnd="32dp"
4040
android:layout_marginBottom="16dp"
41+
android:maxLines="1"
4142
android:textColor="@color/white"
4243
android:textSize="20sp"
4344
app:layout_constraintBottom_toBottomOf="@+id/image"
4445
app:layout_constraintEnd_toEndOf="parent"
4546
app:layout_constraintHorizontal_bias="0.14"
4647
app:layout_constraintStart_toStartOf="parent"
4748
app:layout_constraintTop_toTopOf="@+id/image"
49+
app:layout_constraintVertical_bias="0.39999998"
4850
tools:text="Plan Name" />
4951

5052
<TextView
@@ -56,6 +58,7 @@
5658
android:layout_marginBottom="16dp"
5759
android:textColor="@color/white"
5860
android:textSize="16sp"
61+
android:maxLines="2"
5962
app:layout_constraintBottom_toBottomOf="@+id/image"
6063
app:layout_constraintEnd_toEndOf="parent"
6164
app:layout_constraintHorizontal_bias="0.14"

0 commit comments

Comments
 (0)