From 73c861eef61a046fc1fbd13a3dc71d0ccf934d28 Mon Sep 17 00:00:00 2001 From: flaviuvsp Date: Thu, 3 Oct 2024 11:45:23 +0300 Subject: [PATCH 1/7] Update version --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 63495ba4..59fff758 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,8 +15,8 @@ android { applicationId "org.permanent.PermanentArchive" minSdkVersion 26 targetSdkVersion 34 - versionCode 68 - versionName "1.9.2" + versionCode 69 + versionName "1.9.3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } From 7e195bc8f2311724e2c74125fe839577743341c2 Mon Sep 17 00:00:00 2001 From: flaviuvsp Date: Mon, 7 Oct 2024 12:18:22 +0300 Subject: [PATCH 2/7] Fix date issue Show message when file names updated --- .../org/permanent/permanent/models/Record.kt | 8 +++---- .../permanent/network/models/FileData.kt | 2 +- .../bulkEditMetadata/EditFileNamesFragment.kt | 21 ++++++++++++++++++- .../bulkEditMetadata/EditMetadataFragment.kt | 15 ++++++++++--- .../compose/EditDateTimeScreen.kt | 17 ++++++++++++++- .../compose/EditMetadataScreen.kt | 9 ++++++++ .../viewmodels/EditFileNamesViewModel.kt | 6 ++++++ .../viewmodels/EditMetadataViewModel.kt | 1 + 8 files changed, 69 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/permanent/permanent/models/Record.kt b/app/src/main/java/org/permanent/permanent/models/Record.kt index f013a923..0db8e77b 100644 --- a/app/src/main/java/org/permanent/permanent/models/Record.kt +++ b/app/src/main/java/org/permanent/permanent/models/Record.kt @@ -74,7 +74,7 @@ open class Record : Parcelable { folderLinkId = recordInfo.folder_linkId parentFolderLinkId = recordInfo.parentFolder_linkId displayName = recordInfo.displayName - displayDate = recordInfo.displayDT + displayDate = recordInfo.displayDT?.replace("T", " ") showArchiveThumb = false thumbURL200 = recordInfo.thumbURL200 thumbURL2000 = recordInfo.thumbURL2000 @@ -100,7 +100,7 @@ open class Record : Parcelable { folderLinkId = recordInfo.folder_linkId parentFolderLinkId = recordInfo.parentFolder_linkId displayName = recordInfo.displayName - displayDate = recordInfo.displayDT + displayDate = recordInfo.displayDT?.replace("T", " ") showArchiveThumb = false thumbURL200 = recordInfo.thumbURL200 thumbURL2000 = recordInfo.thumbURL2000 @@ -127,7 +127,7 @@ open class Record : Parcelable { folderLinkId = itemVO.folder_linkId parentFolderLinkId = itemVO.parentFolder_linkId displayName = itemVO.displayName - displayDate = itemVO.displayDT + displayDate = itemVO.displayDT?.replace("T", " ") archiveFullName = "The ${archiveVO.fullName} Archive" archiveThumbURL200 = archiveVO.thumbURL200 showArchiveThumb = showArchiveThumbnail @@ -172,7 +172,7 @@ open class Record : Parcelable { folderLinkId = recordInfo?.folder_linkId parentFolderLinkId = recordInfo?.parentFolder_linkId displayName = recordInfo?.displayName - displayDate = recordInfo?.displayDT + displayDate = recordInfo?.displayDT?.replace("T", " ") thumbURL200 = recordInfo?.thumbURL200 thumbURL2000 = recordInfo?.thumbURL2000 isThumbBlurred = shareByUrlVO.previewToggle == null || shareByUrlVO.previewToggle == 0 diff --git a/app/src/main/java/org/permanent/permanent/network/models/FileData.kt b/app/src/main/java/org/permanent/permanent/network/models/FileData.kt index 24d2707a..5db95479 100644 --- a/app/src/main/java/org/permanent/permanent/network/models/FileData.kt +++ b/app/src/main/java/org/permanent/permanent/network/models/FileData.kt @@ -52,7 +52,7 @@ class FileData private constructor() : Parcelable { } displayName = recordVO.displayName description = recordVO.description - displayDate = recordVO.displayDT + displayDate = recordVO.displayDT?.replace("T", " ") createdDate = recordVO.createdDT?.replace("T", " ") updatedDate = recordVO.updatedDT?.replace("T", " ") derivedDate = recordVO.derivedDT?.replace("T", " ") diff --git a/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/EditFileNamesFragment.kt b/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/EditFileNamesFragment.kt index 9f7f808d..bca278ad 100644 --- a/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/EditFileNamesFragment.kt +++ b/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/EditFileNamesFragment.kt @@ -9,6 +9,8 @@ import android.view.ViewGroup import android.widget.FrameLayout import androidx.compose.material3.MaterialTheme import androidx.compose.ui.platform.ComposeView +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProvider import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetDialog @@ -21,6 +23,7 @@ import org.permanent.permanent.viewmodels.EditFileNamesViewModel class EditFileNamesFragment : PermanentBottomSheetFragment() { private lateinit var viewModel: EditFileNamesViewModel + private val onFileNameChanged = MutableLiveData() override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? @@ -60,12 +63,28 @@ class EditFileNamesFragment : PermanentBottomSheetFragment() { return bottomSheetDialog } - override fun connectViewModelEvents() { + private val onFileNameChangedObserver = Observer { + onFileNameChanged.value = it + } + override fun connectViewModelEvents() { + viewModel.getOnFileNameChanged().observe(this, onFileNameChangedObserver) } override fun disconnectViewModelEvents() { + viewModel.getOnFileNameChanged().removeObserver(onFileNameChangedObserver) + } + override fun onResume() { + super.onResume() + connectViewModelEvents() } + override fun onPause() { + super.onPause() + disconnectViewModelEvents() + } + + fun getOnFilenameChanged() = onFileNameChanged + } \ No newline at end of file diff --git a/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/EditMetadataFragment.kt b/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/EditMetadataFragment.kt index 41cf9eb8..2e6212f4 100644 --- a/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/EditMetadataFragment.kt +++ b/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/EditMetadataFragment.kt @@ -8,6 +8,7 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.ui.platform.ComposeView import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProvider +import com.google.android.material.snackbar.Snackbar import org.permanent.permanent.models.Record import org.permanent.permanent.models.Tag import org.permanent.permanent.ui.PermanentBaseFragment @@ -21,6 +22,7 @@ class EditMetadataFragment : PermanentBaseFragment() { private var newTagFragment: NewTagFragment? = null private var locationFragment: EditLocationFragment? = null private var dateFragment: EditDateTimeFragment? = null + private var fileNameFragment: EditFileNamesFragment? = null private var records = ArrayList() override fun onCreateView( @@ -49,9 +51,11 @@ class EditMetadataFragment : PermanentBaseFragment() { ?.observe(lifecycleOwner, onTagsAddedToSelectionObserver) }, openEditFileNamesScreen = { - var fragment = EditFileNamesFragment() - fragment?.setBundleArguments(records) - fragment?.show(parentFragmentManager, fragment?.tag) + fileNameFragment = EditFileNamesFragment() + fileNameFragment?.setBundleArguments(records) + fileNameFragment?.show(parentFragmentManager, fileNameFragment?.tag) + fileNameFragment?.getOnFilenameChanged() + ?.observe(lifecycleOwner, onFilenameChangedObserver) }, openDateAndTimeScreen = { dateFragment = EditDateTimeFragment() @@ -85,6 +89,10 @@ class EditMetadataFragment : PermanentBaseFragment() { viewModel.onDateChanged(it) } + private val onFilenameChangedObserver = Observer { + viewModel.showInfoMessage.value = it + } + override fun connectViewModelEvents() { @@ -94,6 +102,7 @@ class EditMetadataFragment : PermanentBaseFragment() { newTagFragment?.getOnTagsAddedToSelection()?.removeObserver(onTagsAddedToSelectionObserver) locationFragment?.getOnLocationChanged()?.removeObserver(onLocationChangedObserver) dateFragment?.getOnDateChanged()?.removeObserver(onDateChangedObserver) + fileNameFragment?.getOnFilenameChanged()?.removeObserver(onFilenameChangedObserver) } override fun onResume() { diff --git a/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditDateTimeScreen.kt b/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditDateTimeScreen.kt index 8b486363..9f021fff 100644 --- a/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditDateTimeScreen.kt +++ b/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditDateTimeScreen.kt @@ -18,6 +18,7 @@ import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.DatePicker import androidx.compose.material3.DatePickerDefaults import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.SelectableDates import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.material3.TimePicker @@ -47,6 +48,7 @@ import androidx.core.content.ContextCompat import org.permanent.permanent.R import org.permanent.permanent.viewmodels.EditDateTimeViewModel import java.text.SimpleDateFormat +import java.time.LocalDate import java.util.Date import java.util.Locale @@ -63,8 +65,10 @@ fun EditDateTimeScreen( val openAlertDialog = remember { mutableStateOf(false) } val datePickerState = rememberDatePickerState( - initialSelectedDateMillis = viewModel.initialDateMilis + initialSelectedDateMillis = viewModel.initialDateMilis, + selectableDates = PastOrPresentSelectableDates ) + val selectedDate = datePickerState.selectedDateMillis?.let { convertMillisToDate(it) } ?: "" @@ -264,4 +268,15 @@ fun convertTimeToString(hour: Int, min: Int, sec: Int): String { val secString = String.format("%02d", sec) return "$hourString:$minString:$secString" +} + +@OptIn(ExperimentalMaterial3Api::class) +private object PastOrPresentSelectableDates: SelectableDates { + override fun isSelectableDate(utcTimeMillis: Long): Boolean { + return utcTimeMillis <= System.currentTimeMillis() + } + + override fun isSelectableYear(year: Int): Boolean { + return year <= LocalDate.now().year + } } \ No newline at end of file diff --git a/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditMetadataScreen.kt b/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditMetadataScreen.kt index 7614ae25..3b5a963f 100644 --- a/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditMetadataScreen.kt +++ b/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditMetadataScreen.kt @@ -88,6 +88,7 @@ fun EditMetadataScreen( val allTags by viewModel.getTagsOfSelectedRecords().observeAsState() val focusRequester = remember { FocusRequester() } val errorMessage by viewModel.showError.observeAsState() + val infoMessage by viewModel.showInfoMessage.observeAsState() val showApplyAllToSelection by viewModel.showApplyAllToSelection.observeAsState() val isBusy by viewModel.getIsBusy().observeAsState() val locationMenuName by viewModel.getLocationMenuName().observeAsState() @@ -229,6 +230,14 @@ fun EditMetadataScreen( } } + LaunchedEffect(infoMessage) { + infoMessage?.let { message -> + coroutineScope.launch { + snackbarHostState.showSnackbar(message) + } + } + } + LaunchedEffect(snackbarEventFlow) { snackbarEventFlow.collect { message -> snackbarHostState.showSnackbar(message) diff --git a/app/src/main/java/org/permanent/permanent/viewmodels/EditFileNamesViewModel.kt b/app/src/main/java/org/permanent/permanent/viewmodels/EditFileNamesViewModel.kt index f09bb859..d37a7607 100644 --- a/app/src/main/java/org/permanent/permanent/viewmodels/EditFileNamesViewModel.kt +++ b/app/src/main/java/org/permanent/permanent/viewmodels/EditFileNamesViewModel.kt @@ -1,6 +1,7 @@ package org.permanent.permanent.viewmodels import android.app.Application +import androidx.lifecycle.MutableLiveData import kotlinx.coroutines.flow.MutableStateFlow import org.permanent.permanent.models.Record import org.permanent.permanent.network.IResponseListener @@ -16,6 +17,8 @@ class EditFileNamesViewModel(application: Application) : ObservableAndroidViewMo private var records: MutableList = mutableListOf() + private val onFileNameChanged = MutableLiveData() + fun setRecords(records: ArrayList) { this.records.addAll(records) records.firstOrNull()?.let { @@ -175,6 +178,7 @@ class EditFileNamesViewModel(application: Application) : ObservableAndroidViewMo isFolderRecordType = false, object : IResponseListener { override fun onSuccess(message: String?) { + onFileNameChanged.value = "File names updated successfully!" toggleLoading() triggerCloseScreen() } @@ -187,6 +191,8 @@ class EditFileNamesViewModel(application: Application) : ObservableAndroidViewMo } }) } + + fun getOnFileNameChanged() = onFileNameChanged } data class EditFileNamesUIState( diff --git a/app/src/main/java/org/permanent/permanent/viewmodels/EditMetadataViewModel.kt b/app/src/main/java/org/permanent/permanent/viewmodels/EditMetadataViewModel.kt index d8081cc4..845f3a5a 100644 --- a/app/src/main/java/org/permanent/permanent/viewmodels/EditMetadataViewModel.kt +++ b/app/src/main/java/org/permanent/permanent/viewmodels/EditMetadataViewModel.kt @@ -30,6 +30,7 @@ class EditMetadataViewModel(application: Application) : ObservableAndroidViewMod private var showWarningSomeFilesHaveDescription = MutableLiveData(false) val showError = MutableLiveData() val showApplyAllToSelection = MutableLiveData(true) + val showInfoMessage = MutableLiveData() private val isBusy = MutableLiveData(false) private val locationMenuName = MutableLiveData(appContext.getString(R.string.locations)) private val dateMenuName = MutableLiveData(appContext.getString(R.string.date_time)) From eebb8eff34856a52bfca0f8dfefbf44d368bba3f Mon Sep 17 00:00:00 2001 From: flaviuvsp Date: Mon, 7 Oct 2024 12:23:23 +0300 Subject: [PATCH 3/7] Update build.gradle --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 59fff758..85eb09d0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,7 +15,7 @@ android { applicationId "org.permanent.PermanentArchive" minSdkVersion 26 targetSdkVersion 34 - versionCode 69 + versionCode 70 versionName "1.9.3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" From 92f5cbab09b8052c4e4941589b688507547cd1ed Mon Sep 17 00:00:00 2001 From: flaviuvsp Date: Mon, 7 Oct 2024 14:10:46 +0300 Subject: [PATCH 4/7] move strings to strings.xml --- .../permanent/permanent/viewmodels/EditFileNamesViewModel.kt | 4 +++- app/src/main/res/values/strings.xml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/permanent/permanent/viewmodels/EditFileNamesViewModel.kt b/app/src/main/java/org/permanent/permanent/viewmodels/EditFileNamesViewModel.kt index d37a7607..8ba85c0d 100644 --- a/app/src/main/java/org/permanent/permanent/viewmodels/EditFileNamesViewModel.kt +++ b/app/src/main/java/org/permanent/permanent/viewmodels/EditFileNamesViewModel.kt @@ -3,6 +3,7 @@ package org.permanent.permanent.viewmodels import android.app.Application import androidx.lifecycle.MutableLiveData import kotlinx.coroutines.flow.MutableStateFlow +import org.permanent.permanent.R import org.permanent.permanent.models.Record import org.permanent.permanent.network.IResponseListener import org.permanent.permanent.repositories.FileRepositoryImpl @@ -11,6 +12,7 @@ import org.permanent.permanent.ui.bulkEditMetadata.compose.SequenceDateOptions import org.permanent.permanent.ui.bytesToHumanReadableString class EditFileNamesViewModel(application: Application) : ObservableAndroidViewModel(application) { + private var appContext = application.applicationContext private var fileRepository: IFileRepository = FileRepositoryImpl(application) val uiState = MutableStateFlow(EditFileNamesUIState()) @@ -178,7 +180,7 @@ class EditFileNamesViewModel(application: Application) : ObservableAndroidViewMo isFolderRecordType = false, object : IResponseListener { override fun onSuccess(message: String?) { - onFileNameChanged.value = "File names updated successfully!" + onFileNameChanged.value = appContext.getString(R.string.file_names_updated) toggleLoading() triggerCloseScreen() } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5a944707..95981f47 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -730,6 +730,6 @@ New Date & Time Are you sure you want to set a new date & time for the selected items? Set date and time - + File names updated successfully From b91476c899622f3edb095eee92aef079bef77dcf Mon Sep 17 00:00:00 2001 From: flaviuvsp Date: Mon, 7 Oct 2024 17:41:28 +0300 Subject: [PATCH 5/7] fix app crashing and fix snackbar showing on the top --- app/build.gradle | 2 +- .../compose/EditMetadataScreen.kt | 242 +++++++++--------- .../viewmodels/EditDateTimeViewModel.kt | 2 +- 3 files changed, 126 insertions(+), 120 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 85eb09d0..0a119d78 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,7 +15,7 @@ android { applicationId "org.permanent.PermanentArchive" minSdkVersion 26 targetSdkVersion 34 - versionCode 70 + versionCode 71 versionName "1.9.3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditMetadataScreen.kt b/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditMetadataScreen.kt index 3b5a963f..a21b06b1 100644 --- a/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditMetadataScreen.kt +++ b/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditMetadataScreen.kt @@ -18,6 +18,7 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Divider +import androidx.compose.material3.Scaffold import androidx.compose.material3.SnackbarHost import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.Text @@ -98,153 +99,158 @@ fun EditMetadataScreen( val snackbarEventFlow = remember { MutableSharedFlow() } val snackbarHostState = remember { SnackbarHostState() } - Column( - modifier = Modifier - .fillMaxSize() - .background(lightBlueColor) - .padding(24.dp) - .verticalScroll(scrollState) - .clickable { - viewModel.applyNewDescriptionToAllRecords(inputDescription) - }, - verticalArrangement = Arrangement.Top - ) { - Header(iconURL = firstRecordThumb, titleText = headerTitle) - - Divider(modifier = Modifier.padding(vertical = 24.dp)) - - DescriptionView( - blackColor, - regularFont, - subTitleTextSize, - inputDescription, - focusRequester, - whiteColor, - lightGreyColor, - someFilesHaveDescription, - redColor, - smallTextSize, - onTextChange = { - inputDescription = it - } - ) + Scaffold( + snackbarHost = { + SnackbarHost(hostState = snackbarHostState) + } + ) { it -> + it + Column( + modifier = Modifier + .fillMaxSize() + .background(lightBlueColor) + .padding(24.dp) + .verticalScroll(scrollState) + .clickable { + viewModel.applyNewDescriptionToAllRecords(inputDescription) + }, + verticalArrangement = Arrangement.Top + ) { + Header(iconURL = firstRecordThumb, titleText = headerTitle) + + Divider(modifier = Modifier.padding(vertical = 24.dp)) + + DescriptionView( + blackColor, + regularFont, + subTitleTextSize, + inputDescription, + focusRequester, + whiteColor, + lightGreyColor, + someFilesHaveDescription, + redColor, + smallTextSize, + onTextChange = { + inputDescription = it + } + ) - Divider(modifier = Modifier.padding(vertical = 16.dp)) + Divider(modifier = Modifier.padding(vertical = 16.dp)) - Row( - modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween - ) { Row( - modifier = Modifier.padding(vertical = 8.dp), - horizontalArrangement = Arrangement.spacedBy(16.dp) + modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween ) { - Image( - painter = painterResource(id = R.drawable.ic_tag), - contentDescription = "Description", - modifier = Modifier.size(24.dp), - colorFilter = ColorFilter.tint(lightGreyColor) - ) - Text( - text = stringResource(R.string.edit_files_metadata_tags), - color = blackColor, - fontFamily = regularFont, - fontSize = subTitleTextSize - ) - } - if (showApplyAllToSelection == true) { - Row(modifier = Modifier - .clickable { viewModel.onApplyAllTagsToSelectionClick() } - .padding(vertical = 8.dp), - horizontalArrangement = Arrangement.spacedBy(16.dp)) { - Text( - text = stringResource(R.string.edit_files_metadata_apply_all_to_selection), - color = primaryColor, - fontFamily = semiboldFont, - fontSize = subTitleTextSize - ) + Row( + modifier = Modifier.padding(vertical = 8.dp), + horizontalArrangement = Arrangement.spacedBy(16.dp) + ) { Image( - painter = painterResource(id = R.drawable.ic_done_white), + painter = painterResource(id = R.drawable.ic_tag), contentDescription = "Description", modifier = Modifier.size(24.dp), - colorFilter = ColorFilter.tint(primaryColor) + colorFilter = ColorFilter.tint(lightGreyColor) + ) + Text( + text = stringResource(R.string.edit_files_metadata_tags), + color = blackColor, + fontFamily = regularFont, + fontSize = subTitleTextSize ) } + if (showApplyAllToSelection == true) { + Row(modifier = Modifier + .clickable { viewModel.onApplyAllTagsToSelectionClick() } + .padding(vertical = 8.dp), + horizontalArrangement = Arrangement.spacedBy(16.dp)) { + Text( + text = stringResource(R.string.edit_files_metadata_apply_all_to_selection), + color = primaryColor, + fontFamily = semiboldFont, + fontSize = subTitleTextSize + ) + Image( + painter = painterResource(id = R.drawable.ic_done_white), + contentDescription = "Description", + modifier = Modifier.size(24.dp), + colorFilter = ColorFilter.tint(primaryColor) + ) + } + } } - } - FlowRow( - modifier = Modifier, horizontalArrangement = Arrangement.spacedBy(16.dp) - ) { - allTags?.let { allTagsValue -> - for (tag in allTagsValue) { - TagView( - text = tag.name, - isSelected = tag.isSelected.observeAsState(), - onTagClick = { viewModel.onTagClick(tag) } - ) { viewModel.onTagRemoveClick(tag) } + FlowRow( + modifier = Modifier, horizontalArrangement = Arrangement.spacedBy(16.dp) + ) { + allTags?.let { allTagsValue -> + for (tag in allTagsValue) { + TagView( + text = tag.name, + isSelected = tag.isSelected.observeAsState(), + onTagClick = { viewModel.onTagClick(tag) } + ) { viewModel.onTagRemoveClick(tag) } + } } - } - NewTagView { - val tagsOfSelectedRecords = arrayListOf() - viewModel.getTagsOfSelectedRecords().value?.toList() - ?.let { tagsOfSelectedRecords.addAll(it) } + NewTagView { + val tagsOfSelectedRecords = arrayListOf() + viewModel.getTagsOfSelectedRecords().value?.toList() + ?.let { tagsOfSelectedRecords.addAll(it) } - openNewTagScreen(tagsOfSelectedRecords) + openNewTagScreen(tagsOfSelectedRecords) + } } - } - Divider(modifier = Modifier.padding(vertical = 16.dp)) + Divider(modifier = Modifier.padding(vertical = 16.dp)) - FilesMenuView(icon = R.drawable.ic_edit_name, - title = stringResource(id = R.string.file_names), - actionTitle = stringResource(id = R.string.modify)) { - openEditFileNamesScreen(viewModel.getRecords()) - } + FilesMenuView(icon = R.drawable.ic_edit_name, + title = stringResource(id = R.string.file_names), + actionTitle = stringResource(id = R.string.modify)) { + openEditFileNamesScreen(viewModel.getRecords()) + } - Divider(modifier = Modifier.padding(vertical = 16.dp)) + Divider(modifier = Modifier.padding(vertical = 16.dp)) - dateMenuName?.let { - FilesMenuView(icon = R.drawable.ic_date_time, - title = it, - actionTitle = stringResource(id = R.string.menu_toolbar_public_add)) { - openDateAndTimeScreen(viewModel.getRecords()) + dateMenuName?.let { + FilesMenuView(icon = R.drawable.ic_date_time, + title = it, + actionTitle = stringResource(id = R.string.menu_toolbar_public_add)) { + openDateAndTimeScreen(viewModel.getRecords()) + } } - } - Divider(modifier = Modifier.padding(vertical = 16.dp)) + Divider(modifier = Modifier.padding(vertical = 16.dp)) - locationMenuName?.let { - FilesMenuView(icon = R.drawable.map_icon, - title = it, - actionTitle = stringResource(id = R.string.menu_toolbar_public_add)) { - openLocationScreen(viewModel.getRecords()) + locationMenuName?.let { + FilesMenuView(icon = R.drawable.map_icon, + title = it, + actionTitle = stringResource(id = R.string.menu_toolbar_public_add)) { + openLocationScreen(viewModel.getRecords()) + } } - } - } - LaunchedEffect(errorMessage) { - errorMessage?.let { message -> - coroutineScope.launch { - snackbarHostState.showSnackbar(message) + LaunchedEffect(infoMessage) { + infoMessage?.let { message -> + coroutineScope.launch { + snackbarHostState.showSnackbar(message) + } + } } - } - } - LaunchedEffect(infoMessage) { - infoMessage?.let { message -> - coroutineScope.launch { - snackbarHostState.showSnackbar(message) + LaunchedEffect(errorMessage) { + errorMessage?.let { message -> + coroutineScope.launch { + snackbarHostState.showSnackbar(message) + } + } } - } - } - LaunchedEffect(snackbarEventFlow) { - snackbarEventFlow.collect { message -> - snackbarHostState.showSnackbar(message) + LaunchedEffect(snackbarEventFlow) { + snackbarEventFlow.collect { message -> + snackbarHostState.showSnackbar(message) + } + } } } - - SnackbarHost(hostState = snackbarHostState) } @Composable diff --git a/app/src/main/java/org/permanent/permanent/viewmodels/EditDateTimeViewModel.kt b/app/src/main/java/org/permanent/permanent/viewmodels/EditDateTimeViewModel.kt index b75cd1fd..41461f9b 100644 --- a/app/src/main/java/org/permanent/permanent/viewmodels/EditDateTimeViewModel.kt +++ b/app/src/main/java/org/permanent/permanent/viewmodels/EditDateTimeViewModel.kt @@ -28,7 +28,7 @@ class EditDateTimeViewModel(application: Application) : ObservableAndroidViewMod fun setRecords(records: ArrayList) { this.records.addAll(records) records.firstOrNull()?.displayDate?.let { - val dateFormat = "yyyy-MM-dd'T'HH:mm:ss" + val dateFormat = "yyyy-MM-dd HH:mm:ss" extractDateHourMinute(it, dateFormat) } } From cb15e923e570b37560b4201e4e056e30610462cf Mon Sep 17 00:00:00 2001 From: flaviuvsp Date: Tue, 8 Oct 2024 12:16:43 +0300 Subject: [PATCH 6/7] Fix crash --- .../permanent/ui/bulkEditMetadata/compose/EditDateTimeScreen.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditDateTimeScreen.kt b/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditDateTimeScreen.kt index 9f021fff..05e2e4e7 100644 --- a/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditDateTimeScreen.kt +++ b/app/src/main/java/org/permanent/permanent/ui/bulkEditMetadata/compose/EditDateTimeScreen.kt @@ -220,7 +220,7 @@ fun EditDateTimeScreen( cancelButtonText = stringResource(id = R.string.button_cancel), onConfirm = { openAlertDialog.value = false - viewModel.updateDate(dateString = "${selectedDate}T${selectedTime}") + viewModel.updateDate(dateString = "$selectedDate $selectedTime") }) { openAlertDialog.value = false } From 8beaee75798fc3034e3960c65550cba3888bfb76 Mon Sep 17 00:00:00 2001 From: flaviuvsp Date: Tue, 22 Oct 2024 12:07:27 +0300 Subject: [PATCH 7/7] Update build version --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0a119d78..4228e0b0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,8 +15,8 @@ android { applicationId "org.permanent.PermanentArchive" minSdkVersion 26 targetSdkVersion 34 - versionCode 71 - versionName "1.9.3" + versionCode 72 + versionName "1.9.4" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" }