Skip to content

Commit

Permalink
Update to Gradle 8.2 + AGP 8.2.1
Browse files Browse the repository at this point in the history
- Migrated to buildConfig gradle attribute
- Migrated to non-transitive R classes
  • Loading branch information
nickbeth committed Jan 5, 2024
1 parent fbb139a commit 63d17dd
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 67 deletions.
55 changes: 1 addition & 54 deletions .idea/inspectionProfiles/Project_Default.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ android {

buildFeatures {
viewBinding true
buildConfig true
}

/* Linting */
Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
android:name=".StratoApplication"
android:enableOnBackInvokedCallback="true"
android:allowBackup="true"
android:extractNativeLibs="true"
android:fullBackupContent="@xml/backup_descriptor"
android:icon="@drawable/logo_skyline"
android:isGame="true"
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/org/stratoemu/strato/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import org.stratoemu.strato.utils.GpuDriverHelper
import org.stratoemu.strato.utils.WindowInsetsHelper
import javax.inject.Inject
import kotlin.math.ceil
import com.google.android.material.R as MaterialR

@AndroidEntryPoint
class MainActivity : AppCompatActivity() {
Expand Down Expand Up @@ -118,8 +119,9 @@ class MainActivity : AppCompatActivity() {
setupAppList()

binding.swipeRefreshLayout.apply {
setProgressBackgroundColorSchemeColor(obtainStyledAttributes(intArrayOf(R.attr.colorSurfaceVariant)).use { it.getColor(0, Color.BLACK) })
setColorSchemeColors(obtainStyledAttributes(intArrayOf(R.attr.colorPrimary)).use { it.getColor(0, Color.WHITE) })
setProgressBackgroundColorSchemeColor(
obtainStyledAttributes(intArrayOf(MaterialR.attr.colorSurfaceVariant)).use { it.getColor(0, Color.BLACK) })
setColorSchemeColors(obtainStyledAttributes(intArrayOf(MaterialR.attr.colorPrimary)).use { it.getColor(0, Color.WHITE) })
post { setDistanceToTriggerSync(binding.swipeRefreshLayout.height / 3) }
setOnRefreshListener { loadRoms(false) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import android.graphics.drawable.LayerDrawable
import android.util.TypedValue
import androidx.core.content.ContextCompat
import androidx.core.content.res.use
import org.stratoemu.strato.R
import org.stratoemu.strato.input.ButtonId
import kotlin.math.roundToInt
import com.google.android.material.R as MaterialR

/**
* Converts relative values, such as coordinates and boundaries, to their absolute counterparts, also handles layout modifications like scaling and custom positioning
Expand Down Expand Up @@ -47,7 +47,7 @@ abstract class OnScreenButton(
init {
if (disabledSelectionPaint == null) {
disabledSelectionPaint = Paint().apply {
color = onScreenControllerView.context.obtainStyledAttributes(intArrayOf(R.attr.colorTertiary)).use { it.getColor(0, Color.GREEN) }
color = onScreenControllerView.context.obtainStyledAttributes(intArrayOf(MaterialR.attr.colorTertiary)).use { it.getColor(0, Color.GREEN) }
style = Paint.Style.STROKE
strokeWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2f, onScreenControllerView.context.resources.displayMetrics)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import android.view.View
import android.view.View.OnTouchListener
import androidx.annotation.IntRange
import androidx.core.content.res.use
import org.stratoemu.strato.R
import com.google.android.material.R as MaterialR
import org.stratoemu.strato.input.ButtonId
import org.stratoemu.strato.input.ButtonState
import org.stratoemu.strato.input.ControllerType
Expand Down Expand Up @@ -84,7 +84,7 @@ class OnScreenControllerView @JvmOverloads constructor(context : Context, attrs
}

private val selectionPaint = Paint().apply {
color = context.obtainStyledAttributes(intArrayOf(R.attr.colorPrimary)).use { it.getColor(0, Color.RED) }
color = context.obtainStyledAttributes(intArrayOf(MaterialR.attr.colorPrimary)).use { it.getColor(0, Color.RED) }
style = Paint.Style.STROKE
strokeWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2f, context.resources.displayMetrics)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import org.stratoemu.strato.utils.SwitchColors
import org.stratoemu.strato.utils.add
import org.stratoemu.strato.utils.multiply
import kotlin.math.roundToInt
import com.google.android.material.R as MaterialR

open class CircularButton(
onScreenControllerView : OnScreenControllerView,
Expand Down Expand Up @@ -94,7 +95,7 @@ open class JoystickButton(
override fun renderCenteredText(canvas : Canvas, text : String, size : Float, x : Float, y : Float, alpha : Int) = Unit

private val activationRadiusPaint = Paint().apply {
color = onScreenControllerView.context.obtainStyledAttributes(intArrayOf(R.attr.colorPrimary)).use { it.getColor(0, Color.RED) }
color = onScreenControllerView.context.obtainStyledAttributes(intArrayOf(MaterialR.attr.colorPrimary)).use { it.getColor(0, Color.RED) }
alpha = 64
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.stratoemu.strato.R
/**
* This preference is used to show licenses and the source of a library
*/
class LicensePreference @JvmOverloads constructor(context : Context, attrs : AttributeSet? = null, defStyleAttr : Int = R.attr.dialogPreferenceStyle) : Preference(context, attrs, defStyleAttr) {
class LicensePreference @JvmOverloads constructor(context : Context, attrs : AttributeSet? = null, defStyleAttr : Int = androidx.preference.R.attr.dialogPreferenceStyle) : Preference(context, attrs, defStyleAttr) {
/**
* The [FragmentManager] is used to show the [LicenseDialog] fragment
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class GameSettingsFragment : PreferenceFragmentCompat() {

override fun onViewCreated(view : View, savedInstanceState : Bundle?) {
super.onViewCreated(view, savedInstanceState)
val recyclerView = view.findViewById<View>(R.id.recycler_view)
val recyclerView = view.findViewById<View>(androidx.preference.R.id.recycler_view)
WindowInsetsHelper.setPadding(recyclerView, bottom = true)

(activity as AppCompatActivity).supportActionBar?.subtitle = item.title
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import kotlinx.coroutines.withContext
class GlobalSettingsFragment : PreferenceFragmentCompat() {
override fun onViewCreated(view : View, savedInstanceState : Bundle?) {
super.onViewCreated(view, savedInstanceState)
val recyclerView = view.findViewById<View>(R.id.recycler_view)
val recyclerView = view.findViewById<View>(androidx.preference.R.id.recycler_view)
WindowInsetsHelper.setPadding(recyclerView, bottom = true)
}

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'com.android.tools.build:gradle:8.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Apr 27 08:18:47 GMT 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

0 comments on commit 63d17dd

Please sign in to comment.