Commit 9baac208 authored by Geoffrey Métais's avatar Geoffrey Métais

Upgrade AppCompat to v28

parent 0e7fc6ad
......@@ -24,7 +24,7 @@ allprojects {
}
ext {
appCompatVersion = '27.1.1'
appCompatVersion = '28.0.0'
constraintLayoutVersion = '1.1.3'
archVersion = '1.1.1'
roomVersion = '1.1.1'
......
......@@ -37,6 +37,13 @@ android {
res.srcDirs = ['res']
assets.srcDirs = ['assets', 'libcompat/libs/armeabi']
}
test {
java.srcDirs = ['test']
}
androidTest {
java.srcDirs = ['androidTest']
assets.srcDirs += files("$projectDir/assets/schemas".toString())
}
}
buildTypes {
......@@ -67,4 +74,5 @@ dependencies {
api "com.android.support:support-fragment:$rootProject.ext.appCompatVersion"
testImplementation "junit:junit:$rootProject.ext.junitVersion"
implementation project(':tools')
implementation 'junit:junit:4.12'
}
\ No newline at end of file
package org.videolan.medialibrary;
import junit.framework.TestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
public class ToolsTest extends TestCase {
public void testIsArrayEmpty() throws Exception {
import static org.junit.Assert.assertEquals;
@RunWith(JUnit4::class)
public class ToolsTest {
@Test
public void testIsArrayEmpty() {
}
public void testMillisToString() throws Exception {
@Test
public void testMillisToString()n {
assertEquals("3min30s", Tools.millisToString(210000, true, true));
assertEquals("3min", Tools.millisToString(180000, true, true));
assertEquals("1h30min30s", Tools.millisToString(5430000, true, true));
......
......@@ -145,7 +145,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
did.setDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.divider_grey_50_18dp)!!)
ariane.addItemDecoration(did)
}
ariane.scrollToPosition(ariane.adapter.itemCount - 1)
ariane.scrollToPosition(ariane.adapter!!.itemCount - 1)
} else ariane.visibility = View.GONE
}
......
......@@ -180,14 +180,15 @@ class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb {
if (entryPoint.endsWith("/"))
entryPoint = entryPoint.substring(0, entryPoint.length - 1)
if (mProcessingFolders.containsKey(entryPoint)) {
val cb = mProcessingFolders.remove(entryPoint)
handler.post {
cb.isEnabled = true
if (success) {
(adapter as StorageBrowserAdapter).updateMediaDirs(requireContext())
adapter.notifyDataSetChanged()
} else
cb.isChecked = true
mProcessingFolders.remove(entryPoint)?.let {
handler.post {
it.isEnabled = true
if (success) {
(adapter as StorageBrowserAdapter).updateMediaDirs(requireContext())
adapter.notifyDataSetChanged()
} else
it.isChecked = true
}
}
}
}
......@@ -201,7 +202,7 @@ class StorageBrowserFragment : FileBrowserFragment(), EntryPointsEventsCb {
if (path.endsWith("/")) path = path.dropLast(1)
if (mProcessingFolders.containsKey(path)) {
val finalPath = path
handler.post { mProcessingFolders.get(finalPath).isEnabled = true }
handler.post { mProcessingFolders.get(finalPath)?.isEnabled = true }
(adapter as StorageBrowserAdapter).updateMediaDirs(requireContext())
}
}
......
......@@ -72,7 +72,7 @@ fun getDocumentFiles(context: Context, path: String) : List<MediaWrapper>? {
val parts = path.substringAfterLast(':').split("/".toRegex()).dropLastWhile { it.isEmpty() }
for (part in parts) {
if (part == "") continue
documentFile = documentFile.findFile(part)
documentFile = documentFile?.findFile(part)
}
if (documentFile == null) {
......@@ -84,12 +84,12 @@ fun getDocumentFiles(context: Context, path: String) : List<MediaWrapper>? {
val list = mutableListOf<MediaWrapper>()
for (file in documentFile.listFiles()) {
if (file.exists() && file.canRead()) {
if (file.name.startsWith(".")) continue
if (file.name?.startsWith(".") == true) continue
val mw = MediaWrapper(file.uri).apply {
type = when {
file.isDirectory -> MediaWrapper.TYPE_DIR
file.type.startsWith("video") -> MediaWrapper.TYPE_VIDEO
file.type.startsWith("audio") -> MediaWrapper.TYPE_AUDIO
file.type?.startsWith("video") == true -> MediaWrapper.TYPE_VIDEO
file.type?.startsWith("audio") == true -> MediaWrapper.TYPE_AUDIO
else -> type
}
title = file.name
......
......@@ -69,7 +69,7 @@ class WriteExternalDelegate : BaseHeadlessFragment() {
val persistedUriPermissions = contentResolver.persistedUriPermissions
for (uriPermission in persistedUriPermissions) {
val file = DocumentFile.fromTreeUri(context, uriPermission.uri)
if (treeFile.name == file.name) {
if (treeFile?.name == file?.name) {
contentResolver.releasePersistableUriPermission(uriPermission.uri, Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment