Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

右下角浮动按钮改为扩展态,随滚动缩放,更新 Readme,新增安装包大小指示器(默认不开启,需手动设置) #20

Merged
merged 3 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ local.properties
/app/debug
.idea/misc.xml
/.idea
/.idea
Binary file added QQVerLiteBanner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ QQ 版本列表实用工具的诞生离不开以下开源项目,感谢以下
- [Android Jetpack](https://github.com/androidx/androidx/),[Apache License Version 2.0](https://github.com/androidx/androidx/blob/androidx-main/LICENSE.txt)
- [Remix Icon(Remix Design)](https://remixicon.com/),[Apache License Version 2.0](https://remixicon.com/license)
- [OKHttp(Square)](https://square.github.io/okhttp/),[Apache License Version 2.0](https://github.com/square/okhttp/blob/master/LICENSE.txt)
- [Kotlin(JetBrains)](https://kotlinlang.org/),Apache License Version 2.0
- [Kotlin(JetBrains)](https://kotlinlang.org/),[Apache License Version 2.0](https://github.com/JetBrains/kotlin/blob/master/license%2FREADME.md)
- [Gson(Google)](https://github.com/google/gson/),[Apache License Version 2.0](https://github.com/google/gson/blob/master/LICENSE)
- [Coil](https://coil-kt.github.io/coil/),[Apache License Version 2.0](https://github.com/coil-kt/coil/blob/main/LICENSE.txt)

## 孪生项目

[QQ 版本列表 Lite for WeChat MiniProgram](https://github.com/ArcticFoxPro/QQVersionListTool-WeChatMiniProgram),Licenced under [木兰公共许可证, 第2版](https://github.com/ArcticFoxPro/QQVersionListTool-WeChatMiniProgram/blob/main/LICENSE)

[![QQ 版本列表 Lite Banner](/QQVerLiteBanner.png)](https://github.com/ArcticFoxPro/QQVersionListTool-WeChatMiniProgram)
2 changes: 1 addition & 1 deletion UserAgreement.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,5 @@ Android™ 是 Google LLC 的商标。

QQ 版本列表实用工具

2024 年 3 月 11
2024 年 3 月 22

2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ android {
minSdk = 24
targetSdk = 34
versionCode = gitCommitCount
versionName = "1.2.1-$gitCommitHash"
versionName = "1.2.2-$gitCommitHash"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
25 changes: 24 additions & 1 deletion app/src/main/java/com/xiaoniu/qqversionlist/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ class MainActivity : AppCompatActivity() {
}
}

fun UADialog(agreed: Boolean) {

private fun UADialog(agreed: Boolean) {
//用户协议,传参内容表示先前是否同意过协议
val UAView: View = layoutInflater.inflate(R.layout.user_agreement, null)
val uaAgree = UAView.findViewById<Button>(R.id.ua_button_agree)
Expand Down Expand Up @@ -202,6 +203,18 @@ class MainActivity : AppCompatActivity() {

getData()

binding.rvContent.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy > 0) {
binding.btnGuess.shrink()
} else if(dy < 0){
binding.btnGuess.extend()
}
}
})


binding.bottomAppBar.setOnMenuItemClickListener { menuItem ->
//底部左下角按钮动作
when (menuItem.itemId) {
Expand Down Expand Up @@ -243,6 +256,7 @@ class MainActivity : AppCompatActivity() {
val longPressCardSwitch =
settingView.findViewById<MaterialSwitch>(R.id.long_press_card)
val guessNot5Switch = settingView.findViewById<MaterialSwitch>(R.id.guess_not_5)
val progressSizeSwitch = settingView.findViewById<MaterialSwitch>(R.id.progress_size)
val btnOk = settingView.findViewById<Button>(R.id.btn_setting_ok)

if (settingView.parent != null) {
Expand All @@ -252,6 +266,8 @@ class MainActivity : AppCompatActivity() {
displayFirstSwitch.isChecked = SpUtil.getBoolean(this, "displayFirst", true)
longPressCardSwitch.isChecked = SpUtil.getBoolean(this, "longPressCard", true)
guessNot5Switch.isChecked = SpUtil.getBoolean(this, "guessNot5", false)
progressSizeSwitch.isChecked = SpUtil.getBoolean(this, "progressSize", false)


val dialogSetting = MaterialAlertDialogBuilder(this).setTitle("设置")
.setIcon(R.drawable.settings_line).setView(settingView).setCancelable(true)
Expand All @@ -264,13 +280,18 @@ class MainActivity : AppCompatActivity() {

displayFirstSwitch.setOnCheckedChangeListener { _, isChecked ->
SpUtil.putBoolean(this, "displayFirst", isChecked)
getData()
}
longPressCardSwitch.setOnCheckedChangeListener { _, isChecked ->
SpUtil.putBoolean(this, "longPressCard", isChecked)
}
guessNot5Switch.setOnCheckedChangeListener { _, isChecked ->
SpUtil.putBoolean(this, "guessNot5", isChecked)
}
progressSizeSwitch.setOnCheckedChangeListener { _, isChecked ->
SpUtil.putBoolean(this, "progressSize", isChecked)
getData()
}


true
Expand Down Expand Up @@ -340,8 +361,10 @@ class MainActivity : AppCompatActivity() {
dialogGuessBinding.guessDialogWarning.visibility = View.GONE
}
}

override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
}

override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package com.xiaoniu.qqversionlist.ui
import android.annotation.SuppressLint
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
Expand Down Expand Up @@ -131,6 +132,14 @@ class VersionAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
if (holder is ViewHolder) {
val result = "版本:" + bean.versionNumber + "\n大小:" + bean.size + " MB"
holder.binding.tvContent.text = result
if (!SpUtil.getBoolean(holder.itemView.context, "progressSize", false)) {
holder.binding.listProgressLine.visibility = View.GONE
} else{
holder.binding.listProgressLine.visibility = View.VISIBLE
holder.binding.listProgressLine.max =
((list.maxByOrNull { it.size.toFloat() }?.size?.toFloat() ?: 0f) * 10).toInt()
holder.binding.listProgressLine.progress = (bean.size.toFloat() * 10).toInt()
}
} else if (holder is ViewHolderDetail) {
holder.binding.apply {
linearImages.removeAllViews()
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
QQ Version Tool for Android™
Copyright (C) 2023 klxiaoniu

Expand Down Expand Up @@ -63,7 +62,6 @@
</com.google.android.material.appbar.AppBarLayout>



<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bottomAppBar"
style="@style/Widget.Material3.BottomAppBar"
Expand All @@ -75,21 +73,23 @@
app:layout_constraintBottom_toBottomOf="parent"
app:menu="@menu/bottom_app_bar" />

<com.google.android.material.floatingactionbutton.FloatingActionButton
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/btn_guess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="猜版"
app:icon="@drawable/search_line"
app:layout_anchor="@id/bottomAppBar"
app:srcCompat="@drawable/search_line" />
app:removeEmbeddedFabElevation="true" />

<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress_line"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
android:elevation="10dp"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:elevation="10dp"
android:indeterminate="true"
app:layout_anchor="@id/topAppBar"
app:layout_anchorGravity="bottom" />

Expand Down
19 changes: 9 additions & 10 deletions app/src/main/res/layout/dialog_guess.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
QQ Version Tool for Android™
Copyright (C) 2023 klxiaoniu

Expand Down Expand Up @@ -35,11 +34,11 @@
android:id="@+id/et_version_big"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="8dp"
app:helperTextEnabled="true"
android:layout_weight="1"
android:hint="主版本号"
app:helperText="填写格式为 x.y.z"
android:hint="主版本号">
app:helperTextEnabled="true">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
Expand All @@ -60,11 +59,11 @@
style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="8dp"
app:helperTextEnabled="true"
android:layout_weight="1"
android:hint="版本"
app:helperText="指定猜版版本"
android:hint="版本">
app:helperTextEnabled="true">

<AutoCompleteTextView
android:id="@+id/spinner_version"
Expand All @@ -81,9 +80,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:helperTextEnabled="true"
android:hint="起始小版本号"
app:helperText="填写起始猜测小版本号,猜正式版时无需填写"
android:hint="起始小版本号">
app:helperTextEnabled="true">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
Expand Down
12 changes: 5 additions & 7 deletions app/src/main/res/layout/dialog_loading.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
QQ Version Tool for Android™
Copyright (C) 2023 klxiaoniu

Expand All @@ -20,8 +19,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="16dp">

<com.google.android.material.progressindicator.CircularProgressIndicator
Expand All @@ -45,13 +44,12 @@
android:textAlignment="viewStart"
android:textSize="13sp" />

<Button
xmlns:app="http://schemas.android.com/apk/res-auto"
<Button xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/dialog_button_cancel"
style="?attr/materialIconButtonFilledTonalStyle"
app:icon="@drawable/stop_line"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="13sp" />
android:textSize="13sp"
app:icon="@drawable/stop_line" />

</LinearLayout>
11 changes: 9 additions & 2 deletions app/src/main/res/layout/dialog_setting.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
QQ Version Tool for Android™
Copyright (C) 2023 klxiaoniu

Expand Down Expand Up @@ -42,6 +41,14 @@
android:paddingBottom="8dp"
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="版本列表折叠态展示当前包大小占比最大包指示条" />

<com.google.android.material.materialswitch.MaterialSwitch
android:id="@+id/guess_not_5"
android:layout_width="match_parent"
Expand Down
23 changes: 21 additions & 2 deletions app/src/main/res/layout/item_version.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
QQ Version Tool for Android™
Copyright (C) 2023 klxiaoniu

Expand Down Expand Up @@ -27,6 +26,11 @@
android:layout_height="wrap_content"
android:padding="10dp">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/list_con"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/tv_content"
android:layout_width="match_parent"
Expand All @@ -48,4 +52,19 @@
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/list_progress_line"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="10dp"
app:layout_constraintTop_toBottomOf="@id/list_con"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_anchorGravity="bottom" />

</androidx.constraintlayout.widget.ConstraintLayout>



</com.google.android.material.card.MaterialCardView>
21 changes: 10 additions & 11 deletions app/src/main/res/layout/item_version_detail.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
QQ Version Tool for Android™
Copyright (C) 2023 klxiaoniu

Expand Down Expand Up @@ -44,36 +43,36 @@
android:id="@+id/tv_version"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="版本:9.0.25"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="版本:9.0.25" />
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tv_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="大小:307MB"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_version"
tools:text="大小:307MB" />
app:layout_constraintTop_toBottomOf="@id/tv_version" />

</androidx.constraintlayout.widget.ConstraintLayout>

<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
tools:text="体验说明:"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/item_old"
tools:text="体验说明:" />
app:layout_constraintTop_toBottomOf="@id/item_old" />

<TextView
android:id="@+id/tv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
tools:text="新年新“状态”"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_title"
tools:text="新年新“状态”" />
app:layout_constraintTop_toBottomOf="@id/tv_title" />

<HorizontalScrollView
android:id="@+id/scroll"
Expand All @@ -98,7 +97,7 @@
android:layout_height="wrap_content"
app:icon="@drawable/ic_up"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
app:layout_constraintTop_toTopOf="parent" />


</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/success_button.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
QQ Version Tool for Android™
Copyright (C) 2023 klxiaoniu

Expand Down
Loading
Loading