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

Hotfix 1.65.1 #1123

Merged
merged 2 commits into from
Jul 25, 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
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'