Skip to content

Commit

Permalink
feat(about): add license list page and improve about page (Ashinch#664)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashinch authored Mar 26, 2024
1 parent d705726 commit cbc0e06
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 9 deletions.
6 changes: 6 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id "kotlin-kapt"
id "dagger.hilt.android.plugin"
id "com.google.dagger.hilt.android"
id 'com.mikepenz.aboutlibraries.plugin'
}

def gitCommitHash = "git rev-parse --verify --short HEAD".execute().text.trim()
Expand Down Expand Up @@ -107,6 +108,11 @@ android {
}

dependencies {
// https://github.com/mikepenz/AboutLibraries/releases
implementation "com.mikepenz:aboutlibraries-core:${aboutLibsRelease}"
implementation "com.mikepenz:aboutlibraries-compose-m3:${aboutLibsRelease}"

// https://github.com/ireward/compose-html/tags
implementation "com.github.ireward:compose-html:1.0.2"

// http://bigbadaboom.github.io/androidsvg/release_notes.html
Expand Down
25 changes: 22 additions & 3 deletions app/src/main/java/me/ash/reader/ui/page/common/HomeEntry.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ import android.util.Log
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.background
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
Expand All @@ -18,7 +23,12 @@ import kotlinx.coroutines.flow.collectLatest
import me.ash.reader.domain.model.general.Filter
import me.ash.reader.infrastructure.preference.LocalDarkTheme
import me.ash.reader.infrastructure.preference.LocalReadingDarkTheme
import me.ash.reader.ui.ext.*
import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.findActivity
import me.ash.reader.ui.ext.forwardAndBackwardComposable
import me.ash.reader.ui.ext.initialFilter
import me.ash.reader.ui.ext.initialPage
import me.ash.reader.ui.ext.isFirstLaunch
import me.ash.reader.ui.page.home.HomeViewModel
import me.ash.reader.ui.page.home.feeds.FeedsPage
import me.ash.reader.ui.page.home.feeds.subscribe.SubscribeViewModel
Expand All @@ -32,9 +42,15 @@ import me.ash.reader.ui.page.settings.color.ColorAndStylePage
import me.ash.reader.ui.page.settings.color.DarkThemePage
import me.ash.reader.ui.page.settings.color.feeds.FeedsPageStylePage
import me.ash.reader.ui.page.settings.color.flow.FlowPageStylePage
import me.ash.reader.ui.page.settings.color.reading.*
import me.ash.reader.ui.page.settings.color.reading.ReadingDarkThemePage
import me.ash.reader.ui.page.settings.color.reading.ReadingImagePage
import me.ash.reader.ui.page.settings.color.reading.ReadingStylePage
import me.ash.reader.ui.page.settings.color.reading.ReadingTextPage
import me.ash.reader.ui.page.settings.color.reading.ReadingTitlePage
import me.ash.reader.ui.page.settings.color.reading.ReadingVideoPage
import me.ash.reader.ui.page.settings.interaction.InteractionPage
import me.ash.reader.ui.page.settings.languages.LanguagesPage
import me.ash.reader.ui.page.settings.tips.LicenseListPage
import me.ash.reader.ui.page.settings.tips.TipsAndSupportPage
import me.ash.reader.ui.page.startup.StartupPage
import me.ash.reader.ui.theme.AppTheme
Expand Down Expand Up @@ -225,6 +241,9 @@ fun HomeEntry(
forwardAndBackwardComposable(route = RouteName.TIPS_AND_SUPPORT) {
TipsAndSupportPage(navController)
}
forwardAndBackwardComposable(route = RouteName.LICENSE_LIST) {
LicenseListPage(navController)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ object RouteName {

// Tips & Support
const val TIPS_AND_SUPPORT = "tips_and_support"
const val LICENSE_LIST = "license_list"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package me.ash.reader.ui.page.settings.tips

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.add
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material.icons.rounded.Star
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController
import com.mikepenz.aboutlibraries.ui.compose.m3.LibrariesContainer
import me.ash.reader.R
import me.ash.reader.infrastructure.preference.OpenLinkPreference
import me.ash.reader.ui.component.base.FeedbackIconButton
import me.ash.reader.ui.component.base.RYScaffold
import me.ash.reader.ui.ext.openURL
import me.ash.reader.ui.theme.palette.onLight

@Composable
fun LicenseListPage(
navController: NavHostController,
) {
val context = LocalContext.current

RYScaffold(
containerColor = MaterialTheme.colorScheme.surface onLight MaterialTheme.colorScheme.inverseOnSurface,
navigationIcon = {
FeedbackIconButton(
imageVector = Icons.AutoMirrored.Rounded.ArrowBack,
contentDescription = stringResource(R.string.back),
tint = MaterialTheme.colorScheme.onSurface
) {
navController.popBackStack()
}
},
actions = {
FeedbackIconButton(
modifier = Modifier.size(20.dp),
imageVector = Icons.Rounded.Star,
contentDescription = stringResource(R.string.open_source_licenses),
tint = MaterialTheme.colorScheme.onSurface
) {
context.openURL(
url = context.getString(R.string.github_link) + "/blob/main/LICENSE",
openLink = OpenLinkPreference.AutoPreferCustomTabs,
)
}
},
content = {
Column {
LibrariesContainer(
modifier = Modifier.fillMaxSize(),
contentPadding = WindowInsets(0, 0, 0, 24)
.add(WindowInsets.navigationBars)
.asPaddingValues(),
)
}
},
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,38 @@ import androidx.compose.animation.core.tween
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material.icons.rounded.Balance
import androidx.compose.material.icons.rounded.TipsAndUpdates
import androidx.compose.material.icons.rounded.VolunteerActivism
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.material3.Badge
import androidx.compose.material3.BadgedBox
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
Expand All @@ -38,7 +60,13 @@ import me.ash.reader.infrastructure.preference.OpenLinkPreference
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.ext.DataStoreKeys
import me.ash.reader.ui.ext.dataStore
import me.ash.reader.ui.ext.getCurrentVersion
import me.ash.reader.ui.ext.openURL
import me.ash.reader.ui.ext.put
import me.ash.reader.ui.ext.showToast
import me.ash.reader.ui.page.common.RouteName
import me.ash.reader.ui.theme.palette.alwaysLight
import me.ash.reader.ui.theme.palette.onLight

Expand Down Expand Up @@ -80,7 +108,9 @@ fun TipsAndSupportPage(
contentDescription = stringResource(R.string.open_source_licenses),
tint = MaterialTheme.colorScheme.onSurface
) {
context.showToast(context.getString(R.string.coming_soon))
navController.navigate(RouteName.LICENSE_LIST) {
launchSingleTop = true
}
}
},
content = {
Expand Down Expand Up @@ -213,7 +243,7 @@ fun TipsAndSupportPage(
) {
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP)
view.playSoundEffect(SoundEffectConstants.CLICK)
context.showToast(context.getString(R.string.coming_soon))
context.openURL(context.getString(R.string.wiki_link), OpenLinkPreference.AutoPreferCustomTabs)
})
}
Spacer(modifier = Modifier.height(48.dp))
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@
<string name="open_source_licenses">Open source licenses</string>
<string name="github_link" translatable="false">https://github.com/Ashinch/ReadYou</string>
<string name="telegram_link" translatable="false">https://t.me/ReadYouApp</string>
<string name="wiki_link" translatable="false">https://github.com/Ashinch/ReadYou/wiki/Getting-Started</string>
<string name="update_link">https://api.github.com/repos/Ashinch/ReadYou/releases/latest</string>
<string name="change_log">Changelog</string>
<string name="update">Update</string>
Expand Down
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ buildscript {
opmlParser = '3.1.0'
// http://bigbadaboom.github.io/androidsvg/release_notes.html
androidSVG = '1.4'
// https://github.com/mikepenz/AboutLibraries/releases
aboutLibsRelease = '11.1.1'
}

dependencies {
Expand All @@ -46,6 +48,7 @@ plugins {
id 'com.android.application' version '8.2.1' apply false
id 'com.android.library' version '8.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.9.22' apply false
id 'com.mikepenz.aboutlibraries.plugin' version "${aboutLibsRelease}" apply false
}

task clean(type: Delete) {
Expand Down

0 comments on commit cbc0e06

Please sign in to comment.