110 changed files with 664 additions and 272 deletions
@ -0,0 +1 @@ |
|||
/build |
|||
@ -0,0 +1,70 @@ |
|||
/* |
|||
* ************************************************************************ |
|||
* build.gradle |
|||
* ************************************************************************* |
|||
* Copyright © 2020 VLC authors and VideoLAN |
|||
* Author: Nicolas POMEPUY |
|||
* This program is free software; you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation; either version 2 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
|||
* ************************************************************************** |
|||
* |
|||
* |
|||
*/ |
|||
|
|||
apply plugin: 'com.android.library' |
|||
apply plugin: 'kotlin-android' |
|||
apply plugin: 'kotlin-kapt' |
|||
apply plugin: 'kotlin-android-extensions' |
|||
android { |
|||
compileSdkVersion 29 |
|||
buildToolsVersion "29.0.2" |
|||
|
|||
|
|||
defaultConfig { |
|||
minSdkVersion 17 |
|||
targetSdkVersion 29 |
|||
versionCode 1 |
|||
versionName "1.0" |
|||
|
|||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
|||
consumerProguardFiles 'consumer-rules.pro' |
|||
} |
|||
|
|||
buildTypes { |
|||
release { |
|||
minifyEnabled false |
|||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
dependencies { |
|||
implementation fileTree(dir: 'libs', include: ['*.jar']) |
|||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" |
|||
implementation 'androidx.appcompat:appcompat:1.1.0' |
|||
implementation 'androidx.core:core-ktx:1.1.0' |
|||
testImplementation 'junit:junit:4.12' |
|||
androidTestImplementation 'androidx.test.ext:junit:1.1.1' |
|||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' |
|||
//Room |
|||
implementation "androidx.room:room-runtime:$rootProject.ext.roomVersion" |
|||
kapt "androidx.room:room-compiler:$rootProject.ext.roomVersion" |
|||
implementation project(':tools') |
|||
implementation project(':resources') |
|||
|
|||
|
|||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.ext.kotlinx_version" |
|||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.ext.kotlinx_version" |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
# Add project specific ProGuard rules here. |
|||
# You can control the set of applied configuration files using the |
|||
# proguardFiles setting in build.gradle. |
|||
# |
|||
# For more details, see |
|||
# http://developer.android.com/guide/developing/tools/proguard.html |
|||
|
|||
# If your project uses WebView with JS, uncomment the following |
|||
# and specify the fully qualified class name to the JavaScript interface |
|||
# class: |
|||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { |
|||
# public *; |
|||
#} |
|||
|
|||
# Uncomment this to preserve the line number information for |
|||
# debugging stack traces. |
|||
#-keepattributes SourceFile,LineNumberTable |
|||
|
|||
# If you keep the line number information, uncomment this to |
|||
# hide the original source file name. |
|||
#-renamesourcefileattribute SourceFile |
|||
@ -0,0 +1,48 @@ |
|||
/* |
|||
* ************************************************************************ |
|||
* ExampleInstrumentedTest.kt |
|||
* ************************************************************************* |
|||
* Copyright © 2020 VLC authors and VideoLAN |
|||
* Author: Nicolas POMEPUY |
|||
* This program is free software; you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation; either version 2 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
|||
* ************************************************************************** |
|||
* |
|||
* |
|||
*/ |
|||
|
|||
package org.videolan.vlc.mediadb |
|||
|
|||
import androidx.test.platform.app.InstrumentationRegistry |
|||
import androidx.test.ext.junit.runners.AndroidJUnit4 |
|||
|
|||
import org.junit.Test |
|||
import org.junit.runner.RunWith |
|||
|
|||
import org.junit.Assert.* |
|||
|
|||
/** |
|||
* Instrumented test, which will execute on an Android device. |
|||
* |
|||
* See [testing documentation](http://d.android.com/tools/testing). |
|||
*/ |
|||
@RunWith(AndroidJUnit4::class) |
|||
class ExampleInstrumentedTest { |
|||
@Test |
|||
fun useAppContext() { |
|||
// Context of the app under test. |
|||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext |
|||
assertEquals("org.videolan.vlc.mediadb.test", appContext.packageName) |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
<!-- |
|||
~ ************************************************************************* |
|||
~ AndroidManifest.xml |
|||
~ ************************************************************************** |
|||
~ Copyright © 2020 VLC authors and VideoLAN |
|||
~ Author: Nicolas POMEPUY |
|||
~ This program is free software; you can redistribute it and/or modify |
|||
~ it under the terms of the GNU General Public License as published by |
|||
~ the Free Software Foundation; either version 2 of the License, or |
|||
~ (at your option) any later version. |
|||
~ |
|||
~ This program is distributed in the hope that it will be useful, |
|||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
~ GNU General Public License for more details. |
|||
~ |
|||
~ You should have received a copy of the GNU General Public License |
|||
~ along with this program; if not, write to the Free Software |
|||
~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
|||
~ *************************************************************************** |
|||
~ |
|||
~ |
|||
--> |
|||
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
|||
package="org.videolan.vlc.mediadb" /> |
|||
@ -0,0 +1,67 @@ |
|||
/* |
|||
* ************************************************************************ |
|||
* Converters.kt |
|||
* ************************************************************************* |
|||
* Copyright © 2020 VLC authors and VideoLAN |
|||
* Author: Nicolas POMEPUY |
|||
* This program is free software; you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation; either version 2 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
|||
* ************************************************************************** |
|||
* |
|||
* |
|||
*/ |
|||
|
|||
/******************************************************************************* |
|||
* Converters.kt |
|||
* **************************************************************************** |
|||
* Copyright © 2018 VLC authors and VideoLAN |
|||
* |
|||
* This program is free software; you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation; either version 2 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
|||
******************************************************************************/ |
|||
|
|||
package org.videolan.vlc.mediadb |
|||
|
|||
import android.net.Uri |
|||
import androidx.room.TypeConverter |
|||
import java.util.* |
|||
|
|||
class Converters { |
|||
@TypeConverter |
|||
fun uriToString(uri: Uri): String = uri.toString() |
|||
|
|||
@TypeConverter |
|||
fun stringToUri(value: String): Uri = Uri.parse(value) |
|||
|
|||
@TypeConverter |
|||
fun fromTimestamp(value: Long?): Date? { |
|||
return value?.let { Date(it) } |
|||
} |
|||
|
|||
@TypeConverter |
|||
fun dateToTimestamp(date: Date?): Long? { |
|||
return date?.time?.toLong() |
|||
} |
|||
} |
|||
@ -1,7 +1,7 @@ |
|||
package org.videolan.vlc.database |
|||
|
|||
import androidx.room.* |
|||
import org.videolan.vlc.database.models.CustomDirectory |
|||
import org.videolan.vlc.mediadb.models.CustomDirectory |
|||
|
|||
@Dao |
|||
interface CustomDirectoryDao { |
|||
@ -0,0 +1,63 @@ |
|||
/* |
|||
* ************************************************************************ |
|||
* BrowserFav.kt |
|||
* ************************************************************************* |
|||
* Copyright © 2020 VLC authors and VideoLAN |
|||
* Author: Nicolas POMEPUY |
|||
* This program is free software; you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation; either version 2 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
|||
* ************************************************************************** |
|||
* |
|||
* |
|||
*/ |
|||
|
|||
/******************************************************************************* |
|||
* BrowserFav.kt |
|||
* **************************************************************************** |
|||
* Copyright © 2018 VLC authors and VideoLAN |
|||
* |
|||
* This program is free software; you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation; either version 2 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
|||
******************************************************************************/ |
|||
|
|||
package org.videolan.vlc.mediadb.models |
|||
|
|||
import android.net.Uri |
|||
import androidx.room.ColumnInfo |
|||
import androidx.room.Entity |
|||
import androidx.room.PrimaryKey |
|||
|
|||
@Entity(tableName = "fav_table") |
|||
data class BrowserFav( |
|||
@PrimaryKey |
|||
@ColumnInfo(name = "uri") |
|||
val uri: Uri, |
|||
@ColumnInfo(name = "type") |
|||
val type: Int, |
|||
@ColumnInfo(name = "title") |
|||
val title: String, |
|||
@ColumnInfo(name = "icon_url") |
|||
val iconUrl: String? |
|||
) |
|||
@ -1,4 +1,4 @@ |
|||
package org.videolan.vlc.database.models |
|||
package org.videolan.vlc.mediadb.models |
|||
|
|||
import androidx.room.Entity |
|||
import androidx.room.PrimaryKey |
|||
@ -0,0 +1,27 @@ |
|||
<!-- |
|||
~ ************************************************************************* |
|||
~ strings.xml |
|||
~ ************************************************************************** |
|||
~ Copyright © 2020 VLC authors and VideoLAN |
|||
~ Author: Nicolas POMEPUY |
|||
~ This program is free software; you can redistribute it and/or modify |
|||
~ it under the terms of the GNU General Public License as published by |
|||
~ the Free Software Foundation; either version 2 of the License, or |
|||
~ (at your option) any later version. |
|||
~ |
|||
~ This program is distributed in the hope that it will be useful, |
|||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
~ GNU General Public License for more details. |
|||
~ |
|||
~ You should have received a copy of the GNU General Public License |
|||
~ along with this program; if not, write to the Free Software |
|||
~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
|||
~ *************************************************************************** |
|||
~ |
|||
~ |
|||
--> |
|||
|
|||
<resources> |
|||
<string name="app_name">mediadb</string> |
|||
</resources> |
|||
@ -1,3 +1,3 @@ |
|||
include ':libvlc', ':api', ':medialibrary', ':tools', ':resources' |
|||
include ':libvlc', ':api', ':medialibrary', ':tools', ':resources', ':mediadb' |
|||
include ':vlc-android' |
|||
include ':moviepedia' |
|||
|
|||
@ -0,0 +1,46 @@ |
|||
/* |
|||
* ************************************************************************ |
|||
* Workers.kt |
|||
* ************************************************************************* |
|||
* Copyright © 2020 VLC authors and VideoLAN |
|||
* Author: Nicolas POMEPUY |
|||
* This program is free software; you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation; either version 2 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
|||
* ************************************************************************** |
|||
* |
|||
* |
|||
*/ |
|||
|
|||
package org.videolan.tools |
|||
|
|||
import android.os.Looper |
|||
import kotlinx.coroutines.* |
|||
|
|||
fun runBackground(runnable: Runnable) { |
|||
if (Looper.myLooper() != Looper.getMainLooper()) runnable.run() |
|||
else AppScope.launch(Dispatchers.Default) { runnable.run() } |
|||
} |
|||
|
|||
fun runOnMainThread(runnable: Runnable) { |
|||
AppScope.launch { runnable.run() } |
|||
} |
|||
|
|||
fun runIO(runnable: Runnable) { |
|||
AppScope.launch(Dispatchers.IO) { runnable.run() } |
|||
} |
|||
|
|||
object AppScope : CoroutineScope { |
|||
@ExperimentalCoroutinesApi |
|||
override val coroutineContext = Dispatchers.Main.immediate + SupervisorJob() |
|||
} |
|||
@ -1,22 +0,0 @@ |
|||
package org.videolan.vlc.util |
|||
|
|||
import android.os.Looper |
|||
import kotlinx.coroutines.* |
|||
|
|||
fun runBackground(runnable: Runnable) { |
|||
if (Looper.myLooper() != Looper.getMainLooper()) runnable.run() |
|||
else AppScope.launch(Dispatchers.Default) { runnable.run() } |
|||
} |
|||
|
|||
fun runOnMainThread(runnable: Runnable) { |
|||
AppScope.launch { runnable.run() } |
|||
} |
|||
|
|||
fun runIO(runnable: Runnable) { |
|||
AppScope.launch(Dispatchers.IO) { runnable.run() } |
|||
} |
|||
|
|||
object AppScope : CoroutineScope { |
|||
@ExperimentalCoroutinesApi |
|||
override val coroutineContext = Dispatchers.Main.immediate + SupervisorJob() |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue