Skip to content

Commit

Permalink
- added NovelWorld! Still some things I need to take care of includin…
Browse files Browse the repository at this point in the history
…g a new logo and another source.
  • Loading branch information
jakepurple13 committed May 14, 2021
1 parent a57f098 commit 5a8479b
Show file tree
Hide file tree
Showing 50 changed files with 1,250 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
local.properties
/animeworld/google-services.json
/mangaworld/google-services.json
/novelworld/google-services.json
3 changes: 2 additions & 1 deletion .idea/gradle.xml

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

2 changes: 1 addition & 1 deletion anime_sources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies {
implementation "com.squareup.okhttp3:okhttp:4.9.1"
implementation "com.squareup.okhttp3:okhttp-dnsoverhttps:4.9.1"
implementation coroutinesCore
implementation 'org.jsoup:jsoup:1.13.1'
implementation jsoup
implementation 'com.squareup.duktape:duktape-android:1.3.0'
implementation gson
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
Expand Down
40 changes: 33 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'com.mikepenz.aboutlibraries.plugin'
}

//This is just to show what the minimum is needed to create a new app

android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
compileSdkVersion compileVersion
buildToolsVersion buildVersion

defaultConfig {
applicationId "com.programmersbox.otakuworld"
minSdkVersion 23
targetSdkVersion 30
versionCode 1
versionName "1.0"
versionName otakuVersionName

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -30,15 +34,37 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
dataBinding true
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation androidCore
implementation appCompat
implementation material
implementation constraintlayout
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

implementation recyclerview

implementation project(':UIViews')
implementation project(':Models')
implementation project(':favoritesdatabase')
implementation project(':novel_sources')

implementation rxkotlin
implementation rxandroid
implementation rxbinding
implementation rxbindingKotlin

implementation room.room
// For Kotlin use kapt instead of annotationProcessor
kapt "androidx.room:room-compiler:$room_version"

//Custom Libraries
implementation jakepurple13Tools.helpfultools
}
17 changes: 17 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.programmersbox.otakuworld">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:usesCleartextTraffic="true"
android:theme="@style/Theme.OtakuWorld">
<activity android:name=".MainActivity">
<intent-filter>
Expand All @@ -16,6 +21,18 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<receiver
android:name="com.programmersbox.uiviews.DeleteNotificationReceiver"
android:enabled="true"
android:exported="true" />

<receiver android:name="com.programmersbox.uiviews.BootReceived">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.PACKAGE_FIRST_LAUNCH" />
</intent-filter>
</receiver>
</application>

</manifest>
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ buildscript {
ext.constraintlayout = 'androidx.constraintlayout:constraintlayout:2.0.4'
ext.swiperefresh = 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

ext.jsoup = 'org.jsoup:jsoup:1.13.1'

ext.room_version = "2.3.0"

ext {
Expand Down
2 changes: 1 addition & 1 deletion manga_sources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dependencies {
implementation "com.squareup.okhttp3:okhttp:4.9.1"
implementation "com.squareup.okhttp3:okhttp-dnsoverhttps:4.9.1"
implementation coroutinesCore
implementation 'org.jsoup:jsoup:1.13.1'
implementation jsoup
implementation 'com.squareup.duktape:duktape-android:1.3.0'
implementation gson
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
Expand Down
1 change: 1 addition & 0 deletions novel_sources/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
54 changes: 54 additions & 0 deletions novel_sources/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
plugins {
id 'com.android.library'
id 'kotlin-android'
}

android {
compileSdkVersion 30

defaultConfig {
minSdkVersion 23
targetSdkVersion 30
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'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation androidCore
implementation appCompat
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

implementation gsonutils
implementation helpfulutils
implementation rxutils
implementation gson

implementation jsoup

implementation rxkotlin
implementation rxandroid

implementation project(':Models')
}
Empty file.
21 changes: 21 additions & 0 deletions novel_sources/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.programmersbox.novel_sources

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

/**
* 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("com.programmersbox.novel_sources.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions novel_sources/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.programmersbox.novel_sources">

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.programmersbox.novel_sources

import com.programmersbox.models.ApiService
import com.programmersbox.novel_sources.novels.WuxiaWorld
import org.jsoup.Jsoup

enum class Sources(
val source: ApiService
) : ApiService by source {

WUXIAWORLD(WuxiaWorld);

override val serviceName: String get() = this.name

}

internal fun String.toJsoup() = Jsoup.connect(this).get()
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package com.programmersbox.novel_sources.novels

import com.programmersbox.models.*
import com.programmersbox.novel_sources.Sources
import com.programmersbox.novel_sources.toJsoup
import io.reactivex.Single

object WuxiaWorld : ApiService {

override val baseUrl: String get() = "https://wuxiaworld.online"

override fun getRecent(page: Int): Single<List<ItemModel>> = Single.create {
val pop = "/wuxia-list?view=list&page=$page"
"$baseUrl$pop".toJsoup()
.select("div.update_item")
.map {
ItemModel(
title = it
.select("h3")
.select("a.tooltip")
.attr("title"),
description = "",
imageUrl = it.select("img").attr("abs:src"),
url = it
.select("h3")
.select("a.tooltip")
.attr("abs:href"),
source = this
)
}
.let(it::onSuccess)
}

override fun getList(page: Int): Single<List<ItemModel>> = Single.create {
val pop = "/wuxia-list?view=list&sort=popularity&page=$page"
"$baseUrl$pop".toJsoup()
.select("div.update_item")
.map {
ItemModel(
title = it
.select("h3")
.select("a.tooltip")
.attr("title"),
description = "",
imageUrl = it.select("img").attr("abs:src"),
url = it
.select("h3")
.select("a.tooltip")
.attr("abs:href"),
source = this
)
}
.let(it::onSuccess)
}

override fun getItemInfo(model: ItemModel): Single<InfoModel> = Single.create {

val info = model.url.toJsoup()

InfoModel(
source = this,
url = model.url,
title = model.title,
description = info.select("meta[name='description']").attr("content"),
imageUrl = model.imageUrl,
genres = emptyList(),
chapters = info
.select("div.chapter-list")
.select("div.row")
.select("span")
.select("a")
.map {
ChapterModel(
name = it.attr("title"),
url = it.attr("abs:href"),
uploaded = "",
source = Sources.WUXIAWORLD
)
},
alternativeNames = emptyList()
)
.let(it::onSuccess)

}

override fun getChapterInfo(chapterModel: ChapterModel): Single<List<Storage>> = Single.create {
it.onSuccess(
listOf(
Storage(
link = chapterModel.url.toJsoup().select("div.content-area").html(),
source = chapterModel.url,
quality = "Good",
sub = "Yes"
)
)
)
}
}
Loading

0 comments on commit 5a8479b

Please sign in to comment.