Skip to content

Commit 77f8cc5

Browse files
fix: resolve Kotlin overrides, nullability, visibility, and API compatibility issues
1 parent ff77b48 commit 77f8cc5

10 files changed

Lines changed: 31 additions & 31 deletions

File tree

MikuRay/app/src/main/java/com/miku/ray/particlesdrawable/ParticlesDrawable.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,13 @@ class ParticlesDrawable : Drawable(), Animatable, SceneConfiguration, SceneContr
179179

180180
override fun getLineLength(): Float = scene.getLineLength()
181181

182-
fun setDensity(@IntRange(from = 0) newNum: Int) {
182+
override fun setDensity(@IntRange(from = 0) newNum: Int) {
183183
scene.setDensity(newNum)
184184
}
185185

186186
override fun getDensity(): Int = scene.getDensity()
187187

188-
fun setParticleColor(@ColorInt color: Int) {
188+
override fun setParticleColor(@ColorInt color: Int) {
189189
scene.setParticleColor(color)
190190
}
191191

MikuRay/app/src/main/java/com/miku/ray/particlesdrawable/ParticlesView.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class ParticlesView @JvmOverloads constructor(
8282
return scene.speedFactor
8383
}
8484

85-
fun setParticleRadiusRange(
85+
override fun setParticleRadiusRange(
8686
@FloatRange(from = 0.5) minRadius: Float,
8787
@FloatRange(from = 0.5) maxRadius: Float
8888
) {
@@ -97,39 +97,39 @@ class ParticlesView @JvmOverloads constructor(
9797
return scene.particleRadiusMax
9898
}
9999

100-
fun setLineThickness(@FloatRange(from = 1.0) lineThickness: Float) {
100+
override fun setLineThickness(@FloatRange(from = 1.0) lineThickness: Float) {
101101
scene.setLineThickness(lineThickness)
102102
}
103103

104104
override fun getLineThickness(): Float {
105105
return scene.lineThickness
106106
}
107107

108-
fun setLineLength(@FloatRange(from = 0.0) lineLength: Float) {
108+
override fun setLineLength(@FloatRange(from = 0.0) lineLength: Float) {
109109
scene.setLineLength(lineLength)
110110
}
111111

112112
override fun getLineLength(): Float {
113113
return scene.lineLength
114114
}
115115

116-
fun setDensity(@IntRange(from = 0) newNum: Int) {
116+
override fun setDensity(@IntRange(from = 0) newNum: Int) {
117117
scene.setDensity(newNum)
118118
}
119119

120120
override fun getDensity(): Int {
121121
return scene.density
122122
}
123123

124-
fun setParticleColor(@ColorInt color: Int) {
124+
override fun setParticleColor(@ColorInt color: Int) {
125125
scene.setParticleColor(color)
126126
}
127127

128128
override fun getParticleColor(): Int {
129129
return scene.particleColor
130130
}
131131

132-
fun setLineColor(@ColorInt lineColor: Int) {
132+
override fun setLineColor(@ColorInt lineColor: Int) {
133133
scene.setLineColor(lineColor)
134134
}
135135

MikuRay/app/src/main/java/com/miku/ray/particlesdrawable/contract/SceneConfiguration.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ interface SceneConfiguration {
1616

1717
fun getFrameDelay(): Int
1818

19-
fun setLineColor(@ColorInt lineColor: Int)
19+
fun setLineColor( lineColor: Int)
2020

21-
fun getLineColor(): @ColorInt Int
21+
fun getLineColor(): Int
2222

2323
fun setLineLength(@FloatRange(from = 0.0) lineLength: Float)
2424

@@ -28,9 +28,9 @@ interface SceneConfiguration {
2828

2929
fun getLineThickness(): Float
3030

31-
fun setParticleColor(@ColorInt color: Int)
31+
fun setParticleColor( color: Int)
3232

33-
fun getParticleColor(): @ColorInt Int
33+
fun getParticleColor(): Int
3434

3535
fun setParticleRadiusRange(
3636
@FloatRange(from = 0.5) minRadius: Float,

MikuRay/app/src/main/java/com/miku/ray/particlesdrawable/model/Scene.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@ class Scene : SceneConfiguration {
1818

1919
private var alpha: Int = 255
2020

21-
private var density: Int = Defaults.DENSITY
21+
var density: Int = Defaults.DENSITY
2222

23-
private var frameDelay: Int = Defaults.FRAME_DELAY
23+
var frameDelay: Int = Defaults.FRAME_DELAY
2424

2525
@ColorInt
26-
private var lineColor: Int = Defaults.LINE_COLOR
26+
var lineColor: Int = Defaults.LINE_COLOR
2727

28-
private var lineLength: Float = Defaults.LINE_LENGTH
28+
var lineLength: Float = Defaults.LINE_LENGTH
2929

30-
private var lineThickness: Float = Defaults.LINE_THICKNESS
30+
var lineThickness: Float = Defaults.LINE_THICKNESS
3131

3232
@ColorInt
33-
private var particleColor: Int = Defaults.PARTICLE_COLOR
33+
var particleColor: Int = Defaults.PARTICLE_COLOR
3434

35-
private var particleRadiusMax: Float = Defaults.PARTICLE_RADIUS_MAX
35+
var particleRadiusMax: Float = Defaults.PARTICLE_RADIUS_MAX
3636

37-
private var particleRadiusMin: Float = Defaults.PARTICLE_RADIUS_MIN
37+
var particleRadiusMin: Float = Defaults.PARTICLE_RADIUS_MIN
3838

39-
private var speedFactor: Float = Defaults.SPEED_FACTOR
39+
var speedFactor: Float = Defaults.SPEED_FACTOR
4040

4141
private var width: Int = 0
4242
private var height: Int = 0

MikuRay/app/src/main/java/com/miku/ray/particlesdrawable/util/LineColorResolver.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ object LineColorResolver {
2020

2121
fun resolveLineColorWithAlpha(
2222
@IntRange(from = 0, to = 255) sceneAlpha: Int,
23-
@ColorInt lineColor: Int,
23+
lineColor: Int,
2424
maxDistance: Float,
2525
distance: Float
26-
): @ColorInt Int {
26+
): Int {
2727
val alpha = resolveLineAlpha(sceneAlpha, maxDistance, distance)
2828
return (lineColor and 0x00FFFFFF) or (alpha shl 24)
2929
}

MikuRay/app/src/main/java/com/miku/ray/preferencesearch/HistoryItem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.miku.ray.preferencesearch
22

3-
class HistoryItem(private val term: String) : ListItem() {
3+
class HistoryItem(val term: String) : ListItem() {
44

55
companion object {
66
const val TYPE = 1

MikuRay/app/src/main/java/com/miku/ray/preferencesearch/PreferenceItem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class PreferenceItem() : ListItem(), Parcelable {
7575
}
7676

7777
fun withSummary(summary: String?): PreferenceItem {
78-
this.summary = summary
78+
this.summary = summary ?: ""
7979
return this
8080
}
8181

MikuRay/app/src/main/java/com/miku/ray/preferencesearch/SearchPreferenceAdapter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import com.miku.ray.util.ThemeManagerKt
1515
import java.util.ArrayList
1616
import java.util.Locale
1717

18-
class SearchPreferenceAdapter : RecyclerView.Adapter<SearchPreferenceAdapter.ViewHolder>() {
18+
open class SearchPreferenceAdapter : RecyclerView.Adapter<SearchPreferenceAdapter.ViewHolder>() {
1919
private var dataset: MutableList<ListItem> = ArrayList()
2020
private lateinit var searchConfiguration: SearchConfiguration
2121
private var onItemClickListener: SearchClickListener? = null
@@ -44,7 +44,7 @@ class SearchPreferenceAdapter : RecyclerView.Adapter<SearchPreferenceAdapter.Vie
4444
override fun onBindViewHolder(h: ViewHolder, position: Int) {
4545
val listItem = dataset[position]
4646

47-
val highlightColor = ThemeManagerKt.getColorAttr(h.root.context, "colorPrimary")
47+
val highlightColor = getColorAttr(h.root.context, "colorPrimary")
4848

4949
when (getItemViewType(position)) {
5050
HistoryItem.TYPE -> {

MikuRay/app/src/main/java/com/miku/ray/preferencesearch/SearchPreferenceFragment.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class SearchPreferenceFragment : Fragment(), SearchPreferenceAdapter.SearchClick
4343
private var historyClickListener: HistoryClickListener? = null
4444
private var searchTermPreset: CharSequence? = null
4545

46-
override fun onCreate(savedInstanceState: Bundle?) {
46+
override fun onCreate(savedInstanceState: Bundle??) {
4747
super.onCreate(savedInstanceState)
4848
prefs = requireContext().getSharedPreferences(SHARED_PREFS_FILE, Context.MODE_PRIVATE)
4949
searcher = PreferenceParser(requireContext())
@@ -58,7 +58,7 @@ class SearchPreferenceFragment : Fragment(), SearchPreferenceAdapter.SearchClick
5858
}
5959

6060
@SuppressLint("ClickableViewAccessibility")
61-
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
61+
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle??): View {
6262
val rootView = inflater.inflate(R.layout.searchpreference_fragment, container, false)
6363
viewHolder = SearchViewHolder(rootView)
6464

@@ -115,7 +115,7 @@ class SearchPreferenceFragment : Fragment(), SearchPreferenceAdapter.SearchClick
115115
return rootView
116116
}
117117

118-
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
118+
override fun onViewCreated(view: View, savedInstanceState: Bundle??) {
119119
super.onViewCreated(view, savedInstanceState)
120120
ViewCompat.setOnApplyWindowInsetsListener(view) { v, insets ->
121121
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())

MikuRay/app/src/main/java/com/miku/ray/preferencesearch/SearchPreferenceResult.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import androidx.preference.PreferenceFragmentCompat
1414
import androidx.preference.PreferenceGroup
1515
import androidx.recyclerview.widget.RecyclerView
1616

17-
class SearchPreferenceResult(private val key: String, private val file: Int, private val screen: String) {
17+
class SearchPreferenceResult(val key: String, private val file: Int, private val screen: String) {
1818

1919
fun getKey(): String = key
2020
fun getResourceFile(): Int = file

0 commit comments

Comments
 (0)