[书籍详情界面]取消书籍简介展开时最大行数限制(无法显示完全)

master^2
fengyuecanzhu 2 years ago
parent 4d40520e60
commit 130694fa55
No known key found for this signature in database
GPG Key ID: 04B78AD06A9D6E6C
  1. 2
      .idea/misc.xml
  2. 2
      app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java
  3. 1
      dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt
  4. 61
      dynamic/src/main/java/xyz/fycz/dynamic/fix/App250Fix.kt

@ -5,6 +5,7 @@
<map>
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_about.xml" value="0.2296195652173913" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_ad_setting.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_book_detail.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_donate.xml" value="0.264" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_more_setting.xml" value="0.2" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/activity_read.xml" value="0.12132725430597771" />
@ -18,6 +19,7 @@
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_source_edit.xml" value="0.22826086956521738" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_subscribe_source.xml" value="0.2" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/layout_about_content.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/layout_book_detail_content.xml" value="0.2296195652173913" />
</map>
</option>
</component>

@ -361,7 +361,7 @@ public class BookDetailedActivity extends BaseActivity<ActivityBookDetailBinding
*/
protected void showMoreDesc() {
if (binding.ic.bookDetailTvDesc.getMaxLines() == 5)
binding.ic.bookDetailTvDesc.setMaxLines(15);
binding.ic.bookDetailTvDesc.setMaxLines(Integer.MAX_VALUE);
else
binding.ic.bookDetailTvDesc.setMaxLines(5);
}

@ -57,6 +57,7 @@ class AppLoadImpl : IAppLoader {
App246Fix3::class.java,
App246Fix4::class.java,
App246Fix5::class.java,
App250Fix::class.java,
)
override fun onLoad(appParam: AppParam) {

@ -0,0 +1,61 @@
/*
* This file is part of FYReader.
* FYReader is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FYReader is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with FYReader. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2020 - 2022 fengyuecanzhu
*/
package xyz.fycz.dynamic.fix
import android.widget.TextView
import androidx.viewbinding.ViewBinding
import me.fycz.maple.MapleBridge
import me.fycz.maple.MapleUtils
import me.fycz.maple.MethodReplacement
import xyz.fycz.myreader.ui.activity.BookDetailedActivity
/**
* @author fengyue
* @date 2022/8/11 16:44
*/
@AppFix([243, 244, 245, 246, 250], ["[书籍详情界面]取消书籍简介展开时最大行数限制(无法显示完全)"], "2022-08-11")
class App250Fix : AppFixHandle {
override fun onFix(key: String): BooleanArray {
return handleFix(
key,
"showMoreDesc" to { fxShowMoreDesc() },
)
}
fun fxShowMoreDesc() {
MapleUtils.findAndHookMethod(
BookDetailedActivity::class.java,
"showMoreDesc",
object : MethodReplacement() {
override fun replaceHookedMethod(param: MapleBridge.MethodHookParam) {
val binding =
MapleUtils.getObjectField(param.thisObject, "binding") as ViewBinding
val icBinding = MapleUtils.getObjectField(binding, "ic") as ViewBinding
val bookDetailTvDesc =
MapleUtils.getObjectField(icBinding, "bookDetailTvDesc") as TextView
if (bookDetailTvDesc.maxLines == 5) {
bookDetailTvDesc.maxLines = Int.MAX_VALUE
} else {
bookDetailTvDesc.maxLines = 5
}
}
}
)
}
}
Loading…
Cancel
Save