Skip to content

Commit

Permalink
Merge pull request #1123 from hyperskill/hotfix/Fix-android-home-scre…
Browse files Browse the repository at this point in the history
…en-is-not-shown

Hotfix 1.65.1
  • Loading branch information
ivan-magda authored Jul 25, 2024
2 parents 54f25bf + e42dbc8 commit 9e7aea8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.hyperskill.app.android.gamification_toolbar.view.ui.delegate

import android.content.Context
import android.util.TypedValue
import androidx.annotation.DrawableRes
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.doOnNextLayout
Expand All @@ -22,6 +23,7 @@ import org.hyperskill.app.android.main.view.ui.navigation.switch
import org.hyperskill.app.android.problems_limit.dialog.ProblemsLimitInfoBottomSheet
import org.hyperskill.app.android.progress.navigation.ProgressScreen
import org.hyperskill.app.android.topic_search.navigation.TopicSearchScreen
import org.hyperskill.app.android.view.base.ui.extension.setCompoundDrawables
import org.hyperskill.app.android.view.base.ui.extension.setElevationOnCollapsed
import org.hyperskill.app.gamification_toolbar.presentation.GamificationToolbarFeature
import org.hyperskill.app.gamification_toolbar.presentation.GamificationToolbarFeature.Message
Expand All @@ -33,7 +35,7 @@ class GamificationToolbarDelegate(
lifecycleOwner: LifecycleOwner,
private val context: Context,
private val viewBinding: LayoutGamificationToolbarBinding,
onChangeTrackClicked: () -> Unit = {},
onChangeTrackClicked: (() -> Unit)? = null,
onNewMessage: (Message) -> Unit,
) {

Expand All @@ -56,8 +58,10 @@ class GamificationToolbarDelegate(
gamificationProblemsLimitTextView.setOnClickListener {
onNewMessage(Message.ProblemsLimitClicked)
}
subtitleTextView.setOnClickListener {
onChangeTrackClicked()
if (onChangeTrackClicked != null) {
subtitleTextView.setOnClickListener {
onChangeTrackClicked()
}
}
}
}
Expand Down Expand Up @@ -157,13 +161,19 @@ class GamificationToolbarDelegate(
}
}

fun setSubtitle(subtitle: String?) {
fun setSubtitle(
subtitle: String?,
@DrawableRes drawableEnd: Int? = null
) {
this.subtitle = subtitle
with(viewBinding.subtitleTextView) {
isVisible = subtitle != null
if (subtitle != null) {
setTextIfChanged(subtitle)
}
if (subtitle != null) {
setCompoundDrawables(end = drawableEnd ?: -1)
}
}
applyInsetsToCollapsingToolbarLayout(
context = context,
Expand Down Expand Up @@ -206,7 +216,7 @@ class GamificationToolbarDelegate(
context.resources.getDimensionPixelOffset(R.dimen.gamification_toolbar_with_subtitle_height) +
subtitlePaddingVertical
} else {
R.dimen.gamification_toolbar_default_height
context.resources.getDimensionPixelOffset(R.dimen.gamification_toolbar_default_height)
} + insetTop
}
collapsingToolbarLayout.expandedTitleMarginTop = insetTop + subtitlePaddingVertical
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class StudyPlanFragment :
override fun render(state: StudyPlanScreenFeature.ViewState) {
renderSwipeRefresh(state)
gamificationToolbarDelegate?.render(state.toolbarViewState)
gamificationToolbarDelegate?.setSubtitle(state.trackTitle)
gamificationToolbarDelegate?.setSubtitle(state.trackTitle, R.drawable.ic_change_track)
studyPlanWidgetDelegate?.render(state.studyPlanWidgetViewState)
usersInterviewCardDelegate?.render(
state.usersInterviewWidgetState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
android:maxLines="1"
android:ellipsize="end"
android:gravity="center_vertical"
app:drawableEndCompat="@drawable/ic_change_track"
android:drawablePadding="10dp"
android:background="@drawable/selectable_item_rounded_background"
app:layout_collapseMode="parallax"
Expand All @@ -141,6 +140,7 @@
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:visibility="gone"
tools:drawableEndCompat="@drawable/ic_change_track"
tools:visibility="visible"
tools:text="Lorem Ipsum Iran Lorem Ipsum Iran Lorem Ipsu"/>

Expand Down
4 changes: 2 additions & 2 deletions gradle/app.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
minSdk = '24'
targetSdk = '34'
compileSdk = '34'
versionName = '1.65'
versionCode = '497'
versionName = '1.65.1'
versionCode = '498'

0 comments on commit 9e7aea8

Please sign in to comment.