Skip to content

Commit

Permalink
v81
Browse files Browse the repository at this point in the history
  • Loading branch information
jordyamc committed Dec 23, 2018
1 parent 2e07134 commit 985c0da
Show file tree
Hide file tree
Showing 20 changed files with 71 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ android {
applicationId "knf.kuma"
minSdkVersion 21
targetSdkVersion 28
versionCode 80
versionName "3.0.6"
versionCode 81
versionName "3.0.7"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
Expand Down Expand Up @@ -190,8 +190,8 @@ dependencies {
testImplementation 'junit:junit:4.12'
//Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.0'
implementation 'org.jetbrains.anko:anko:0.10.8'
implementation 'org.jetbrains.anko:anko-coroutines:0.10.8'
//------
Expand Down
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

-keepattributes *Annotation*
-keepattributes SourceFile,LineNumberTable
-keep,allowobfuscation @interface kotlin.coroutines.jvm.internal.DebugMetadata
-keep @interface kotlin.coroutines.jvm.internal.DebugMetadata { *; }
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**

Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"apkInfo": {
"type": "MAIN",
"splits": [],
"versionCode": 80,
"versionName": "3.0.6",
"versionCode": 81,
"versionName": "3.0.7",
"enabled": true,
"outputFile": "app-release.apk",
"fullName": "release",
Expand Down
8 changes: 8 additions & 0 deletions app/src/debug/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@
android:icon="@drawable/ic_import"
android:key="show_import"
android:title="Importar archivos"/>
<ListPreference
android:defaultValue="0"
android:entries="@array/savetype"
android:entryValues="@array/savetype_values"
android:icon="@drawable/ic_save"
android:key="save_type"
android:summary="%s"
android:title="Formato de guardado"/>
<ListPreference
android:defaultValue="1"
android:entries="@array/downloader_type"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/knf/kuma/commons/PatternUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ object PatternUtil {
return matcher.group(1) + "/"
}

fun getNumFromfile(file: String): String {
fun getNumFromFile(file: String): String {
val matcher = Pattern.compile("^.*\\$[a-z-0-9]*-(\\d+)\\.mp4$").matcher(file)
matcher.find()
return matcher.group(1)
}

fun getEidFromfile(file: String): String {
fun getEidFromFile(file: String): String {
val matcher = Pattern.compile("^(\\d+)\\$.*$").matcher(file)
matcher.find()
return matcher.group(1)
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/knf/kuma/commons/PrefsUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ object PrefsUtil {
get() = PreferenceManager.getDefaultSharedPreferences(context).getLong("first_start_new", 0)
set(value) = PreferenceManager.getDefaultSharedPreferences(context).edit().putLong("first_start_new", value).apply()

val saveWithName: Boolean
get() = PreferenceManager.getDefaultSharedPreferences(context).getString("save_type", "0") == "0"

fun init(context: Context) {
PrefsUtil.context = context
}
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/java/knf/kuma/download/DownloadManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class DownloadManager : Service() {
downloadObject.setDid(request.id)
downloadObject.canResume = true
downloadDao.insert(downloadObject)
fetch!!.enqueue(request, Func { Log.e("Download", "Queued " + it.id) }, Func {
fetch?.enqueue(request, Func { Log.e("Download", "Queued " + it.id) }, Func {
if (it.throwable != null) it.throwable!!.printStackTrace()
downloadDao.delete(downloadObject)
})
Expand Down Expand Up @@ -255,10 +255,10 @@ class DownloadManager : Service() {
}

fun pauseAll() {
fetch?.getDownloadsWithStatus(Status.DOWNLOADING, Func { it ->
fetch?.getDownloadsWithStatus(Status.DOWNLOADING, Func {
val list = mutableListOf<Int>()
it.forEach {
list.add(it.id)
it.forEach { download ->
list.add(download.id)
}
fetch?.pause(list)
})
Expand All @@ -278,16 +278,16 @@ class DownloadManager : Service() {

private fun updateNotification(downloadObject: DownloadObject, isPaused: Boolean) {
val notification = NotificationCompat.Builder(context!!, CHANNEL_ONGOING)
.setSmallIcon(if (isPaused) R.drawable.ic_pause_not else if (downloadObject.eta!!.toInt() == -2) R.drawable.ic_move else android.R.drawable.stat_sys_download)
.setSmallIcon(if (isPaused) R.drawable.ic_pause_not else if (downloadObject.eta.toInt() == -2) R.drawable.ic_move else android.R.drawable.stat_sys_download)
.setContentTitle(downloadObject.name)
.setContentText(downloadObject.chapter)
.setOnlyAlertOnce(!isPaused || downloadObject.eta!!.toInt() == -2)
.setOnlyAlertOnce(!isPaused || downloadObject.eta.toInt() == -2)
.setProgress(100, downloadObject.progress, downloadObject.state == DownloadObject.PENDING)
.setOngoing(!isPaused)
.setSound(null)
.setWhen(downloadObject.time)
.setPriority(NotificationCompat.PRIORITY_LOW)
if (downloadObject.eta!!.toInt() != -2) {
if (downloadObject.eta.toInt() != -2) {
if (isPaused)
notification.addAction(R.drawable.ic_play_not, "Reanudar", getPending(downloadObject, ACTION_RESUME))
else
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/knf/kuma/pojos/Achievement.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ data class Achievement(

private fun tintedIcon(context: Context): Drawable? {
return try {
val drawable = DrawableCompat.wrap(context.getDrawable(AchievementManager.getIcon(key))!!)
val drawable = DrawableCompat.wrap(ContextCompat.getDrawable(context, AchievementManager.getIcon(key))!!)
DrawableCompat.setTint(drawable, Color.WHITE)
drawable
} catch (e: Exception) {
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/knf/kuma/pojos/AnimeObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import androidx.room.TypeConverters;
import knf.kuma.animeinfo.AnimeInfo;
import knf.kuma.commons.PatternUtil;
import knf.kuma.commons.PrefsUtil;
import pl.droidsonroids.jspoon.ElementConverter;
import pl.droidsonroids.jspoon.annotation.Selector;

Expand Down Expand Up @@ -351,7 +352,10 @@ public static List<AnimeChapter> create(AnimeInfo info) {
}

public String getFileName() {
return eid + "$" + PatternUtil.INSTANCE.getFileName(link);
if (PrefsUtil.INSTANCE.getSaveWithName())
return eid + "$" + PatternUtil.INSTANCE.getFileName(link);
else
return eid + "$" + aid + "-" + number.substring(number.lastIndexOf(" ") + 1) + ".mp4";
}

public String getEpTitle() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/knf/kuma/pojos/ExplorerObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private void process(Context context) {
for (File chap : file_list)
try {
String file_name = chap.getName();
chapters.add(new FileDownObj(context, name, aid, PatternUtil.INSTANCE.getNumFromfile(file_name), file_name, chap));
chapters.add(new FileDownObj(context, name, aid, PatternUtil.INSTANCE.getNumFromFile(file_name), file_name, chap));
} catch (Exception e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -146,7 +146,7 @@ public static class FileDownObj implements Comparable<FileDownObj> {
this.title = title;
this.chapter = chapter;
this.aid = aid;
this.eid = PatternUtil.INSTANCE.getEidFromfile(name);
this.eid = PatternUtil.INSTANCE.getEidFromFile(name);
this.fileName = name;
this.path = file.getAbsolutePath();
this.time = getTime(context, file);
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/knf/kuma/pojos/RecentObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import androidx.room.Ignore;
import androidx.room.PrimaryKey;
import knf.kuma.commons.PatternUtil;
import knf.kuma.commons.PrefsUtil;
import knf.kuma.database.CacheDB;
import knf.kuma.database.dao.AnimeDAO;
import knf.kuma.download.FileAccessHelper;
Expand Down Expand Up @@ -69,7 +70,10 @@ public static List<RecentObject> create(List<WebInfo> infos) {
}

public String getFileName() {
return eid + "$" + PatternUtil.INSTANCE.getFileName(url);
if (PrefsUtil.INSTANCE.getSaveWithName())
return eid + "$" + PatternUtil.INSTANCE.getFileName(url);
else
return eid + "$" + aid + "-" + chapter.substring(chapter.lastIndexOf(" ") + 1) + ".mp4";
}

public String getEpTitle() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/knf/kuma/videoservers/MangoServer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MangoServer(context: Context, baseLink: String) : Server(context, baseLink
get() {
try {
val frame = baseLink.substring(baseLink.indexOf("'") + 1, baseLink.lastIndexOf("'"))
val downLink = Jsoup.parse(frame).select("iframe").first().attr("src")
val downLink = Jsoup.parse(frame).select("iframe").attr("src")
val mangoLink = PatternUtil.extractMangoLink(Jsoup.connect(downLink).cookies(BypassUtil.getMapCookie(context)).userAgent(BypassUtil.userAgent).get().select("script").last().html())
val html = Jsoup.connect(mangoLink).get().html()
val matcher = Pattern.compile("type:\"video/mp4\",src:d\\('([^']+)',(\\d+)\\)").matcher(html)
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_save.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!-- drawable/content_save.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?colorControlNormal"
android:pathData="M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z"/>
</vector>
8 changes: 8 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@
<item>5</item>
<item>7</item>
</string-array>
<string-array name="savetype_values">
<item>0</item>
<item>1</item>
</string-array>
<string-array name="savetype">
<item>Nombre</item>
<item>ID</item>
</string-array>
<string-array name="list_states">
<item>Ninguno</item>
<item>Viendo</item>
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@
android:icon="@drawable/ic_import"
android:key="show_import"
android:title="Importar archivos"/>
<ListPreference
android:defaultValue="0"
android:entries="@array/savetype"
android:entryValues="@array/savetype_values"
android:icon="@drawable/ic_save"
android:key="save_type"
android:summary="%s"
android:title="Formato de guardado"/>
<ListPreference
android:defaultValue="1"
android:entries="@array/downloader_type"
Expand Down
Binary file modified app/tv/app-tv.apk
Binary file not shown.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0-alpha05'
classpath 'com.google.gms:google-services:4.1.0'
classpath 'com.google.gms:google-services:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:$dokka_version"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
Expand Down
2 changes: 1 addition & 1 deletion version.num
Original file line number Diff line number Diff line change
@@ -1 +1 @@
80
81

0 comments on commit 985c0da

Please sign in to comment.