Rename RY component

This commit is contained in:
Ash 2022-05-21 18:42:27 +08:00
parent efdff0e49c
commit 647ef7a0bd
42 changed files with 427 additions and 107 deletions

View File

@ -0,0 +1,321 @@
{
"formatVersion": 1,
"database": {
"version": 2,
"identityHash": "98462c2e9c32394054102313366e7262",
"entities": [
{
"tableName": "account",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` TEXT NOT NULL, `type` INTEGER NOT NULL, `updateAt` INTEGER)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updateAt",
"columnName": "updateAt",
"affinity": "INTEGER",
"notNull": false
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "feed",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `icon` TEXT, `url` TEXT NOT NULL, `groupId` TEXT NOT NULL, `accountId` INTEGER NOT NULL, `isNotification` INTEGER NOT NULL DEFAULT false, `isFullContent` INTEGER NOT NULL DEFAULT false, PRIMARY KEY(`id`), FOREIGN KEY(`groupId`) REFERENCES `group`(`id`) ON UPDATE CASCADE ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "icon",
"columnName": "icon",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "url",
"columnName": "url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "groupId",
"columnName": "groupId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "accountId",
"columnName": "accountId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isNotification",
"columnName": "isNotification",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "false"
},
{
"fieldPath": "isFullContent",
"columnName": "isFullContent",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "false"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [
{
"name": "index_feed_groupId",
"unique": false,
"columnNames": [
"groupId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_feed_groupId` ON `${TABLE_NAME}` (`groupId`)"
},
{
"name": "index_feed_accountId",
"unique": false,
"columnNames": [
"accountId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_feed_accountId` ON `${TABLE_NAME}` (`accountId`)"
}
],
"foreignKeys": [
{
"table": "group",
"onDelete": "CASCADE",
"onUpdate": "CASCADE",
"columns": [
"groupId"
],
"referencedColumns": [
"id"
]
}
]
},
{
"tableName": "article",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `date` INTEGER NOT NULL, `title` TEXT NOT NULL, `author` TEXT, `rawDescription` TEXT NOT NULL, `shortDescription` TEXT NOT NULL, `fullContent` TEXT, `img` TEXT, `link` TEXT NOT NULL, `feedId` TEXT NOT NULL, `accountId` INTEGER NOT NULL, `isUnread` INTEGER NOT NULL DEFAULT true, `isStarred` INTEGER NOT NULL DEFAULT false, `isReadLater` INTEGER NOT NULL DEFAULT false, PRIMARY KEY(`id`), FOREIGN KEY(`feedId`) REFERENCES `feed`(`id`) ON UPDATE CASCADE ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "author",
"columnName": "author",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "rawDescription",
"columnName": "rawDescription",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "shortDescription",
"columnName": "shortDescription",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "fullContent",
"columnName": "fullContent",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "img",
"columnName": "img",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "feedId",
"columnName": "feedId",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "accountId",
"columnName": "accountId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "isUnread",
"columnName": "isUnread",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "true"
},
{
"fieldPath": "isStarred",
"columnName": "isStarred",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "false"
},
{
"fieldPath": "isReadLater",
"columnName": "isReadLater",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "false"
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [
{
"name": "index_article_feedId",
"unique": false,
"columnNames": [
"feedId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_article_feedId` ON `${TABLE_NAME}` (`feedId`)"
},
{
"name": "index_article_accountId",
"unique": false,
"columnNames": [
"accountId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_article_accountId` ON `${TABLE_NAME}` (`accountId`)"
}
],
"foreignKeys": [
{
"table": "feed",
"onDelete": "CASCADE",
"onUpdate": "CASCADE",
"columns": [
"feedId"
],
"referencedColumns": [
"id"
]
}
]
},
{
"tableName": "group",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `accountId` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "accountId",
"columnName": "accountId",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [
{
"name": "index_group_accountId",
"unique": false,
"columnNames": [
"accountId"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_group_accountId` ON `${TABLE_NAME}` (`accountId`)"
}
],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '98462c2e9c32394054102313366e7262')"
]
}
}

View File

@ -6,7 +6,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".App"
android:name=".RYApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/read_you"

View File

@ -12,9 +12,9 @@ import kotlinx.coroutines.launch
import me.ash.reader.data.module.ApplicationScope
import me.ash.reader.data.module.DispatcherDefault
import me.ash.reader.data.repository.*
import me.ash.reader.data.source.AppNetworkDataSource
import me.ash.reader.data.source.OpmlLocalDataSource
import me.ash.reader.data.source.ReaderDatabase
import me.ash.reader.data.source.RYDatabase
import me.ash.reader.data.source.RYNetworkDataSource
import me.ash.reader.ui.ext.*
import okhttp3.OkHttpClient
import org.conscrypt.Conscrypt
@ -22,7 +22,7 @@ import java.security.Security
import javax.inject.Inject
@HiltAndroidApp
class App : Application(), Configuration.Provider {
class RYApp : Application(), Configuration.Provider {
init {
// From: https://gitlab.com/spacecowboy/Feeder
// Install Conscrypt to handle TLSv1.3 pre Android10
@ -30,7 +30,7 @@ class App : Application(), Configuration.Provider {
}
@Inject
lateinit var readerDatabase: ReaderDatabase
lateinit var RYDatabase: RYDatabase
@Inject
lateinit var workerFactory: HiltWorkerFactory
@ -39,7 +39,7 @@ class App : Application(), Configuration.Provider {
lateinit var workManager: WorkManager
@Inject
lateinit var appNetworkDataSource: AppNetworkDataSource
lateinit var RYNetworkDataSource: RYNetworkDataSource
@Inject
lateinit var opmlLocalDataSource: OpmlLocalDataSource
@ -51,7 +51,7 @@ class App : Application(), Configuration.Provider {
lateinit var notificationHelper: NotificationHelper
@Inject
lateinit var appRepository: AppRepository
lateinit var ryRepository: RYRepository
@Inject
lateinit var stringsRepository: StringsRepository
@ -116,7 +116,7 @@ class App : Application(), Configuration.Provider {
it.del()
}
}
appRepository.checkUpdate(showToast = false)
ryRepository.checkUpdate(showToast = false)
}
override fun getWorkManagerConfiguration(): Configuration =

View File

@ -10,7 +10,7 @@ import me.ash.reader.data.dao.AccountDao
import me.ash.reader.data.dao.ArticleDao
import me.ash.reader.data.dao.FeedDao
import me.ash.reader.data.dao.GroupDao
import me.ash.reader.data.source.ReaderDatabase
import me.ash.reader.data.source.RYDatabase
import javax.inject.Singleton
@Module
@ -19,26 +19,26 @@ object DatabaseModule {
@Provides
@Singleton
fun provideArticleDao(readerDatabase: ReaderDatabase): ArticleDao =
readerDatabase.articleDao()
fun provideArticleDao(RYDatabase: RYDatabase): ArticleDao =
RYDatabase.articleDao()
@Provides
@Singleton
fun provideFeedDao(readerDatabase: ReaderDatabase): FeedDao =
readerDatabase.feedDao()
fun provideFeedDao(RYDatabase: RYDatabase): FeedDao =
RYDatabase.feedDao()
@Provides
@Singleton
fun provideGroupDao(readerDatabase: ReaderDatabase): GroupDao =
readerDatabase.groupDao()
fun provideGroupDao(RYDatabase: RYDatabase): GroupDao =
RYDatabase.groupDao()
@Provides
@Singleton
fun provideAccountDao(readerDatabase: ReaderDatabase): AccountDao =
readerDatabase.accountDao()
fun provideAccountDao(RYDatabase: RYDatabase): AccountDao =
RYDatabase.accountDao()
@Provides
@Singleton
fun provideReaderDatabase(@ApplicationContext context: Context): ReaderDatabase =
ReaderDatabase.getInstance(context)
fun provideReaderDatabase(@ApplicationContext context: Context): RYDatabase =
RYDatabase.getInstance(context)
}

View File

@ -4,7 +4,7 @@ import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import me.ash.reader.data.source.AppNetworkDataSource
import me.ash.reader.data.source.RYNetworkDataSource
import me.ash.reader.data.source.FeverApiDataSource
import me.ash.reader.data.source.GoogleReaderApiDataSource
import javax.inject.Singleton
@ -15,8 +15,8 @@ object RetrofitModule {
@Provides
@Singleton
fun provideAppNetworkDataSource(): AppNetworkDataSource =
AppNetworkDataSource.getInstance()
fun provideAppNetworkDataSource(): RYNetworkDataSource =
RYNetworkDataSource.getInstance()
@Provides
@Singleton

View File

@ -13,8 +13,8 @@ import me.ash.reader.data.module.DispatcherIO
import me.ash.reader.data.module.DispatcherMain
import me.ash.reader.data.preference.*
import me.ash.reader.data.preference.NewVersionSizePreference.formatSize
import me.ash.reader.data.source.AppNetworkDataSource
import me.ash.reader.data.source.Download
import me.ash.reader.data.source.RYNetworkDataSource
import me.ash.reader.data.source.downloadToFileWithProgress
import me.ash.reader.ui.ext.getCurrentVersion
import me.ash.reader.ui.ext.getLatestApk
@ -22,10 +22,10 @@ import me.ash.reader.ui.ext.showToast
import me.ash.reader.ui.ext.skipVersionNumber
import javax.inject.Inject
class AppRepository @Inject constructor(
class RYRepository @Inject constructor(
@ApplicationContext
private val context: Context,
private val appNetworkDataSource: AppNetworkDataSource,
private val RYNetworkDataSource: RYNetworkDataSource,
@DispatcherIO
private val dispatcherIO: CoroutineDispatcher,
@DispatcherMain
@ -34,7 +34,7 @@ class AppRepository @Inject constructor(
suspend fun checkUpdate(showToast: Boolean = true): Boolean? = withContext(dispatcherIO) {
try {
val response =
appNetworkDataSource.getReleaseLatest(context.getString(R.string.update_link))
RYNetworkDataSource.getReleaseLatest(context.getString(R.string.update_link))
when {
response.code() == 403 -> {
withContext(dispatcherMain) {
@ -85,7 +85,7 @@ class AppRepository @Inject constructor(
withContext(dispatcherIO) {
Log.i("RLog", "downloadFile start: $url")
try {
return@withContext appNetworkDataSource.downloadFile(url)
return@withContext RYNetworkDataSource.downloadFile(url)
.downloadToFileWithProgress(context.getLatestApk())
} catch (e: Exception) {
e.printStackTrace()

View File

@ -18,21 +18,21 @@ import java.util.*
entities = [Account::class, Feed::class, Article::class, Group::class],
version = 2,
)
@TypeConverters(ReaderDatabase.Converters::class)
abstract class ReaderDatabase : RoomDatabase() {
@TypeConverters(RYDatabase.Converters::class)
abstract class RYDatabase : RoomDatabase() {
abstract fun accountDao(): AccountDao
abstract fun feedDao(): FeedDao
abstract fun articleDao(): ArticleDao
abstract fun groupDao(): GroupDao
companion object {
private var instance: ReaderDatabase? = null
private var instance: RYDatabase? = null
fun getInstance(context: Context): ReaderDatabase {
fun getInstance(context: Context): RYDatabase {
return instance ?: synchronized(this) {
instance ?: Room.databaseBuilder(
context.applicationContext,
ReaderDatabase::class.java,
RYDatabase::class.java,
"Reader"
).addMigrations(*allMigrations).build().also {
instance = it

View File

@ -14,7 +14,7 @@ import retrofit2.http.Streaming
import retrofit2.http.Url
import java.io.File
interface AppNetworkDataSource {
interface RYNetworkDataSource {
@GET
suspend fun getReleaseLatest(@Url url: String): Response<LatestRelease>
@ -23,14 +23,14 @@ interface AppNetworkDataSource {
suspend fun downloadFile(@Url url: String): ResponseBody
companion object {
private var instance: AppNetworkDataSource? = null
private var instance: RYNetworkDataSource? = null
fun getInstance(): AppNetworkDataSource {
fun getInstance(): RYNetworkDataSource {
return instance ?: synchronized(this) {
instance ?: Retrofit.Builder()
.baseUrl("https://api.github.com/")
.addConverterFactory(GsonConverterFactory.create())
.build().create(AppNetworkDataSource::class.java).also {
.build().create(RYNetworkDataSource::class.java).also {
instance = it
}
}

View File

@ -7,7 +7,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
@Composable
fun BlockRadioGroupButton(
fun BlockRadioButton(
modifier: Modifier = Modifier,
selected: Int = 0,
onSelected: (Int) -> Unit,

View File

@ -32,7 +32,7 @@ fun ClipboardTextField(
) {
Column(modifier = modifier) {
Spacer(modifier = Modifier.height(10.dp))
TextField(
RYTextField(
readOnly = readOnly,
value = value,
onValueChange = onValueChange,

View File

@ -41,7 +41,7 @@ fun DynamicSVGImage(
},
) {
Crossfade(targetState = pic) {
AsyncImage(
RYAsyncImage(
contentDescription = contentDescription,
data = it,
placeholder = null,

View File

@ -22,7 +22,7 @@ import me.ash.reader.R
val Size_1000 = Size(1000, 1000)
@Composable
fun AsyncImage(
fun RYAsyncImage(
modifier: Modifier = Modifier,
data: Any? = null,
size: Size = Size.ORIGINAL,

View File

@ -6,7 +6,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.window.DialogProperties
@Composable
fun Dialog(
fun RYDialog(
modifier: Modifier = Modifier,
visible: Boolean,
properties: DialogProperties = DialogProperties(),

View File

@ -18,7 +18,7 @@ import me.ash.reader.ui.theme.palette.onDark
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun Scaffold(
fun RYScaffold(
containerColor: Color = MaterialTheme.colorScheme.surface,
topBarTonalElevation: Dp = 0.dp,
containerTonalElevation: Dp = 0.dp,

View File

@ -31,7 +31,7 @@ import me.ash.reader.ui.theme.palette.onDark
// TODO: ripple & swipe
@Composable
fun Switch(
fun RYSwitch(
modifier: Modifier = Modifier,
activated: Boolean,
enable: Boolean = true,
@ -101,7 +101,7 @@ fun SwitchHeadline(
)
}
Box(Modifier.padding(start = 20.dp)) {
Switch(activated = activated)
RYSwitch(activated = activated)
}
}
}

View File

@ -19,7 +19,7 @@ import kotlinx.coroutines.delay
import me.ash.reader.R
@Composable
fun TextField(
fun RYTextField(
readOnly: Boolean,
value: String,
onValueChange: (String) -> Unit,

View File

@ -29,7 +29,7 @@ fun RadioDialog(
options: List<RadioDialogOption> = emptyList(),
onDismissRequest: () -> Unit = {},
) {
Dialog(
RYDialog(
modifier = modifier,
visible = visible,
onDismissRequest = onDismissRequest,

View File

@ -35,7 +35,7 @@ fun TextFieldDialog(
) {
val focusManager = LocalFocusManager.current
Dialog(
RYDialog(
modifier = modifier,
visible = visible,
onDismissRequest = onDismissRequest,

View File

@ -51,7 +51,7 @@ import coil.size.Precision
import coil.size.Size
import coil.size.pxOrElse
import me.ash.reader.R
import me.ash.reader.ui.component.base.AsyncImage
import me.ash.reader.ui.component.base.RYAsyncImage
import org.jsoup.Jsoup
import org.jsoup.helper.StringUtil
import org.jsoup.nodes.Element
@ -465,7 +465,7 @@ private fun TextComposer.appendTextChildren(
// }
) {
val imageSize = maxImageSize()
AsyncImage(
RYAsyncImage(
modifier = Modifier.fillMaxWidth(),
data = imageCandidates.getBestImageForMaxSize(
pixelDensity = pixelDensity(),
@ -591,7 +591,7 @@ private fun TextComposer.appendTextChildren(
BoxWithConstraints(
modifier = Modifier.fillMaxWidth()
) {
AsyncImage(
RYAsyncImage(
modifier = Modifier
.clickable {
onLinkClick(video.link)

View File

@ -30,10 +30,7 @@ import me.ash.reader.data.model.getName
import me.ash.reader.data.preference.*
import me.ash.reader.data.repository.SyncWorker.Companion.getIsSyncing
import me.ash.reader.ui.component.FilterBar
import me.ash.reader.ui.component.base.Banner
import me.ash.reader.ui.component.base.DisplayText
import me.ash.reader.ui.component.base.FeedbackIconButton
import me.ash.reader.ui.component.base.Subtitle
import me.ash.reader.ui.component.base.*
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.findActivity
import me.ash.reader.ui.ext.getCurrentVersion
@ -113,7 +110,7 @@ fun FeedsPage(
context.findActivity()?.moveTaskToBack(false)
}
me.ash.reader.ui.component.base.Scaffold(
RYScaffold(
topBarTonalElevation = topBarTonalElevation.value.dp,
containerTonalElevation = groupListTonalElevation.value.dp,
navigationIcon = {

View File

@ -11,7 +11,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import me.ash.reader.R
import me.ash.reader.ui.component.base.Dialog
import me.ash.reader.ui.component.base.RYDialog
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.showToast
@ -25,7 +25,7 @@ fun ClearFeedDialog(
val scope = rememberCoroutineScope()
val toastString = stringResource(R.string.clear_articles_in_feed_toast, feedName)
Dialog(
RYDialog(
visible = feedOptionUiState.clearDialogVisible,
onDismissRequest = {
feedOptionViewModel.hideClearDialog()

View File

@ -11,7 +11,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import me.ash.reader.R
import me.ash.reader.ui.component.base.Dialog
import me.ash.reader.ui.component.base.RYDialog
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.showToast
@ -25,7 +25,7 @@ fun DeleteFeedDialog(
val scope = rememberCoroutineScope()
val toastString = stringResource(R.string.delete_toast, feedName)
Dialog(
RYDialog(
visible = feedOptionUiState.deleteDialogVisible,
onDismissRequest = {
feedOptionViewModel.hideDeleteDialog()

View File

@ -11,7 +11,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import me.ash.reader.R
import me.ash.reader.ui.component.base.Dialog
import me.ash.reader.ui.component.base.RYDialog
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.showToast
@ -26,7 +26,7 @@ fun AllAllowNotificationDialog(
val allowToastString = stringResource(R.string.all_allow_notification_toast, groupName)
val denyToastString = stringResource(R.string.all_deny_notification_toast, groupName)
Dialog(
RYDialog(
visible = groupOptionUiState.allAllowNotificationDialogVisible,
onDismissRequest = {
groupOptionViewModel.hideAllAllowNotificationDialog()

View File

@ -11,7 +11,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import me.ash.reader.R
import me.ash.reader.ui.component.base.Dialog
import me.ash.reader.ui.component.base.RYDialog
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.showToast
@ -28,7 +28,7 @@ fun AllMoveToGroupDialog(
groupOptionUiState.targetGroup?.name ?: ""
)
Dialog(
RYDialog(
visible = groupOptionUiState.allMoveToGroupDialogVisible,
onDismissRequest = {
groupOptionViewModel.hideAllMoveToGroupDialog()

View File

@ -11,7 +11,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import me.ash.reader.R
import me.ash.reader.ui.component.base.Dialog
import me.ash.reader.ui.component.base.RYDialog
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.showToast
@ -26,7 +26,7 @@ fun AllParseFullContentDialog(
val allowToastString = stringResource(R.string.all_parse_full_content_toast, groupName)
val denyToastString = stringResource(R.string.all_deny_parse_full_content_toast, groupName)
Dialog(
RYDialog(
visible = groupOptionUiState.allParseFullContentDialogVisible,
onDismissRequest = {
groupOptionViewModel.hideAllParseFullContentDialog()

View File

@ -11,7 +11,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import me.ash.reader.R
import me.ash.reader.ui.component.base.Dialog
import me.ash.reader.ui.component.base.RYDialog
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.showToast
@ -25,7 +25,7 @@ fun ClearGroupDialog(
val scope = rememberCoroutineScope()
val toastString = stringResource(R.string.clear_articles_in_group_toast, groupName)
Dialog(
RYDialog(
visible = groupOptionUiState.clearDialogVisible,
onDismissRequest = {
groupOptionViewModel.hideClearDialog()

View File

@ -11,7 +11,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import me.ash.reader.R
import me.ash.reader.ui.component.base.Dialog
import me.ash.reader.ui.component.base.RYDialog
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.showToast
@ -25,7 +25,7 @@ fun DeleteGroupDialog(
val scope = rememberCoroutineScope()
val toastString = stringResource(R.string.delete_toast, groupName)
Dialog(
RYDialog(
visible = groupOptionUiState.deleteDialogVisible,
onDismissRequest = {
groupOptionViewModel.hideDeleteDialog()

View File

@ -26,7 +26,7 @@ import androidx.compose.ui.window.DialogProperties
import androidx.hilt.navigation.compose.hiltViewModel
import me.ash.reader.R
import me.ash.reader.ui.component.base.ClipboardTextField
import me.ash.reader.ui.component.base.Dialog
import me.ash.reader.ui.component.base.RYDialog
import me.ash.reader.ui.component.base.TextFieldDialog
import me.ash.reader.ui.ext.collectAsStateValue
@ -60,7 +60,7 @@ fun SubscribeDialog(
}
}
Dialog(
RYDialog(
modifier = Modifier.padding(horizontal = 44.dp),
visible = subscribeUiState.visible,
properties = DialogProperties(usePlatformDefaultWidth = false),

View File

@ -23,7 +23,7 @@ import coil.size.Scale
import me.ash.reader.R
import me.ash.reader.data.entity.ArticleWithFeed
import me.ash.reader.data.preference.*
import me.ash.reader.ui.component.base.AsyncImage
import me.ash.reader.ui.component.base.RYAsyncImage
import me.ash.reader.ui.ext.formatAsString
import me.ash.reader.ui.component.FeedIcon
import me.ash.reader.ui.component.base.Size_1000
@ -139,7 +139,7 @@ fun ArticleItem(
// Image
if (articleWithFeed.article.img != null && articleListImage.value) {
AsyncImage(
RYAsyncImage(
modifier = Modifier
.padding(start = 10.dp)
.size(80.dp)

View File

@ -30,6 +30,7 @@ import me.ash.reader.data.repository.SyncWorker.Companion.getIsSyncing
import me.ash.reader.ui.component.FilterBar
import me.ash.reader.ui.component.base.DisplayText
import me.ash.reader.ui.component.base.FeedbackIconButton
import me.ash.reader.ui.component.base.RYScaffold
import me.ash.reader.ui.component.base.SwipeRefresh
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.page.common.RouteName
@ -100,7 +101,7 @@ fun FlowPage(
onSearch = false
}
me.ash.reader.ui.component.base.Scaffold(
RYScaffold(
topBarTonalElevation = topBarTonalElevation.value.dp,
containerTonalElevation = articleListTonalElevation.value.dp,
navigationIcon = {

View File

@ -27,6 +27,7 @@ import androidx.navigation.NavHostController
import me.ash.reader.R
import me.ash.reader.data.entity.ArticleWithFeed
import me.ash.reader.ui.component.base.FeedbackIconButton
import me.ash.reader.ui.component.base.RYScaffold
import me.ash.reader.ui.component.reader.reader
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.drawVerticalScrollbar
@ -56,7 +57,7 @@ fun ReadingPage(
}
}
me.ash.reader.ui.component.base.Scaffold(
RYScaffold(
content = {
Box(Modifier.fillMaxSize()) {
Box(

View File

@ -25,6 +25,7 @@ import me.ash.reader.data.preference.LocalSkipVersionNumber
import me.ash.reader.ui.component.base.Banner
import me.ash.reader.ui.component.base.DisplayText
import me.ash.reader.ui.component.base.FeedbackIconButton
import me.ash.reader.ui.component.base.RYScaffold
import me.ash.reader.ui.ext.getCurrentVersion
import me.ash.reader.ui.page.common.RouteName
import me.ash.reader.ui.page.settings.tips.UpdateDialog
@ -41,7 +42,7 @@ fun SettingsPage(
val skipVersion = LocalSkipVersionNumber.current
val currentVersion by remember { mutableStateOf(context.getCurrentVersion()) }
me.ash.reader.ui.component.base.Scaffold(
RYScaffold(
containerColor = MaterialTheme.colorScheme.surface onLight MaterialTheme.colorScheme.inverseOnSurface,
navigationIcon = {
FeedbackIconButton(

View File

@ -50,7 +50,7 @@ fun ColorAndStylePage(
val wallpaperTonalPalettes = extractTonalPalettesFromUserWallpaper()
var radioButtonSelected by remember { mutableStateOf(if (themeIndex > 4) 0 else 1) }
me.ash.reader.ui.component.base.Scaffold(
RYScaffold(
containerColor = MaterialTheme.colorScheme.surface onLight MaterialTheme.colorScheme.inverseOnSurface,
navigationIcon = {
FeedbackIconButton(
@ -90,7 +90,7 @@ fun ColorAndStylePage(
Spacer(modifier = Modifier.height(24.dp))
}
item {
BlockRadioGroupButton(
BlockRadioButton(
selected = radioButtonSelected,
onSelected = { radioButtonSelected = it },
itemRadioGroups = listOf(
@ -142,7 +142,7 @@ fun ColorAndStylePage(
}
},
) {
me.ash.reader.ui.component.base.Switch(
RYSwitch(
activated = darkTheme.isDarkTheme()
) {
darkThemeNot.put(context, scope)

View File

@ -19,10 +19,7 @@ import me.ash.reader.data.preference.DarkThemePreference
import me.ash.reader.data.preference.LocalAmoledDarkTheme
import me.ash.reader.data.preference.LocalDarkTheme
import me.ash.reader.data.preference.not
import me.ash.reader.ui.component.base.DisplayText
import me.ash.reader.ui.component.base.FeedbackIconButton
import me.ash.reader.ui.component.base.Subtitle
import me.ash.reader.ui.component.base.Switch
import me.ash.reader.ui.component.base.*
import me.ash.reader.ui.page.settings.SettingItem
import me.ash.reader.ui.theme.palette.onLight
@ -36,7 +33,7 @@ fun DarkThemePage(
val amoledDarkTheme = LocalAmoledDarkTheme.current
val scope = rememberCoroutineScope()
me.ash.reader.ui.component.base.Scaffold(
RYScaffold(
containerColor = MaterialTheme.colorScheme.surface onLight MaterialTheme.colorScheme.inverseOnSurface,
navigationIcon = {
FeedbackIconButton(
@ -75,7 +72,7 @@ fun DarkThemePage(
(!amoledDarkTheme).put(context, scope)
},
) {
Switch(activated = amoledDarkTheme.value) {
RYSwitch(activated = amoledDarkTheme.value) {
(!amoledDarkTheme).put(context, scope)
}
}

View File

@ -58,7 +58,7 @@ fun FeedsPageStylePage(
var filterBarPaddingValue: Int? by remember { mutableStateOf(filterBarPadding) }
me.ash.reader.ui.component.base.Scaffold(
RYScaffold(
containerColor = MaterialTheme.colorScheme.surface onLight MaterialTheme.colorScheme.inverseOnSurface,
navigationIcon = {
FeedbackIconButton(
@ -132,7 +132,7 @@ fun FeedsPageStylePage(
(!groupListExpand).put(context, scope)
},
) {
Switch(activated = groupListExpand.value) {
RYSwitch(activated = groupListExpand.value) {
(!groupListExpand).put(context, scope)
}
}
@ -166,7 +166,7 @@ fun FeedsPageStylePage(
(!filterBarFilled).put(context, scope)
},
) {
Switch(activated = filterBarFilled.value) {
RYSwitch(activated = filterBarFilled.value) {
(!filterBarFilled).put(context, scope)
}
}

View File

@ -10,7 +10,6 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.ArrowBack
import androidx.compose.material.icons.rounded.DoneAll
import androidx.compose.material.icons.rounded.Search
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SmallTopAppBar
import androidx.compose.material3.TopAppBarDefaults
@ -66,7 +65,7 @@ fun FlowPageStylePage(
var filterBarPaddingValue: Int? by remember { mutableStateOf(filterBarPadding) }
me.ash.reader.ui.component.base.Scaffold(
RYScaffold(
containerColor = MaterialTheme.colorScheme.surface onLight MaterialTheme.colorScheme.inverseOnSurface,
navigationIcon = {
FeedbackIconButton(
@ -145,7 +144,7 @@ fun FlowPageStylePage(
(!articleListFeedIcon).put(context, scope)
},
) {
me.ash.reader.ui.component.base.Switch(activated = articleListFeedIcon.value) {
RYSwitch(activated = articleListFeedIcon.value) {
(!articleListFeedIcon).put(context, scope)
}
}
@ -155,7 +154,7 @@ fun FlowPageStylePage(
(!articleListFeedName).put(context, scope)
},
) {
me.ash.reader.ui.component.base.Switch(activated = articleListFeedName.value) {
RYSwitch(activated = articleListFeedName.value) {
(!articleListFeedName).put(context, scope)
}
}
@ -165,7 +164,7 @@ fun FlowPageStylePage(
(!articleListImage).put(context, scope)
},
) {
me.ash.reader.ui.component.base.Switch(activated = articleListImage.value) {
RYSwitch(activated = articleListImage.value) {
(!articleListImage).put(context, scope)
}
}
@ -175,7 +174,7 @@ fun FlowPageStylePage(
(!articleListDesc).put(context, scope)
},
) {
me.ash.reader.ui.component.base.Switch(activated = articleListDesc.value) {
RYSwitch(activated = articleListDesc.value) {
(!articleListDesc).put(context, scope)
}
}
@ -185,7 +184,7 @@ fun FlowPageStylePage(
(!articleListTime).put(context, scope)
},
) {
me.ash.reader.ui.component.base.Switch(activated = articleListTime.value) {
RYSwitch(activated = articleListTime.value) {
(!articleListTime).put(context, scope)
}
}
@ -195,7 +194,7 @@ fun FlowPageStylePage(
(!articleListStickyDate).put(context, scope)
},
) {
me.ash.reader.ui.component.base.Switch(activated = articleListStickyDate.value) {
RYSwitch(activated = articleListStickyDate.value) {
(!articleListStickyDate).put(context, scope)
}
}
@ -229,7 +228,7 @@ fun FlowPageStylePage(
(!filterBarFilled).put(context, scope)
},
) {
me.ash.reader.ui.component.base.Switch(activated = filterBarFilled.value) {
RYSwitch(activated = filterBarFilled.value) {
(!filterBarFilled).put(context, scope)
}
}

View File

@ -33,7 +33,7 @@ fun InteractionPage(
var initialPageDialogVisible by remember { mutableStateOf(false) }
var initialFilterDialogVisible by remember { mutableStateOf(false) }
me.ash.reader.ui.component.base.Scaffold(
RYScaffold(
containerColor = MaterialTheme.colorScheme.surface onLight MaterialTheme.colorScheme.inverseOnSurface,
navigationIcon = {
FeedbackIconButton(

View File

@ -26,6 +26,7 @@ import me.ash.reader.data.preference.LocalLanguages
import me.ash.reader.ui.component.base.Banner
import me.ash.reader.ui.component.base.DisplayText
import me.ash.reader.ui.component.base.FeedbackIconButton
import me.ash.reader.ui.component.base.RYScaffold
import me.ash.reader.ui.page.settings.SettingItem
import me.ash.reader.ui.theme.palette.onLight
@ -38,7 +39,7 @@ fun LanguagesPage(
val languages = LocalLanguages.current
val scope = rememberCoroutineScope()
me.ash.reader.ui.component.base.Scaffold(
RYScaffold(
containerColor = MaterialTheme.colorScheme.surface onLight MaterialTheme.colorScheme.inverseOnSurface,
navigationIcon = {
FeedbackIconButton(

View File

@ -38,6 +38,7 @@ import androidx.navigation.NavHostController
import me.ash.reader.R
import me.ash.reader.ui.component.base.CurlyCornerShape
import me.ash.reader.ui.component.base.FeedbackIconButton
import me.ash.reader.ui.component.base.RYScaffold
import me.ash.reader.ui.ext.*
import me.ash.reader.ui.theme.palette.alwaysLight
import me.ash.reader.ui.theme.palette.onLight
@ -61,7 +62,7 @@ fun TipsAndSupportPage(
currentVersion = context.getCurrentVersion().toString()
}
me.ash.reader.ui.component.base.Scaffold(
RYScaffold(
containerColor = MaterialTheme.colorScheme.surface onLight MaterialTheme.colorScheme.inverseOnSurface,
navigationIcon = {
FeedbackIconButton(

View File

@ -33,7 +33,7 @@ import kotlinx.coroutines.Dispatchers
import me.ash.reader.R
import me.ash.reader.data.preference.*
import me.ash.reader.data.source.Download
import me.ash.reader.ui.component.base.Dialog
import me.ash.reader.ui.component.base.RYDialog
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.installLatestApk
@ -71,7 +71,7 @@ fun UpdateDialog(
}
}
Dialog(
RYDialog(
modifier = Modifier.heightIn(max = 400.dp),
visible = updateUiState.updateDialogVisible,
onDismissRequest = { updateViewModel.hideDialog() },

View File

@ -5,14 +5,14 @@ import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
import me.ash.reader.data.repository.AppRepository
import me.ash.reader.data.repository.RYRepository
import me.ash.reader.data.source.Download
import me.ash.reader.ui.ext.notFdroid
import javax.inject.Inject
@HiltViewModel
class UpdateViewModel @Inject constructor(
private val appRepository: AppRepository,
private val ryRepository: RYRepository,
) : ViewModel() {
private val _updateUiState = MutableStateFlow(UpdateUiState())
val updateUiState: StateFlow<UpdateUiState> = _updateUiState.asStateFlow()
@ -24,7 +24,7 @@ class UpdateViewModel @Inject constructor(
if (notFdroid) {
viewModelScope.launch {
preProcessor()
appRepository.checkUpdate().let {
ryRepository.checkUpdate().let {
it?.let {
if (it) {
showDialog()
@ -63,7 +63,7 @@ class UpdateViewModel @Inject constructor(
}
_updateUiState.update {
it.copy(
downloadFlow = appRepository.downloadFile(url)
downloadFlow = ryRepository.downloadFile(url)
)
}
}

View File

@ -21,6 +21,7 @@ import kotlinx.coroutines.launch
import me.ash.reader.R
import me.ash.reader.ui.component.base.DisplayText
import me.ash.reader.ui.component.base.DynamicSVGImage
import me.ash.reader.ui.component.base.RYScaffold
import me.ash.reader.ui.component.base.Tips
import me.ash.reader.ui.ext.DataStoreKeys
import me.ash.reader.ui.ext.dataStore
@ -36,7 +37,7 @@ fun StartupPage(
val context = LocalContext.current
val scope = rememberCoroutineScope()
me.ash.reader.ui.component.base.Scaffold(
RYScaffold(
content = {
LazyColumn {
item {