Skip to content

Commit e572b4e

Browse files
committed
Migrate to compileSdk 34
- kotlin 1.5.31 -> 1.9.0 - compose 1.0.5 -> 1.5.0
1 parent daa7d5c commit e572b4e

File tree

40 files changed

+157
-117
lines changed

40 files changed

+157
-117
lines changed

api/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ apply plugin: 'com.android.library'
22
apply from: '../gradle/android_extension.gradle'
33

44
android {
5-
compileSdkVersion 31
5+
compileSdkVersion 34
66

77
defaultConfig {
88
minSdkVersion 14
9-
targetSdkVersion 31
9+
targetSdkVersion 34
1010
consumerProguardFiles file('./proguard.pro')
1111
}
12+
13+
namespace 'com.pitaya.mobile.uinspector'
1214
}
1315

1416
dependencies {

api/src/main/AndroidManifest.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.pitaya.mobile.uinspector">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32

43
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
54
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
5+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
6+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
67

78
<application>
89
<service
9-
android:name=".notification.UInspectorNotificationService"
10+
android:name="com.pitaya.mobile.uinspector.notification.UInspectorNotificationService"
1011
android:foregroundServiceType="dataSync"
1112
android:exported="false" />
1213
</application>

api/src/main/java/com/pitaya/mobile/uinspector/state/UInspectorTargetViews.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ class UInspectorTargetViews private constructor(
4545

4646
private val attachState = object : View.OnAttachStateChangeListener {
4747

48-
override fun onViewDetachedFromWindow(v: View?) {
48+
override fun onViewDetachedFromWindow(v: View) {
4949
onDetach.forEach { it.onChange() }
5050
clear()
5151
views.clear()
5252
}
5353

54-
override fun onViewAttachedToWindow(v: View?) {}
54+
override fun onViewAttachedToWindow(v: View) {}
5555
}
5656

5757
init {

api/src/main/java/com/pitaya/mobile/uinspector/ui/panel/fullscreen/UInspectorLegacyDialogFragment.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import android.os.Bundle
77
import android.view.LayoutInflater
88
import android.view.View
99
import android.view.ViewGroup
10+
import androidx.annotation.RestrictTo
1011
import com.pitaya.mobile.uinspector.hierarchy.Layer
1112
import com.pitaya.mobile.uinspector.lifecycle.Disposable
1213
import com.pitaya.mobile.uinspector.ui.decoration.UInspectorDecoration
@@ -17,7 +18,8 @@ import com.pitaya.mobile.uinspector.ui.panel.popup.UInspectorChildPanelContainer
1718
* @author YvesCheung
1819
* 2020/12/30
1920
*/
20-
internal class UInspectorLegacyDialogFragment : DialogFragment(), UInspectorPanel {
21+
@RestrictTo(RestrictTo.Scope.LIBRARY)
22+
class UInspectorLegacyDialogFragment : DialogFragment(), UInspectorPanel {
2123

2224
private val delegate = UInspectorPanelDelegate()
2325

api/src/main/java/com/pitaya/mobile/uinspector/ui/panel/fullscreen/UInspectorMask.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ internal class UInspectorMask(
6969
return true
7070
}
7171

72-
override fun onSingleTapUp(e: MotionEvent?): Boolean {
72+
override fun onSingleTapUp(e: MotionEvent): Boolean {
7373
isSingleTap = true
7474
return super.onSingleTapUp(e)
7575
}
7676

77-
override fun onSingleTapConfirmed(e: MotionEvent?): Boolean {
77+
override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
7878
val event = downEvent
7979
val activity = tryGetActivity(context)
8080
if (event != null && activity != null) {

api/src/main/java/com/pitaya/mobile/uinspector/ui/panel/popup/UInspectorPopupPanelContainerImpl.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import android.widget.TextView
1313
import androidx.core.content.ContextCompat
1414
import androidx.viewpager.widget.PagerAdapter
1515
import androidx.viewpager.widget.ViewPager
16+
import com.github.yvescheung.whisper.IntDef
17+
import com.google.android.material.tabs.TabLayout
1618
import com.pitaya.mobile.uinspector.R
1719
import com.pitaya.mobile.uinspector.UInspector
1820
import com.pitaya.mobile.uinspector.hierarchy.Layer
1921
import com.pitaya.mobile.uinspector.hierarchy.LayerFactoryPlugin
2022
import com.pitaya.mobile.uinspector.util.dpToPx
2123
import com.pitaya.mobile.uinspector.util.log
22-
import com.github.yvescheung.whisper.IntDef
23-
import kotlinx.android.synthetic.main.uinspector_popup_panel_container.view.*
2424

2525
/**
2626
* @author YvesCheung
@@ -71,9 +71,9 @@ internal class UInspectorPopupPanelContainerImpl(val parent: ViewGroup) :
7171
val inspectorMask: View,
7272
children: List<UInspectorChildPanel>
7373
) {
74-
private val popupPanel = inspectorMask.popup_panel
75-
private val viewPager = popupPanel.popup_panel_viewpager
76-
private val tabLayout = popupPanel.popup_panel_tab
74+
private val popupPanel: ViewGroup = inspectorMask.findViewById(R.id.popup_panel)
75+
private val viewPager: ViewPager = popupPanel.findViewById(R.id.popup_panel_viewpager)
76+
private val tabLayout: TabLayout = popupPanel.findViewById(R.id.popup_panel_tab)
7777

7878
private val adapter = PanelAdapter(children)
7979

app/build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,25 @@ apply plugin: 'com.android.application'
22
apply from: '../gradle/android_extension.gradle'
33

44
android {
5-
compileSdkVersion 31
5+
compileSdkVersion 34
66

77
defaultConfig {
88
applicationId "com.pitaya.mobile.uinspector.demo"
99
minSdkVersion 21
10-
targetSdkVersion 31
10+
targetSdkVersion 34
1111
versionCode 1
1212
versionName "1.0"
1313

1414
multiDexEnabled true
1515
}
1616

17+
namespace 'com.pitaya.mobile.uinspector.demo'
18+
1719
buildFeatures {
1820
// Enables Jetpack Compose for this module
1921
compose true
22+
23+
buildConfig true
2024
}
2125

2226
buildTypes {

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.pitaya.mobile.uinspector.demo">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
43

54
<uses-permission android:name="android.permission.INTERNET" />
65

app/src/main/java/com/pitaya/mobile/uinspector/ui/home/HomeFragment.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import androidx.fragment.app.viewModels
1111
import androidx.lifecycle.Observer
1212
import androidx.recyclerview.widget.RecyclerView
1313
import com.pitaya.mobile.uinspector.demo.R
14-
import kotlinx.android.synthetic.main.fragment_home.*
15-
import kotlinx.android.synthetic.main.item_recycler_view.view.*
1614

1715
class HomeFragment : Fragment() {
1816

@@ -30,7 +28,7 @@ class HomeFragment : Fragment() {
3028
super.onViewCreated(view, savedInstanceState)
3129
val data = mutableListOf<HomeItem>()
3230
val adapter = HomeAdapter(data)
33-
home_recycler_view.adapter = adapter
31+
view.findViewById<RecyclerView>(R.id.home_recycler_view).adapter = adapter
3432
homeViewModel.data.observe(viewLifecycleOwner, Observer {
3533
data.clear()
3634
data.addAll(it)
@@ -58,6 +56,8 @@ class HomeFragment : Fragment() {
5856
}
5957
}
6058

61-
private class HomeVH(itemView: View, val textView: TextView = itemView.recycler_text) :
62-
RecyclerView.ViewHolder(itemView)
59+
private class HomeVH(
60+
itemView: View,
61+
val textView: TextView = itemView.findViewById(R.id.recycler_text)
62+
) : RecyclerView.ViewHolder(itemView)
6363
}

app/src/main/java/com/pitaya/mobile/uinspector/ui/optional/ImageLoaderActivity.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import android.graphics.Color
55
import android.graphics.drawable.ColorDrawable
66
import android.os.Bundle
77
import com.bumptech.glide.Glide
8+
import com.facebook.drawee.view.SimpleDraweeView
89
import com.pitaya.mobile.uinspector.demo.R
9-
import kotlinx.android.synthetic.main.activity_image_loader.*
1010

1111
/**
1212
* @author YvesCheung
@@ -22,9 +22,9 @@ class ImageLoaderActivity : Activity() {
2222
.load("https://raw.githubusercontent.com/YvesCheung/UInspector/2.x/art/uinspector.png")
2323
.error(ColorDrawable(Color.GREEN))
2424
.placeholder(ColorDrawable(Color.parseColor("#ff0099cc")))
25-
.into(glide_imageview)
25+
.into(findViewById(R.id.glide_imageview))
2626

27-
fresco_imageview.setImageURI(
27+
findViewById<SimpleDraweeView>(R.id.fresco_imageview).setImageURI(
2828
"https://raw.githubusercontent.com/YvesCheung/UInspector/2.x/art/uinspector.png"
2929
)
3030
}

0 commit comments

Comments
 (0)