Skip to content

Commit bfebe68

Browse files
committed
Clean up dependencies
1 parent 7f0a218 commit bfebe68

5 files changed

Lines changed: 55 additions & 39 deletions

File tree

app/build.gradle

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,17 @@ def workVersion = "1.0.0-alpha10"
170170

171171
dependencies {
172172
// Multi-dex
173-
implementation "androidx.multidex:multidex:2.0.0"
173+
implementation "androidx.multidex:multidex:2.0.1"
174174

175-
// KOTLIN STANDARD LIBRARY
175+
// Kotlin Standard library
176176
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
177177

178-
// FIREBASE LIBRARIES
178+
// Firebase-related dependencies
179179
implementation "com.google.firebase:firebase-core:16.0.6"
180180
implementation "com.google.firebase:firebase-ads:17.1.2"
181181
implementation "com.crashlytics.sdk.android:crashlytics:2.9.7"
182182

183-
// ANDROID SUPPORT LIBRARIES
183+
// AndroidX support libraries
184184
implementation "androidx.appcompat:appcompat:$androidxVersion"
185185
implementation "com.google.android.material:material:$androidxVersion"
186186
implementation "androidx.cardview:cardview:$androidxVersion"
@@ -194,56 +194,49 @@ dependencies {
194194
implementation 'com.google.android.ads.consent:consent-library:1.0.6'
195195
implementation "com.android.volley:volley:1.1.1"
196196

197+
// Android WorkManager
197198
implementation("android.arch.work:work-runtime-ktx:$workVersion", {
198199
exclude group: "com.google.guava", module: "listenablefuture"
199200
})
200-
implementation("android.arch.work:work-firebase:$workVersion", {
201-
exclude group: "com.google.guava", module: "listenablefuture"
202-
})
203201

204-
// APACHE COMMONS LIBRARIES
205-
//noinspection GradleDependency
206-
implementation "commons-io:commons-io:2.5" // Fix to 2.5 for compatibility
207-
implementation "commons-cli:commons-cli:1.4"
208202

209-
// DEX2JAR AND FRIENDS
203+
// Dex2Jar & friends
210204
implementation "asm:asm-all:3.3.1"
211205
implementation files("libs/smali-2.2.1.jar")
212206
implementation files("libs/dex-ir-1.12.jar")
213207
implementation files("libs/dex-reader-1.15.jar")
214208
implementation files("libs/dex-tools-0.0.9.15.jar")
215209
implementation files("libs/dex-translator-0.0.9.15.jar")
216210

217-
// CLASS FILE READER - JAVA DECOMPILER
211+
// CFR Decompiler
218212
implementation "org.benf:cfr:0.138"
219213

220214
// DX Tool. We are using jar-jar to repackage the dx lib.
221215
// As android comes with the same classes in the lib-art.jar package that is usually a tad bit
222216
// older than what we need and hence missing stuff.
223217
jarJar files("libs/dx-1.14.jar")
224218

225-
// DEPENDENCIES FOR JaDX
219+
// JaDX & friends
220+
implementation files("libs/jadx-core-0.8.0.jar")
226221
implementation files("libs/dx-1.14.jar")
227222
implementation files("libs/android-5.1.jar")
228-
implementation files("libs/jadx-core-0.8.0.jar")
229223
implementation "org.slf4j:slf4j-api:1.7.25"
230224
implementation "org.slf4j:slf4j-simple:1.7.25"
225+
implementation "uk.com.robust-it:cloning:1.9.10"
231226
// implementation "ch.qos.logback:logback-classic:1.2.3"
232227
// implementation "ch.qos.logback:logback-core:1.2.3"
233228

234-
implementation "uk.com.robust-it:cloning:1.9.10"
235-
236-
// APK PARSER AND BINARY XML DECODER
229+
// APK parser
237230
implementation "net.dongliu:apk-parser:2.6.4"
238231

239-
// FERN FLOWER
232+
// Fernflower decompiler
240233
implementation 'com.github.fesh0r:fernflower:2c2b00b369'
241234

242-
// RxJAVA AND FRIENDS
235+
// RxAndroid & friends
243236
implementation "io.reactivex.rxjava2:rxandroid:2.1.0"
244237
implementation "io.reactivex.rxjava2:rxkotlin:2.3.0"
245238

246-
// LEAKCANARY AND FRIENDS
239+
// Testing tools
247240
androidTestImplementation "junit:junit:4.12"
248241
androidTestImplementation "androidx.test:core:$androidxVersion"
249242
androidTestImplementation "androidx.test:rules:1.1.1"
@@ -253,7 +246,9 @@ dependencies {
253246
exclude group: "com.google.code.findbugs", module: "jsr305"
254247
})
255248

256-
// EVERYBODY ELSE
249+
// Everybody else
250+
//noinspection GradleDependency
251+
implementation "commons-io:commons-io:2.5" // Fix to 2.5 for compatibility
257252
implementation "io.github.inflationx:calligraphy3:3.0.0"
258253
implementation "io.github.inflationx:viewpump:1.0.0"
259254
implementation "com.jakewharton.timber:timber:4.7.1"

app/src/main/kotlin/com/njlabs/showjava/MainApplication.kt

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@ import com.njlabs.showjava.utils.logging.ProductionTree
3232
import io.github.inflationx.calligraphy3.CalligraphyConfig
3333
import io.github.inflationx.calligraphy3.CalligraphyInterceptor
3434
import io.github.inflationx.viewpump.ViewPump
35+
import io.reactivex.Observable
36+
import io.reactivex.disposables.CompositeDisposable
37+
import io.reactivex.schedulers.Schedulers
3538
import timber.log.Timber
3639

3740

3841
class MainApplication : MultiDexApplication() {
3942

40-
/**
41-
* Setup fonts, plant the correct logging tree for Timber and init ads
42-
*/
43+
val disposables = CompositeDisposable()
44+
4345
override fun onCreate() {
4446
super.onCreate()
4547

@@ -52,7 +54,12 @@ class MainApplication : MultiDexApplication() {
5254
)
5355

5456
val preferences =
55-
UserPreferences(applicationContext.getSharedPreferences(UserPreferences.NAME, Context.MODE_PRIVATE))
57+
UserPreferences(
58+
applicationContext.getSharedPreferences(
59+
UserPreferences.NAME,
60+
Context.MODE_PRIVATE
61+
)
62+
)
5663

5764
AppCompatDelegate.setDefaultNightMode(
5865
if (preferences.darkMode)
@@ -83,24 +90,37 @@ class MainApplication : MultiDexApplication() {
8390
}
8491

8592
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
86-
cleanStaleNotifications()
93+
disposables.add(
94+
cleanStaleNotifications()
95+
.subscribeOn(Schedulers.io())
96+
.observeOn(Schedulers.io())
97+
.onErrorReturn {}
98+
.subscribe()
99+
)
87100
}
88101
}
89102

90103
/**
91104
* Clean any stale notifications not linked to any decompiler process
92105
*/
93106
@RequiresApi(Build.VERSION_CODES.M)
94-
fun cleanStaleNotifications() {
95-
val manager = applicationContext
96-
.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
97-
val workManager = WorkManager.getInstance()
98-
manager.activeNotifications.forEach { notification ->
99-
val status = workManager.getStatusesForUniqueWorkLiveData(notification.tag)
100-
.value?.any { it.state.isFinished }
101-
if (status == null || status == true) {
102-
manager.cancel(notification.tag, notification.id)
107+
fun cleanStaleNotifications(): Observable<Unit> {
108+
return Observable.fromCallable {
109+
val manager = applicationContext
110+
.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
111+
val workManager = WorkManager.getInstance()
112+
manager.activeNotifications.forEach { notification ->
113+
val status = workManager.getStatusesForUniqueWorkLiveData(notification.tag)
114+
.value?.any { it.state.isFinished }
115+
if (status == null || status == true) {
116+
manager.cancel(notification.tag, notification.id)
117+
}
103118
}
104119
}
105120
}
121+
122+
override fun onTerminate() {
123+
super.onTerminate()
124+
disposables.clear()
125+
}
106126
}

app/src/main/kotlin/com/njlabs/showjava/decompilers/BaseDecompiler.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ abstract class BaseDecompiler(val context: Context, val data: Data) {
150150
}
151151

152152
fun setStep(title: String) {
153-
sendStatus(title, "", true)
153+
sendStatus(title, context.getString(R.string.initializing), true)
154154
}
155155

156156
/**

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,5 @@
160160
<string name="deviceVerificationFailed">Device failed the verification for making in-app purchases on Show Java.</string>
161161
<string name="adPreferences">Ads Preferences</string>
162162
<string name="adPreferencesSummary">Change your personalization preferences for Ads</string>
163+
<string name="initializing">Initializing</string>
163164
</resources>

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ buildscript {
2828
maven { url "https://maven.fabric.io/public" }
2929
}
3030
dependencies {
31-
classpath "com.android.tools.build:gradle:3.3.0-rc02"
31+
classpath 'com.android.tools.build:gradle:3.3.0-rc03'
3232
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
3333
classpath "com.google.gms:google-services:4.2.0"
34-
classpath "io.fabric.tools:gradle:1.26.1"
34+
classpath "io.fabric.tools:gradle:1.27.0"
3535
classpath "com.bryansharp:hibeaver:1.2.7"
3636
classpath "io.michaelrocks:paranoid-gradle-plugin:0.2.4"
3737
classpath "com.google.android.gms:oss-licenses-plugin:0.9.4"

0 commit comments

Comments
 (0)