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

Populate nutrition programs correctly #43

Merged
merged 1 commit into from
Jun 23, 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
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
Loading