various small improvements

This commit is contained in:
Phillip Thelen 2022-12-09 15:35:31 +01:00
parent 077a5d903c
commit 175f067083
10 changed files with 31 additions and 22 deletions

View file

@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/colorWindowBackground" />
<corners android:radius="20dp" />
<stroke android:color="?colorAccent" android:width="2dp" />
<stroke android:color="?colorAccent" android:width="1dp" />
</shape>

View file

@ -1268,7 +1268,7 @@
<string name="completed_at">Completed at %s</string>
<string name="assign">Assign</string>
<string name="edit_assignees">Edit assignees</string>
<string name="assign_to">Assign to...</string>
<string name="assign_to">Assign to</string>
<string name="promote_to_manager">Promote to Manager</string>
<string name="manager">Manager</string>
<string name="member_list">Member List</string>
@ -1278,7 +1278,7 @@
<item quantity="other">You, %d others</item>
</plurals>
<plurals name="people">
<item quantity="one">%d Person</item>
<item quantity="other">%d People</item>
<item quantity="one">%d person</item>
<item quantity="other">%d people</item>
</plurals>
</resources>

View file

@ -57,7 +57,7 @@ abstract class RealmBaseLocalRepository internal constructor(override var realm:
private fun process() {
if (isClosed) { return }
realm.executeTransactionAsync {
realm.executeTransaction {
while (pendingSaves.isNotEmpty()) {
val pending = pendingSaves.removeFirst()
@Suppress("UNCHECKED_CAST")

View file

@ -97,7 +97,7 @@ class RealmTaskLocalRepository(realm: Realm) : RealmBaseLocalRepository(realm),
private fun removeOldChecklists(onlineItems: List<ChecklistItem>) {
val localItems = realm.where(ChecklistItem::class.java).findAll().createSnapshot()
val itemsToDelete = localItems.filterNot { onlineItems.contains(it) }
executeTransaction {
realm.executeTransaction {
for (item in itemsToDelete) {
item.deleteFromRealm()
}
@ -107,7 +107,7 @@ class RealmTaskLocalRepository(realm: Realm) : RealmBaseLocalRepository(realm),
private fun removeOldReminders(onlineReminders: List<RemindersItem>) {
val localReminders = realm.where(RemindersItem::class.java).findAll().createSnapshot()
val itemsToDelete = localReminders.filterNot { onlineReminders.contains(it) }
executeTransaction {
realm.executeTransaction {
for (item in itemsToDelete) {
item.deleteFromRealm()
}

View file

@ -30,6 +30,7 @@ import androidx.compose.ui.res.colorResource
import androidx.core.os.bundleOf
import androidx.core.view.children
import androidx.core.view.forEachIndexed
import androidx.core.view.isVisible
import androidx.core.widget.NestedScrollView
import androidx.lifecycle.lifecycleScope
import com.habitrpg.android.habitica.R
@ -241,6 +242,9 @@ class TaskFormActivity : BaseActivity() {
groupMembers = it
}
}
binding.tagsTitleView.isVisible = false
binding.tagsWrapper.isVisible = false
} else {
binding.assignTitleView.visibility = View.GONE
binding.assignView.visibility = View.GONE

View file

@ -192,7 +192,7 @@ class TasksFragment : BaseMainFragment<FragmentViewpagerBinding>(), SearchView.O
private fun showFilterDialog() {
context?.let {
val dialog = TaskFilterDialog(it, HabiticaBaseApplication.userComponent)
val dialog = TaskFilterDialog(it, HabiticaBaseApplication.userComponent, viewModel.isPersonalBoard)
dialog.viewModel = viewModel
// There are some cases where these things might not be correctly set after the app resumes. This is just to catch that as best as possible

View file

@ -75,7 +75,7 @@ class DailyViewHolder(
override fun configureSpecialTaskTextView(task: Task) {
super.configureSpecialTaskTextView(task)
if ((task.streak ?: 0) > 0) {
if ((task.streak ?: 0) > 0 && !task.isGroupTask) {
this.streakTextView.text = task.streak.toString()
this.streakTextView.visibility = View.VISIBLE
this.streakIconView.visibility = View.VISIBLE

View file

@ -118,7 +118,7 @@ class HabitViewHolder(
}
val streakString = task?.streakString
if (streakString?.isNotEmpty() == true) {
if (streakString?.isNotEmpty() == true && task?.isGroupTask != true) {
streakTextView.text = streakString
streakTextView.visibility = View.VISIBLE
streakIconView.visibility = View.VISIBLE

View file

@ -153,7 +153,7 @@ fun AppHeaderView(
.clickable {
MainNavigationController.navigate(
R.id.guildFragment,
bundleOf("groupID" to teamPlan?.id)
bundleOf("groupID" to teamPlan?.id, "tabToOpen" to 1)
)
}
) {
@ -168,11 +168,11 @@ fun AppHeaderView(
enter = slideInVertically { animHeight } + fadeIn(),
exit = slideOutVertically { animHeight } + fadeOut()) {
Row(
horizontalArrangement = Arrangement.spacedBy(14.dp, Alignment.CenterHorizontally),
horizontalArrangement = Arrangement.spacedBy(12.dp, Alignment.CenterHorizontally),
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.fillMaxWidth()
.padding(top = 12.dp)
.padding(top = 12.dp, start = 12.dp, end = 12.dp)
.height(40.dp)
.width(72.dp)
.clip(MaterialTheme.shapes.medium)

View file

@ -12,6 +12,7 @@ import android.widget.RadioGroup
import androidx.annotation.IdRes
import androidx.appcompat.widget.AppCompatCheckBox
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import androidx.core.widget.CompoundButtonCompat
import androidx.core.widget.TextViewCompat
import androidx.lifecycle.lifecycleScope
@ -31,7 +32,7 @@ import com.habitrpg.shared.habitica.models.tasks.TaskType
import java.util.UUID
import javax.inject.Inject
class TaskFilterDialog(context: Context, component: UserComponent?) : HabiticaBottomSheetDialog(context), RadioGroup.OnCheckedChangeListener {
class TaskFilterDialog(context: Context, component: UserComponent?, private val showTags: Boolean) : HabiticaBottomSheetDialog(context), RadioGroup.OnCheckedChangeListener {
lateinit var viewModel: TasksViewModel
private val binding = DialogTaskFilterBinding.inflate(layoutInflater)
@ -92,17 +93,21 @@ class TaskFilterDialog(context: Context, component: UserComponent?) : HabiticaBo
setActiveTags(null)
}
binding.tagEditButton.setOnClickListener { editButtonClicked() }
}
override fun dismiss() {
super.dismiss()
if (showTags) {
binding.tagEditButton.setOnClickListener { editButtonClicked() }
} else {
binding.tagsList.isVisible = false
binding.tagsTitle.isVisible = false
binding.tagEditButton.isVisible = false
}
}
override fun show() {
lifecycleScope.launchCatching {
viewModel.tagRepository.getTags().collect {
setTags(it)
if (showTags) {
lifecycleScope.launchCatching {
viewModel.tagRepository.getTags().collect {
setTags(it)
}
}
}
super.show()