Skip to content

Commit

Permalink
Merge pull request #57 from ArcticFoxPro/master
Browse files Browse the repository at this point in the history
修复一处 TextView 可被选中的问题、对关于界面进行了更改,将猜版 OkHttp 默认请求改为 HEAD
  • Loading branch information
klxiaoniu authored Jul 22, 2024
2 parents 9106b85 + dd3c9a4 commit f5e7e13
Show file tree
Hide file tree
Showing 11 changed files with 214 additions and 182 deletions.
10 changes: 9 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,17 @@

## 自检清单

> 请检查下列所有选项并打勾
> 请确认下列所有选项并打勾
- [ ] 此 PR 已实现我的所有预期更改,可以被合并。
- [ ] 我确认此 PR 全部代码仅由本人(或联合作者)编写,代码所有权归本人(或联合作者)所有。
- [ ] 此 PR 更新日志已提供(或无须提供)。
- [ ] Readme 文档无须补充(或已补充)。

> 请确认下列选项并打勾。如不认可选项内容或存在需备注内容,请在选项旁随附补充说明。
- [ ] 我认可并确认我贡献的代码将以 [GNU Affero General Public License Version 3](/LICENSE) 开源许可进行发行。
- (单项选择)若后续项目决定更改开源许可:
- [ ] 请通知我并等待我的决定
- [ ] 无需通知,我授权项目所有者自行决定我的贡献的开源许可变更。
- [ ] 其他,请补充说明:_______
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ QQ 版本列表实用工具 for Android 是一个使用 Material 3 组件库构
- `https://downv6.qq.com/qqweb/QQ_1/android_apk/Android_<主版本号>.<小版本号><自定义后缀>.apk`

> [!TIP]
> QQ 版本列表实用工具实验性支持了 Android 微信的猜版。若选择微信猜版,对话框将变更为四个输入框,分别是“主版本号”、“猜版”、“真实版本号”和“十六进制代码”,对应的直链为:
> QQ 版本列表实用工具实验性支持了 Android 微信的猜版。若选择微信猜版,对话框将变更为四个输入框,分别是“主版本号”、“猜版类型”、“真实版本号”和“十六进制代码”,对应的直链为:
>
> `http://dldir1.qq.com/weixin/android/weixin<主版本号>android<真实版本号>_<十六进制代码>_arm64.apk`
>
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ dependencies {
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1")
implementation("io.coil-kt:coil:2.6.0")
implementation("io.coil-kt:coil:2.7.0")
implementation("androidx.datastore:datastore-preferences:1.1.1")
implementation("com.google.code.gson:gson:2.11.0")
}
294 changes: 132 additions & 162 deletions app/src/main/java/com/xiaoniu/qqversionlist/ui/MainActivity.kt

Large diffs are not rendered by default.

17 changes: 11 additions & 6 deletions app/src/main/java/com/xiaoniu/qqversionlist/ui/VersionAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class VersionAdapter : ListAdapter<QQVersionBean, RecyclerView.ViewHolder>(Versi
return (dp * resources.displayMetrics.density).toInt()
}*/

private var getProgressSize = DataStoreUtil.getBoolean("progressSize", false)
private var getVersionTCloud = DataStoreUtil.getBoolean("versionTCloud", true)

class ViewHolder(val binding: ItemVersionBinding, val context: Context) :
RecyclerView.ViewHolder(binding.root)

Expand All @@ -72,15 +75,15 @@ class VersionAdapter : ListAdapter<QQVersionBean, RecyclerView.ViewHolder>(Versi
currentList[adapterPosition].displayType = 1
notifyItemChanged(adapterPosition)
}
binding.itemAll.setOnLongClickListener {
binding.cardAll.setOnLongClickListener {
if (DataStoreUtil.getBoolean("longPressCard", true)) {
showDialog(
it.context, currentList[adapterPosition].jsonString.toPrettyFormat()
)
} else {
Toast.makeText(
it.context,
"未开启长按查看详情功能\n请前往设置开启",
"未开启长按查看 JSON 详情功能,请前往设置开启",
Toast.LENGTH_SHORT
).show()
}
Expand All @@ -99,15 +102,15 @@ class VersionAdapter : ListAdapter<QQVersionBean, RecyclerView.ViewHolder>(Versi
currentList[adapterPosition].displayType = 0
notifyItemChanged(adapterPosition)
}
binding.itemAllDetail.setOnLongClickListener {
binding.cardAllDetail.setOnLongClickListener {
if (DataStoreUtil.getBoolean("longPressCard", true)) {
showDialog(
it.context, currentList[adapterPosition].jsonString.toPrettyFormat()
)
} else {
Toast.makeText(
it.context,
"未开启长按查看详情功能\n请前往设置开启",
"未开启长按查看 JSON 详情功能,请前往设置开启",
Toast.LENGTH_SHORT
).show()
}
Expand Down Expand Up @@ -176,7 +179,7 @@ class VersionAdapter : ListAdapter<QQVersionBean, RecyclerView.ViewHolder>(Versi
tvSizeCard: MaterialCardView,
bean: QQVersionBean,
) {
with(DataStoreUtil.getBoolean("progressSize", false)) {
with(getProgressSize) {
tvPerSize?.isVisible = this
listProgressLine.isVisible = this
tvPerSizeCard.isVisible = this
Expand Down Expand Up @@ -221,7 +224,7 @@ class VersionAdapter : ListAdapter<QQVersionBean, RecyclerView.ViewHolder>(Versi
private fun bindVersionTCloud(
tvVersion: TextView, bean: QQVersionBean, context: Context
) {
if (DataStoreUtil.getBoolean("versionTCloud", true)) {
if (getVersionTCloud) {
val TCloudFont = ResourcesCompat.getFont(context, R.font.tcloud_number_vf)
tvVersion.typeface = TCloudFont
} else {
Expand Down Expand Up @@ -303,10 +306,12 @@ class VersionAdapter : ListAdapter<QQVersionBean, RecyclerView.ViewHolder>(Versi
fun updateItemProperty(payloads: Any?) {
when (payloads) {
"isShowProgressSize" -> {
getProgressSize = DataStoreUtil.getBoolean("progressSize", false)
notifyItemRangeChanged(0, currentList.size, "isShowProgressSize")
}

"isTCloud" -> {
getVersionTCloud = DataStoreUtil.getBoolean("versionTCloud", true)
notifyItemRangeChanged(0, currentList.size, "isTCloud")
}
}
Expand Down

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions app/src/main/res/layout/dialog_personalization.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:paddingTop="16dp"
android:text="版本列表首项默认展开" />
android:text="版本列表首项卡片默认显示详情" />

<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/progress_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:text="版本列表展示额定包大小占比历史最大包指示条" />
android:text="版本卡片展示额定包大小占比历史最大包指示条" />

<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/version_tcloud"
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/dialog_setting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:paddingTop="16dp"
android:text="长按版本列表文字弹出源 JSON 字符串" />
android:text="长按版本卡片查看源 JSON 详情" />

<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/download_on_system_manager"
Expand Down Expand Up @@ -71,7 +71,7 @@
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:text="扩展测试版猜版直链格式" />
android:text="扩展测试版猜版直链后缀" />

<TextView
android:id="@+id/dialog_suffix_define_click"
Expand All @@ -81,7 +81,7 @@
android:gravity="center_vertical"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:text="猜版后缀设置"
android:text="猜版直链后缀设置"
android:textColor="?attr/colorOnSurface"
app:drawableEndCompat="@drawable/arrow_right_s_line" />

Expand All @@ -91,7 +91,7 @@
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="16dp"
android:text="解除猜版小版本号遵循 5 的倍数限制" />
android:text="解除 QQ 测试版猜版小版本号遵循 5 的倍数限制" />

<Button
android:id="@+id/btn_setting_ok"
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/res/layout/dialog_shiply_back.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
android:paddingBottom="6dp"
android:text="建议的内容"
android:textColor="?attr/colorPrimary"
android:textIsSelectable="true"
android:textSize="11sp"
android:textStyle="bold" />

Expand All @@ -62,7 +61,6 @@
android:paddingBottom="4dp"
android:text="源 JSON"
android:textColor="?attr/colorPrimary"
android:textIsSelectable="true"
android:textSize="11sp"
android:textStyle="bold" />

Expand All @@ -73,7 +71,7 @@
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:paddingBottom="20dp"
android:text="489945498498\n89844947987\n89494948\n9787984"
android:text="我是一段测试文本\n我也是一段测试文本\n兄弟,我还是\n兄弟,我没了"
android:textIsSelectable="true" />

</LinearLayout>
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/item_version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
android:id="@+id/card_all"
style="?attr/materialCardViewElevatedStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/item_all"
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/item_version_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
style="?attr/materialCardViewElevatedStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="?android:colorBackground">
android:backgroundTint="?android:colorBackground"
android:clickable="true"
android:focusable="true">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/item_all_detail"
Expand Down

0 comments on commit f5e7e13

Please sign in to comment.