Skip to content

Commit

Permalink
Update libraries and minSdk, gradle version update. Remove next fetch…
Browse files Browse the repository at this point in the history
… text from widget header. Fix R8 rule and remove jvm arg that is no longer supported.
  • Loading branch information
premnirmal committed Jan 18, 2024
1 parent 290c47f commit 9ac4afe
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 110 deletions.
108 changes: 50 additions & 58 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ buildscript {
maven { url "https://jitpack.io" }
}
dependencies {
classpath "com.google.gms:google-services:4.3.15"
classpath "com.google.firebase:firebase-crashlytics-gradle:2.9.6"
classpath "com.google.gms:google-services:4.4.0"
classpath "com.google.firebase:firebase-crashlytics-gradle:2.9.9"

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Expand Down Expand Up @@ -54,9 +54,13 @@ def getOldGitVersion = { ->
}

android {
buildFeatures {
buildConfig = true
}

namespace 'com.github.premnirmal.tickerwidget'
compileSdkVersion 33
buildToolsVersion "31.0.0"
compileSdk 34
buildToolsVersion = "31.0.0"

def final name = getVersionName()
def final major = name.split("\\.")[0].toInteger()
Expand All @@ -70,7 +74,7 @@ android {
defaultConfig {
applicationId appIdBase
minSdkVersion 26
targetSdkVersion 33
targetSdkVersion 34

versionCode = code
versionName = name
Expand Down Expand Up @@ -197,105 +201,93 @@ android {
}
}

ext {
LIFECYCLE_VERSION = "2.5.0"
MOCKITO_VERSION = "3.4.6"
JUNIT_VERSION = "4.13.1"
RETROFIT_VERSION = "2.9.0"
OKHTTP_VERSION = "4.9.0"
ROBOLECTRIC_VERSION = "4.4"
COROUTINES_VERSION = "1.6.0"
ROOM_VERSION = "2.5.2"
WORK_VERSION = "2.8.1"
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

implementation "androidx.core:core-ktx:1.10.1"
implementation "androidx.core:core-ktx:1.12.0"

implementation "androidx.appcompat:appcompat:1.6.1"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "com.google.android.material:material:1.9.0"
implementation "androidx.preference:preference-ktx:1.2.0"
implementation "androidx.browser:browser:1.5.0"
implementation "com.google.android.material:material:1.11.0"
implementation "androidx.preference:preference-ktx:1.2.1"
implementation "androidx.browser:browser:1.7.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation 'androidx.core:core-splashscreen:1.0.1'
implementation "androidx.fragment:fragment-ktx:1.6.0"
implementation "androidx.fragment:fragment-ktx:1.6.2"

implementation "io.coil-kt:coil:2.2.2"

implementation "javax.inject:javax.inject:1"
implementation "javax.annotation:javax.annotation-api:1.3.2"

implementation "com.google.dagger:hilt-android:2.44"
kapt "com.google.dagger:hilt-compiler:2.44"
implementation "com.google.dagger:hilt-android:2.48.1"
kapt "com.google.dagger:hilt-compiler:2.48.1"

implementation "com.squareup.okhttp3:okhttp:$OKHTTP_VERSION"
implementation "com.squareup.okhttp3:logging-interceptor:$OKHTTP_VERSION"
implementation "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION"
implementation "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION"
implementation "com.squareup.retrofit2:converter-simplexml:$RETROFIT_VERSION"
implementation "com.squareup.retrofit2:converter-scalars:$RETROFIT_VERSION"
implementation "com.squareup.okhttp3:okhttp:4.10.0"
implementation "com.squareup.okhttp3:logging-interceptor:4.10.0"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.squareup.retrofit2:converter-simplexml:2.9.0"
implementation "com.squareup.retrofit2:converter-scalars:2.9.0"
implementation "org.jsoup:jsoup:1.14.2"

implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$COROUTINES_VERSION"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$LIFECYCLE_VERSION"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$LIFECYCLE_VERSION"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$LIFECYCLE_VERSION"
implementation "androidx.lifecycle:lifecycle-common-java8:$LIFECYCLE_VERSION"
implementation "androidx.work:work-runtime:$WORK_VERSION"
implementation "androidx.work:work-runtime-ktx:$WORK_VERSION"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.7.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.7.0"
implementation "androidx.lifecycle:lifecycle-common-java8:2.7.0"
implementation "androidx.work:work-runtime:2.9.0"
implementation "androidx.work:work-runtime-ktx:2.9.0"

implementation "com.jakewharton.threetenabp:threetenabp:1.4.6"

implementation "com.jakewharton.timber:timber:4.7.1"
implementation "com.github.PhilJay:MPAndroidChart:v3.0.3"

implementation "androidx.room:room-runtime:$ROOM_VERSION"
kapt "androidx.room:room-compiler:$ROOM_VERSION"
implementation "androidx.room:room-ktx:$ROOM_VERSION"
implementation "androidx.room:room-runtime:2.6.1"
kapt "androidx.room:room-compiler:2.6.1"
implementation "androidx.room:room-ktx:2.6.1"

prodImplementation 'com.google.android.play:review:2.0.1'
prodImplementation 'com.google.android.play:review-ktx:2.0.1'

implementation "com.robinhood.ticker:ticker:2.0.2"

prodImplementation "com.google.firebase:firebase-crashlytics:18.3.7"
prodImplementation "com.google.firebase:firebase-analytics:21.3.0"
prodImplementation "com.google.firebase:firebase-crashlytics:18.6.0"
prodImplementation "com.google.firebase:firebase-analytics:21.5.0"

// debugImplementation "com.squareup.leakcanary:leakcanary-android:2.4"

testImplementation 'com.google.dagger:hilt-android-testing:2.44'
kaptTest 'com.google.dagger:hilt-compiler:2.44'
testImplementation 'com.google.dagger:hilt-android-testing:2.48.1'
kaptTest 'com.google.dagger:hilt-compiler:2.48.1'

testImplementation "junit:junit:$JUNIT_VERSION"
testImplementation "junit:junit:4.13.2"
testImplementation "org.assertj:assertj-core:3.8.0"
testImplementation "org.robolectric:robolectric:$ROBOLECTRIC_VERSION"
testImplementation "org.robolectric:shadows-multidex:$ROBOLECTRIC_VERSION"
testImplementation "androidx.test:runner:1.4.0"
testImplementation "androidx.test:rules:1.4.0"
testImplementation "androidx.annotation:annotation:1.6.0"
testImplementation "androidx.test:rules:1.4.0"
testImplementation "androidx.test:runner:1.4.0"
testImplementation "org.threeten:threetenbp:1.5.0"
testImplementation "org.mockito:mockito-core:$MOCKITO_VERSION"
testImplementation "org.robolectric:robolectric:4.10.3"
testImplementation "org.robolectric:shadows-multidex:4.10.3"
testImplementation "androidx.test:runner:1.5.2"
testImplementation "androidx.test:rules:1.5.0"
testImplementation "androidx.annotation:annotation:1.7.1"
testImplementation "androidx.test:rules:1.5.0"
testImplementation "androidx.test:runner:1.5.2"
testImplementation "org.threeten:threetenbp:1.6.8"
testImplementation "org.mockito:mockito-core:5.3.1"
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$COROUTINES_VERSION"
testImplementation "androidx.room:room-testing:$ROOM_VERSION"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3"
testImplementation "androidx.room:room-testing:2.6.1"

// Need this to fix a class not found error in tests (https://github.com/robolectric/robolectric/issues/1932)
testImplementation "org.khronos:opengl-api:gl1.1-android-2.1_r1"
}

configurations.all {
configurations.configureEach {
resolutionStrategy.force "org.objenesis:objenesis:2.5.1"
resolutionStrategy.force "org.ow2.asm:asm:7.0"
exclude group: "xpp3", module: "xpp3"
}

android.applicationVariants.all { variant ->
android.applicationVariants.configureEach { variant ->
if (!variant.name.toLowerCase().contains("prod")) {
def googleTask = tasks.findByName("process${variant.name.capitalize()}GoogleServices")
def crashlyticsMappingTask = tasks.
Expand Down
11 changes: 10 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,13 @@
-keep class com.squareup.haha.** { *; }
-keep class com.squareup.leakcanary.** { *; }
-keep class leakcanary.** { *; }
-keep class shark.** { *; }
-keep class shark.** { *; }

# To fix an R8 warning
-dontwarn org.bouncycastle.jsse.BCSSLSocket
-dontwarn org.bouncycastle.jsse.BCSSLParameters
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
-dontwarn org.conscrypt.*
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,6 @@ class WidgetSettingsFragment : BaseFragment<FragmentWidgetSettingsBinding>(), Ch
else -> FetchState.NotFetched.displayString
}
binding.widgetLayout.root.findViewById<TextView>(R.id.last_updated).text = lastUpdatedText
val nextUpdateMs = stocksProvider.nextFetchMs.value
val instant = Instant.ofEpochMilli(nextUpdateMs)
val time = ZonedDateTime.ofInstant(instant, ZoneId.systemDefault())
val nextUpdate = time.createTimeString()
val nextUpdateText: String = getString(R.string.next_fetch, nextUpdate)
binding.widgetLayout.root.findViewById<TextView>(R.id.next_update).text = nextUpdateText
binding.widgetLayout.root.findViewById<View>(R.id.widget_header).isVisible = !widgetData.hideHeader()
adapter.refresh(widgetData)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,6 @@ class StockWidget : AppWidgetProvider() {
else -> FetchState.NotFetched.displayString
}
remoteViews.setTextViewText(R.id.last_updated, lastUpdatedText)
val nextUpdateMs = stocksProvider.nextFetchMs.value
val instant = Instant.ofEpochMilli(nextUpdateMs)
val time = ZonedDateTime.ofInstant(instant, ZoneId.systemDefault())
val nextUpdate = time.createTimeString()
val nextUpdateText: String = context.getString(R.string.next_fetch, nextUpdate)
remoteViews.setTextViewText(R.id.next_update, nextUpdateText)
remoteViews.setInt(R.id.widget_layout, "setBackgroundResource", widgetData.backgroundResource())
// Refresh icon and progress
val refreshing = appPreferences.isRefreshing.value
Expand Down
43 changes: 11 additions & 32 deletions app/src/main/res/layout/widget_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,19 @@
android:baselineAligned="false"
>

<LinearLayout
<TextView
android:id="@+id/last_updated"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
>

<TextView
android:id="@+id/next_update"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:gravity="start"
android:lines="1"
android:maxLines="1"
android:textColor="@color/text_widget_header"
android:textSize="@dimen/small_text"
tools:text="Next fetch: 10:00"
/>

<TextView
android:id="@+id/last_updated"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:gravity="start"
android:lines="1"
android:maxLines="1"
android:textColor="@color/text_widget_header"
android:textSize="@dimen/small_text"
tools:text="Last fetch: 10:00"
/>

</LinearLayout>
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:gravity="start|center_vertical"
android:lines="1"
android:maxLines="1"
android:textColor="@color/text_widget_header"
android:textSize="@dimen/small_text"
tools:text="Last fetch: 10:00"
/>

<FrameLayout
android:layout_width="wrap_content"
Expand Down
4 changes: 2 additions & 2 deletions app/version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# this file is purely for f-droid because it cannot infer the version name/code from the git tag
versionName=3.9.830
versionCode=300900830
versionName=3.9.832
versionCode=300900832
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.8.21'
ext.kotlin_version = '1.9.10'
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:8.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.44"
classpath "com.google.dagger:hilt-android-gradle-plugin:2.48.1"
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ android.enableJetifier=true
android.nonTransitiveRClass=true
android.useAndroidX=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx1536M -Dkotlin.daemon.jvm.options\="-Xmx1024M" -XX\:MaxPermSize\=512m -XX\:+HeapDumpOnOutOfMemoryError -Dfile.encoding\=UTF-8
org.gradle.jvmargs=-Xmx1536M -Dkotlin.daemon.jvm.options\="-Xmx1024M" -XX\:+HeapDumpOnOutOfMemoryError -Dfile.encoding\=UTF-8
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 @@
#Thu May 13 13:17:55 BST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-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 9ac4afe

Please sign in to comment.