Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

updated to latest sdk and changed deprecated code for newer android i… #116

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ plugins {


android {
compileSdk 33
compileSdk 34

defaultConfig {
applicationId "com.draco.ladb"
minSdk 26
targetSdk 33
targetSdk 34
versionCode 43
versionName "2.3.1"

Expand Down Expand Up @@ -49,6 +49,7 @@ android {

buildFeatures {
viewBinding true
android.buildFeatures.buildConfig true
}
namespace 'com.draco.ladb'
}
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 @@ -17,7 +17,6 @@

<application
android:banner="@drawable/banner"
android:extractNativeLibs="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
Expand Down
29 changes: 26 additions & 3 deletions app/src/main/java/com/draco/ladb/services/QSTile.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
package com.draco.ladb.services

import android.annotation.SuppressLint
import android.app.PendingIntent
import android.content.Intent
import android.os.Build
import android.service.quicksettings.TileService
import com.draco.ladb.views.MainActivity

class QSTile : TileService() {
@SuppressLint("StartActivityAndCollapseDeprecated")
override fun onClick() {
super.onClick()
val intent = Intent(applicationContext, MainActivity::class.java)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivityAndCollapse(intent)
val intent = Intent(
applicationContext,
MainActivity::class.java
).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)

// code added to not cause avoid deprecated method for newer android
// and to avoid UnsupportedOperationException

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
// ---------------------------------REVIEW NEEDED-----------------------------
// pretty sure it should be getService call otherwise it should be getActivity
PendingIntent.getService(
applicationContext,
0,
intent,
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_ONE_SHOT
)
}else{
// if sdk_int is less than UPSIDE_DOWN_CAKE
startActivityAndCollapse(intent)
}

}
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.1'
classpath 'com.android.tools.build:gradle:8.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.6'

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ android.useAndroidX=true
kotlin.code.style=official
DEBUG_ANTIPIRACY=false
RELEASE_ANTIPIRACY=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
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 @@
#Fri Jun 03 20:49:13 PDT 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME