mirror of
https://github.com/fumiama/copymanga.git
synced 2026-06-29 23:30:41 +08:00
v2.2.7
新增 1. 设置每行显示卡片数 修复 1. 进入我的订阅概率闪退
This commit is contained in:
1
.idea/dictionaries/fumiama.xml
generated
1
.idea/dictionaries/fumiama.xml
generated
@@ -1,6 +1,7 @@
|
|||||||
<component name="ProjectDictionaryState">
|
<component name="ProjectDictionaryState">
|
||||||
<dictionary name="fumiama">
|
<dictionary name="fumiama">
|
||||||
<words>
|
<words>
|
||||||
|
<w>alphae</w>
|
||||||
<w>downloaders</w>
|
<w>downloaders</w>
|
||||||
<w>grps</w>
|
<w>grps</w>
|
||||||
<w>imgs</w>
|
<w>imgs</w>
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ android {
|
|||||||
applicationId 'top.fumiama.copymanga'
|
applicationId 'top.fumiama.copymanga'
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 34
|
targetSdkVersion 34
|
||||||
versionCode 54
|
versionCode 55
|
||||||
versionName '2.2.6'
|
versionName '2.2.7'
|
||||||
resourceConfigurations += ['zh', 'zh-rCN']
|
resourceConfigurations += ['zh', 'zh-rCN']
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ open class MangaPagesFragmentTemplate(inflateRes:Int, private val isLazy: Boolea
|
|||||||
cardPerRow = widthData?.get(0) ?: 3
|
cardPerRow = widthData?.get(0) ?: 3
|
||||||
cardWidth = widthData?.get(2) ?: 128
|
cardWidth = widthData?.get(2) ?: 128
|
||||||
cardHeight = (cardWidth / 0.75 + 0.5).toInt()
|
cardHeight = (cardWidth / 0.75 + 0.5).toInt()
|
||||||
withContext(Dispatchers.Main){
|
withContext(Dispatchers.Main) {
|
||||||
mysp.footerView.lht.text = "加载"
|
mysp.footerView.lht.text = "加载"
|
||||||
mysp.headerView.lht.text = "刷新"
|
mysp.headerView.lht.text = "刷新"
|
||||||
mydll?.setPadding(0, 0, 0, navBarHeight)
|
mydll?.setPadding(0, 0, 0, navBarHeight)
|
||||||
@@ -102,8 +102,8 @@ open class MangaPagesFragmentTemplate(inflateRes:Int, private val isLazy: Boolea
|
|||||||
setListeners()
|
setListeners()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun managePage() {
|
private suspend fun managePage() {
|
||||||
lifecycleScope.launch { addPage() }
|
addPage()
|
||||||
if (isLazy) {
|
if (isLazy) {
|
||||||
mysp.apply {
|
mysp.apply {
|
||||||
post {
|
post {
|
||||||
@@ -118,10 +118,10 @@ open class MangaPagesFragmentTemplate(inflateRes:Int, private val isLazy: Boolea
|
|||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
reset()
|
reset()
|
||||||
delay(600)
|
delay(600)
|
||||||
}
|
|
||||||
addPage()
|
addPage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.net.ConnectivityManager
|
|||||||
import android.net.NetworkCapabilities
|
import android.net.NetworkCapabilities
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import top.fumiama.dmzj.copymanga.R
|
import top.fumiama.dmzj.copymanga.R
|
||||||
@@ -94,11 +95,15 @@ class UITools(that: Context?, w: WeakReference<Activity>? = null) {
|
|||||||
private fun px2dp(px:Int):Int?{
|
private fun px2dp(px:Int):Int?{
|
||||||
return zis?.resources?.displayMetrics?.density?.let { (px.toDouble() / it + 0.5).toInt()}
|
return zis?.resources?.displayMetrics?.density?.let { (px.toDouble() / it + 0.5).toInt()}
|
||||||
}
|
}
|
||||||
fun calcWidthFromDp(marginLeftDp:Int, widthDp:Int):List<Int>{
|
fun calcWidthFromDp(marginLeftDp:Int, widthDp:Int): List<Int> {
|
||||||
val margin = marginLeftDp.toDouble()
|
val margin = marginLeftDp.toDouble()
|
||||||
val marginPx = dp2px(marginLeftDp)?:16
|
val marginPx = dp2px(marginLeftDp)?:16
|
||||||
val screenWidth = zis?.resources?.displayMetrics?.widthPixels?:1080
|
val screenWidth = zis?.resources?.displayMetrics?.widthPixels?:1080
|
||||||
val numPerRow = ((px2dp(screenWidth)?:400).toDouble() / (widthDp + 2 * margin) + 0.5).toInt()
|
val numPerRow = ((px2dp(screenWidth)?:400).toDouble() / (widthDp + 2 * margin) + 0.5).toInt().let {
|
||||||
|
it + (zis?.let {
|
||||||
|
a -> PreferenceManager.getDefaultSharedPreferences(a).getInt("settings_cat_general_sb_card_per_row", 0)
|
||||||
|
} ?: 0)
|
||||||
|
}.let { if(it <= 0) 3 else it }
|
||||||
val w = (screenWidth - marginPx*numPerRow*2)/numPerRow
|
val w = (screenWidth - marginPx*numPerRow*2)/numPerRow
|
||||||
val totalWidth = screenWidth/numPerRow
|
val totalWidth = screenWidth/numPerRow
|
||||||
return listOf(numPerRow, w, totalWidth)
|
return listOf(numPerRow, w, totalWidth)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class RankFragment : InfoCardLoader(R.layout.fragment_rank, R.id.action_nav_rank
|
|||||||
|
|
||||||
override fun setListeners() {
|
override fun setListeners() {
|
||||||
super.setListeners()
|
super.setListeners()
|
||||||
frlai.lrt.addOnTabSelectedListener(object: TabLayout.OnTabSelectedListener {
|
frlai.lrt.apply { post { addOnTabSelectedListener(object: TabLayout.OnTabSelectedListener {
|
||||||
override fun onTabReselected(tab: TabLayout.Tab?) {}
|
override fun onTabReselected(tab: TabLayout.Tab?) {}
|
||||||
|
|
||||||
override fun onTabSelected(tab: TabLayout.Tab?) {
|
override fun onTabSelected(tab: TabLayout.Tab?) {
|
||||||
@@ -68,7 +68,7 @@ class RankFragment : InfoCardLoader(R.layout.fragment_rank, R.id.action_nav_rank
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onTabUnselected(tab: TabLayout.Tab?) {}
|
override fun onTabUnselected(tab: TabLayout.Tab?) {}
|
||||||
})
|
}) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showSexInfo(toolsBox: UITools) {
|
fun showSexInfo(toolsBox: UITools) {
|
||||||
|
|||||||
@@ -48,36 +48,42 @@ class ShelfFragment : InfoCardLoader(R.layout.fragment_shelf, R.id.action_nav_su
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpdate() {
|
private fun setUpdate() {
|
||||||
if (ad?.exit == true) return
|
line_shelf_updated.apply { post {
|
||||||
line_shelf_updated.apt.setText(R.string.menu_update_time)
|
if (ad?.exit == true) return@post
|
||||||
line_shelf_updated.setOnClickListener {
|
apt.setText(R.string.menu_update_time)
|
||||||
|
setOnClickListener {
|
||||||
val same = sortValue in 0..1
|
val same = sortValue in 0..1
|
||||||
sortValue = rotate(it.apim, same, 0)
|
sortValue = rotate(it.apim, same, 0)
|
||||||
if (!same) fade()
|
if (!same) fade()
|
||||||
delayedRefresh(400)
|
delayedRefresh(400)
|
||||||
}
|
}
|
||||||
|
} }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setModify() {
|
private fun setModify() {
|
||||||
if (ad?.exit == true) return
|
line_shelf_modifier.apply { post {
|
||||||
line_shelf_modifier.apt.setText(R.string.menu_add_time)
|
if (ad?.exit == true) return@post
|
||||||
line_shelf_modifier.setOnClickListener {
|
apt.setText(R.string.menu_add_time)
|
||||||
|
setOnClickListener {
|
||||||
val same = sortValue in 2..3
|
val same = sortValue in 2..3
|
||||||
sortValue = rotate(it.apim, same, 2)
|
sortValue = rotate(it.apim, same, 2)
|
||||||
if (!same) fade()
|
if (!same) fade()
|
||||||
delayedRefresh(400)
|
delayedRefresh(400)
|
||||||
}
|
}
|
||||||
|
} }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setBrowse() {
|
private fun setBrowse() {
|
||||||
if (ad?.exit == true) return
|
line_shelf_browse.apply { post {
|
||||||
line_shelf_browse.apt.setText(R.string.menu_read_time)
|
if (ad?.exit == true) return@post
|
||||||
line_shelf_browse.setOnClickListener {
|
apt.setText(R.string.menu_read_time)
|
||||||
|
setOnClickListener {
|
||||||
val same = sortValue>=4
|
val same = sortValue>=4
|
||||||
sortValue = rotate(it.apim, same, 4)
|
sortValue = rotate(it.apim, same, 4)
|
||||||
if (!same) fade()
|
if (!same) fade()
|
||||||
delayedRefresh(400)
|
delayedRefresh(400)
|
||||||
}
|
}
|
||||||
|
} }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun rotate(img: View, isSameSlot: Boolean, offset: Int): Int {
|
private fun rotate(img: View, isSameSlot: Boolean, offset: Int): Int {
|
||||||
@@ -99,22 +105,14 @@ class ShelfFragment : InfoCardLoader(R.layout.fragment_shelf, R.id.action_nav_su
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun fade() {
|
private fun fade() {
|
||||||
when(sortValue) {
|
val alphae = when(sortValue) {
|
||||||
0, 1 -> {
|
0, 1 -> listOf(1f, 0.5f, 0.5f)
|
||||||
line_shelf_updated.alpha = 1f
|
2, 3 -> listOf(0.5f, 1f, 0.5f)
|
||||||
line_shelf_modifier.alpha = 0.5f
|
4, 5 -> listOf(0.5f, 0.5f, 1f)
|
||||||
line_shelf_browse.alpha = 0.5f
|
else -> listOf(1f, 1f, 1f)
|
||||||
}
|
|
||||||
2, 3 -> {
|
|
||||||
line_shelf_updated.alpha = 0.5f
|
|
||||||
line_shelf_modifier.alpha = 1f
|
|
||||||
line_shelf_browse.alpha = 0.5f
|
|
||||||
}
|
|
||||||
4, 5 -> {
|
|
||||||
line_shelf_updated.alpha = 0.5f
|
|
||||||
line_shelf_modifier.alpha = 0.5f
|
|
||||||
line_shelf_browse.alpha = 1f
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
line_shelf_updated.apply { post { alpha = alphae[0] } }
|
||||||
|
line_shelf_modifier.apply { post { alpha = alphae[1] } }
|
||||||
|
line_shelf_browse.apply { post { alpha = alphae[2] } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,13 +13,11 @@ import androidx.preference.EditTextPreferenceDialogFragmentCompat
|
|||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.async
|
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import top.fumiama.copymanga.tools.ui.UITools
|
import top.fumiama.copymanga.tools.ui.UITools
|
||||||
import top.fumiama.dmzj.copymanga.R
|
import top.fumiama.dmzj.copymanga.R
|
||||||
import java.lang.Thread.sleep
|
|
||||||
|
|
||||||
class SettingsFragment: PreferenceFragmentCompat() {
|
class SettingsFragment: PreferenceFragmentCompat() {
|
||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
@@ -36,7 +34,7 @@ class SettingsFragment: PreferenceFragmentCompat() {
|
|||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
context?.let { c ->
|
context?.let { c ->
|
||||||
view.setPadding(0, 0, 0, UITools.getNavigationBarHeight(c))
|
view.apply { post { setPadding(0, 0, 0, UITools.getNavigationBarHeight(c)) } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,33 +44,35 @@ class SettingsFragment: PreferenceFragmentCompat() {
|
|||||||
val f = EditTextPreferenceDialogFragmentCompat.newInstance(preference.key)
|
val f = EditTextPreferenceDialogFragmentCompat.newInstance(preference.key)
|
||||||
f.setTargetFragment(this, 0)
|
f.setTargetFragment(this, 0)
|
||||||
f.show(parentFragmentManager, null)
|
f.show(parentFragmentManager, null)
|
||||||
Thread {
|
lifecycleScope.launch {
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
var diff = 0
|
var diff = 0
|
||||||
var cnt = 0
|
var cnt = 0
|
||||||
while (diff == 0 && cnt++ < 20) {
|
while (diff == 0 && cnt++ < 20) {
|
||||||
sleep(50)
|
delay(50)
|
||||||
if (f.dialog == null) continue
|
if (f.dialog == null) continue
|
||||||
val v = view?:return@Thread
|
val v = view?:return@withContext
|
||||||
// https://github.com/mikepenz/MaterialDrawer/blob/aa9136fb4f5b3a80460fe5f47213985026d20c88/library/src/main/java/com/mikepenz/materialdrawer/util/KeyboardUtil.java
|
// https://github.com/mikepenz/MaterialDrawer/blob/aa9136fb4f5b3a80460fe5f47213985026d20c88/library/src/main/java/com/mikepenz/materialdrawer/util/KeyboardUtil.java
|
||||||
val r = Rect()
|
val r = Rect()
|
||||||
//r will be populated with the coordinates of your view that area still visible.
|
//r will be populated with the coordinates of your view that area still visible.
|
||||||
v.getWindowVisibleDisplayFrame(r)
|
v.getWindowVisibleDisplayFrame(r)
|
||||||
//get screen height and calculate the difference with the useable area from the r
|
//get screen height and calculate the difference with the usable area from the r
|
||||||
val height = v.context.resources.displayMetrics.heightPixels
|
val height = v.context.resources.displayMetrics.heightPixels
|
||||||
diff = height - r.bottom
|
diff = height - r.bottom
|
||||||
Log.d("MySF", "diff: $diff")
|
Log.d("MySF", "diff: $diff")
|
||||||
}
|
}
|
||||||
Log.d("MySF", "diff out while: $diff")
|
Log.d("MySF", "diff out while: $diff")
|
||||||
if (diff <= 0) return@Thread
|
if (diff <= 0) return@withContext
|
||||||
Log.d("MySF", "f.dialog is ${f.dialog}")
|
Log.d("MySF", "f.dialog is ${f.dialog}")
|
||||||
f.activity?.runOnUiThread {
|
withContext(Dispatchers.Main) {
|
||||||
f.dialog?.window?.apply {
|
f.dialog?.window?.apply {
|
||||||
val attr = attributes
|
val attr = attributes
|
||||||
Log.d("MySF", "animate from ${attr.y} to ${attr.y-diff/2}")
|
Log.d("MySF", "animate from ${attr.y} to ${attr.y-diff/2}")
|
||||||
ObjectAnimator.ofInt(WindowAttributeSetter(this), "y", attr.y, attr.y-diff/2).setDuration(233).start()
|
ObjectAnimator.ofInt(WindowAttributeSetter(this), "y", attr.y, attr.y-diff/2).setDuration(233).start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start()
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
super.onDisplayPreferenceDialog(preference)
|
super.onDisplayPreferenceDialog(preference)
|
||||||
|
|||||||
@@ -135,6 +135,8 @@
|
|||||||
<string name="settings_cat_general">通用</string>
|
<string name="settings_cat_general">通用</string>
|
||||||
<string name="settings_cat_general_sb_title_startup_menu">启动时显示</string>
|
<string name="settings_cat_general_sb_title_startup_menu">启动时显示</string>
|
||||||
<string name="settings_cat_general_sb_summary_startup_menu">默认主页</string>
|
<string name="settings_cat_general_sb_summary_startup_menu">默认主页</string>
|
||||||
|
<string name="settings_cat_general_sb_card_per_row">每行加载卡片数偏移</string>
|
||||||
|
<string name="settings_cat_general_sm_card_per_row">默认为0表示无偏移, 在此基础上加减</string>
|
||||||
|
|
||||||
<string name="settings_cat_net">网络</string>
|
<string name="settings_cat_net">网络</string>
|
||||||
<string name="settings_cat_net_sb_title_image_resolution">图片分辨率</string>
|
<string name="settings_cat_net_sb_title_image_resolution">图片分辨率</string>
|
||||||
|
|||||||
@@ -14,6 +14,15 @@
|
|||||||
app:entries="@array/menus"
|
app:entries="@array/menus"
|
||||||
app:entryValues="@array/menu_ids"
|
app:entryValues="@array/menu_ids"
|
||||||
android:defaultValue="0"/>
|
android:defaultValue="0"/>
|
||||||
|
<SeekBarPreference
|
||||||
|
android:defaultValue="0"
|
||||||
|
android:max="8"
|
||||||
|
app:iconSpaceReserved="false"
|
||||||
|
app:key="settings_cat_general_sb_card_per_row"
|
||||||
|
app:min="-8"
|
||||||
|
app:showSeekBarValue="true"
|
||||||
|
app:summary="@string/settings_cat_general_sm_card_per_row"
|
||||||
|
app:title="@string/settings_cat_general_sb_card_per_row" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
|
|||||||
Reference in New Issue
Block a user