Skip to content

Commit

Permalink
update minsdk
Browse files Browse the repository at this point in the history
  • Loading branch information
WrBug committed Sep 12, 2024
1 parent fc586a4 commit 350a42f
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ android {
compileSdk 34
defaultConfig {
applicationId "com.wrbug.developerhelper"
minSdkVersion 21
minSdkVersion 23
targetSdkVersion 34
versionCode 100040
versionName "1.0.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ import android.view.LayoutInflater
import android.view.View
import android.widget.CompoundButton
import android.widget.FrameLayout
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.core.view.updatePadding
import com.wrbug.developerhelper.R
import com.wrbug.developerhelper.commonutil.dpInt
import com.wrbug.developerhelper.commonwidget.util.setOnDoubleCheckClickListener
import com.wrbug.developerhelper.databinding.ViewSettingItemBinding

class SettingItemView : FrameLayout {
class SettingItemView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
) : ConstraintLayout(context, attrs) {

var checkable: Boolean = true
set(value) {
Expand All @@ -29,24 +34,20 @@ class SettingItemView : FrameLayout {
binding.switcher.isChecked = checked
}
private var switcherMaskViewClicked = false
private val binding: ViewSettingItemBinding by lazy {
ViewSettingItemBinding.inflate(LayoutInflater.from(context), this, true)
}

constructor(context: Context) : super(context) {
initView()
}
private val binding = ViewSettingItemBinding.inflate(LayoutInflater.from(context), this)

constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
init {
initView()
initAttrs(attrs)
}

private fun initView() {
updatePadding(top = 8.dpInt(context), bottom = 8.dpInt(context))
setBackgroundResource(R.drawable.ripple_with_color_mask)
}

private fun initAttrs(attrs: AttributeSet) {
private fun initAttrs(attrs: AttributeSet?) {
attrs ?: return
with(context.obtainStyledAttributes(attrs, R.styleable.SettingItemView)) {
val src = getDrawable(R.styleable.SettingItemView_src)
setImage(src)
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/view_setting_item.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_with_color_mask"
android:paddingVertical="8dp">
android:paddingVertical="8dp"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/icoIv"
Expand Down Expand Up @@ -65,4 +65,4 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/switcher"
app:layout_constraintTop_toTopOf="@+id/switcher" />
</androidx.constraintlayout.widget.ConstraintLayout>
</merge>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@
<string name="find_new_version">发现新版本</string>
<string name="download">下载</string>
<string name="open_notification_title">通知栏常驻</string>
<string name="open_notification_summary">用于进程保活,按需开启</string>
<string name="open_notification_summary">用于进程保活,当应用经常被杀死时,请打开该功能</string>
</resources>
2 changes: 1 addition & 1 deletion basecommon/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {
namespace "com.wrbug.developerhelper.basecommon"
compileSdk 34
defaultConfig {
minSdkVersion 21
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ abstract class BaseActivity : AppCompatActivity() {
private var mPermissionCallback: PermissionCallback? = null

companion object {

private const val PERMISSION_REQUEST_CODE = 0xAADF1
}

Expand All @@ -42,12 +41,7 @@ abstract class BaseActivity : AppCompatActivity() {
Snackbar.make(toastRootView, id, Snackbar.LENGTH_SHORT).show()
}

@TargetApi(Build.VERSION_CODES.M)
fun requestPermission(permissions: Array<String>, callback: PermissionCallback) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
callback.granted()
return
}
val list = ArrayList<String>()
for (permission in permissions) {
val hasPermission = checkSelfPermission(permission)
Expand Down Expand Up @@ -170,11 +164,7 @@ abstract class BaseActivity : AppCompatActivity() {
}

fun hasPermission(permissions: String): Boolean {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
checkSelfPermission(permissions) == PackageManager.PERMISSION_GRANTED
} else {
true
}
return checkSelfPermission(permissions) == PackageManager.PERMISSION_GRANTED
}

override fun onRequestPermissionsResult(
Expand Down
2 changes: 1 addition & 1 deletion basemoduleimport/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {


defaultConfig {
minSdkVersion 21
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName "1.0"
Expand Down
2 changes: 1 addition & 1 deletion commonutil/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {


defaultConfig {
minSdkVersion 21
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName "1.0"
Expand Down
2 changes: 1 addition & 1 deletion commonwidget/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {


defaultConfig {
minSdkVersion 21
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName "1.0"
Expand Down
2 changes: 1 addition & 1 deletion mmkv/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {
compileSdk 34

defaultConfig {
minSdkVersion 21
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName "1.0"
Expand Down

0 comments on commit 350a42f

Please sign in to comment.