🚀 Improve Toast messages
* Cancel previous toast if new appeared * Simplified call
This commit is contained in:
parent
532050f944
commit
995f371d5a
21 changed files with 126 additions and 235 deletions
|
|
@ -1,9 +1,13 @@
|
||||||
package ua.acclorite.book_story.presentation.data
|
package ua.acclorite.book_story.presentation.data
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
|
|
||||||
fun String.removeTrailingZero(): String {
|
fun String.removeTrailingZero(): String {
|
||||||
|
var toast: Toast? = null
|
||||||
|
|
||||||
if (!this.contains('.'))
|
if (!this.contains('.'))
|
||||||
return this
|
return this
|
||||||
return this
|
return this
|
||||||
|
|
@ -34,3 +38,11 @@ fun Intent.launchActivity(
|
||||||
|
|
||||||
success?.invoke()
|
success?.invoke()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun String.showToast(context: Context, longToast: Boolean = true) {
|
||||||
|
toast?.cancel()
|
||||||
|
toast = null
|
||||||
|
|
||||||
|
toast = Toast.makeText(context, this, if (longToast) Toast.LENGTH_LONG else Toast.LENGTH_SHORT)
|
||||||
|
toast?.show()
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.about
|
package ua.acclorite.book_story.presentation.screens.about
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
import androidx.compose.foundation.layout.WindowInsets
|
||||||
|
|
@ -38,6 +37,7 @@ import ua.acclorite.book_story.presentation.components.GoBackButton
|
||||||
import ua.acclorite.book_story.presentation.components.collapsibleUntilExitScrollBehaviorWithLazyListState
|
import ua.acclorite.book_story.presentation.components.collapsibleUntilExitScrollBehaviorWithLazyListState
|
||||||
import ua.acclorite.book_story.presentation.data.LocalNavigator
|
import ua.acclorite.book_story.presentation.data.LocalNavigator
|
||||||
import ua.acclorite.book_story.presentation.data.Screen
|
import ua.acclorite.book_story.presentation.data.Screen
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.about.components.AboutItem
|
import ua.acclorite.book_story.presentation.screens.about.components.AboutItem
|
||||||
import ua.acclorite.book_story.presentation.screens.about.components.AboutUpdateDialog
|
import ua.acclorite.book_story.presentation.screens.about.components.AboutUpdateDialog
|
||||||
import ua.acclorite.book_story.presentation.screens.about.components.badges.AboutBadges
|
import ua.acclorite.book_story.presentation.screens.about.components.badges.AboutBadges
|
||||||
|
|
@ -152,27 +152,18 @@ private fun AboutScreen(
|
||||||
AboutEvent.OnCheckForUpdates(
|
AboutEvent.OnCheckForUpdates(
|
||||||
context = context,
|
context = context,
|
||||||
noUpdatesFound = {
|
noUpdatesFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.no_updates)
|
||||||
context,
|
.showToast(context = context)
|
||||||
context.getString(R.string.no_updates),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
},
|
},
|
||||||
error = {
|
error = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_check_internet)
|
||||||
context,
|
.showToast(context = context)
|
||||||
context.getString(R.string.error_check_internet),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(
|
context.getString(R.string.no_updates)
|
||||||
context,
|
.showToast(context = context)
|
||||||
context.getString(R.string.no_updates),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -187,11 +178,8 @@ private fun AboutScreen(
|
||||||
context.getString(R.string.issues_page),
|
context.getString(R.string.issues_page),
|
||||||
context,
|
context,
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_browser)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.error_no_browser),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -208,11 +196,8 @@ private fun AboutScreen(
|
||||||
context.getString(R.string.releases_page),
|
context.getString(R.string.releases_page),
|
||||||
context,
|
context,
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_browser)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.error_no_browser),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -251,11 +236,8 @@ private fun AboutScreen(
|
||||||
context.getString(R.string.translation_page),
|
context.getString(R.string.translation_page),
|
||||||
context,
|
context,
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_browser)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.error_no_browser),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.about.components
|
package ua.acclorite.book_story.presentation.screens.about.components
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Update
|
import androidx.compose.material.icons.filled.Update
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
@ -10,6 +9,7 @@ import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import ua.acclorite.book_story.R
|
import ua.acclorite.book_story.R
|
||||||
import ua.acclorite.book_story.presentation.components.custom_dialog.CustomDialogWithContent
|
import ua.acclorite.book_story.presentation.components.custom_dialog.CustomDialogWithContent
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.about.data.AboutEvent
|
import ua.acclorite.book_story.presentation.screens.about.data.AboutEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.about.data.AboutState
|
import ua.acclorite.book_story.presentation.screens.about.data.AboutState
|
||||||
|
|
||||||
|
|
@ -43,11 +43,10 @@ fun AboutUpdateDialog(
|
||||||
page = context.getString(R.string.download_latest_release_page),
|
page = context.getString(R.string.download_latest_release_page),
|
||||||
context = context,
|
context = context,
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_browser).showToast(
|
||||||
context,
|
context = context,
|
||||||
context.getString(R.string.error_no_browser),
|
longToast = false
|
||||||
Toast.LENGTH_SHORT
|
)
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.about.components.badges
|
package ua.acclorite.book_story.presentation.screens.about.components.badges
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
|
@ -15,6 +14,7 @@ import androidx.compose.ui.unit.dp
|
||||||
import ua.acclorite.book_story.R
|
import ua.acclorite.book_story.R
|
||||||
import ua.acclorite.book_story.domain.util.Constants
|
import ua.acclorite.book_story.domain.util.Constants
|
||||||
import ua.acclorite.book_story.presentation.components.customItems
|
import ua.acclorite.book_story.presentation.components.customItems
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.about.data.AboutEvent
|
import ua.acclorite.book_story.presentation.screens.about.data.AboutEvent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -45,11 +45,8 @@ fun AboutBadges(
|
||||||
AboutBadgeItem(badge = badge) {
|
AboutBadgeItem(badge = badge) {
|
||||||
when (badge.id) {
|
when (badge.id) {
|
||||||
"tryzub" -> {
|
"tryzub" -> {
|
||||||
Toast.makeText(
|
context.getString(R.string.slava_ukraini)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.slava_ukraini),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
|
|
@ -59,11 +56,8 @@ fun AboutBadges(
|
||||||
it,
|
it,
|
||||||
context,
|
context,
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_browser)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.error_no_browser),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.about.nested.credits
|
package ua.acclorite.book_story.presentation.screens.about.nested.credits
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
import androidx.compose.foundation.layout.WindowInsets
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
import androidx.compose.foundation.layout.navigationBars
|
||||||
|
|
@ -26,6 +25,7 @@ import ua.acclorite.book_story.presentation.components.GoBackButton
|
||||||
import ua.acclorite.book_story.presentation.components.collapsibleUntilExitScrollBehaviorWithLazyListState
|
import ua.acclorite.book_story.presentation.components.collapsibleUntilExitScrollBehaviorWithLazyListState
|
||||||
import ua.acclorite.book_story.presentation.components.customItems
|
import ua.acclorite.book_story.presentation.components.customItems
|
||||||
import ua.acclorite.book_story.presentation.data.LocalNavigator
|
import ua.acclorite.book_story.presentation.data.LocalNavigator
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.about.data.AboutEvent
|
import ua.acclorite.book_story.presentation.screens.about.data.AboutEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.about.data.AboutViewModel
|
import ua.acclorite.book_story.presentation.screens.about.data.AboutViewModel
|
||||||
import ua.acclorite.book_story.presentation.screens.about.nested.credits.components.CreditItem
|
import ua.acclorite.book_story.presentation.screens.about.nested.credits.components.CreditItem
|
||||||
|
|
@ -86,11 +86,8 @@ private fun CreditsScreen(
|
||||||
page = website,
|
page = website,
|
||||||
context = context,
|
context = context,
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_browser)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.error_no_browser),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.about.nested.license_info
|
package ua.acclorite.book_story.presentation.screens.about.nested.license_info
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
|
@ -44,6 +43,7 @@ import ua.acclorite.book_story.presentation.components.collapsibleUntilExitScrol
|
||||||
import ua.acclorite.book_story.presentation.components.customItems
|
import ua.acclorite.book_story.presentation.components.customItems
|
||||||
import ua.acclorite.book_story.presentation.data.LocalNavigator
|
import ua.acclorite.book_story.presentation.data.LocalNavigator
|
||||||
import ua.acclorite.book_story.presentation.data.Screen
|
import ua.acclorite.book_story.presentation.data.Screen
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.about.nested.license_info.data.LicenseInfoEvent
|
import ua.acclorite.book_story.presentation.screens.about.nested.license_info.data.LicenseInfoEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.about.nested.license_info.data.LicenseInfoState
|
import ua.acclorite.book_story.presentation.screens.about.nested.license_info.data.LicenseInfoState
|
||||||
import ua.acclorite.book_story.presentation.screens.about.nested.license_info.data.LicenseInfoViewModel
|
import ua.acclorite.book_story.presentation.screens.about.nested.license_info.data.LicenseInfoViewModel
|
||||||
|
|
@ -126,11 +126,10 @@ private fun LicenseInfoScreen(
|
||||||
page = url,
|
page = url,
|
||||||
context = context,
|
context = context,
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_browser).showToast(
|
||||||
context,
|
context = context,
|
||||||
context.getString(R.string.error_no_browser),
|
longToast = false
|
||||||
Toast.LENGTH_SHORT
|
)
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.book_info.components.change_cover_bottom_sheet
|
package ua.acclorite.book_story.presentation.screens.book_info.components.change_cover_bottom_sheet
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||||
import androidx.activity.result.PickVisualMediaRequest
|
import androidx.activity.result.PickVisualMediaRequest
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
|
@ -21,6 +20,7 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import ua.acclorite.book_story.R
|
import ua.acclorite.book_story.R
|
||||||
import ua.acclorite.book_story.presentation.components.CustomBottomSheet
|
import ua.acclorite.book_story.presentation.components.CustomBottomSheet
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.book_info.data.BookInfoEvent
|
import ua.acclorite.book_story.presentation.screens.book_info.data.BookInfoEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.book_info.data.BookInfoState
|
import ua.acclorite.book_story.presentation.screens.book_info.data.BookInfoState
|
||||||
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
||||||
|
|
@ -56,11 +56,8 @@ fun BookInfoChangeCoverBottomSheet(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
Toast.makeText(
|
context.getString(R.string.cover_image_changed)
|
||||||
context,
|
.showToast(context = context)
|
||||||
context.getString(R.string.cover_image_changed),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -90,11 +87,7 @@ fun BookInfoChangeCoverBottomSheet(
|
||||||
onHistoryUpdateEvent(HistoryEvent.OnUpdateBook(it))
|
onHistoryUpdateEvent(HistoryEvent.OnUpdateBook(it))
|
||||||
},
|
},
|
||||||
showResult = {
|
showResult = {
|
||||||
Toast.makeText(
|
it.asString(context).showToast(context = context)
|
||||||
context,
|
|
||||||
it.asString(context),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -129,11 +122,8 @@ fun BookInfoChangeCoverBottomSheet(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
Toast.makeText(
|
context.getString(R.string.cover_image_deleted)
|
||||||
context,
|
.showToast(context = context)
|
||||||
context.getString(R.string.cover_image_deleted),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.book_info.components.details_bottom_sheet
|
package ua.acclorite.book_story.presentation.screens.book_info.components.details_bottom_sheet
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
|
|
@ -13,6 +12,7 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import ua.acclorite.book_story.R
|
import ua.acclorite.book_story.R
|
||||||
import ua.acclorite.book_story.presentation.components.CustomBottomSheet
|
import ua.acclorite.book_story.presentation.components.CustomBottomSheet
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.book_info.data.BookInfoEvent
|
import ua.acclorite.book_story.presentation.screens.book_info.data.BookInfoEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.book_info.data.BookInfoState
|
import ua.acclorite.book_story.presentation.screens.book_info.data.BookInfoState
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
@ -75,11 +75,8 @@ fun BookInfoDetailsBottomSheet(
|
||||||
context,
|
context,
|
||||||
state.value.book.filePath.substringAfterLast("/").trim(),
|
state.value.book.filePath.substringAfterLast("/").trim(),
|
||||||
success = {
|
success = {
|
||||||
Toast.makeText(
|
context.getString(R.string.copied)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.copied),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -92,11 +89,8 @@ fun BookInfoDetailsBottomSheet(
|
||||||
context,
|
context,
|
||||||
state.value.book.filePath.trim(),
|
state.value.book.filePath.trim(),
|
||||||
success = {
|
success = {
|
||||||
Toast.makeText(
|
context.getString(R.string.copied)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.copied),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -111,11 +105,8 @@ fun BookInfoDetailsBottomSheet(
|
||||||
context,
|
context,
|
||||||
lastOpened,
|
lastOpened,
|
||||||
success = {
|
success = {
|
||||||
Toast.makeText(
|
context.getString(R.string.copied)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.copied),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -130,13 +121,11 @@ fun BookInfoDetailsBottomSheet(
|
||||||
context,
|
context,
|
||||||
fileSize,
|
fileSize,
|
||||||
success = {
|
success = {
|
||||||
Toast.makeText(
|
context.getString(R.string.copied)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.copied),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
))
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.book_info.components.dialog
|
package ua.acclorite.book_story.presentation.screens.book_info.components.dialog
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.DeleteOutline
|
import androidx.compose.material.icons.outlined.DeleteOutline
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
@ -9,6 +8,7 @@ import androidx.compose.ui.res.stringResource
|
||||||
import ua.acclorite.book_story.R
|
import ua.acclorite.book_story.R
|
||||||
import ua.acclorite.book_story.presentation.components.custom_dialog.CustomDialogWithContent
|
import ua.acclorite.book_story.presentation.components.custom_dialog.CustomDialogWithContent
|
||||||
import ua.acclorite.book_story.presentation.data.LocalNavigator
|
import ua.acclorite.book_story.presentation.data.LocalNavigator
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.book_info.data.BookInfoEvent
|
import ua.acclorite.book_story.presentation.screens.book_info.data.BookInfoEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.browse.data.BrowseEvent
|
import ua.acclorite.book_story.presentation.screens.browse.data.BrowseEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
||||||
|
|
@ -53,11 +53,8 @@ fun BookInfoDeleteDialog(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
Toast.makeText(
|
context.getString(R.string.book_deleted)
|
||||||
context,
|
.showToast(context = context)
|
||||||
context.getString(R.string.book_deleted),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.book_info.components.dialog
|
package ua.acclorite.book_story.presentation.screens.book_info.components.dialog
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.outlined.DriveFileMove
|
import androidx.compose.material.icons.automirrored.outlined.DriveFileMove
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
@ -15,6 +14,7 @@ import ua.acclorite.book_story.presentation.components.customItems
|
||||||
import ua.acclorite.book_story.presentation.components.custom_dialog.CustomDialogWithLazyColumn
|
import ua.acclorite.book_story.presentation.components.custom_dialog.CustomDialogWithLazyColumn
|
||||||
import ua.acclorite.book_story.presentation.components.custom_dialog.SelectableDialogItem
|
import ua.acclorite.book_story.presentation.components.custom_dialog.SelectableDialogItem
|
||||||
import ua.acclorite.book_story.presentation.data.LocalNavigator
|
import ua.acclorite.book_story.presentation.data.LocalNavigator
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.book_info.data.BookInfoEvent
|
import ua.acclorite.book_story.presentation.screens.book_info.data.BookInfoEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.book_info.data.BookInfoState
|
import ua.acclorite.book_story.presentation.screens.book_info.data.BookInfoState
|
||||||
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
||||||
|
|
@ -69,11 +69,8 @@ fun BookInfoMoveDialog(
|
||||||
onNavigate = { navigator.it() }
|
onNavigate = { navigator.it() }
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
Toast.makeText(
|
context.getString(R.string.book_moved)
|
||||||
context,
|
.showToast(context = context)
|
||||||
context.getString(R.string.book_moved),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
},
|
},
|
||||||
withDivider = false,
|
withDivider = false,
|
||||||
items = {
|
items = {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.browse
|
package ua.acclorite.book_story.presentation.screens.browse
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
|
@ -34,6 +33,7 @@ import ua.acclorite.book_story.presentation.data.MainEvent
|
||||||
import ua.acclorite.book_story.presentation.data.MainState
|
import ua.acclorite.book_story.presentation.data.MainState
|
||||||
import ua.acclorite.book_story.presentation.data.MainViewModel
|
import ua.acclorite.book_story.presentation.data.MainViewModel
|
||||||
import ua.acclorite.book_story.presentation.data.Screen
|
import ua.acclorite.book_story.presentation.data.Screen
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.browse.components.BrowseEmptyPlaceholder
|
import ua.acclorite.book_story.presentation.screens.browse.components.BrowseEmptyPlaceholder
|
||||||
import ua.acclorite.book_story.presentation.screens.browse.components.BrowseStoragePermissionDialog
|
import ua.acclorite.book_story.presentation.screens.browse.components.BrowseStoragePermissionDialog
|
||||||
import ua.acclorite.book_story.presentation.screens.browse.components.adding_dialog.BrowseAddingDialog
|
import ua.acclorite.book_story.presentation.screens.browse.components.adding_dialog.BrowseAddingDialog
|
||||||
|
|
@ -166,14 +166,10 @@ private fun BrowseScreen(
|
||||||
onLongItemClick = { selectableFile ->
|
onLongItemClick = { selectableFile ->
|
||||||
when (selectableFile.isDirectory) {
|
when (selectableFile.isDirectory) {
|
||||||
false -> {
|
false -> {
|
||||||
Toast.makeText(
|
context.getString(
|
||||||
context,
|
R.string.file_path_query,
|
||||||
context.getString(
|
selectableFile.fileOrDirectory.path
|
||||||
R.string.file_path_query,
|
).showToast(context = context)
|
||||||
selectableFile.fileOrDirectory.path
|
|
||||||
),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
true -> {
|
true -> {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.browse.components.adding_dialog
|
package ua.acclorite.book_story.presentation.screens.browse.components.adding_dialog
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
|
@ -22,6 +21,7 @@ import ua.acclorite.book_story.domain.model.NullableBook
|
||||||
import ua.acclorite.book_story.presentation.components.customItems
|
import ua.acclorite.book_story.presentation.components.customItems
|
||||||
import ua.acclorite.book_story.presentation.components.custom_dialog.CustomDialogWithLazyColumn
|
import ua.acclorite.book_story.presentation.components.custom_dialog.CustomDialogWithLazyColumn
|
||||||
import ua.acclorite.book_story.presentation.data.LocalNavigator
|
import ua.acclorite.book_story.presentation.data.LocalNavigator
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.browse.data.BrowseEvent
|
import ua.acclorite.book_story.presentation.screens.browse.data.BrowseEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.browse.data.BrowseState
|
import ua.acclorite.book_story.presentation.screens.browse.data.BrowseState
|
||||||
import ua.acclorite.book_story.presentation.screens.library.data.LibraryEvent
|
import ua.acclorite.book_story.presentation.screens.library.data.LibraryEvent
|
||||||
|
|
@ -60,18 +60,12 @@ fun BrowseAddingDialog(
|
||||||
onLibraryEvent(LibraryEvent.OnLoadList)
|
onLibraryEvent(LibraryEvent.OnLoadList)
|
||||||
},
|
},
|
||||||
onFailed = {
|
onFailed = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_something_went_wrong)
|
||||||
context,
|
.showToast(context = context)
|
||||||
context.getString(R.string.error_something_went_wrong),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
},
|
},
|
||||||
onSuccess = {
|
onSuccess = {
|
||||||
Toast.makeText(
|
context.getString(R.string.books_added)
|
||||||
context,
|
.showToast(context = context)
|
||||||
context.getString(R.string.books_added),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -102,11 +96,8 @@ fun BrowseAddingDialog(
|
||||||
if (it) {
|
if (it) {
|
||||||
onEvent(BrowseEvent.OnSelectBook(book))
|
onEvent(BrowseEvent.OnSelectBook(book))
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(
|
book.first.message?.asString(context)
|
||||||
context,
|
?.showToast(context = context)
|
||||||
book.first.message?.asString(context),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.help.components.content
|
package ua.acclorite.book_story.presentation.screens.help.components.content
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
|
@ -26,6 +25,7 @@ import androidx.compose.ui.text.input.KeyboardCapitalization
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import ua.acclorite.book_story.R
|
import ua.acclorite.book_story.R
|
||||||
import ua.acclorite.book_story.presentation.components.CustomIconButton
|
import ua.acclorite.book_story.presentation.components.CustomIconButton
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.help.components.HelpAnnotation
|
import ua.acclorite.book_story.presentation.screens.help.components.HelpAnnotation
|
||||||
import ua.acclorite.book_story.presentation.screens.help.data.HelpEvent
|
import ua.acclorite.book_story.presentation.screens.help.data.HelpEvent
|
||||||
import ua.acclorite.book_story.presentation.ui.SlidingTransition
|
import ua.acclorite.book_story.presentation.ui.SlidingTransition
|
||||||
|
|
@ -52,11 +52,8 @@ fun HelpFindBooksContent(onEvent: (HelpEvent) -> Unit) {
|
||||||
page = string.substringAfterLast("|"),
|
page = string.substringAfterLast("|"),
|
||||||
context = context,
|
context = context,
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_browser)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.error_no_browser),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -93,11 +90,8 @@ fun HelpFindBooksContent(onEvent: (HelpEvent) -> Unit) {
|
||||||
showError.value = true
|
showError.value = true
|
||||||
},
|
},
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_browser)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.error_no_browser),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -124,11 +118,8 @@ fun HelpFindBooksContent(onEvent: (HelpEvent) -> Unit) {
|
||||||
context = context,
|
context = context,
|
||||||
error = { showError.value = true },
|
error = { showError.value = true },
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_browser)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.error_no_browser),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.help.components.items
|
package ua.acclorite.book_story.presentation.screens.help.components.items
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.foundation.lazy.LazyItemScope
|
import androidx.compose.foundation.lazy.LazyItemScope
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.buildAnnotatedString
|
import androidx.compose.ui.text.buildAnnotatedString
|
||||||
import ua.acclorite.book_story.R
|
import ua.acclorite.book_story.R
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.help.components.HelpAnnotation
|
import ua.acclorite.book_story.presentation.screens.help.components.HelpAnnotation
|
||||||
import ua.acclorite.book_story.presentation.screens.help.components.HelpClickableNote
|
import ua.acclorite.book_story.presentation.screens.help.components.HelpClickableNote
|
||||||
|
|
||||||
|
|
@ -24,11 +24,8 @@ fun LazyItemScope.HelpClickMeNoteItem() {
|
||||||
|
|
||||||
HelpAnnotation(
|
HelpAnnotation(
|
||||||
onClick = {
|
onClick = {
|
||||||
Toast.makeText(
|
context.getString(R.string.help_clickable_note_action)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.help_clickable_note_action),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
append(stringResource(id = R.string.help_clickable_note_2))
|
append(stringResource(id = R.string.help_clickable_note_2))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.history.components
|
package ua.acclorite.book_story.presentation.screens.history.components
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.DeleteOutline
|
import androidx.compose.material.icons.outlined.DeleteOutline
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
@ -8,6 +7,7 @@ import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import ua.acclorite.book_story.R
|
import ua.acclorite.book_story.R
|
||||||
import ua.acclorite.book_story.presentation.components.custom_dialog.CustomDialogWithContent
|
import ua.acclorite.book_story.presentation.components.custom_dialog.CustomDialogWithContent
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.library.data.LibraryEvent
|
import ua.acclorite.book_story.presentation.screens.library.data.LibraryEvent
|
||||||
|
|
||||||
|
|
@ -37,11 +37,8 @@ fun HistoryDeleteWholeHistoryDialog(
|
||||||
onLibraryLoadEvent(LibraryEvent.OnLoadList)
|
onLibraryLoadEvent(LibraryEvent.OnLoadList)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Toast.makeText(
|
context.getString(R.string.history_deleted)
|
||||||
context,
|
.showToast(context = context)
|
||||||
context.getString(R.string.history_deleted),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
package ua.acclorite.book_story.presentation.screens.library
|
package ua.acclorite.book_story.presentation.screens.library
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
|
|
@ -58,6 +57,7 @@ import ua.acclorite.book_story.presentation.data.LocalNavigator
|
||||||
import ua.acclorite.book_story.presentation.data.MainState
|
import ua.acclorite.book_story.presentation.data.MainState
|
||||||
import ua.acclorite.book_story.presentation.data.MainViewModel
|
import ua.acclorite.book_story.presentation.data.MainViewModel
|
||||||
import ua.acclorite.book_story.presentation.data.Screen
|
import ua.acclorite.book_story.presentation.data.Screen
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.browse.data.BrowseEvent
|
import ua.acclorite.book_story.presentation.screens.browse.data.BrowseEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.browse.data.BrowseViewModel
|
import ua.acclorite.book_story.presentation.screens.browse.data.BrowseViewModel
|
||||||
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
||||||
|
|
@ -293,11 +293,8 @@ private fun LibraryScreen(
|
||||||
return@BackHandler
|
return@BackHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
Toast.makeText(
|
activity.getString(R.string.press_again_toast)
|
||||||
activity,
|
.showToast(context = activity, longToast = false)
|
||||||
activity.getString(R.string.press_again_toast),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
shouldExit = true
|
shouldExit = true
|
||||||
|
|
||||||
scope.launch {
|
scope.launch {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.library.components.dialog
|
package ua.acclorite.book_story.presentation.screens.library.components.dialog
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.DeleteOutline
|
import androidx.compose.material.icons.outlined.DeleteOutline
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
@ -9,6 +8,7 @@ import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import ua.acclorite.book_story.R
|
import ua.acclorite.book_story.R
|
||||||
import ua.acclorite.book_story.presentation.components.custom_dialog.CustomDialogWithContent
|
import ua.acclorite.book_story.presentation.components.custom_dialog.CustomDialogWithContent
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.browse.data.BrowseEvent
|
import ua.acclorite.book_story.presentation.screens.browse.data.BrowseEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.library.data.LibraryEvent
|
import ua.acclorite.book_story.presentation.screens.library.data.LibraryEvent
|
||||||
|
|
@ -44,11 +44,8 @@ fun LibraryDeleteDialog(
|
||||||
onHistoryLoadEvent(HistoryEvent.OnLoadList)
|
onHistoryLoadEvent(HistoryEvent.OnLoadList)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Toast.makeText(
|
context.getString(R.string.books_deleted)
|
||||||
context,
|
.showToast(context = context)
|
||||||
context.getString(R.string.books_deleted),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.library.components.dialog
|
package ua.acclorite.book_story.presentation.screens.library.components.dialog
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.compose.foundation.pager.PagerState
|
import androidx.compose.foundation.pager.PagerState
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.outlined.DriveFileMove
|
import androidx.compose.material.icons.automirrored.outlined.DriveFileMove
|
||||||
|
|
@ -13,6 +12,7 @@ import ua.acclorite.book_story.domain.model.Category
|
||||||
import ua.acclorite.book_story.presentation.components.customItems
|
import ua.acclorite.book_story.presentation.components.customItems
|
||||||
import ua.acclorite.book_story.presentation.components.custom_dialog.CustomDialogWithLazyColumn
|
import ua.acclorite.book_story.presentation.components.custom_dialog.CustomDialogWithLazyColumn
|
||||||
import ua.acclorite.book_story.presentation.components.custom_dialog.SelectableDialogItem
|
import ua.acclorite.book_story.presentation.components.custom_dialog.SelectableDialogItem
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.library.data.LibraryEvent
|
import ua.acclorite.book_story.presentation.screens.library.data.LibraryEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.library.data.LibraryState
|
import ua.acclorite.book_story.presentation.screens.library.data.LibraryState
|
||||||
|
|
@ -48,11 +48,8 @@ fun LibraryMoveDialog(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
Toast.makeText(
|
context.getString(R.string.books_moved)
|
||||||
context,
|
.showToast(context = context)
|
||||||
context.getString(R.string.books_moved),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
},
|
},
|
||||||
withDivider = false,
|
withDivider = false,
|
||||||
items = {
|
items = {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package ua.acclorite.book_story.presentation.screens.reader
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.compose.animation.animateColorAsState
|
import androidx.compose.animation.animateColorAsState
|
||||||
|
|
@ -63,6 +62,7 @@ import ua.acclorite.book_story.presentation.data.MainEvent
|
||||||
import ua.acclorite.book_story.presentation.data.MainState
|
import ua.acclorite.book_story.presentation.data.MainState
|
||||||
import ua.acclorite.book_story.presentation.data.MainViewModel
|
import ua.acclorite.book_story.presentation.data.MainViewModel
|
||||||
import ua.acclorite.book_story.presentation.data.Screen
|
import ua.acclorite.book_story.presentation.data.Screen
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.history.data.HistoryViewModel
|
import ua.acclorite.book_story.presentation.screens.history.data.HistoryViewModel
|
||||||
import ua.acclorite.book_story.presentation.screens.library.data.LibraryEvent
|
import ua.acclorite.book_story.presentation.screens.library.data.LibraryEvent
|
||||||
|
|
@ -118,11 +118,8 @@ fun ReaderScreenRoot(screen: Screen.Reader) {
|
||||||
historyViewModel.onEvent(HistoryEvent.OnLoadList)
|
historyViewModel.onEvent(HistoryEvent.OnLoadList)
|
||||||
},
|
},
|
||||||
onError = {
|
onError = {
|
||||||
Toast.makeText(
|
it.asString(context)
|
||||||
context,
|
.showToast(context = context)
|
||||||
it.asString(context),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -281,11 +278,8 @@ private fun ReaderScreen(
|
||||||
CustomSelectionContainer(
|
CustomSelectionContainer(
|
||||||
onCopyRequested = {
|
onCopyRequested = {
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) {
|
||||||
Toast.makeText(
|
context.getString(R.string.copied)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.copied),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShareRequested = { textToShare ->
|
onShareRequested = { textToShare ->
|
||||||
|
|
@ -294,11 +288,8 @@ private fun ReaderScreen(
|
||||||
textToShare = textToShare,
|
textToShare = textToShare,
|
||||||
context,
|
context,
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_share_app)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.error_no_share_app),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -309,11 +300,8 @@ private fun ReaderScreen(
|
||||||
textToSearch = textToSearch,
|
textToSearch = textToSearch,
|
||||||
context,
|
context,
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_browser)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.error_no_browser),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -325,11 +313,8 @@ private fun ReaderScreen(
|
||||||
translateWholeParagraph = false,
|
translateWholeParagraph = false,
|
||||||
context,
|
context,
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_translator)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.error_no_translator),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -340,11 +325,8 @@ private fun ReaderScreen(
|
||||||
textToDefine,
|
textToDefine,
|
||||||
context,
|
context,
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_dictionary)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.error_no_dictionary),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -377,18 +359,14 @@ private fun ReaderScreen(
|
||||||
toolbarHidden = toolbarHidden,
|
toolbarHidden = toolbarHidden,
|
||||||
onSettingsEvent = onSettingsEvent,
|
onSettingsEvent = onSettingsEvent,
|
||||||
presetChanged = {
|
presetChanged = {
|
||||||
Toast
|
context
|
||||||
.makeText(
|
.getString(
|
||||||
context,
|
R.string.color_preset_selected_query,
|
||||||
context.getString(
|
it
|
||||||
R.string.color_preset_selected_query,
|
.asString(context)
|
||||||
it
|
.trim()
|
||||||
.asString(context)
|
|
||||||
.trim()
|
|
||||||
),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
)
|
)
|
||||||
.show()
|
.showToast(context = context, longToast = false)
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
verticalArrangement = Arrangement.spacedBy(paragraphHeight)
|
verticalArrangement = Arrangement.spacedBy(paragraphHeight)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.reader.components
|
package ua.acclorite.book_story.presentation.screens.reader.components
|
||||||
|
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
|
@ -32,6 +31,7 @@ import ua.acclorite.book_story.R
|
||||||
import ua.acclorite.book_story.domain.model.Category
|
import ua.acclorite.book_story.domain.model.Category
|
||||||
import ua.acclorite.book_story.domain.util.OnNavigate
|
import ua.acclorite.book_story.domain.util.OnNavigate
|
||||||
import ua.acclorite.book_story.presentation.data.Screen
|
import ua.acclorite.book_story.presentation.data.Screen
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
import ua.acclorite.book_story.presentation.screens.history.data.HistoryEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.library.data.LibraryEvent
|
import ua.acclorite.book_story.presentation.screens.library.data.LibraryEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.reader.data.ReaderEvent
|
import ua.acclorite.book_story.presentation.screens.reader.data.ReaderEvent
|
||||||
|
|
@ -111,11 +111,8 @@ fun ReaderEndItem(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
Toast.makeText(
|
context.getString(R.string.book_moved)
|
||||||
context,
|
.showToast(context = context)
|
||||||
context.getString(R.string.book_moved),
|
|
||||||
Toast.LENGTH_LONG
|
|
||||||
).show()
|
|
||||||
} else {
|
} else {
|
||||||
onEvent(
|
onEvent(
|
||||||
ReaderEvent.OnGoBack(
|
ReaderEvent.OnGoBack(
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package ua.acclorite.book_story.presentation.screens.reader.components
|
package ua.acclorite.book_story.presentation.screens.reader.components
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
|
|
@ -24,6 +23,7 @@ import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.TextUnit
|
import androidx.compose.ui.unit.TextUnit
|
||||||
import ua.acclorite.book_story.R
|
import ua.acclorite.book_story.R
|
||||||
import ua.acclorite.book_story.domain.model.FontWithName
|
import ua.acclorite.book_story.domain.model.FontWithName
|
||||||
|
import ua.acclorite.book_story.presentation.data.showToast
|
||||||
import ua.acclorite.book_story.presentation.screens.reader.data.ReaderEvent
|
import ua.acclorite.book_story.presentation.screens.reader.data.ReaderEvent
|
||||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.data.ReaderTextAlignment
|
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.data.ReaderTextAlignment
|
||||||
|
|
||||||
|
|
@ -100,11 +100,8 @@ fun LazyItemScope.ReaderTextParagraph(
|
||||||
translateWholeParagraph = true,
|
translateWholeParagraph = true,
|
||||||
context = context as ComponentActivity,
|
context = context as ComponentActivity,
|
||||||
noAppsFound = {
|
noAppsFound = {
|
||||||
Toast.makeText(
|
context.getString(R.string.error_no_translator)
|
||||||
context,
|
.showToast(context = context, longToast = false)
|
||||||
context.getString(R.string.error_no_translator),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue