Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Android 12 Update #134

Merged
merged 27 commits into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
761ada4
Update Project Dependencies
englehorn Dec 6, 2021
c0f7a06
Update App Dependencies
englehorn Dec 6, 2021
5685d1c
Update SDK
englehorn Dec 6, 2021
c24c5d4
Android 12 export declaration
englehorn Dec 6, 2021
64ab19a
Update Google Map Dependency
englehorn Dec 6, 2021
c9fc94d
Update Activity Dependency
englehorn Dec 6, 2021
50ade2c
Update Android 12 (SDK 31) Dependencies
englehorn Dec 6, 2021
d52b4f6
Fix crash on device rotation
englehorn Jan 13, 2022
8f8442d
Fix notification display issue
englehorn Jan 13, 2022
7de9e56
Update bottom sheet view layout
englehorn Jan 13, 2022
9810470
Access Coarse Location
englehorn Jan 15, 2022
5160944
Merge branch 'wsdot-android-12-update-ae1' into dev
englehorn Jan 18, 2022
9763838
Enable ferry alert view hyperlinks
englehorn Jan 18, 2022
4f9ba66
Decrease ferry data cache time
englehorn Jan 18, 2022
3254b6d
Merge branch 'wsdot-ferry-data-update-ae1' into dev
englehorn Jan 18, 2022
5004a0a
Remove Banner Ads
englehorn Jan 18, 2022
b161350
Merge branch 'wsdot-android-banner-ads-ae1' into dev
englehorn Jan 18, 2022
d02185d
Remove HOV Button
englehorn Jan 18, 2022
7bcd05d
Merge branch 'wsdot-HOV-button-ae1' into dev
englehorn Jan 18, 2022
bfa3449
Update Dependencies
englehorn Jan 18, 2022
b3a2bb8
Update Location Dependency
englehorn Jan 18, 2022
05dee02
Disable approximate location map icon
englehorn Jan 21, 2022
87ef251
Update map location icon logic
englehorn Jan 21, 2022
de21a71
Add comments to dependencies
englehorn Jan 21, 2022
7021398
Clean up options menu code
englehorn Jan 31, 2022
f759154
Add boolean check to location permissions
englehorn Jan 31, 2022
2f0d5df
Add approximate location radius circle
englehorn Jan 31, 2022
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
62 changes: 34 additions & 28 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'com.google.firebase.crashlytics'

android {
compileSdkVersion 30
compileSdkVersion 31
defaultConfig {
applicationId "gov.wa.wsdot.android.wsdot"
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 31
versionCode 21060703
versionName "6.7.3"
vectorDrawables.useSupportLibrary = true
Expand Down Expand Up @@ -87,37 +87,41 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.activity:activity-ktx:1.1.0'
implementation 'androidx.fragment:fragment-ktx:1.2.5'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.activity:activity-ktx:1.4.0'
implementation 'androidx.fragment:fragment-ktx:1.4.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'

// Updating to 2.4.0 causes error. Duplicate classes found in modules.
implementation 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0'

implementation 'com.google.android.gms:play-services-ads:20.2.0'
implementation 'com.google.android.gms:play-services-location:17.1.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-ads:20.5.0'
implementation 'com.google.android.gms:play-services-location:19.0.1'
implementation 'com.google.android.gms:play-services-maps:18.0.2'

implementation 'com.google.firebase:firebase-core:18.0.2'
implementation 'com.google.firebase:firebase-analytics:18.0.2'
implementation 'com.google.firebase:firebase-messaging:21.0.1'
implementation 'com.google.firebase:firebase-crashlytics-ktx:17.3.1'
implementation 'com.google.firebase:firebase-core:20.0.2'
implementation 'com.google.firebase:firebase-analytics:20.0.2'
implementation 'com.google.firebase:firebase-messaging:23.0.0'
implementation 'com.google.firebase:firebase-crashlytics-ktx:18.2.6'

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'androidx.core:core-ktx:1.7.0'

implementation 'androidx.preference:preference-ktx:1.1.1'

implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0"

implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'

kapt "androidx.lifecycle:lifecycle-common-java8:2.2.0"
kapt "androidx.lifecycle:lifecycle-common-java8:2.4.0"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

implementation "androidx.room:room-runtime:2.2.6"
kapt "androidx.room:room-compiler:2.2.6"
annotationProcessor 'androidx.room:room-compiler:2.2.6'
implementation "androidx.room:room-runtime:2.4.0"

// Updating to 2.4.1 causes app:kaptDebugKotlin error.
kapt "androidx.room:room-compiler:2.3.0"
annotationProcessor 'androidx.room:room-compiler:2.4.0'

// drag and drop list
implementation 'com.ernestoyaquello.dragdropswiperecyclerview:drag-drop-swipe-recyclerview:0.5.1'
Expand All @@ -132,7 +136,7 @@ dependencies {
kapt "com.android.databinding:compiler:3.1.4"

// Navigation - https://developer.android.com/jetpack/androidx/releases/navigation
def nav_version = "2.3.3"
def nav_version = "2.3.5"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

Expand All @@ -153,6 +157,8 @@ dependencies {

kapt "com.google.dagger:dagger-compiler:$daggerVersion"
kapt "com.google.dagger:dagger-android-processor:$daggerVersion"

// Updating to 2.28.3 causes app:kaptDebugKotlin error.
implementation "com.google.dagger:dagger:$daggerVersion"
implementation "com.google.dagger:dagger-android-support:$daggerVersion"

Expand All @@ -167,12 +173,12 @@ dependencies {
// Required -- JUnit 4 framework
testImplementation 'junit:junit:4.13.1'
// Optional -- Robolectric environment
testImplementation 'androidx.test:core:1.3.0'
androidTestImplementation 'androidx.test:core:1.3.0'
testImplementation "androidx.room:room-testing:2.2.6"
testImplementation 'androidx.test:core:1.4.0'
androidTestImplementation 'androidx.test:core:1.4.0'
testImplementation "androidx.room:room-testing:2.4.0"
androidTestImplementation "androidx.arch.core:core-testing:2.1.0"
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

}
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

Expand Down Expand Up @@ -51,6 +52,7 @@

<activity
android:name="gov.wa.wsdot.android.wsdot.ui.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTask">
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class FerriesRepository @Inject constructor(

if (data != null && data.isNotEmpty()) {

if (TimeUtils.isOverXMinOld(data[0].localCacheDate, x = 15)) {
if (TimeUtils.isOverXMinOld(data[0].localCacheDate, x = 5)) {
update = true
}
} else {
Expand Down Expand Up @@ -94,7 +94,7 @@ class FerriesRepository @Inject constructor(

if (data != null) {

if (TimeUtils.isOverXMinOld(data.localCacheDate, x = 15)) {
if (TimeUtils.isOverXMinOld(data.localCacheDate, x = 5)) {
update = true
}
} else {
Expand Down Expand Up @@ -267,7 +267,7 @@ class FerriesRepository @Inject constructor(

if (data != null && data.isNotEmpty()) {

if (TimeUtils.isOverXMinOld(data[0].localCacheDate, x = 15)) {
if (TimeUtils.isOverXMinOld(data[0].localCacheDate, x = 5)) {
update = true
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.os.Build
import android.util.Log
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
import androidx.preference.PreferenceManager
import com.google.firebase.messaging.FirebaseMessagingService
Expand Down Expand Up @@ -71,6 +73,7 @@ class MyFirebaseMessagingService : FirebaseMessagingService() {
}
}

@RequiresApi(Build.VERSION_CODES.M)
private fun getNotificationIntent(data: MutableMap<String, String>): PendingIntent {

val type = data["type"]
Expand Down Expand Up @@ -120,7 +123,7 @@ class MyFirebaseMessagingService : FirebaseMessagingService() {
}
}
return PendingIntent.getActivity(this, alertId?.toInt() ?: 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT)
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
}

/**
Expand Down
26 changes: 13 additions & 13 deletions app/src/main/java/gov/wa/wsdot/android/wsdot/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class MainActivity : DaggerAppCompatActivity(), NavigationView.OnNavigationItemS

private lateinit var firebaseAnalytics: FirebaseAnalytics

private lateinit var adView: AdManagerAdView
private var adView: AdManagerAdView? = null

private val adSize: AdSize
get() {
Expand Down Expand Up @@ -201,12 +201,12 @@ class MainActivity : DaggerAppCompatActivity(), NavigationView.OnNavigationItemS

adView = AdManagerAdView(this)
ad_banner_box.addView(adView)
adView.setAdSizes(adSize)
adView.adUnitId = ApiKeys.UNIT_ID
adView?.setAdSizes(adSize)
adView?.adUnitId = ApiKeys.UNIT_ID

}

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
addMenuBadgeIfNeeded()
return super.onCreateOptionsMenu(menu)
}
Expand Down Expand Up @@ -592,9 +592,9 @@ class MainActivity : DaggerAppCompatActivity(), NavigationView.OnNavigationItemS
* Initialize and display ads.
* WARNING: don't call in onCreate
*/
fun enableAds(targets: Map<String, String>) {
fun enableAds(targets: Map<String, String>) {

ad_banner_box.visibility = VISIBLE
ad_banner_box?.visibility = VISIBLE

//val testDeviceIds = Arrays.asList("2531EB5FD75758B5E8BDD4669A870BF7")
//val configuration = RequestConfiguration.Builder()
Expand All @@ -604,15 +604,15 @@ class MainActivity : DaggerAppCompatActivity(), NavigationView.OnNavigationItemS
//.build()
//MobileAds.setRequestConfiguration(configuration)

adView.pause()
adView.adListener = null
adView.adListener = object : AdListener() {
adView?.pause()
adView?.adListener = null
adView?.adListener = object : AdListener() {

override fun onAdLoaded() {
super.onAdLoaded()

// report ad ID to crashlytics
val info = adView.responseInfo
val info = adView?.responseInfo
var adResponseId = "null"
if (info != null){
Log.e("Ads", info.toString())
Expand All @@ -632,7 +632,7 @@ class MainActivity : DaggerAppCompatActivity(), NavigationView.OnNavigationItemS
}

// Start loading the ad in the background.
adView.loadAd(adRequest.build())
adView?.loadAd(adRequest.build())

}

Expand All @@ -641,8 +641,8 @@ class MainActivity : DaggerAppCompatActivity(), NavigationView.OnNavigationItemS
* WARNING: don't call in onCreate
*/
fun disableAds() {
ad_banner_box.visibility = GONE
adView.pause()
ad_banner_box?.visibility = GONE
adView?.pause()
}

fun setScreenName(screenName: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ class AboutFragment: DaggerFragment(), Injectable {
startActivity(browserIntent)
}

binding.heroButton.setOnClickListener {
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse("https://www.wsdot.wa.gov/travel/highways-bridges/hov/report-violator"))
startActivity(browserIntent)
}

binding.appBugReportButton.setOnClickListener {
val emailIntent = Intent(Intent.ACTION_SEND)
emailIntent.putExtra(Intent.EXTRA_EMAIL, arrayOf("[email protected]"))
Expand Down
Loading