A fork of Simple Time Tracker with WearOS support. (Now integrated upstream)
0

Configure Feed

Select the types of activity you want to include in your feed.

add categories and archive hint

razeeman (Nov 13, 2022, 3:26 PM +0300) 788e161e ac2237fa

+153 -59
+2
core/src/main/res/values-de/strings.xml
··· 62 62 63 63 <!-- Categories --> 64 64 <string name="categories_title">Kategorien und Tags</string> 65 + <string name="categories_edit_hint">Klicken Sie zum Bearbeiten auf die Karte</string> 65 66 <string name="categories_record_type_hint">Weise verschiedenen Aktivitäten denselben Kategorie zu, um gruppierten Statistiken anzuzeigen</string> 66 67 <string name="categories_record_hint">Ordne den Datensätzen verschiedene Tags zu, um sie zu unterscheiden</string> 67 68 <string name="categories_add_category">Kategorie hinzufügen</string> ··· 290 291 <string name="notification_record_type_goal_time">ziel %s</string> 291 292 292 293 <!-- Archive --> 294 + <string name="archive_hint">Klicken Sie auf die Karte, um Details anzuzeigen</string> 293 295 <string name="archive_dialog_delete">Löschen</string> 294 296 <string name="archive_dialog_restore">Wiederherstellen</string> 295 297 <string name="archive_empty">Das Archiv ist leer</string>
+2
core/src/main/res/values-es/strings.xml
··· 62 62 63 63 <!-- Categories --> 64 64 <string name="categories_title">Categorías y etiquetas</string> 65 + <string name="categories_edit_hint">Haga clic en la tarjeta para editar</string> 65 66 <string name="categories_record_type_hint">Asigne la misma categoría a diferentes actividades para ver las estadísticas del grupo</string> 66 67 <string name="categories_record_hint">Asigne diferentes etiquetas para registrar las diferencias entre ellas.</string> 67 68 <string name="categories_add_category">Añadir categoría</string> ··· 290 291 <string name="notification_record_type_goal_time">objetivo %s</string> 291 292 292 293 <!-- Archive --> 294 + <string name="archive_hint">Haga clic en la tarjeta para ver los detalles</string> 293 295 <string name="archive_dialog_delete">Eliminar</string> 294 296 <string name="archive_dialog_restore">Restaurar</string> 295 297 <string name="archive_empty">El archivo está vacío</string>
+2
core/src/main/res/values-fr/strings.xml
··· 62 62 63 63 <!-- Categories --> 64 64 <string name="categories_title">Catégories et étiquettes</string> 65 + <string name="categories_edit_hint">Cliquez sur la carte pour modifier</string> 65 66 <string name="categories_record_type_hint">Attribuez la même catégorie à différentes activités pour afficher leurs statistiques groupées</string> 66 67 <string name="categories_record_hint">Attribuez différentes étiquettes aux enregistrements pour les différencier</string> 67 68 <string name="categories_add_category">Créer une catégorie</string> ··· 290 291 <string name="notification_record_type_goal_time">objectif %s</string> 291 292 292 293 <!-- Archive --> 294 + <string name="archive_hint">Cliquez sur la carte pour voir les détails</string> 293 295 <string name="archive_dialog_delete">Supprimer</string> 294 296 <string name="archive_dialog_restore">Restaurer</string> 295 297 <string name="archive_empty">L\'archive est vide</string>
+2
core/src/main/res/values-in/strings.xml
··· 62 62 63 63 <!-- Categories --> 64 64 <string name="categories_title">Kategori dan tag</string> 65 + <string name="categories_edit_hint">Klik pada kartu untuk mengedit</string> 65 66 <string name="categories_record_type_hint">Tetapkan kategori yang sama untuk kegiatan yang berbeda untuk melihat statistik yang dikelompokkan</string> 66 67 <string name="categories_record_hint">Tetapkan label yang berbeda ke rekaman untuk membedakannya</string> 67 68 <string name="categories_add_category">Tambahkan kategori</string> ··· 290 291 <string name="notification_record_type_goal_time">tujuan %s</string> 291 292 292 293 <!-- Archive --> 294 + <string name="archive_hint">Klik pada kartu untuk melihat detail</string> 293 295 <string name="archive_dialog_delete">Menghapus</string> 294 296 <string name="archive_dialog_restore">Memulihkan</string> 295 297 <string name="archive_empty">Arsip kosong</string>
+2
core/src/main/res/values-it/strings.xml
··· 62 62 63 63 <!-- Categories --> 64 64 <string name="categories_title">Categorie e tag</string> 65 + <string name="categories_edit_hint">Clicca sulla scheda per modificare</string> 65 66 <string name="categories_record_type_hint">Assegna la stessa categoria a differenti attività per mostrare le relative statistiche raggruppate</string> 66 67 <string name="categories_record_hint">Assegna diverse etichette alle registrazioni per differenziarle tra loro</string> 67 68 <string name="categories_add_category">Aggiungi categoria</string> ··· 290 291 <string name="notification_record_type_goal_time">obiettivo %s</string> 291 292 292 293 <!-- Archive --> 294 + <string name="archive_hint">Clicca sulla scheda per visualizzare i dettagli</string> 293 295 <string name="archive_dialog_delete">Elimina</string> 294 296 <string name="archive_dialog_restore">Ripristina</string> 295 297 <string name="archive_empty">L\'archivio è vuoto</string>
+2
core/src/main/res/values-ja/strings.xml
··· 62 62 63 63 <!-- Categories --> 64 64 <string name="categories_title">カテゴリとタグ</string> 65 + <string name="categories_edit_hint">カードをクリックして編集します</string> 65 66 <string name="categories_record_type_hint">同じカテゴリを異なるアクティビティに割り当てて、グループ化された統計を表示します</string> 66 67 <string name="categories_record_hint">計測記録に異なるタグを付与し、計測記録を区別することが可能です</string> 67 68 <string name="categories_add_category">カテゴリを追加</string> ··· 290 291 <string name="notification_record_type_goal_time">目標 %s</string> 291 292 292 293 <!-- Archive --> 294 + <string name="archive_hint">カードをクリックすると詳細が表示されます</string> 293 295 <string name="archive_dialog_delete">削除</string> 294 296 <string name="archive_dialog_restore">復元</string> 295 297 <string name="archive_empty">アーカイブはありません</string>
+2
core/src/main/res/values-nl/strings.xml
··· 62 62 63 63 <!-- Categories --> 64 64 <string name="categories_title">Categorieën en tags</string> 65 + <string name="categories_edit_hint">Klik op de kaart om te bewerken</string> 65 66 <string name="categories_record_type_hint">Wijs hetzelfde categorie toe aan verschillende activiteiten om hun gegroepeerde statistieken te bekijken</string> 66 67 <string name="categories_record_hint">Wijs verschillende labels toe aan records om ze te onderscheiden</string> 67 68 <string name="categories_add_category">Categorie toevoegen</string> ··· 290 291 <string name="notification_record_type_goal_time">doelstelling %s</string> 291 292 292 293 <!-- Archive --> 294 + <string name="archive_hint">Klik op de kaart om details te bekijken</string> 293 295 <string name="archive_dialog_delete">Verwijderen</string> 294 296 <string name="archive_dialog_restore">Herstellen</string> 295 297 <string name="archive_empty">Archief is leeg</string>
+2
core/src/main/res/values-pt/strings.xml
··· 62 62 63 63 <!-- Categories --> 64 64 <string name="categories_title">Categorias e tags</string> 65 + <string name="categories_edit_hint">Clique no cartão para editar</string> 65 66 <string name="categories_record_type_hint">Atribua a mesma categoria a diferentes atividades para visualizar suas estatísticas agrupadas</string> 66 67 <string name="categories_record_hint">Atribua tags diferentes aos registros para diferenciá-los</string> 67 68 <string name="categories_add_category">Adicionar categoria</string> ··· 286 287 <string name="notification_record_type_goal_time">meta %s</string> 287 288 288 289 <!-- Archive --> 290 + <string name="archive_hint">Clique no cartão para ver os detalhes</string> 289 291 <string name="archive_dialog_delete">Deletar</string> 290 292 <string name="archive_dialog_restore">Restaurar</string> 291 293 <string name="archive_empty">O arquivo está vazio</string>
+2
core/src/main/res/values-ru/strings.xml
··· 62 62 63 63 <!-- Categories --> 64 64 <string name="categories_title">Категории и теги</string> 65 + <string name="categories_edit_hint">Нажмите на карточку для редактирования</string> 65 66 <string name="categories_record_type_hint">Назначьте одну и ту же категорию разным активностям, чтобы просматривать их сгруппированную статистику</string> 66 67 <string name="categories_record_hint">Назначьте разные теги записям, чтобы различать их</string> 67 68 <string name="categories_add_category">Добавить категорию</string> ··· 290 291 <string name="notification_record_type_goal_time">цель %s</string> 291 292 292 293 <!-- Archive --> 294 + <string name="archive_hint">Нажмите на карточку для просмотра деталей</string> 293 295 <string name="archive_dialog_delete">Удалить</string> 294 296 <string name="archive_dialog_restore">Восстановить</string> 295 297 <string name="archive_empty">Архив пуст</string>
+2
core/src/main/res/values-sv/strings.xml
··· 62 62 63 63 <!-- Categories --> 64 64 <string name="categories_title">Kategorier och taggar</string> 65 + <string name="categories_edit_hint">Klicka på kortet för att redigera</string> 65 66 <string name="categories_record_type_hint">Ge flera aktiviteter samma kategori för att se gruppstatistik</string> 66 67 <string name="categories_record_hint">Ge händelser olika taggar för att skilja dem åt</string> 67 68 <string name="categories_add_category">Lägg till kategori</string> ··· 290 291 <string name="notification_record_type_goal_time">tidsmål %s</string> 291 292 292 293 <!-- Archive --> 294 + <string name="archive_hint">Klicka på kortet för att se detaljer</string> 293 295 <string name="archive_dialog_delete">Ta bort</string> 294 296 <string name="archive_dialog_restore">Återställ</string> 295 297 <string name="archive_empty">Arkiv tomt</string>
+2
core/src/main/res/values-tr/strings.xml
··· 62 62 63 63 <!-- Categories --> 64 64 <string name="categories_title">Kategoriler ve etiketler</string> 65 + <string name="categories_edit_hint">Düzenlemek için karta tıklayın</string> 65 66 <string name="categories_record_type_hint">Farklı aktivitelerin istatistiklerini grup halinde görmek için aynı kategoriyi farklı aktivitelere atayın</string> 66 67 <string name="categories_record_hint">Aralarında ayrım yapabilmek için kayıtlara farklı etiketler atayın</string> 67 68 <string name="categories_add_category">Kategori ekle</string> ··· 290 291 <string name="notification_record_type_goal_time">hedef %s</string> 291 292 292 293 <!-- Archive --> 294 + <string name="archive_hint">Ayrıntıları görmek için karta tıklayın</string> 293 295 <string name="archive_dialog_delete">Sil</string> 294 296 <string name="archive_dialog_restore">Geri yükle</string> 295 297 <string name="archive_empty">Arşiv boş</string>
+2
core/src/main/res/values-uk/strings.xml
··· 62 62 63 63 <!-- Categories --> 64 64 <string name="categories_title">Категорії та теги</string> 65 + <string name="categories_edit_hint">Натисніть картку для редагування</string> 65 66 <string name="categories_record_type_hint">Призначте ту саму категорію різним активностям, щоб переглядати їх згруповану статистику</string> 66 67 <string name="categories_record_hint">Призначте різні теги записам, щоб розрізняти їх</string> 67 68 <string name="categories_add_category">Додати категорію</string> ··· 290 291 <string name="notification_record_type_goal_time">ціль %s</string> 291 292 292 293 <!-- Archive --> 294 + <string name="archive_hint">Натисніть картку, щоб переглянути деталі</string> 293 295 <string name="archive_dialog_delete">Видалити</string> 294 296 <string name="archive_dialog_restore">Відновити</string> 295 297 <string name="archive_empty">Архів порожній</string>
+2
core/src/main/res/values-zh/strings.xml
··· 62 62 63 63 <!-- Categories --> 64 64 <string name="categories_title">类别和标签</string> 65 + <string name="categories_edit_hint">点击卡片进行编辑</string> 65 66 <string name="categories_record_type_hint">将同一类别分配给不同的活动以查看其分组统计信息</string> 66 67 <string name="categories_record_hint">为同一种活动记录分配不同的标签,细致地区分它们</string> 67 68 <string name="categories_add_category">添加类别</string> ··· 290 291 <string name="notification_record_type_goal_time">目标时间 %s</string> 291 292 292 293 <!-- Archive --> 294 + <string name="archive_hint">点击卡片查看详情</string> 293 295 <string name="archive_dialog_delete">删除</string> 294 296 <string name="archive_dialog_restore">恢复</string> 295 297 <string name="archive_empty">存档为空</string>
+2
core/src/main/res/values/strings.xml
··· 62 62 63 63 <!-- Categories --> 64 64 <string name="categories_title">Categories and tags</string> 65 + <string name="categories_edit_hint">Click on card to edit</string> 65 66 <string name="categories_record_type_hint">Assign the same category to different activities to view their grouped statistics</string> 66 67 <string name="categories_record_hint">Assign different tags to records to differentiate between them</string> 67 68 <string name="categories_add_category">Add category</string> ··· 290 291 <string name="notification_record_type_goal_time">goal %s</string> 291 292 292 293 <!-- Archive --> 294 + <string name="archive_hint">Click on card to view details</string> 293 295 <string name="archive_dialog_delete">Delete</string> 294 296 <string name="archive_dialog_restore">Restore</string> 295 297 <string name="archive_empty">Archive is empty</string>
+2 -2
domain/src/main/java/com/example/util/simpletimetracker/domain/model/ActivityFilter.kt
··· 10 10 ) { 11 11 12 12 sealed interface Type { 13 - object Category: Type 14 - object Activity: Type 13 + object Category : Type 14 + object Activity : Type 15 15 } 16 16 }
+14 -7
features/feature_archive/src/main/java/com/example/util/simpletimetracker/feature_archive/interactor/ArchiveViewDataInteractor.kt
··· 1 1 package com.example.util.simpletimetracker.feature_archive.interactor 2 2 3 - import com.example.util.simpletimetracker.feature_base_adapter.ViewHolderType 4 - import com.example.util.simpletimetracker.feature_base_adapter.divider.DividerViewData 5 - import com.example.util.simpletimetracker.feature_base_adapter.hint.HintViewData 6 3 import com.example.util.simpletimetracker.core.mapper.CategoryViewDataMapper 7 4 import com.example.util.simpletimetracker.core.mapper.RecordTypeViewDataMapper 8 5 import com.example.util.simpletimetracker.core.repo.ResourceRepo ··· 10 7 import com.example.util.simpletimetracker.domain.interactor.RecordTagInteractor 11 8 import com.example.util.simpletimetracker.domain.interactor.RecordTypeInteractor 12 9 import com.example.util.simpletimetracker.feature_archive.R 10 + import com.example.util.simpletimetracker.feature_archive.viewData.ArchiveViewData 11 + import com.example.util.simpletimetracker.feature_base_adapter.ViewHolderType 12 + import com.example.util.simpletimetracker.feature_base_adapter.divider.DividerViewData 13 + import com.example.util.simpletimetracker.feature_base_adapter.hint.HintViewData 13 14 import javax.inject.Inject 14 15 15 16 class ArchiveViewDataInteractor @Inject constructor( ··· 20 21 private val recordTagInteractor: RecordTagInteractor, 21 22 // mappers 22 23 private val recordTypeViewDataMapper: RecordTypeViewDataMapper, 23 - private val categoryViewDataMapper: CategoryViewDataMapper 24 + private val categoryViewDataMapper: CategoryViewDataMapper, 24 25 ) { 25 26 26 - suspend fun getViewData(): List<ViewHolderType> { 27 + suspend fun getViewData(): ArchiveViewData { 27 28 val result: MutableList<ViewHolderType> = mutableListOf() 28 29 val numberOfCards = prefsInteractor.getNumberOfCards() 29 30 val isDarkTheme = prefsInteractor.getDarkMode() 30 31 31 - val types = recordTypeInteractor.getAll().map { it.id to it }.toMap() 32 + val types = recordTypeInteractor.getAll().associateBy { it.id } 32 33 val archivedTypes = types.values.filter { it.hidden } 33 34 val archivedRecordTags = recordTagInteractor.getAll().filter { it.archived } 34 35 ··· 70 71 HintViewData(resourceRepo.getString(R.string.archive_empty)).let(result::add) 71 72 } 72 73 73 - return result 74 + val showHint = archivedTypes.isNotEmpty() || 75 + archivedRecordTags.isNotEmpty() 76 + 77 + return ArchiveViewData( 78 + items = result, 79 + showHint = showHint, 80 + ) 74 81 } 75 82 }
+5 -1
features/feature_archive/src/main/java/com/example/util/simpletimetracker/feature_archive/view/ArchiveFragment.kt
··· 22 22 import dagger.hilt.android.AndroidEntryPoint 23 23 import javax.inject.Inject 24 24 import com.example.util.simpletimetracker.feature_archive.databinding.ArchiveFragmentBinding as Binding 25 + import androidx.core.view.isVisible 25 26 26 27 @AndroidEntryPoint 27 28 class ArchiveFragment : ··· 61 62 } 62 63 63 64 override fun initViewModel(): Unit = with(viewModel) { 64 - viewData.observe(archiveAdapter::replace) 65 + viewData.observe { 66 + archiveAdapter.replace(it.items) 67 + binding.tvArchiveHint.isVisible = it.showHint 68 + } 65 69 } 66 70 67 71 override fun onDeleteClick(params: ArchiveDialogParams?) =
+8
features/feature_archive/src/main/java/com/example/util/simpletimetracker/feature_archive/viewData/ArchiveViewData.kt
··· 1 + package com.example.util.simpletimetracker.feature_archive.viewData 2 + 3 + import com.example.util.simpletimetracker.feature_base_adapter.ViewHolderType 4 + 5 + data class ArchiveViewData( 6 + val items: List<ViewHolderType>, 7 + val showHint: Boolean, 8 + )
+8 -5
features/feature_archive/src/main/java/com/example/util/simpletimetracker/feature_archive/viewModel/ArchiveViewModel.kt
··· 10 10 import com.example.util.simpletimetracker.domain.interactor.RecordTypeInteractor 11 11 import com.example.util.simpletimetracker.feature_archive.R 12 12 import com.example.util.simpletimetracker.feature_archive.interactor.ArchiveViewDataInteractor 13 - import com.example.util.simpletimetracker.feature_base_adapter.ViewHolderType 13 + import com.example.util.simpletimetracker.feature_archive.viewData.ArchiveViewData 14 14 import com.example.util.simpletimetracker.feature_base_adapter.category.CategoryViewData 15 15 import com.example.util.simpletimetracker.feature_base_adapter.loader.LoaderViewData 16 16 import com.example.util.simpletimetracker.feature_base_adapter.recordType.RecordTypeViewData ··· 29 29 private val recordTagInteractor: RecordTagInteractor, 30 30 ) : ViewModel() { 31 31 32 - val viewData: LiveData<List<ViewHolderType>> by lazy { 33 - return@lazy MutableLiveData<List<ViewHolderType>>().let { initial -> 32 + val viewData: LiveData<ArchiveViewData> by lazy { 33 + return@lazy MutableLiveData<ArchiveViewData>().let { initial -> 34 34 viewModelScope.launch { 35 - initial.value = listOf(LoaderViewData()) 35 + initial.value = ArchiveViewData( 36 + items = listOf(LoaderViewData()), 37 + showHint = false, 38 + ) 36 39 initial.value = loadViewData() 37 40 } 38 41 initial ··· 118 121 viewData.set(data) 119 122 } 120 123 121 - private suspend fun loadViewData(): List<ViewHolderType> { 124 + private suspend fun loadViewData(): ArchiveViewData { 122 125 return archiveViewDataInteractor.getViewData() 123 126 } 124 127
+13 -1
features/feature_archive/src/main/res/layout/archive_fragment.xml
··· 19 19 android:textStyle="bold" 20 20 app:layout_constraintTop_toTopOf="parent" /> 21 21 22 + <androidx.appcompat.widget.AppCompatTextView 23 + android:id="@+id/tvArchiveHint" 24 + android:layout_width="match_parent" 25 + android:layout_height="wrap_content" 26 + android:layout_marginHorizontal="12dp" 27 + android:gravity="center" 28 + android:text="@string/archive_hint" 29 + android:textColor="?appTextHintColor" 30 + android:visibility="gone" 31 + app:layout_constraintTop_toBottomOf="@id/tvArchiveTitle" 32 + tools:visibility="visible" /> 33 + 22 34 <com.example.util.simpletimetracker.feature_views.DividerView 23 35 android:id="@+id/dividerArchive" 24 36 android:layout_width="match_parent" 25 37 android:layout_height="wrap_content" 26 - app:layout_constraintTop_toBottomOf="@id/tvArchiveTitle" /> 38 + app:layout_constraintTop_toBottomOf="@id/tvArchiveHint" /> 27 39 28 40 <androidx.recyclerview.widget.RecyclerView 29 41 android:id="@+id/rvArchiveList"
+21 -7
features/feature_categories/src/main/java/com/example/util/simpletimetracker/feature_categories/interactor/CategoriesViewDataInteractor.kt
··· 8 8 import com.example.util.simpletimetracker.domain.interactor.RecordTagInteractor 9 9 import com.example.util.simpletimetracker.domain.interactor.RecordTypeInteractor 10 10 import com.example.util.simpletimetracker.core.mapper.CategoriesViewDataMapper 11 + import com.example.util.simpletimetracker.feature_categories.viewData.CategoriesViewData 11 12 import kotlinx.coroutines.async 12 13 import kotlinx.coroutines.coroutineScope 13 14 import javax.inject.Inject ··· 21 22 private val categoriesViewDataMapper: CategoriesViewDataMapper, 22 23 ) { 23 24 24 - suspend fun getViewData(): List<ViewHolderType> = coroutineScope { 25 + suspend fun getViewData(): CategoriesViewData = coroutineScope { 25 26 val typeTags = async { getRecordTypeTagViewData() } 26 27 val recordTags = async { getRecordTagViewData() } 27 28 28 - typeTags.await() + 29 + val items = typeTags.await().items + 29 30 DividerViewData(1) + 30 - recordTags.await() 31 + recordTags.await().items 32 + val showHint = typeTags.await().showHint || 33 + recordTags.await().showHint 34 + 35 + return@coroutineScope CategoriesViewData( 36 + items = items, 37 + showHint = showHint, 38 + ) 31 39 } 32 40 33 - private suspend fun getRecordTypeTagViewData(): List<ViewHolderType> { 41 + private suspend fun getRecordTypeTagViewData(): CategoriesViewData { 34 42 val categories = categoryInteractor.getAll() 35 43 val isDarkTheme = prefsInteractor.getDarkMode() 36 44 val result: MutableList<ViewHolderType> = mutableListOf() ··· 46 54 47 55 categoriesViewDataMapper.mapToTypeTagAddItem(isDarkTheme).let(result::add) 48 56 49 - return result 57 + return CategoriesViewData( 58 + items = result, 59 + showHint = categories.isNotEmpty(), 60 + ) 50 61 } 51 62 52 - private suspend fun getRecordTagViewData(): List<ViewHolderType> { 63 + private suspend fun getRecordTagViewData(): CategoriesViewData { 53 64 val tags = recordTagInteractor.getAll().filterNot { it.archived } 54 65 val types = recordTypeInteractor.getAll() 55 66 val isDarkTheme = prefsInteractor.getDarkMode() ··· 70 81 71 82 categoriesViewDataMapper.mapToRecordTagAddItem(isDarkTheme).let(result::add) 72 83 73 - return result 84 + return CategoriesViewData( 85 + items = result, 86 + showHint = tags.isNotEmpty(), 87 + ) 74 88 } 75 89 }
+5 -1
features/feature_categories/src/main/java/com/example/util/simpletimetracker/feature_categories/view/CategoriesFragment.kt
··· 19 19 import dagger.hilt.android.AndroidEntryPoint 20 20 import javax.inject.Inject 21 21 import com.example.util.simpletimetracker.feature_categories.databinding.CategoriesFragmentBinding as Binding 22 + import androidx.core.view.isVisible 22 23 23 24 @AndroidEntryPoint 24 25 class CategoriesFragment : BaseFragment<Binding>() { ··· 63 64 } 64 65 65 66 override fun initViewModel(): Unit = with(viewModel) { 66 - categories.observe(categoriesAdapter::replace) 67 + categories.observe { 68 + categoriesAdapter.replace(it.items) 69 + binding.tvCategoriesEditHint.isVisible = it.showHint 70 + } 67 71 } 68 72 69 73 override fun onResume() {
+8
features/feature_categories/src/main/java/com/example/util/simpletimetracker/feature_categories/viewData/CategoriesViewData.kt
··· 1 + package com.example.util.simpletimetracker.feature_categories.viewData 2 + 3 + import com.example.util.simpletimetracker.feature_base_adapter.ViewHolderType 4 + 5 + data class CategoriesViewData( 6 + val items: List<ViewHolderType>, 7 + val showHint: Boolean, 8 + )
+10 -6
features/feature_categories/src/main/java/com/example/util/simpletimetracker/feature_categories/viewModel/CategoriesViewModel.kt
··· 4 4 import androidx.lifecycle.MutableLiveData 5 5 import androidx.lifecycle.ViewModel 6 6 import androidx.lifecycle.viewModelScope 7 + import com.example.util.simpletimetracker.core.extension.set 7 8 import com.example.util.simpletimetracker.core.extension.toParams 8 - import com.example.util.simpletimetracker.feature_base_adapter.ViewHolderType 9 9 import com.example.util.simpletimetracker.feature_base_adapter.category.CategoryAddViewData 10 10 import com.example.util.simpletimetracker.feature_base_adapter.category.CategoryViewData 11 11 import com.example.util.simpletimetracker.feature_base_adapter.category.TagType 12 12 import com.example.util.simpletimetracker.feature_base_adapter.loader.LoaderViewData 13 13 import com.example.util.simpletimetracker.feature_categories.interactor.CategoriesViewDataInteractor 14 + import com.example.util.simpletimetracker.feature_categories.viewData.CategoriesViewData 14 15 import com.example.util.simpletimetracker.navigation.Router 15 16 import com.example.util.simpletimetracker.navigation.params.screen.ChangeCategoryFromTagsParams 16 17 import com.example.util.simpletimetracker.navigation.params.screen.ChangeRecordTagFromTagsParams ··· 23 24 private val categoriesViewDataInteractor: CategoriesViewDataInteractor, 24 25 ) : ViewModel() { 25 26 26 - val categories: LiveData<List<ViewHolderType>> by lazy { 27 - return@lazy MutableLiveData<List<ViewHolderType>>().let { initial -> 27 + val categories: LiveData<CategoriesViewData> by lazy { 28 + return@lazy MutableLiveData<CategoriesViewData>().let { initial -> 28 29 viewModelScope.launch { 29 - initial.value = listOf(LoaderViewData()) 30 + initial.value = CategoriesViewData( 31 + items = listOf(LoaderViewData()), 32 + showHint = false 33 + ) 30 34 initial.value = loadCategoriesViewData() 31 35 } 32 36 initial ··· 73 77 74 78 private fun updateCategories() = viewModelScope.launch { 75 79 val data = loadCategoriesViewData() 76 - (categories as MutableLiveData).value = data 80 + categories.set(data) 77 81 } 78 82 79 - private suspend fun loadCategoriesViewData(): List<ViewHolderType> { 83 + private suspend fun loadCategoriesViewData(): CategoriesViewData { 80 84 return categoriesViewDataInteractor.getViewData() 81 85 } 82 86 }
+3 -3
features/feature_categories/src/main/res/layout/categories_fragment.xml
··· 20 20 app:layout_constraintTop_toTopOf="parent" /> 21 21 22 22 <androidx.appcompat.widget.AppCompatTextView 23 - android:id="@+id/tvCategoriesHint" 23 + android:id="@+id/tvCategoriesEditHint" 24 24 android:layout_width="match_parent" 25 25 android:layout_height="wrap_content" 26 26 android:layout_marginHorizontal="12dp" 27 27 android:gravity="center" 28 - android:text="Hint text" 28 + android:text="@string/categories_edit_hint" 29 29 android:textColor="?appTextHintColor" 30 30 android:visibility="gone" 31 31 app:layout_constraintTop_toBottomOf="@id/tvCategoriesTitle" ··· 35 35 android:id="@+id/dividerCategories" 36 36 android:layout_width="match_parent" 37 37 android:layout_height="wrap_content" 38 - app:layout_constraintTop_toBottomOf="@id/tvCategoriesHint" /> 38 + app:layout_constraintTop_toBottomOf="@id/tvCategoriesEditHint" /> 39 39 40 40 <androidx.recyclerview.widget.RecyclerView 41 41 android:id="@+id/rvCategoriesList"
+7 -7
features/feature_change_record_type/src/main/java/com/example/util/simpletimetracker/feature_change_record_type/view/ChangeRecordTypeFragment.kt
··· 1 1 package com.example.util.simpletimetracker.feature_change_record_type.view 2 2 3 + import com.example.util.simpletimetracker.feature_change_record_type.databinding.ChangeRecordTypeFragmentBinding as Binding 3 4 import android.os.Bundle 4 5 import android.view.LayoutInflater 5 6 import android.view.ViewGroup 7 + import androidx.core.view.isVisible 6 8 import androidx.core.widget.doAfterTextChanged 7 9 import androidx.fragment.app.viewModels 8 10 import androidx.recyclerview.widget.GridLayoutManager ··· 22 24 import com.example.util.simpletimetracker.domain.model.IconEmojiType 23 25 import com.example.util.simpletimetracker.feature_base_adapter.BaseRecyclerAdapter 24 26 import com.example.util.simpletimetracker.feature_base_adapter.category.createCategoryAdapterDelegate 27 + import com.example.util.simpletimetracker.feature_base_adapter.category.createCategoryAddAdapterDelegate 25 28 import com.example.util.simpletimetracker.feature_base_adapter.color.createColorAdapterDelegate 26 29 import com.example.util.simpletimetracker.feature_base_adapter.color.createColorPaletteAdapterDelegate 27 30 import com.example.util.simpletimetracker.feature_base_adapter.divider.createDividerAdapterDelegate ··· 31 34 import com.example.util.simpletimetracker.feature_base_adapter.info.createInfoAdapterDelegate 32 35 import com.example.util.simpletimetracker.feature_base_adapter.recordType.RecordTypeViewData 33 36 import com.example.util.simpletimetracker.feature_change_record_type.R 34 - import com.example.util.simpletimetracker.feature_base_adapter.category.createCategoryAddAdapterDelegate 35 37 import com.example.util.simpletimetracker.feature_change_record_type.adapter.createChangeRecordTypeIconAdapterDelegate 36 38 import com.example.util.simpletimetracker.feature_change_record_type.adapter.createChangeRecordTypeIconCategoryAdapterDelegate 37 39 import com.example.util.simpletimetracker.feature_change_record_type.adapter.createChangeRecordTypeIconCategoryInfoAdapterDelegate ··· 45 47 import com.example.util.simpletimetracker.feature_views.extension.setOnClick 46 48 import com.example.util.simpletimetracker.feature_views.extension.setSpanSizeLookup 47 49 import com.example.util.simpletimetracker.feature_views.extension.updatePadding 48 - import com.example.util.simpletimetracker.feature_views.extension.visible 49 50 import com.example.util.simpletimetracker.navigation.params.screen.ChangeRecordTypeParams 50 51 import com.google.android.flexbox.FlexDirection 51 52 import com.google.android.flexbox.FlexWrap ··· 54 55 import dagger.hilt.android.AndroidEntryPoint 55 56 import javax.inject.Inject 56 57 import kotlin.math.max 57 - import com.example.util.simpletimetracker.feature_change_record_type.databinding.ChangeRecordTypeFragmentBinding as Binding 58 58 59 59 @AndroidEntryPoint 60 60 class ChangeRecordTypeFragment : ··· 173 173 override fun initViewModel(): Unit = with(binding) { 174 174 with(viewModel) { 175 175 extra = params 176 - deleteIconVisibility.observeOnce(viewLifecycleOwner, btnChangeRecordTypeDelete::visible::set) 176 + deleteIconVisibility.observeOnce(viewLifecycleOwner, btnChangeRecordTypeDelete::isVisible::set) 177 177 saveButtonEnabled.observe(btnChangeRecordTypeSave::setEnabled) 178 178 deleteButtonEnabled.observe(btnChangeRecordTypeDelete::setEnabled) 179 179 recordType.observeOnce(viewLifecycleOwner, ::updateUi) ··· 185 185 categories.observe(categoriesAdapter::replace) 186 186 goalTimeViewData.observe(tvChangeRecordTypeGoalTimeTime::setText) 187 187 flipColorChooser.observe { opened -> 188 - rvChangeRecordTypeColor.visible = opened 188 + rvChangeRecordTypeColor.isVisible = opened 189 189 fieldChangeRecordTypeColor.setChooserColor(opened) 190 190 arrowChangeRecordTypeColor.apply { 191 191 if (opened) rotateDown() else rotateUp() 192 192 } 193 193 } 194 194 flipIconChooser.observe { opened -> 195 - containerChangeRecordTypeIcon.visible = opened 195 + containerChangeRecordTypeIcon.isVisible = opened 196 196 fieldChangeRecordTypeIcon.setChooserColor(opened) 197 197 arrowChangeRecordTypeIcon.apply { 198 198 if (opened) rotateDown() else rotateUp() 199 199 } 200 200 } 201 201 flipCategoryChooser.observe { opened -> 202 - rvChangeRecordTypeCategories.visible = opened 202 + rvChangeRecordTypeCategories.isVisible = opened 203 203 fieldChangeRecordTypeCategory.setChooserColor(opened) 204 204 arrowChangeRecordTypeCategory.apply { 205 205 if (opened) rotateDown() else rotateUp()
+1 -1
features/feature_dialogs/src/main/java/com/example/util/simpletimetracker/feature_dialogs/helpDialog/HelpDialogFragment.kt
··· 28 28 setFullScreen() 29 29 } 30 30 31 - override fun initUi() = with (binding) { 31 + override fun initUi() = with(binding) { 32 32 tvHelpDialogTitle.text = params.title 33 33 tvHelpDialogDescription.text = HtmlCompat.fromHtml(params.text, FROM_HTML_MODE_LEGACY) 34 34 }
+1 -2
features/feature_notification/src/main/java/com/example/util/simpletimetracker/feature_notification/goalTime/scheduler/NotificationGoalTimeScheduler.kt
··· 31 31 private fun scheduleAtTime(timestamp: Long, typeId: Long) { 32 32 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 33 33 alarmManager?.setAndAllowWhileIdle(RTC_WAKEUP, timestamp, getPendingIntent(typeId)) 34 - } 35 - else { 34 + } else { 36 35 alarmManager?.set(RTC_WAKEUP, timestamp, getPendingIntent(typeId)) 37 36 } 38 37 }
+1 -2
features/feature_notification/src/main/java/com/example/util/simpletimetracker/feature_notification/inactivity/scheduler/NotificationInactivityScheduler.kt
··· 31 31 private fun scheduleAtTime(timestamp: Long) { 32 32 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 33 33 alarmManager?.setAndAllowWhileIdle(RTC_WAKEUP, timestamp, getPendingIntent()) 34 - } 35 - else { 34 + } else { 36 35 alarmManager?.set(RTC_WAKEUP, timestamp, getPendingIntent()) 37 36 } 38 37 }
+18 -14
features/feature_running_records/src/main/java/com/example/util/simpletimetracker/feature_running_records/interactor/RunningRecordsViewDataInteractor.kt
··· 104 104 isDarkTheme: Boolean, 105 105 ): List<ViewHolderType> { 106 106 return when (filter) { 107 - is Filter.NoFilter -> emptyList() 108 - is Filter.ApplyFilter -> filter.activityFilters 109 - .map { 110 - activityFilterViewDataMapper.map( 111 - filter = it, 112 - isDarkTheme = isDarkTheme, 107 + is Filter.NoFilter -> { 108 + emptyList() 109 + } 110 + is Filter.ApplyFilter -> { 111 + filter.activityFilters 112 + .map { 113 + activityFilterViewDataMapper.map( 114 + filter = it, 115 + isDarkTheme = isDarkTheme, 116 + ) 117 + } 118 + .plus( 119 + mapper.mapToActivityFilterAddItem( 120 + isDarkTheme = isDarkTheme, 121 + ) 113 122 ) 114 - } 115 - .plus( 116 - mapper.mapToActivityFilterAddItem( 117 - isDarkTheme = isDarkTheme, 123 + .plus( 124 + DividerViewData(2) 118 125 ) 119 - ) 120 - .plus( 121 - DividerViewData(2) 122 - ) 126 + } 123 127 } 124 128 } 125 129