diff --git a/app/src/main/java/org/oppia/android/app/home/topiclist/TopicSummaryViewModel.kt b/app/src/main/java/org/oppia/android/app/home/topiclist/TopicSummaryViewModel.kt index 36807c9d4cf..269e75c5b16 100755 --- a/app/src/main/java/org/oppia/android/app/home/topiclist/TopicSummaryViewModel.kt +++ b/app/src/main/java/org/oppia/android/app/home/topiclist/TopicSummaryViewModel.kt @@ -2,6 +2,7 @@ package org.oppia.android.app.home.topiclist import androidx.appcompat.app.AppCompatActivity import org.oppia.android.R +import android.util.Log import org.oppia.android.app.home.HomeItemViewModel import org.oppia.android.app.model.EphemeralTopicSummary import org.oppia.android.app.translation.AppLanguageResourceHandler @@ -11,7 +12,7 @@ import java.util.Objects /** The view model corresponding to individual topic summaries in the topic summary RecyclerView. */ class TopicSummaryViewModel( private val activity: AppCompatActivity, - ephemeralTopicSummary: EphemeralTopicSummary, + private val ephemeralTopicSummary: EphemeralTopicSummary, val entityType: String, private val topicSummaryClickListener: TopicSummaryClickListener, private val position: Int, @@ -41,72 +42,12 @@ class TopicSummaryViewModel( topicSummaryClickListener.onTopicSummaryClicked(topicSummary) } - /** - * Determines the start margin for an individual TopicSummary relative to the grid columns laid out on the - * HomeActivity. GridLayout columns are evenly spread out across the entire activity screen but the - * Topic Summaries are positioned towards the center, so start margins are calculated to stagger inside each - * fixed column but centered on the activity's layout, as shown below. - * - * | _____| _____ | _____ |_____ | - * | | | | | | | | | | | - * | | | | | | | | | | | - * | |_____| |_____| | |_____| |_____| | - * | | | | | - * | _____ _____ _____ _____ | - * | | | | | | | | | | - * | | | | | | | | | | - * | |_____| |_____| |_____| |_____| | - * | | - */ fun computeStartMargin(): Int { - return when (spanCount) { - 2 -> when (position % spanCount) { - 0 -> outerMargin - else -> innerMargin - } - 3 -> when (position % spanCount) { - 0 -> outerMargin - 1 -> innerMargin - 2 -> 0 - else -> 0 - } - 4 -> when (position % spanCount) { - 0 -> outerMargin - 1 -> innerMargin - 2 -> innerMargin / 2 - 3 -> 0 - else -> 0 - } - else -> 0 - } + return outerMargin } - /** - * Determines the end margin for an individual TopicSummary relative to the grid columns laid out on the - * HomeActivity. The end margins are calculated to stagger inside each fixed column but centered on the - * activity's layout (see [computeStartMargin]). - */ fun computeEndMargin(): Int { - return when (spanCount) { - 2 -> when (position % spanCount) { - 0 -> innerMargin - else -> outerMargin - } - 3 -> when (position % spanCount) { - 0 -> 0 - 1 -> innerMargin - 2 -> outerMargin - else -> 0 - } - 4 -> when (position % spanCount) { - 0 -> 0 - 1 -> innerMargin / 2 - 2 -> innerMargin - 3 -> outerMargin - else -> 0 - } - else -> 0 - } + return innerMargin } fun computeLessonCountText(): String {