#1386 remove lint inspection profile, update dependencies, minor fixes

This commit is contained in:
Sean Mac Gillicuddy 2019-09-04 13:58:47 +01:00
parent c2244476fb
commit 0323af70ad
11 changed files with 17 additions and 1231 deletions

File diff suppressed because it is too large Load Diff

View File

@ -132,9 +132,8 @@ dependencies {
implementation "io.objectbox:objectbox-rxjava:$objectboxVersion" implementation "io.objectbox:objectbox-rxjava:$objectboxVersion"
implementation 'com.google.android.gms:play-services-location:17.0.0' implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation "androidx.tonyodev.fetch2:xfetch2:3.1.4" implementation "androidx.tonyodev.fetch2:xfetch2:$fetchVersion"
implementation "androidx.tonyodev.fetch2okhttp:xfetch2okhttp:3.1.4" implementation "androidx.tonyodev.fetch2okhttp:xfetch2okhttp:$fetchVersion"
implementation "androidx.tonyodev.fetch2rx:xfetch2rx:3.1.4"
testImplementation "org.junit.jupiter:junit-jupiter:5.4.2" testImplementation "org.junit.jupiter:junit-jupiter:5.4.2"
testImplementation "io.mockk:mockk:1.9" testImplementation "io.mockk:mockk:1.9"
@ -145,7 +144,7 @@ dependencies {
androidTestImplementation "io.mockk:mockk-android:1.9" androidTestImplementation "io.mockk:mockk-android:1.9"
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
androidTestImplementation "org.assertj:assertj-core:3.11.1" androidTestImplementation "org.assertj:assertj-core:3.11.1"
androidTestImplementation ("org.simpleframework:simple-xml:2.7.1"){ androidTestImplementation("org.simpleframework:simple-xml:2.7.1") {
exclude module: 'stax' exclude module: 'stax'
exclude module: 'stax-api' exclude module: 'stax-api'
exclude module: 'xpp3' exclude module: 'xpp3'
@ -253,9 +252,9 @@ android {
'LogConditional' 'LogConditional'
warning 'UnknownNullness', warning 'UnknownNullness',
'SelectableText', 'SelectableText',
'IconDensities', 'IconDensities',
'SyntheticAccessor' 'SyntheticAccessor'
baseline file("lint-baseline.xml") baseline file("lint-baseline.xml")
} }
@ -281,7 +280,6 @@ android {
} }
} }
flavorDimensions "default" flavorDimensions "default"
signingConfigs { signingConfigs {

View File

@ -51,6 +51,7 @@ internal object ExternalPaths {
"/mnt/extsd", "/mnt/extsd",
"/extsd", "/extsd",
"/mnt/sdcard", "/mnt/sdcard",
"/misc/android" "/misc/android",
"/mnt"
) )
} }

View File

@ -26,7 +26,7 @@ import com.tonyodev.fetch2okhttp.OkHttpDownloader
import dagger.Module import dagger.Module
import dagger.Provides import dagger.Provides
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import org.kiwix.kiwixmobile.BuildConfig.DEBUG import org.kiwix.kiwixmobile.BuildConfig
import org.kiwix.kiwixmobile.data.remote.KiwixService import org.kiwix.kiwixmobile.data.remote.KiwixService
import org.kiwix.kiwixmobile.database.newdb.dao.FetchDownloadDao import org.kiwix.kiwixmobile.database.newdb.dao.FetchDownloadDao
import org.kiwix.kiwixmobile.downloader.DownloadRequester import org.kiwix.kiwixmobile.downloader.DownloadRequester
@ -72,7 +72,7 @@ object DownloaderModule {
): FetchConfiguration = ): FetchConfiguration =
FetchConfiguration.Builder(context).apply { FetchConfiguration.Builder(context).apply {
setDownloadConcurrentLimit(5) setDownloadConcurrentLimit(5)
enableLogging(DEBUG) enableLogging(BuildConfig.DEBUG)
enableRetryOnNetworkGain(true) enableRetryOnNetworkGain(true)
setHttpDownloader(okHttpDownloader) setHttpDownloader(okHttpDownloader)
setNotificationManager(fetchNotificationManager) setNotificationManager(fetchNotificationManager)

View File

@ -106,9 +106,7 @@ class FetchDownloadMonitor @Inject constructor(fetch: Fetch, fetchDownloadDao: F
init { init {
fetch.addListener(fetchListener, true) fetch.addListener(fetchListener, true)
updater.subscribeOn(Schedulers.io()).observeOn(Schedulers.io()).subscribe( updater.subscribeOn(Schedulers.io()).observeOn(Schedulers.io()).subscribe(
{ { it.invoke() },
it.invoke()
},
Throwable::printStackTrace Throwable::printStackTrace
) )
} }

View File

@ -48,10 +48,6 @@ class FetchDownloadNotificationManager(context: Context) :
} }
} }
override fun notify(groupId: Int) {
super.notify(groupId)
}
override fun updateNotification( override fun updateNotification(
notificationBuilder: NotificationCompat.Builder, notificationBuilder: NotificationCompat.Builder,
downloadNotification: DownloadNotification, downloadNotification: DownloadNotification,

View File

@ -84,12 +84,10 @@ public class SharedPreferenceUtil {
} }
public String getPrefStorage() { public String getPrefStorage() {
String storage = sharedPreferences.getString(PREF_STORAGE, String storage = sharedPreferences.getString(PREF_STORAGE, null);
null);
if (storage == null) { if (storage == null) {
storage = storage =
ContextCompat.getExternalFilesDirs(KiwixApplication.getInstance(), null)[0] ContextCompat.getExternalFilesDirs(KiwixApplication.getInstance(), null)[0].getPath();
.getPath();
putPrefStorage(storage); putPrefStorage(storage);
} }
return storage; return storage;

View File

@ -22,7 +22,6 @@ package org.kiwix.kiwixmobile.utils.files
import android.content.Context import android.content.Context
import android.provider.MediaStore.Files import android.provider.MediaStore.Files
import android.provider.MediaStore.MediaColumns import android.provider.MediaStore.MediaColumns
import android.util.Log
import eu.mhutti1.utils.storage.StorageDevice import eu.mhutti1.utils.storage.StorageDevice
import eu.mhutti1.utils.storage.StorageDeviceUtils import eu.mhutti1.utils.storage.StorageDeviceUtils
import io.reactivex.Flowable import io.reactivex.Flowable
@ -65,17 +64,13 @@ class FileSearch @Inject constructor(private val context: Context) {
private fun scanFileSystem() = private fun scanFileSystem() =
directoryRoots() directoryRoots()
.also { Log.d("FileSearch", "searching at distinct: $it") }
.fold(mutableListOf<File>(), { acc, root -> .fold(mutableListOf<File>(), { acc, root ->
acc.apply { addAll(scanDirectory(root)) } acc.apply { addAll(scanDirectory(root)) }
}) })
.distinctBy { it.canonicalPath } .distinctBy { it.canonicalPath }
.also { Log.d("FileSearch", "found distinct files: $it") }
private fun directoryRoots() = listOf( private fun directoryRoots() =
"/mnt", StorageDeviceUtils.getReadableStorage(context).map(StorageDevice::name)
*StorageDeviceUtils.getReadableStorage(context).map(StorageDevice::name).toTypedArray()
)
private fun scanDirectory(directory: String): List<File> = File(directory).listFiles() private fun scanDirectory(directory: String): List<File> = File(directory).listFiles()
?.fold( ?.fold(

View File

@ -68,7 +68,6 @@
android:id="@+id/eta" android:id="@+id/eta"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
tools:text="1min 10secs" /> tools:text="1min 10secs" />
</LinearLayout> </LinearLayout>

View File

@ -107,7 +107,7 @@ class FileSearchTest {
".zim", ".zim",
File("$tempRoot${File.separator}dir").apply { mkdirs() }) File("$tempRoot${File.separator}dir").apply { mkdirs() })
every { contentResolver.query(any(), any(), any(), any(), any()) } returns null every { contentResolver.query(any(), any(), any(), any(), any()) } returns null
every { storageDevice.name } returns tempRoot every { storageDevice.name } returns zimFile.parentFile.parent
val fileList = fileSearch.scan() val fileList = fileSearch.scan()
.test() .test()
.values()[0] .values()[0]

View File

@ -37,6 +37,7 @@ ext {
set("baristaVersion", "2.7.1") set("baristaVersion", "2.7.1")
set("kotlinVersion", "1.3.50") set("kotlinVersion", "1.3.50")
set("objectboxVersion", "2.3.4") set("objectboxVersion", "2.3.4")
set("fetchVersion", "3.1.4")
} }
allprojects { allprojects {