-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from ArcticFoxPro/master
更正 Kuikly 标识最早版本不准确的问题,优化设置、实验性功能和本机版本详情对话框界面
- Loading branch information
Showing
45 changed files
with
2,306 additions
and
545 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
227 changes: 136 additions & 91 deletions
227
app/src/main/java/com/xiaoniu/qqversionlist/ui/LocalQQAdapter.kt
Large diffs are not rendered by default.
Oops, something went wrong.
228 changes: 139 additions & 89 deletions
228
app/src/main/java/com/xiaoniu/qqversionlist/ui/LocalTIMAdapter.kt
Large diffs are not rendered by default.
Oops, something went wrong.
131 changes: 59 additions & 72 deletions
131
app/src/main/java/com/xiaoniu/qqversionlist/ui/MainActivity.kt
Large diffs are not rendered by default.
Oops, something went wrong.
86 changes: 86 additions & 0 deletions
86
app/src/main/java/com/xiaoniu/qqversionlist/ui/components/cell/CellBottomClick.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
Qverbow Util | ||
Copyright (C) 2023 klxiaoniu | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as | ||
published by the Free Software Foundation, either version 3 of the | ||
License, or (at your option) any later version. | ||
This program 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 Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.xiaoniu.qqversionlist.ui.components.cell | ||
|
||
import android.annotation.SuppressLint | ||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.widget.LinearLayout | ||
import androidx.core.view.isVisible | ||
import com.xiaoniu.qqversionlist.R | ||
import com.xiaoniu.qqversionlist.databinding.CellBottomClickBinding | ||
|
||
@SuppressLint("CustomViewStyleable") | ||
class CellBottomClick @JvmOverloads constructor( | ||
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 | ||
) : LinearLayout(context, attrs, defStyleAttr) { | ||
private val binding: CellBottomClickBinding = | ||
CellBottomClickBinding.inflate(LayoutInflater.from(context), this, true) | ||
|
||
init { | ||
val a = context.obtainStyledAttributes(attrs, R.styleable.Cell, defStyleAttr, 0) | ||
val title = a.getString(R.styleable.Cell_cellTitle) | ||
val iconResId = a.getResourceId(R.styleable.Cell_cellIcon, 0) | ||
val description = a.getString(R.styleable.Cell_cellDescription) | ||
a.recycle() | ||
if (title == null) throw IllegalArgumentException("Title and type are required attributes for CellSwitch.") | ||
|
||
binding.title.text = title | ||
|
||
if (iconResId != 0) binding.icon.apply { | ||
setImageResource(iconResId) | ||
isVisible = true | ||
} else binding.icon.isVisible = false | ||
|
||
if (description != null) binding.description.apply { | ||
text = description | ||
isVisible = true | ||
} else binding.description.isVisible = false | ||
|
||
setOnClickListener { v -> | ||
onClick?.invoke(v) | ||
} | ||
} | ||
|
||
var onClick: ((View) -> Unit)? = null | ||
|
||
fun setCellTitle(title: String) { | ||
binding.title.text = title | ||
} | ||
|
||
fun setCellDescription(description: String?) { | ||
if (description == null) binding.description.isVisible = false | ||
else binding.description.apply { | ||
isVisible = true | ||
text = description | ||
} | ||
|
||
} | ||
|
||
fun setCellIcon(iconResId: Int?) { | ||
if (iconResId == null) | ||
binding.icon.isVisible = false | ||
else binding.icon.apply { | ||
isVisible = true | ||
setImageResource(iconResId) | ||
} | ||
} | ||
} |
113 changes: 113 additions & 0 deletions
113
app/src/main/java/com/xiaoniu/qqversionlist/ui/components/cell/CellBottomSwitch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
Qverbow Util | ||
Copyright (C) 2023 klxiaoniu | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as | ||
published by the Free Software Foundation, either version 3 of the | ||
License, or (at your option) any later version. | ||
This program 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 Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.xiaoniu.qqversionlist.ui.components.cell | ||
|
||
import android.annotation.SuppressLint | ||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.widget.LinearLayout | ||
import androidx.core.view.isVisible | ||
import com.xiaoniu.qqversionlist.R | ||
import com.xiaoniu.qqversionlist.databinding.CellBottomSwitchBinding | ||
|
||
@SuppressLint("CustomViewStyleable") | ||
class CellBottomSwitch @JvmOverloads constructor( | ||
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 | ||
) : LinearLayout(context, attrs, defStyleAttr) { | ||
private val binding: CellBottomSwitchBinding = | ||
CellBottomSwitchBinding.inflate(LayoutInflater.from(context), this, true) | ||
private var onCheckedChangeListener: ((Boolean) -> Unit)? = null | ||
|
||
init { | ||
val a = context.obtainStyledAttributes(attrs, R.styleable.Cell, defStyleAttr, 0) | ||
val title = a.getString(R.styleable.Cell_cellTitle) | ||
val iconResId = a.getResourceId(R.styleable.Cell_cellIcon, 0) | ||
val description = a.getString(R.styleable.Cell_cellDescription) | ||
a.recycle() | ||
if (title == null) throw IllegalArgumentException("Title and type are required attributes for CellSwitch.") | ||
|
||
binding.title.text = title | ||
|
||
if (iconResId != 0) binding.icon.apply { | ||
setImageResource(iconResId) | ||
isVisible = true | ||
} else binding.icon.isVisible = false | ||
|
||
if (description != null) binding.description.apply { | ||
text = description | ||
isVisible = true | ||
} else binding.description.isVisible = false | ||
|
||
setOnClickListener { v -> | ||
toggleSwitch() | ||
onClick?.invoke(v) | ||
} | ||
} | ||
|
||
var onClick: ((View) -> Unit)? = null | ||
|
||
fun setCellTitle(title: String) { | ||
binding.title.text = title | ||
} | ||
|
||
fun setCellDescription(description: String?) { | ||
if (description == null) binding.description.isVisible = false | ||
else binding.description.apply { | ||
isVisible = true | ||
text = description | ||
} | ||
|
||
} | ||
|
||
fun setCellIcon(iconResId: Int?) { | ||
if (iconResId == null) | ||
binding.icon.isVisible = false | ||
else binding.icon.apply { | ||
isVisible = true | ||
setImageResource(iconResId) | ||
} | ||
} | ||
|
||
var switchChecked: Boolean | ||
get() = binding.switchCompat.isChecked | ||
set(value) { | ||
binding.switchCompat.isChecked = value | ||
} | ||
|
||
var switchEnabled: Boolean | ||
get() = binding.switchCompat.isEnabled | ||
set(value) { | ||
binding.switchCompat.isEnabled = value | ||
} | ||
|
||
fun setOnCheckedChangeListener(listener: (Boolean) -> Unit) { | ||
onCheckedChangeListener = listener | ||
} | ||
|
||
private fun toggleSwitch() { | ||
val isChecked = !binding.switchCompat.isChecked | ||
val isEnabled = binding.switchCompat.isEnabled | ||
if (isEnabled) { | ||
binding.switchCompat.isChecked = isChecked | ||
onCheckedChangeListener?.invoke(isChecked) | ||
} | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
app/src/main/java/com/xiaoniu/qqversionlist/ui/components/cell/CellMiddleClick.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
Qverbow Util | ||
Copyright (C) 2023 klxiaoniu | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as | ||
published by the Free Software Foundation, either version 3 of the | ||
License, or (at your option) any later version. | ||
This program 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 Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.xiaoniu.qqversionlist.ui.components.cell | ||
|
||
import android.annotation.SuppressLint | ||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.widget.LinearLayout | ||
import androidx.core.view.isVisible | ||
import com.xiaoniu.qqversionlist.R | ||
import com.xiaoniu.qqversionlist.databinding.CellMiddleClickBinding | ||
|
||
@SuppressLint("CustomViewStyleable") | ||
class CellMiddleClick @JvmOverloads constructor( | ||
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 | ||
) : LinearLayout(context, attrs, defStyleAttr) { | ||
private val binding: CellMiddleClickBinding = | ||
CellMiddleClickBinding.inflate(LayoutInflater.from(context), this, true) | ||
|
||
init { | ||
val a = context.obtainStyledAttributes(attrs, R.styleable.Cell, defStyleAttr, 0) | ||
val title = a.getString(R.styleable.Cell_cellTitle) | ||
val iconResId = a.getResourceId(R.styleable.Cell_cellIcon, 0) | ||
val description = a.getString(R.styleable.Cell_cellDescription) | ||
a.recycle() | ||
if (title == null) throw IllegalArgumentException("Title and type are required attributes for CellSwitch.") | ||
|
||
binding.title.text = title | ||
|
||
if (iconResId != 0) binding.icon.apply { | ||
setImageResource(iconResId) | ||
isVisible = true | ||
} else binding.icon.isVisible = false | ||
|
||
if (description != null) binding.description.apply { | ||
text = description | ||
isVisible = true | ||
} else binding.description.isVisible = false | ||
|
||
setOnClickListener { v -> | ||
onClick?.invoke(v) | ||
} | ||
} | ||
|
||
var onClick: ((View) -> Unit)? = null | ||
|
||
fun setCellTitle(title: String) { | ||
binding.title.text = title | ||
} | ||
|
||
fun setCellDescription(description: String?) { | ||
if (description == null) binding.description.isVisible = false | ||
else binding.description.apply { | ||
isVisible = true | ||
text = description | ||
} | ||
|
||
} | ||
|
||
fun setCellIcon(iconResId: Int?) { | ||
if (iconResId == null) | ||
binding.icon.isVisible = false | ||
else binding.icon.apply { | ||
isVisible = true | ||
setImageResource(iconResId) | ||
} | ||
} | ||
} |
Oops, something went wrong.