Skip to content

Commit

Permalink
[Feat]: setting page
Browse files Browse the repository at this point in the history
  • Loading branch information
why committed Dec 17, 2023
1 parent bd80db6 commit c253074
Show file tree
Hide file tree
Showing 19 changed files with 93 additions and 30 deletions.
10 changes: 8 additions & 2 deletions app/src/main/java/com/xiaoyv/bangumi/helper/RouteHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,18 @@ object RouteHelper {

}

fun jumpWeb(url: String, fitToolbar: Boolean = false, injectJs: String = "") {
fun jumpWeb(
url: String,
fitToolbar: Boolean = true,
smallToolbar: Boolean = false,
injectJs: String = "",
) {
WebActivity::class.open(
bundleOf(
NavKey.KEY_STRING to url,
NavKey.KEY_STRING_SECOND to injectJs,
NavKey.KEY_BOOLEAN to fitToolbar
NavKey.KEY_BOOLEAN to fitToolbar,
NavKey.KEY_BOOLEAN_SECOND to smallToolbar
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AlmanacActivity : BaseListActivity<AlmanacEntity, AlmanacViewModel>() {
super.initListener()

contentAdapter.setOnDebouncedChildClickListener(R.id.item_year) {
RouteHelper.jumpWeb(BgmApiManager.URL_BASE_WEB + "/award/${it.id}")
RouteHelper.jumpWeb(BgmApiManager.URL_BASE_WEB + "/award/${it.id}", fitToolbar = false)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ import com.xiaoyv.bangumi.databinding.ActivitySettingBinding
import com.xiaoyv.bangumi.helper.RouteHelper
import com.xiaoyv.blueprint.base.mvvm.normal.BaseViewModelActivity
import com.xiaoyv.blueprint.kts.launchUI
import com.xiaoyv.common.config.GlobalConfig
import com.xiaoyv.common.helper.UpdateHelper
import com.xiaoyv.common.helper.UserHelper
import com.xiaoyv.common.kts.initNavBack
import com.xiaoyv.common.kts.openInBrowser
import com.xiaoyv.common.kts.showConfirmDialog
import com.xiaoyv.common.kts.showOptionsDialog
import com.xiaoyv.common.widget.dialog.AnimeLoadingDialog
import com.xiaoyv.widget.callback.setOnFastLimitClickListener
import com.xiaoyv.widget.dialog.UiDialog
Expand Down Expand Up @@ -63,7 +65,7 @@ class SettingActivity : BaseViewModelActivity<ActivitySettingBinding, SettingVie
}

binding.settingRobot.setOnFastLimitClickListener {

showConfirmDialog(message = "正在调试中,敬请期待")
}

binding.settingClean.setOnFastLimitClickListener {
Expand All @@ -80,7 +82,17 @@ class SettingActivity : BaseViewModelActivity<ActivitySettingBinding, SettingVie
}

binding.settingFeedback.setOnFastLimitClickListener {

showOptionsDialog(
title = "反馈建议",
items = listOf("Github Issues", "班固米小组"),
onItemClick = { _, position ->
if (position == 0) {
openInBrowser("https://github.com/xiaoyvyv/Bangumi-for-Android/issues")
} else {
RouteHelper.jumpGroupDetail("android_client")
}
}
)
}

binding.settingDonation.setOnFastLimitClickListener {
Expand All @@ -90,7 +102,7 @@ class SettingActivity : BaseViewModelActivity<ActivitySettingBinding, SettingVie
}

binding.settingDonationUser.setOnFastLimitClickListener {

RouteHelper.jumpWeb(GlobalConfig.DOC_DONATION, fitToolbar = true, smallToolbar = true)
}

binding.settingGroup.setOnFastLimitClickListener {
Expand All @@ -102,20 +114,16 @@ class SettingActivity : BaseViewModelActivity<ActivitySettingBinding, SettingVie
}

binding.settingAgreement.setOnFastLimitClickListener {

RouteHelper.jumpWeb(GlobalConfig.DOC_PRIVACY, fitToolbar = true, smallToolbar = true)
}

binding.settingAuthor.setOnFastLimitClickListener {

RouteHelper.jumpWeb(GlobalConfig.DOC_AUTHOR, fitToolbar = true, smallToolbar = true)
}

binding.settingAbout.setOnFastLimitClickListener {
UpdateHelper.checkUpdate(this, true)
}

binding.settingAuthor.setOnFastLimitClickListener {

}
}

override fun LifecycleOwner.initViewObserver() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.xiaoyv.bangumi.ui.feature.setting.translate

import android.view.Menu
import android.view.MenuItem
import com.xiaoyv.bangumi.databinding.ActivitySettingTranslateBinding
import com.xiaoyv.blueprint.base.binding.BaseBindingActivity
import com.xiaoyv.common.helper.ConfigHelper
import com.xiaoyv.common.kts.initNavBack
import com.xiaoyv.common.kts.openInBrowser
import com.xiaoyv.common.kts.showConfirmDialog
import com.xiaoyv.common.kts.showInputDialog
Expand All @@ -19,6 +21,8 @@ class TranslateConfigActivity : BaseBindingActivity<ActivitySettingTranslateBind
override fun initView() {
binding.settingAppId.title = "百度翻译 AppId"
binding.settingAppSecret.title = "百度翻译 AppSecret"

binding.toolbar.initNavBack(this)
}

override fun initData() {
Expand Down Expand Up @@ -80,4 +84,9 @@ class TranslateConfigActivity : BaseBindingActivity<ActivitySettingTranslateBind
}
return super.onCreateOptionsMenu(menu)
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
item.initNavBack(this)
return super.onOptionsItemSelected(item)
}
}
21 changes: 18 additions & 3 deletions app/src/main/java/com/xiaoyv/bangumi/ui/feature/web/WebActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ import com.xiaoyv.bangumi.databinding.ActivityWebBinding
import com.xiaoyv.bangumi.helper.RouteHelper
import com.xiaoyv.blueprint.base.binding.BaseBindingActivity
import com.xiaoyv.blueprint.constant.NavKey
import com.xiaoyv.blueprint.kts.activity
import com.xiaoyv.common.api.BgmApiManager
import com.xiaoyv.common.helper.UserHelper
import com.xiaoyv.common.kts.GoogleStyle
import com.xiaoyv.common.kts.debugLog
import com.xiaoyv.common.kts.initNavBack
import com.xiaoyv.widget.kts.dpi
import com.xiaoyv.widget.webview.listener.OnWebLoadListener
import com.xiaoyv.widget.webview.listener.OnWindowListener

Expand All @@ -34,15 +36,27 @@ class WebActivity : BaseBindingActivity<ActivityWebBinding>() {
private var url = ""
private var injectJs = ""
private var fitToolbar = false
private var hideToolbar = false

override fun initIntentData(intent: Intent, bundle: Bundle, isNewIntent: Boolean) {
url = bundle.getString(NavKey.KEY_STRING).orEmpty()
injectJs = bundle.getString(NavKey.KEY_STRING_SECOND).orEmpty()
fitToolbar = bundle.getBoolean(NavKey.KEY_BOOLEAN, false)
hideToolbar = bundle.getBoolean(NavKey.KEY_BOOLEAN_SECOND, false)
}

override fun initView() {
binding.toolbar.initNavBack(this)
if (hideToolbar) {
binding.toolbar.setTitleTextAppearance(
activity,
GoogleStyle.TextAppearance_Material3_LabelSmall
)
binding.toolbar.updateLayoutParams {
height = 32.dpi
}
} else {
binding.toolbar.initNavBack(this)
}

binding.webView.bindTitleToolbar(binding.toolbar)
binding.webView.bindWebProgress(binding.pbProgress)
Expand Down Expand Up @@ -80,7 +94,8 @@ class WebActivity : BaseBindingActivity<ActivityWebBinding>() {
if (RouteHelper.handleUrl(url)) {
return
}
RouteHelper.jumpWeb(url)

RouteHelper.jumpWeb(url, fitToolbar, hideToolbar)
}
}

Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/activity_web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/Theme.Bangumi.PopupOverlay"
app:title="Loading..." />

</com.xiaoyv.common.widget.appbar.AnimeAppBarLayout>

<com.xiaoyv.widget.webview.UiWebView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ object GlobalConfig {
const val GROUP_MY_REPLY_TOPIC = "my_reply"
const val GROUP_MY_SEND_TOPIC = "my_topic"

const val DOC_PRIVACY =
"https://xiaoyvyv.github.io/Bangumi-for-Android/lib-doc/build/starter.html"
const val DOC_AUTHOR =
"https://xiaoyvyv.github.io/Bangumi-for-Android/lib-doc/build/author.html"
const val DOC_DONATION =
"https://xiaoyvyv.github.io/Bangumi-for-Android/lib-doc/build/donation.html"

val mediaTypes by lazy {
listOf(
Expand Down
2 changes: 1 addition & 1 deletion lib-doc/build/HelpTOC.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"entities":{"pages":{"Home":{"id":"Home","title":"关于 Bangumi for Android","url":"home.html","level":0,"pages":["Starter","Preview"],"tabIndex":0},"Starter":{"id":"Starter","title":"隐私保护政策","url":"starter.html","level":1,"parentId":"Home","tabIndex":0},"Preview":{"id":"Preview","title":"App 功能预览","url":"preview.html","level":1,"parentId":"Home","tabIndex":1},"Download":{"id":"Download","title":"获取客户端","url":"download.html","level":0,"tabIndex":1},"Question":{"id":"Question","title":"常见的问题","url":"question.html","level":0,"tabIndex":2},"Overview":{"id":"Overview","title":"功能介绍","url":"overview.html","level":0,"tabIndex":3},"Update":{"id":"Update","title":"更新记录","url":"update.html","level":0,"tabIndex":4}}},"topLevelIds":["Home","Download","Question","Overview","Update"]}
{"entities":{"pages":{"Home":{"id":"Home","title":"关于 Bangumi for Android","url":"home.html","level":0,"pages":["Starter","Preview","Author"],"tabIndex":0},"Starter":{"id":"Starter","title":"隐私保护政策","url":"starter.html","level":1,"parentId":"Home","tabIndex":0},"Preview":{"id":"Preview","title":"App 功能预览","url":"preview.html","level":1,"parentId":"Home","tabIndex":1},"Author":{"id":"Author","title":"关于作者","url":"author.html","level":1,"parentId":"Home","tabIndex":2},"Download":{"id":"Download","title":"获取客户端","url":"download.html","level":0,"tabIndex":1},"Question":{"id":"Question","title":"常见的问题","url":"question.html","level":0,"tabIndex":2},"Overview":{"id":"Overview","title":"功能介绍","url":"overview.html","level":0,"tabIndex":3},"Update":{"id":"Update","title":"更新记录","url":"update.html","level":0,"tabIndex":4}}},"topLevelIds":["Home","Download","Question","Overview","Update"]}
2 changes: 1 addition & 1 deletion lib-doc/build/Map.jhm
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?xml version='1.0' encoding='UTF-8'?><map version="2.0"><mapID target="Home.md" url="home.html" default="yes"/><mapID target="Home" url="home.html" default="yes"/><mapID target="Starter.md" url="starter.html" default="no"/><mapID target="Starter" url="starter.html" default="no"/><mapID target="Preview.md" url="preview.html" default="no"/><mapID target="Preview" url="preview.html" default="no"/><mapID target="Download.md" url="download.html" default="no"/><mapID target="Download" url="download.html" default="no"/><mapID target="Question.md" url="question.html" default="no"/><mapID target="Question" url="question.html" default="no"/><mapID target="Overview.md" url="overview.html" default="no"/><mapID target="Overview" url="overview.html" default="no"/><mapID target="Update.md" url="update.html" default="no"/><mapID target="Update" url="update.html" default="no"/></map>
<?xml version='1.0' encoding='UTF-8'?><map version="2.0"><mapID target="Home.md" url="home.html" default="yes"/><mapID target="Home" url="home.html" default="yes"/><mapID target="Starter.md" url="starter.html" default="no"/><mapID target="Starter" url="starter.html" default="no"/><mapID target="Preview.md" url="preview.html" default="no"/><mapID target="Preview" url="preview.html" default="no"/><mapID target="Author.md" url="author.html" default="no"/><mapID target="Author" url="author.html" default="no"/><mapID target="Download.md" url="download.html" default="no"/><mapID target="Download" url="download.html" default="no"/><mapID target="Question.md" url="question.html" default="no"/><mapID target="Question" url="question.html" default="no"/><mapID target="Overview.md" url="overview.html" default="no"/><mapID target="Overview" url="overview.html" default="no"/><mapID target="Update.md" url="update.html" default="no"/><mapID target="Update" url="update.html" default="no"/></map>
1 change: 1 addition & 0 deletions lib-doc/build/author.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html SYSTEM "about:legacy-compat"><html lang="en-US" data-colors-preset="contrast" data-primary-color="#307FFF"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"> <meta name="built-on" content="2023-12-17T15:42:04.895865"><meta name="build-number" content="${buildNumber}"> <title>关于作者 | Bangumi for Android</title><script id="virtual-toc-data" type="application/json">[{"id":"what-is-product-service-concept","level":0,"title":"What is product/service/concept","anchor":"#what-is-product-service-concept"},{"id":"glossary","level":0,"title":"Glossary","anchor":"#glossary"}]</script><script id="topic-shortcuts" type="application/json"></script><link href="https://resources.jetbrains.com/writerside/apidoc/6.6.6-b205/app.css" rel="stylesheet"> <link rel="apple-touch-icon" sizes="180x180" href="https://jetbrains.com/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="https://jetbrains.com/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="https://jetbrains.com/favicon-16x16.png"><link rel="manifest" href="https://jetbrains.com/site.webmanifest"><link rel="mask-icon" href="https://jetbrains.com/safari-pinned-tab.svg" color="#000000"><meta name="msapplication-TileColor" content="#000000"/><meta name="msapplication-TileImage" content="https://resources.jetbrains.com/storage/ui/favicons/mstile-144x144.png"/><meta name="msapplication-square70x70logo" content="https://resources.jetbrains.com/storage/ui/favicons/mstile-70x70.png"/><meta name="msapplication-square150x150logo" content="https://resources.jetbrains.com/storage/ui/favicons/mstile-150x150.png"/><meta name="msapplication-wide310x150logo" content="https://resources.jetbrains.com/storage/ui/favicons/mstile-310x150.png"/><meta name="msapplication-square310x310logo" content="https://resources.jetbrains.com/storage/ui/favicons/mstile-310x310.png"/> <meta name="image" content=""><!-- Open Graph --><meta property="og:title" content="关于作者 | Bangumi for Android"/><meta property="og:description" content=""/><meta property="og:image" content=""/><meta property="og:site_name" content="Bangumi for Android Help"/><meta property="og:type" content="website"/><meta property="og:locale" content="en_US"/><meta property="og:url" content="./1.0.0/author.html"/><!-- End Open Graph --><!-- Twitter Card --><meta name="twitter:card" content="summary_large_image"><meta name="twitter:site" content=""><meta name="twitter:title" content="关于作者 | Bangumi for Android"><meta name="twitter:description" content=""><meta name="twitter:creator" content=""><meta name="twitter:image:src" content=""><!-- End Twitter Card --><!-- Schema.org WebPage --><script type="application/ld+json"> { "@context": "http://schema.org", "@type": "WebPage", "@id": "./1.0.0/author.html#webpage", "url": "./1.0.0/author.html", "name": "关于作者 | Bangumi for Android", "description": "", "image": "", "inLanguage":"en-US" }</script><!-- End Schema.org --><!-- Schema.org WebSite --><script type="application/ld+json"> { "@type": "WebSite", "@id": "./#website", "url": "./", "name": "Bangumi for Android Help" }</script><!-- End Schema.org --></head> <body data-id="Author" data-main-title="关于作者" data-article-props="{&quot;seeAlsoStyle&quot;:&quot;links&quot;}" data-template="article" data-breadcrumbs="Home.md|关于 Bangumi for Android" > <div class="wrapper"><main class="panel _main"><header class="panel__header"><div class="container"><h3>Bangumi for Android 1.0.0 Help</h3><div class="panel-trigger"></div></div></header><section class="panel__content"><div class="container"><article class="article" data-shortcut-switcher="inactive"><h1 data-toc="Author" id="Author.md">关于作者</h1> <p id="501934ef_7">Overview articles give background information and provide context to a particular subject. Their goal is to explain a concept, not to teach or give instructions.</p><section class="chapter"><h2 id="what-is-product-service-concept" data-toc="what-is-product-service-concept" >What is product/service/concept</h2><p id="501934ef_8">Provide some background and context, explain choices and alternatives.</p></section><section class="chapter"><h2 id="glossary" data-toc="glossary" >Glossary</h2><p id="501934ef_9">A definition list or a glossary:</p><dl id="501934ef_10" data-style="title-top"><dt id="501934ef_11" data-expandable="false">First Term</dt><dd><p id="501934ef_13">This is the definition of the first term.</p></dd><dt id="501934ef_14" data-expandable="false">Second Term</dt><dd><p id="501934ef_16">This is the definition of the second term.</p></dd></dl></section><div class="last-modified"> Last modified: 17 十二月 2023</div><div data-feedback-placeholder="true"></div><div class="navigation-links _bottom"> <a class="navigation-links__prev" href="preview.html">App 功能预览</a> <a class="navigation-links__next" href="download.html">获取客户端</a> </div></article><div id="disqus_thread"></div></div></section></main></div> <script src="https://resources.jetbrains.com/writerside/apidoc/6.6.6-b205/app.js"></script></body></html>
Loading

0 comments on commit c253074

Please sign in to comment.