Skip to content

Commit

Permalink
remove Stop button from change running record screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Razeeman committed Dec 8, 2024
1 parent 83f829c commit 4a2b21d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ class ChangeRecordCore(
containerChangeRecordTimeStartedAdjust.listener = viewModel::onAdjustTimeStartedItemClick
containerChangeRecordTimeEndedAdjust.listener = viewModel::onAdjustTimeEndedItemClick
btnChangeRecordSave.setOnClick(viewModel::onSaveClick)
btnChangeRecordStop.setOnClick(viewModel::onStopClick)
fragment.addOnBackPressedListener(action = viewModel::onBackPressed)
}

Expand All @@ -191,10 +190,6 @@ class ChangeRecordCore(
owner = viewLifecycleOwner,
observer = { setTimeEndedVisibility(it, binding) },
)
stopButtonVisibility.observeOnce(
owner = viewLifecycleOwner,
observer = btnChangeRecordStop::visible::set,
)
types.observe(typesAdapter::replace)
categories.observe { updateCategories(it, binding) }
saveButtonEnabled.observe { enableModifyingButtons(it, binding) }
Expand Down Expand Up @@ -290,7 +285,6 @@ class ChangeRecordCore(
binding: ChangeRecordCoreLayoutBinding,
) = with(binding) {
btnChangeRecordSave.isEnabled = isEnabled
btnChangeRecordStop.isEnabled = isEnabled
}

private fun setActionsViewData(data: List<ViewHolderType>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ abstract class ChangeRecordBaseViewModel(
val timeEndedVisibility: LiveData<Boolean> by lazy { MutableLiveData(isTimeEndedAvailable) }
val deleteIconVisibility: LiveData<Boolean> by lazy { MutableLiveData(isDeleteButtonVisible) }
val statsIconVisibility: LiveData<Boolean> by lazy { MutableLiveData(isStatisticsButtonVisible) }
val stopButtonVisibility: LiveData<Boolean> by lazy { MutableLiveData(isStopButtonVisible) }

protected var newTypeId: Long = 0
protected var newTimeEnded: Long = 0
Expand All @@ -122,7 +121,6 @@ abstract class ChangeRecordBaseViewModel(
protected abstract suspend fun updatePreview()
protected abstract fun getChangeCategoryParams(data: ChangeTagData): ChangeRecordTagFromScreen
protected abstract suspend fun onSaveClickDelegate(doAfter: suspend () -> Unit = {})
protected open suspend fun onStopClickDelegate() {}
protected open suspend fun sendPreviewUpdate(fullUpdate: Boolean) {}
protected abstract val forceSecondsInDurationDialog: Boolean
protected abstract val mergeAvailable: Boolean
Expand All @@ -134,7 +132,6 @@ abstract class ChangeRecordBaseViewModel(
protected abstract val adjustNextRecordAvailable: Boolean
protected abstract val isTimeEndedAvailable: Boolean
protected abstract val isAdditionalActionsAvailable: Boolean
protected abstract val isStopButtonVisible: Boolean
protected abstract val isDeleteButtonVisible: Boolean
protected abstract val isStatisticsButtonVisible: Boolean

Expand Down Expand Up @@ -269,12 +266,6 @@ abstract class ChangeRecordBaseViewModel(
)
}

fun onStopClick() {
onRecordChangeButtonClick(
onProceed = ::onStopClickDelegate,
)
}

fun onItemButtonClick(viewData: ChangeRecordButtonViewData) {
changeRecordActionsDelegate.onItemButtonClick(viewData)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class ChangeRecordViewModel @Inject constructor(
override val adjustNextRecordAvailable: Boolean get() = true
override val isTimeEndedAvailable: Boolean get() = true
override val isAdditionalActionsAvailable: Boolean get() = true
override val isStopButtonVisible: Boolean get() = false
override val isDeleteButtonVisible: Boolean get() = recordId.orZero() != 0L
override val isStatisticsButtonVisible: Boolean
get() = extra is ChangeRecordParams.Tracked ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,19 +579,7 @@
android:layout_marginTop="8dp"
android:text="@string/change_record_save"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/btnChangeRecordStop"
app:layout_constraintStart_toStartOf="parent" />

<com.google.android.material.button.MaterialButton
android:id="@+id/btnChangeRecordStop"
style="@style/AppButtonActive"
android:layout_width="wrap_content"
android:layout_marginHorizontal="@dimen/edit_screen_margin_horizontal"
android:layout_marginTop="8dp"
android:text="@string/notification_record_type_stop"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:visibility="visible" />
app:layout_constraintStart_toStartOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class ChangeRunningRecordViewModel @Inject constructor(
override val showTimeEndedOnAdjustPreview: Boolean get() = false
override val isTimeEndedAvailable: Boolean get() = false
override val isAdditionalActionsAvailable: Boolean get() = false
override val isStopButtonVisible: Boolean get() = true
override val isDeleteButtonVisible: Boolean get() = true
override val isStatisticsButtonVisible: Boolean get() = true

Expand Down Expand Up @@ -148,12 +147,6 @@ class ChangeRunningRecordViewModel @Inject constructor(
router.back()
}

override suspend fun onStopClickDelegate() {
runningRecordInteractor.get(extra.id)
?.let { removeRunningRecordMediator.removeWithRecordAdd(it) }
router.back()
}

override suspend fun sendPreviewUpdate(fullUpdate: Boolean) {
val recordPreview = record.value?.recordPreview ?: return
val update = changeRunningRecordMapper.map(
Expand Down

0 comments on commit 4a2b21d

Please sign in to comment.