feat: 调节字体大小

This commit is contained in:
HuanChengFly 2021-08-19 16:57:31 +08:00
parent 8158b30c4c
commit ec65fbdb08
19 changed files with 654 additions and 27 deletions

View File

@ -44,22 +44,25 @@
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:ignore="UnusedAttribute">
<activity
android:name=".activities.AppFontSizeActivity"
android:configChanges="screenSize|screenLayout|orientation|smallestScreenSize|keyboardHidden"
android:label="@string/title_custom_font_size"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".activities.PluginManageActivity"
android:configChanges="screenSize|screenLayout|orientation|smallestScreenSize|keyboardHidden"
android:windowSoftInputMode="adjustResize"
android:label="@string/title_plugin_manage" />
android:label="@string/title_plugin_manage"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".activities.HotMessageListActivity"
android:configChanges="screenSize|screenLayout|orientation|smallestScreenSize|keyboardHidden"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".activities.PhotoViewActivity"
android:configChanges="screenSize|screenLayout|orientation|smallestScreenSize|keyboardHidden"
android:windowSoftInputMode="adjustResize"
android:theme="@style/AppTheme.PhotoView" />
android:theme="@style/AppTheme.PhotoView"
android:windowSoftInputMode="adjustResize" />
<receiver
android:name=".receivers.BootCompleteSignReceiver"
@ -140,6 +143,7 @@
<action android:name="com.huanchengfly.tieba.post.action.OKSIGN" />
</intent-filter>
</activity>
<activity
android:name=".activities.AboutActivity"
android:configChanges="screenSize|screenLayout|orientation|smallestScreenSize|keyboardHidden"

View File

@ -1,23 +1,33 @@
package com.huanchengfly.tieba.post
import android.app.Activity
import android.app.ActivityManager
import android.app.Application
import android.app.Dialog
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.content.res.ColorStateList
import android.content.res.Configuration
import android.content.res.Resources
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.Process
import android.view.View
import android.webkit.WebView
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.TextView
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatDelegate
import com.flurry.android.FlurryAgent
import com.huanchengfly.tieba.post.activities.BaseActivity
import com.huanchengfly.tieba.post.api.interfaces.CommonCallback
import com.huanchengfly.tieba.post.components.dialogs.LoadingDialog
import com.huanchengfly.tieba.post.plugins.PluginManager
import com.huanchengfly.tieba.post.plugins.interfaces.IApp
import com.huanchengfly.tieba.post.ui.theme.interfaces.ThemeSwitcher
@ -33,12 +43,36 @@ import org.litepal.LitePal
import java.util.*
import java.util.regex.Pattern
class BaseApplication : Application(), IApp {
private val mActivityList: MutableList<Activity> = mutableListOf()
@RequiresApi(api = 28)
fun setWebViewPath(context: Context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
val processName = getProcessName(context)
if (applicationContext.packageName != processName) { //判断不等于默认进程名称
WebView.setDataDirectorySuffix(processName!!)
}
}
}
private fun getProcessName(context: Context): String? {
val manager = context.getSystemService(ACTIVITY_SERVICE) as ActivityManager
for (processInfo in manager.runningAppProcesses) {
if (processInfo.pid == Process.myPid()) {
return processInfo.processName
}
}
return null
}
override fun onCreate() {
instance = this
super.onCreate()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
setWebViewPath(this)
}
ThemeUtils.init(ThemeDelegate)
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
LitePal.initialize(this)
@ -177,6 +211,18 @@ class BaseApplication : Application(), IApp {
PluginManager.init(this)
}
//禁止app字体大小跟随系统字体大小调节
override fun getResources(): Resources {
val fontScale = appPreferences.fontScale
val resources = super.getResources()
if (resources.configuration.fontScale != fontScale) {
val configuration = resources.configuration
configuration.fontScale = fontScale
resources.updateConfiguration(configuration, resources.displayMetrics)
}
return resources
}
/**
* 添加Activity
*/

View File

@ -0,0 +1,127 @@
package com.huanchengfly.tieba.post.activities
import android.os.Bundle
import android.util.TypedValue
import android.widget.SeekBar
import android.widget.TextView
import androidx.appcompat.widget.Toolbar
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import butterknife.BindView
import com.google.android.material.appbar.CollapsingToolbarLayout
import com.huanchengfly.tieba.post.*
import com.huanchengfly.tieba.post.adapters.ChatBubbleStyleAdapter
import com.huanchengfly.tieba.post.components.MyLinearLayoutManager
import com.huanchengfly.tieba.post.utils.ThemeUtil
import com.huanchengfly.tieba.post.widgets.RulerSeekBar
class AppFontSizeActivity : BaseActivity() {
@BindView(R.id.toolbar)
lateinit var toolbar: Toolbar
@BindView(R.id.collapsing_toolbar)
lateinit var collapsingToolbar: CollapsingToolbarLayout
@BindView(R.id.app_font_size_seekbar)
lateinit var seekBar: RulerSeekBar
@BindView(R.id.app_font_size_text)
lateinit var sizeText: TextView
@BindView(R.id.app_font_size_bubbles)
lateinit var chatBubblesRv: RecyclerView
var oldFontSize: Float = 0f
var finished: Boolean = false
private val bubblesAdapter: ChatBubbleStyleAdapter by lazy {
ChatBubbleStyleAdapter(
this,
listOf(
ChatBubbleStyleAdapter.Bubble(
getString(R.string.bubble_want_change_font_size),
ChatBubbleStyleAdapter.Bubble.POSITION_RIGHT
),
ChatBubbleStyleAdapter.Bubble(getString(R.string.bubble_change_font_size))
)
)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ThemeUtil.setTranslucentThemeBackground(findViewById(R.id.background))
setSupportActionBar(toolbar)
supportActionBar?.apply {
setDisplayHomeAsUpEnabled(true)
title = this@AppFontSizeActivity.title
}
collapsingToolbar.title = title
oldFontSize = appPreferences.fontScale
chatBubblesRv.apply {
layoutManager =
MyLinearLayoutManager(this@AppFontSizeActivity, LinearLayoutManager.VERTICAL, false)
adapter = bubblesAdapter
}
val progress =
((appPreferences.fontScale * 1000L - FONT_SCALE_MIN * 1000L).toInt()) / ((FONT_SCALE_STEP * 1000L).toInt())
seekBar.progress = progress
updateSizeText(progress)
seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
val fontScale = FONT_SCALE_MIN + progress * FONT_SCALE_STEP
appPreferences.fontScale = fontScale
updatePreview(fontScale)
updateSizeText(progress)
}
override fun onStartTrackingTouch(seekBar: SeekBar?) {}
override fun onStopTrackingTouch(seekBar: SeekBar?) {}
})
}
override fun finish() {
if (!finished && oldFontSize != appPreferences.fontScale) {
finished = true
toastShort(R.string.toast_after_change_will_restart)
BaseApplication.instance.removeAllActivity()
goToActivity<MainActivity>()
}
super.finish()
}
fun updateSizeText(progress: Int) {
val sizeTexts = SIZE_TEXT_MAPPING.filterValues {
progress in it
}
if (sizeTexts.isNotEmpty()) {
sizeText.setText(sizeTexts.map { it.key }[0])
}
}
fun updatePreview(fontScale: Float = appPreferences.fontScale) {
bubblesAdapter.bubblesFontSize = 15f.dpToPxFloat() * fontScale
sizeText.setTextSize(TypedValue.COMPLEX_UNIT_PX, 16f.dpToPxFloat() * fontScale)
}
override fun getLayoutId(): Int {
return R.layout.activity_app_font_size
}
companion object {
const val FONT_SCALE_MIN = 0.8f
const val FONT_SCALE_MAX = 1.3f
const val FONT_SCALE_STEP = 0.05f
const val DEFAULT_FONT_SCALE = 1f
val SIZE_TEXT_MAPPING = mapOf(
R.string.text_size_small to 0..1,
R.string.text_size_little_small to 2..3,
R.string.text_size_default to 4..4,
R.string.text_size_little_large to 5..6,
R.string.text_size_large to 7..8,
R.string.text_size_very_large to 9..10
)
}
}

View File

@ -6,6 +6,7 @@ import android.app.Activity
import android.app.Dialog
import android.content.Context
import android.content.res.ColorStateList
import android.content.res.Resources
import android.graphics.Color
import android.os.Bundle
import android.text.TextUtils
@ -60,6 +61,18 @@ abstract class BaseActivity : SwipeBackActivity(), ExtraRefreshable, CoroutineSc
Jzvd.releaseAllVideos()
}
//禁止app字体大小跟随系统字体大小调节
override fun getResources(): Resources {
val fontScale = appPreferences.fontScale
val resources = super.getResources()
if (resources.configuration.fontScale != fontScale) {
val configuration = resources.configuration
configuration.fontScale = fontScale
resources.updateConfiguration(configuration, resources.displayMetrics)
}
return resources
}
protected fun showDialog(dialog: Dialog): Boolean {
if (isActivityRunning) {
dialog.show()

View File

@ -1,6 +1,8 @@
package com.huanchengfly.tieba.post.adapters
import android.annotation.SuppressLint
import android.content.Context
import android.util.TypedValue
import android.view.Gravity
import android.view.View
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
@ -16,6 +18,13 @@ class ChatBubbleStyleAdapter(
context: Context,
bubbles: List<Bubble>
) : BaseSingleTypeAdapter<ChatBubbleStyleAdapter.Bubble>(context, bubbles) {
var bubblesFontSize: Float = 0f
@SuppressLint("NotifyDataSetChanged")
set(value) {
field = value
notifyDataSetChanged()
}
override fun getItemLayoutId(): Int = R.layout.item_chat_bubble
override fun convert(viewHolder: MyViewHolder, item: Bubble, position: Int) {
@ -34,12 +43,17 @@ class ChatBubbleStyleAdapter(
Gravity.START
}
}
viewHolder.getView<TintTextView>(R.id.chat_bubble_text).tintResId =
viewHolder.getView<TintTextView>(R.id.chat_bubble_text).apply {
tintResId =
if (item.position == POSITION_RIGHT) {
R.color.default_color_on_accent
} else {
R.color.default_color_text
}
if (bubblesFontSize > 0f) {
setTextSize(TypedValue.COMPLEX_UNIT_PX, bubblesFontSize)
}
}
viewHolder.setText(R.id.chat_bubble_text, item.text)
val customView = item.customViewBuilder?.invoke(context, item.position)
if (customView != null) {

View File

@ -21,15 +21,29 @@ open class AppPreferencesUtils(context: Context) {
var customPrimaryColor by SharedPreferenceDelegates.string(key = "custom_primary_color")
var customStatusBarFontDark by SharedPreferenceDelegates.boolean(defaultValue = false, key = "custom_status_bar_font_dark")
var customStatusBarFontDark by SharedPreferenceDelegates.boolean(
defaultValue = false,
key = "custom_status_bar_font_dark"
)
var customToolbarPrimaryColor by SharedPreferenceDelegates.boolean(defaultValue = true, key = "custom_toolbar_primary_color")
var customToolbarPrimaryColor by SharedPreferenceDelegates.boolean(
defaultValue = true,
key = "custom_toolbar_primary_color"
)
var defaultSortType by SharedPreferenceDelegates.string(key = "default_sort_type", defaultValue = "0")
var defaultSortType by SharedPreferenceDelegates.string(
key = "default_sort_type",
defaultValue = "0"
)
var darkTheme by SharedPreferenceDelegates.string(key = "dark_theme", defaultValue = "dark")
var followSystemNight by SharedPreferenceDelegates.boolean(defaultValue = true, key = "follow_system_night")
var followSystemNight by SharedPreferenceDelegates.boolean(
defaultValue = true,
key = "follow_system_night"
)
var fontScale by SharedPreferenceDelegates.float(defaultValue = 1.0f)
var forumFabFunction by SharedPreferenceDelegates.string(defaultValue = "post")
@ -39,7 +53,10 @@ open class AppPreferencesUtils(context: Context) {
var homePageScroll by SharedPreferenceDelegates.boolean(defaultValue = false)
var imageLoadType by SharedPreferenceDelegates.string(key = "image_load_type", defaultValue = "0")
var imageLoadType by SharedPreferenceDelegates.string(
key = "image_load_type",
defaultValue = "0"
)
var listItemsBackgroundIntermixed by SharedPreferenceDelegates.boolean(defaultValue = true)

View File

@ -63,13 +63,25 @@ object TiebaUtil {
fun startSign(context: Context) {
context.appPreferences.signDay = Calendar.getInstance()[Calendar.DAY_OF_MONTH]
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(Intent(context, OKSignService::class.java)
context.startForegroundService(
Intent()
.setClassName(
context.packageName,
"${context.packageName}.services.OKSignService"
)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.setAction(OKSignService.ACTION_START_SIGN))
.setAction(OKSignService.ACTION_START_SIGN)
)
} else {
context.startService(Intent(context, OKSignService::class.java)
context.startService(
Intent()
.setClassName(
context.packageName,
"${context.packageName}.services.OKSignService"
)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.setAction(OKSignService.ACTION_START_SIGN))
.setAction(OKSignService.ACTION_START_SIGN)
)
}
}

View File

@ -0,0 +1,195 @@
package com.huanchengfly.tieba.post.widgets
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.util.AttributeSet
import android.widget.AbsSeekBar
import androidx.appcompat.widget.AppCompatSeekBar
import com.huanchengfly.tieba.post.R
import com.huanchengfly.tieba.post.dpToPxFloat
class RulerSeekBar : AppCompatSeekBar {
/**
* 刻度线画笔
*/
private lateinit var mRulerPaint: Paint
/**
* 刻度线的个数,等分数等于刻度线的个数加1
*/
private var mRulerCount: Int = 0
/**
* 每条刻度线的宽度
*/
private var mRulerSize: Float = 0f
/**
* 刻度线的颜色
*/
private var mRulerColor: Int = Color.WHITE
/**
* 滑块上面是否要显示刻度线
*/
private var isShowTopOfThumb: Boolean = false
/**
* 边缘是否要显示刻度线
*/
private var rulerOnEdge: Boolean = false
constructor(context: Context) : this(context, null)
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
) {
if (attrs != null) {
val array = getContext().obtainStyledAttributes(
attrs,
R.styleable.RulerSeekBar,
defStyleAttr,
0
)
mRulerColor = array.getColor(R.styleable.RulerSeekBar_rulerColor, Color.WHITE)
mRulerCount = array.getInteger(R.styleable.RulerSeekBar_rulerCount, 5)
mRulerSize = array.getDimension(R.styleable.RulerSeekBar_rulerSize, 12f.dpToPxFloat())
isShowTopOfThumb = array.getBoolean(R.styleable.RulerSeekBar_rulerShowTopOfThumb, false)
rulerOnEdge = array.getBoolean(R.styleable.RulerSeekBar_rulerOnEdge, false)
array.recycle()
}
init()
}
/**
* 初始化
*/
private fun init() {
//创建绘制刻度线的画笔
mRulerPaint = Paint()
mRulerPaint.color = mRulerColor
mRulerPaint.isAntiAlias = true
//Api21及以上调用去掉滑块后面的背景
splitTrack = false
}
/**
* 重写onDraw方法绘制刻度线
*
* @param canvas
*/
@SuppressLint("DiscouragedPrivateApi")
@Synchronized
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
//极限条件校验
if (width <= 0 || mRulerCount <= 0) {
return
}
//计算刻度线的顶部坐标和底部坐标
val rulerTop = (height / 2 - minimumHeight / 2) * 1F
val rulerBottom = rulerTop + minimumHeight
val rulerCenterY = (rulerTop + rulerBottom) / 2
val rulerPadding = rulerCenterY - mRulerSize / 2 - rulerTop
//获取每一份的长度
val length = if (rulerOnEdge) {
(width - paddingLeft - paddingRight - (mRulerCount + 2) * mRulerSize - rulerPadding * 2) / (mRulerCount + 1)
} else {
(width - paddingLeft - paddingRight - mRulerCount * mRulerSize) / (mRulerCount + 1)
}
if (rulerOnEdge) {
canvas.drawCircle(
paddingLeft + rulerPadding + mRulerSize / 2,
rulerCenterY,
mRulerSize / 2,
mRulerPaint
)
canvas.drawCircle(
paddingLeft + rulerPadding + (mRulerCount + 1) * (length + mRulerSize) + mRulerSize / 2,
rulerCenterY,
mRulerSize / 2,
mRulerPaint
)
}
//绘制刻度线
for (i in 1..mRulerCount) {
//计算刻度线的左边坐标和右边坐标
val rulerLeft = if (rulerOnEdge) {
(i * length + i * mRulerSize + paddingLeft + rulerPadding) * 1F
} else {
(i * length + (i - 1) * mRulerSize + paddingLeft) * 1F
}
val rulerRight = rulerLeft + mRulerSize
val rulerCenterX = (rulerLeft + rulerRight) / 2
//进行绘制
canvas.drawCircle(rulerCenterX, rulerCenterY, mRulerSize / 2, mRulerPaint)
}
if (!isShowTopOfThumb) {
try {
val absSeekBarClazz = Class.forName("android.widget.AbsSeekBar")
val absSeekBarDrawThumbMethod =
absSeekBarClazz.getDeclaredMethod("drawThumb", Canvas::class.java)
absSeekBarDrawThumbMethod.isAccessible = true
absSeekBarDrawThumbMethod.invoke(this as AbsSeekBar, canvas)
} catch (e: Exception) {
e.printStackTrace()
}
}
}
/**
* 设置刻度线的个数
*
* @param mRulerCount
*/
fun setRulerCount(mRulerCount: Int) {
this.mRulerCount = mRulerCount
requestLayout()
}
/**
* 设置刻度线的宽度单位(px)
*
* @param mRulerWidth
*/
fun setRulerWidth(mRulerWidth: Int) {
this.mRulerSize = mRulerWidth.toFloat()
requestLayout()
}
/**
* 设置刻度线的颜色
*
* @param mRulerColor
*/
fun setRulerColor(mRulerColor: Int) {
this.mRulerColor = mRulerColor
mRulerPaint.color = mRulerColor
requestLayout()
}
/**
* 滑块上面是否需要显示刻度线
*
* @param isShowTopOfThumb
*/
fun setShowTopOfThumb(isShowTopOfThumb: Boolean) {
this.isShowTopOfThumb = isShowTopOfThumb
requestLayout()
}
}

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="22dp" />
<solid android:color="@color/default_color_divider" />
</shape>
</item>
<item android:id="@android:id/progress">
<scale android:scaleWidth="100%">
<shape>
<corners android:radius="22dp" />
<solid android:color="@color/default_color_divider" />
</shape>
</scale>
</item>
</layer-list>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size
android:height="32dp"
android:width="32dp" />
<solid android:color="@color/default_color_card" />
<stroke
android:width="10dp"
android:color="@color/default_color_primary" />
</shape>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M9.93,13.5h4.14L12,7.98 9.93,13.5zM20,2L4,2c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM15.71,17.88l-0.9,-2.38L9.17,15.5l-0.89,2.37c-0.14,0.38 -0.5,0.63 -0.91,0.63 -0.68,0 -1.15,-0.69 -0.9,-1.32l4.25,-10.81c0.22,-0.53 0.72,-0.87 1.28,-0.87s1.06,0.34 1.27,0.87l4.25,10.81c0.25,0.63 -0.22,1.32 -0.9,1.32 -0.4,0 -0.76,-0.25 -0.91,-0.62z" />
</vector>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<com.huanchengfly.tieba.post.widgets.theme.TintRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:backgroundTint="@color/default_color_window_background"
android:id="@+id/background"
tools:context=".activities.AppFontSizeActivity">
<include layout="@layout/layout_new_appbar" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"
android:layout_below="@+id/appbar">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/app_font_size_bubbles"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/app_font_size_card"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<com.huanchengfly.tieba.post.widgets.theme.TintLinearLayout
android:padding="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:id="@+id/app_font_size_card"
android:background="@drawable/bg_radius_10dp"
android:backgroundTint="@color/default_color_card">
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
android:id="@+id/app_font_size_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:textSize="16sp"
android:textStyle="bold"
app:tint="@color/default_color_primary"
tools:text="默认大小" />
<com.huanchengfly.tieba.post.widgets.RulerSeekBar
android:id="@+id/app_font_size_seekbar"
android:progressDrawable="@drawable/drawable_progress_font_size"
android:progressTint="@color/default_color_nav_bar_surface"
android:progressBackgroundTint="@color/default_color_nav_bar_surface"
android:minHeight="44dp"
android:maxHeight="44dp"
android:thumbOffset="-6dp"
android:max="10"
android:progress="4"
android:thumb="@drawable/drawable_thumb_font_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:rulerColor="@color/default_color_text_disabled"
app:rulerCount="4"
app:rulerOnEdge="true"
app:rulerSize="12dp" />
</com.huanchengfly.tieba.post.widgets.theme.TintLinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.huanchengfly.tieba.post.widgets.theme.TintRelativeLayout>

View File

@ -5,7 +5,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
app:backgroundTint="@color/default_color_window_background"
android:id="@+id/background">
android:id="@+id/background"
tools:context=".activities.AppThemeActivity">
<include layout="@layout/layout_new_appbar" />

View File

@ -16,7 +16,7 @@
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
android:id="@+id/chat_bubble_text"
android:padding="16dp"
android:textSize="14sp"
android:textSize="15sp"
android:maxWidth="250dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:padding="16dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
android:id="@+id/check_result_percent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tint="@color/default_color_text"
android:textSize="16sp"
android:textStyle="bold"
tools:text="总文字复制比: 50.00%" />
<com.huanchengfly.tieba.post.widgets.theme.TintProgressBar
android:id="@+id/check_result_progress"
android:layout_marginTop="8dp"
tools:progress="5000"
android:max="10000"
android:minHeight="16dp"
android:progressDrawable="@drawable/bg_seekbar_round"
app:progressTint="@color/default_color_primary"
app:progressBackgroundTint="@color/color_divider"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:id="@+id/check_result_related"
android:layout_marginTop="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
android:id="@+id/check_result_related_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tint="@color/default_color_text"
android:textSize="16sp"
android:textStyle="bold"
tools:text="相似小作文 (0)" />
<com.huanchengfly.tieba.post.widgets.theme.TintTextView
android:layout_marginTop="8dp"
android:id="@+id/check_result_related_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tint="@color/default_color_text"
android:textSize="14sp"
tools:text="链接" />
</LinearLayout>
</LinearLayout>

View File

@ -163,6 +163,14 @@
<attr name="textColor" />
</declare-styleable>
<declare-styleable name="RulerSeekBar">
<attr name="rulerColor" format="color" />
<attr name="rulerSize" format="dimension" />
<attr name="rulerCount" format="integer" />
<attr name="rulerShowTopOfThumb" format="boolean" />
<attr name="rulerOnEdge" format="boolean" />
</declare-styleable>
<declare-styleable name="ScrollCollapsingToolbarLayout">
<!-- Specifies extra space on the start, top, end and bottom
sides of the the expanded title text. Margin values should be positive. -->

View File

@ -44,14 +44,14 @@
<color name="default_color_text">#FF31343C</color>
<color name="default_color_text_on_primary">#FFFFFFFF</color>
<color name="default_color_text_secondary">#FF545967</color>
<color name="default_color_text_disabled">#FF65696C</color>
<color name="default_color_text_disabled">#FFA8ADBB</color>
<color name="default_color_toolbar">#FFFFFFFF</color>
<color name="default_color_toolbar_item">#FF474B54</color>
<color name="default_color_toolbar_item_secondary">#FF545967</color>
<color name="default_color_toolbar_item_active">#FF4477E0</color>
<color name="default_color_toolbar_bar">#E6F2F7FB</color>
<color name="default_color_on_toolbar_bar">#6654585B</color>
<color name="default_color_nav_bar_surface">#FFF3F7F9</color>
<color name="default_color_nav_bar_surface">#FFF3F7FA</color>
<color name="default_color_on_nav_bar_surface">#FF8D9194</color>
<color name="default_color_background">#FFFFFFFF</color>
<color name="default_color_window_background">#FFF3F7F9</color>

View File

@ -435,10 +435,7 @@
<string name="title_collected">已收藏</string>
<string name="text_stat_follow">关注</string>
<string name="text_stat_fans">粉丝</string>
<string name="title_custom_title_style">标题样式</string>
<string name="text_custom_title_style">Title</string>
<string name="title_custom_font_size">字体大小</string>
<string name="text_custom_font_size">永a</string>
<string name="text_singing_progress">%1$s吧 ✓</string>
<string name="text_singing_progress_exp">%1$s吧 ✓ 经验 +%2$s</string>
<string name="title_start_sign">即将开始签到</string>
@ -468,4 +465,19 @@
<string name="plugin_comment_lookup_menu">查询发言</string>
<string name="title_plugin_manage">附加功能管理</string>
<string name="template_plugin_info">v%1$s · 作者 %2$s</string>
<string name="plugin_asoul_cnki_check">枝网查重</string>
<string name="plugin_asoul_cnki_result">枝网文本复制检测报告(简洁)\n查重时间: %1$s\n总文字复制比: %2$s\n%3$s\n\n查重结果仅作参考请注意辨别是否为原创</string>
<string name="plugin_asoul_cnki_related">相似小作文: %1$s\n作者: %2$s\n发表时间: %3$s</string>
<string name="plugin_asoul_cnki_check_result_percent">总文本复制比: %1$s</string>
<string name="plugin_asoul_cnki_check_result_related">相似小作文 (%1$d)</string>
<string name="btn_copy_check_result">复制查重结果</string>
<string name="bubble_want_change_font_size">怎么调节应用内的字体大小呢?</string>
<string name="bubble_change_font_size">尝试着调节下方的控制条吧,可以在这里即时预览字体大小。</string>
<string name="text_size_small"></string>
<string name="text_size_little_small">较小</string>
<string name="text_size_default">默认大小</string>
<string name="text_size_little_large">较大</string>
<string name="text_size_large"></string>
<string name="text_size_very_large">极大</string>
<string name="toast_after_change_will_restart">修改已保存,即将重启 App 以应用设置</string>
</resources>

View File

@ -118,6 +118,7 @@
android:entries="@array/forum_fab_function_name_values"
android:defaultValue="post"
android:key="forumFabFunction"
android:icon="@drawable/ic_round_exit_to_app"
android:title="@string/settings_forum_fab_function" />
<Preference
@ -136,6 +137,16 @@
</androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory android:title="@string/title_settings_custom">
<Preference
android:icon="@drawable/ic_round_font_download"
android:key="font_size"
android:title="@string/title_custom_font_size">
<intent
android:targetPackage="com.huanchengfly.tieba.post"
android:targetClass="com.huanchengfly.tieba.post.activities.AppFontSizeActivity"
android:action="android.intent.action.VIEW" />
</Preference>
<ListPreference
android:icon="@drawable/ic_round_brightness_2_green"
android:key="dark_theme"