Show streak in detail view

This commit is contained in:
Phillip Thelen 2022-06-29 13:32:23 +02:00
parent 5af1fc4010
commit 7335ef240b
4 changed files with 26 additions and 7 deletions

View file

@ -1,7 +1,7 @@
package com.habitrpg.wearos.habitica.ui.activities
import android.os.Bundle
import android.widget.LinearLayout
import android.widget.FrameLayout
import androidx.activity.viewModels
import androidx.core.view.isVisible
import com.habitrpg.android.habitica.R
@ -59,10 +59,10 @@ class RYAActivity : BaseActivity<ActivityRyaBinding, RYAViewModel>() {
taskBinding.root.setOnClickListener {
viewModel.tappedTask(task)
}
val layoutParams = taskBinding.root.layoutParams as LinearLayout.LayoutParams
val layoutParams = taskBinding.chip.layoutParams as FrameLayout.LayoutParams
layoutParams.marginStart = 0
layoutParams.marginEnd = 0
taskBinding.root.layoutParams = layoutParams
taskBinding.chip.layoutParams = layoutParams
holder.bind(task)
}
}

View file

@ -50,6 +50,13 @@ class TaskDetailActivity : BaseActivity<ActivityTaskDetailBinding, TaskDetailVie
} else {
binding.taskNotesView.isVisible = false
}
val streakString = task?.streakString
if (streakString != null) {
binding.taskStreakView.isVisible = true
binding.taskStreakView.text = streakString
} else {
binding.taskStreakView.isVisible = false
}
}
}
}

View file

@ -28,14 +28,26 @@
android:layout_height="wrap_content"
android:textColor="@color/gray_400"
android:gravity="center"
style="@style/Text.Body1"/>
<TextView
android:id="@+id/task_streak_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/watch_gray_200"
android:gravity="center"
android:drawableStart="@drawable/task_icon_streak"
android:drawableTint="@color/watch_gray_200"
android:drawablePadding="@dimen/spacing_small"
style="@style/Text.Body1"
android:layout_marginBottom="30dp"/>
android:textSize="12sp"/>
<Button
android:id="@+id/edit_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/ChipButton"
android:drawableStart="@drawable/handoff"
android:text="@string/edit_on_phone"/>
android:text="@string/edit_on_phone"
android:layout_marginTop="12dp"/>
</LinearLayout>
</com.habitrpg.wearos.habitica.ui.views.HabiticaScrollView>

View file

@ -2,9 +2,9 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/chip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Chip">