Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Jay 2020-01-05 12:45:00 -08:00
commit 1d11d55a18
92 changed files with 196 additions and 149 deletions

View File

@ -117,7 +117,7 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.preference:preference:1.1.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.browser:browser:1.2.0'
implementation 'androidx.biometric:biometric:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
@ -150,7 +150,7 @@ dependencies {
implementation "com.squareup.retrofit2:adapter-rxjava:$retrofit_version"
// JSON
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.github.salomonbrys.kotson:kotson:2.5.0'
// JavaScript engine
@ -219,7 +219,7 @@ dependencies {
implementation ("com.bluelinelabs:conductor-support:2.1.5") {
exclude group: "com.android.support"
}
implementation project(":j2k-preference")
implementation 'com.github.inorichi:conductor-support-preference:a32c357'
// RxBindings
final rxbindings_version = '1.0.1'

View File

@ -4,6 +4,12 @@
-keep class eu.kanade.tachiyomi.**
-keep class eu.kanade.tachiyomi.source.model.** { *; }
# Design library
-dontwarn com.google.android.material.**
-keep class com.google.android.material.** { *; }
-keep interface com.google.android.material.** { *; }
-keep public class com.google.android.material.R$* { *; }
-keep class com.hippo.image.** { *; }
-keep interface com.hippo.image.** { *; }
-dontwarn nucleus.view.NucleusActionBarActivity
@ -46,26 +52,6 @@
rx.internal.util.atomic.LinkedQueueNode consumerNode;
}
### Support v7, Design
# http://stackoverflow.com/questions/29679177/cardview-shadow-not-appearing-in-lollipop-after-obfuscate-with-proguard/29698051
-keep class android.support.v7.widget.RoundRectDrawable { *; }
-keep public class android.support.v7.widget.** { *; }
-keep public class android.support.v7.internal.widget.** { *; }
-keep public class android.support.v7.internal.view.menu.** { *; }
-keep public class android.support.v7.graphics.drawable.** { *; }
-keep public class * extends android.support.v4.view.ActionProvider {
public <init>(android.content.Context);
}
-dontwarn android.support.**
-dontwarn android.support.design.**
-keep class android.support.design.** { *; }
-keep interface android.support.design.** { *; }
-keep public class android.support.design.R$* { *; }
# ReactiveNetwork
-dontwarn com.github.pwittchen.reactivenetwork.**
@ -89,4 +75,4 @@
-dontwarn org.yaml.snakeyaml.**
# Duktape
-keep class com.squareup.duktape.** { *; }
-keep class com.squareup.duktape.** { *; }

View File

@ -172,7 +172,7 @@ class ChapterCache(private val context: Context) {
/**
* Add image to cache.
*
*
* @param imageUrl url of image.
* @param response http response from page.
* @throws IOException image error.

View File

@ -45,4 +45,4 @@ class EmptyPreferenceDataStore : PreferenceDataStore() {
override fun putStringSet(key: String?, values: Set<String>?) {
}
}
}

View File

@ -1,7 +1,12 @@
package eu.kanade.tachiyomi.data.track.anilist
import android.net.Uri
import com.github.salomonbrys.kotson.*
import com.github.salomonbrys.kotson.array
import com.github.salomonbrys.kotson.get
import com.github.salomonbrys.kotson.jsonObject
import com.github.salomonbrys.kotson.nullInt
import com.github.salomonbrys.kotson.nullString
import com.github.salomonbrys.kotson.obj
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import eu.kanade.tachiyomi.data.database.models.Track

View File

@ -43,4 +43,4 @@ class KitsuInterceptor(val kitsu: Kitsu, val gson: Gson) : Interceptor {
kitsu.saveToken(oauth)
}
}
}

View File

@ -11,7 +11,6 @@ import okhttp3.HttpUrl
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import rx.Completable
import rx.Observable
import java.lang.Exception
class Myanimelist(private val context: Context, id: Int) : TrackService(id) {

View File

@ -56,4 +56,4 @@ class MyAnimeListInterceptor(private val myanimelist: Myanimelist): Interceptor
return RequestBody.create(requestBody.contentType(), newBody.toString())
}
}
}

View File

@ -264,7 +264,7 @@ class MyanimelistApi(private val client: OkHttpClient, interceptor: MyAnimeListI
.put("score", track.score)
.put("num_read_chapters", track.last_chapter_read)
return body.toString().toRequestBody("application/json; charset=utf-8".toMediaTypeOrNull())
return RequestBody.create("application/json; charset=utf-8".toMediaTypeOrNull(), body.toString())
}
private fun Element.searchTitle() = select("strong").text()!!
@ -300,4 +300,4 @@ class MyanimelistApi(private val client: OkHttpClient, interceptor: MyAnimeListI
else -> 1
}
}
}
}

View File

@ -109,4 +109,4 @@ internal class UpdaterNotifier(private val context: Context) {
}
notification.show(Notifications.ID_UPDATER)
}
}
}

View File

@ -67,4 +67,4 @@ fun OkHttpClient.newCallWithProgress(request: Request, listener: ProgressListene
.build()
return progressClient.newCall(request)
}
}

View File

@ -25,7 +25,7 @@ class ProgressResponseBody(private val responseBody: ResponseBody, private val p
private fun source(source: Source): Source {
return object : ForwardingSource(source) {
internal var totalBytesRead = 0L
var totalBytesRead = 0L
@Throws(IOException::class)
override fun read(sink: Buffer, byteCount: Long): Long {
@ -37,4 +37,4 @@ class ProgressResponseBody(private val responseBody: ResponseBody, private val p
}
}
}
}
}

View File

@ -4,5 +4,5 @@ import androidx.preference.PreferenceScreen
interface ConfigurableSource : Source {
fun setupPreferenceScreen(screen: PreferenceScreen)
}
fun setupPreferenceScreen(screen: PreferenceScreen)
}

View File

@ -89,4 +89,4 @@ abstract class RxController(bundle: Bundle? = null) : BaseController(bundle) {
return subscribe(onNext, onError, onCompleted).also { untilDestroySubscriptions.add(it) }
}
}
}

View File

@ -7,5 +7,5 @@ interface SecondaryDrawerController {
fun createSecondaryDrawer(drawer: androidx.drawerlayout.widget.DrawerLayout): ViewGroup?
fun cleanupSecondaryDrawer(drawer: androidx.drawerlayout.widget.DrawerLayout)
}
fun cleanupSecondaryDrawer(drawer: DrawerLayout)
}

View File

@ -7,4 +7,4 @@ interface TabbedController {
fun configureTabs(tabs: TabLayout) {}
fun cleanupTabs(tabs: TabLayout) {}
}
}

View File

@ -8,4 +8,4 @@ abstract class BaseViewHolder(view: View) : androidx.recyclerview.widget.Recycle
override val containerView: View?
get() = itemView
}
}

View File

@ -244,4 +244,4 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
@Parcelize
data class SmartSearchConfig(val origTitle: String, val origMangaId: Long) : Parcelable
}
}

View File

@ -38,4 +38,4 @@ data class SourceItem(val source: CatalogueSource, val header: LangItem? = null)
holder.bind(this)
}
}
}

View File

@ -4,9 +4,11 @@ import android.view.Gravity
import android.view.View
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.widget.FrameLayout
import androidx.recyclerview.widget.RecyclerView
import com.f2prateek.rx.preferences.Preference
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.preference.getOrDefault
@ -60,6 +62,4 @@ class CatalogueItem(val manga: Manga, private val catalogueAsList: Preference<Bo
return manga.id!!.hashCode()
}
}
}

View File

@ -48,4 +48,4 @@ class ProgressItem : AbstractFlexibleItem<ProgressItem.Holder>() {
val progressMessage: TextView = view.findViewById(R.id.progress_message)
}
}
}

View File

@ -44,4 +44,4 @@ open class CheckboxItem(val filter: Filter.CheckBox) : AbstractFlexibleItem<Chec
val check: CheckBox = itemView.findViewById(R.id.nav_view_item)
}
}
}

View File

@ -3,8 +3,10 @@ package eu.kanade.tachiyomi.ui.catalogue.filter
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractExpandableHeaderItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.davidea.flexibleadapter.items.ISectionable
import eu.davidea.viewholders.ExpandableViewHolder
import eu.kanade.tachiyomi.R
@ -64,4 +66,4 @@ class GroupItem(val filter: Filter.Group<*>) : AbstractExpandableHeaderItem<Grou
}
}
}
}

View File

@ -4,8 +4,10 @@ import android.annotation.SuppressLint
import com.google.android.material.R
import android.view.View
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractHeaderItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.davidea.viewholders.FlexibleViewHolder
import eu.kanade.tachiyomi.source.model.Filter
import androidx.recyclerview.widget.RecyclerView

View File

@ -4,8 +4,10 @@ import android.view.View
import android.widget.ArrayAdapter
import android.widget.Spinner
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.davidea.viewholders.FlexibleViewHolder
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.model.Filter
@ -53,4 +55,4 @@ open class SelectItem(val filter: Filter.Select<*>) : AbstractFlexibleItem<Selec
val text: TextView = itemView.findViewById(R.id.nav_view_item_text)
val spinner: Spinner = itemView.findViewById(R.id.nav_view_item)
}
}
}

View File

@ -37,4 +37,4 @@ class SeparatorItem(val filter: Filter.Separator) : AbstractHeaderItem<Separator
}
class Holder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>) : FlexibleViewHolder(view, adapter)
}
}

View File

@ -51,4 +51,4 @@ class SortGroup(val filter: Filter.Sort) : AbstractExpandableHeaderItem<SortGrou
}
class Holder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>) : GroupItem.Holder(view, adapter)
}
}

View File

@ -4,8 +4,10 @@ import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
import androidx.core.content.ContextCompat
import android.view.View
import android.widget.CheckedTextView
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractSectionableItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.davidea.viewholders.FlexibleViewHolder
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.model.Filter
@ -73,4 +75,4 @@ class SortItem(val name: String, val group: SortGroup) : AbstractSectionableItem
val text: CheckedTextView = itemView.findViewById(R.id.nav_view_item)
}
}
}

View File

@ -3,8 +3,10 @@ package eu.kanade.tachiyomi.ui.catalogue.filter
import com.google.android.material.textfield.TextInputLayout
import android.view.View
import android.widget.EditText
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.davidea.viewholders.FlexibleViewHolder
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.model.Filter
@ -47,4 +49,4 @@ open class TextItem(val filter: Filter.Text) : AbstractFlexibleItem<TextItem.Hol
val wrapper: TextInputLayout = itemView.findViewById(R.id.nav_view_item_wrapper)
val edit: EditText = itemView.findViewById(R.id.nav_view_item)
}
}
}

View File

@ -4,8 +4,10 @@ import com.google.android.material.R
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat
import android.view.View
import android.widget.CheckedTextView
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.davidea.viewholders.FlexibleViewHolder
import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.util.dpToPx
@ -74,4 +76,4 @@ open class TriStateItem(val filter: Filter.TriState) : AbstractFlexibleItem<TriS
}
}
}
}

View File

@ -1,8 +1,10 @@
package eu.kanade.tachiyomi.ui.catalogue.global_search
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga
import androidx.recyclerview.widget.RecyclerView
@ -34,4 +36,4 @@ class CatalogueSearchCardItem(val manga: Manga) : AbstractFlexibleItem<Catalogue
return manga.id?.toInt() ?: 0
}
}
}

View File

@ -1,8 +1,10 @@
package eu.kanade.tachiyomi.ui.catalogue.global_search
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.CatalogueSource
import androidx.recyclerview.widget.RecyclerView

View File

@ -3,6 +3,8 @@ package eu.kanade.tachiyomi.ui.category
import com.google.android.material.snackbar.Snackbar
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.view.ActionMode
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import android.view.*
import com.google.android.material.snackbar.BaseTransientBottomBar
import com.jakewharton.rxbinding.view.clicks
@ -352,4 +354,4 @@ class CategoryController : NucleusController<CategoryPresenter>(),
activity?.toast(R.string.error_category_exists)
}
}
}

View File

@ -66,4 +66,4 @@ class CategoryItem(val category: Category) : AbstractFlexibleItem<CategoryHolder
return category.id!!
}
}
}

View File

@ -187,8 +187,8 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
f.showDialog(router)
}
override fun <T : Preference> findPreference(key: CharSequence): T? {
return preferenceScreen!!.findPreference(key)
override fun <T : Preference> findPreference(key: CharSequence): T? {
return preferenceScreen!!.findPreference(key)
}
override fun loginDialogClosed(source: LoginSource) {

View File

@ -1,8 +1,10 @@
package eu.kanade.tachiyomi.ui.extension
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractHeaderItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.items.IFlexible

View File

@ -1,8 +1,10 @@
package eu.kanade.tachiyomi.ui.extension
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractSectionableItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.extension.model.InstallStep

View File

@ -87,4 +87,4 @@ class LibraryItem(val manga: LibraryManga, private val libraryAsList: Preference
override fun hashCode(): Int {
return manga.id!!.hashCode()
}
}
}

View File

@ -103,4 +103,4 @@ class TabsAnimator(val tabs: TabLayout) {
private val isMeasured: Boolean
get() = tabsHeight > 0
}
}

View File

@ -1,8 +1,10 @@
package eu.kanade.tachiyomi.ui.manga.chapter
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Chapter
import eu.kanade.tachiyomi.data.database.models.Manga
@ -52,4 +54,4 @@ class ChapterItem(val chapter: Chapter, val manga: Manga) : AbstractFlexibleItem
return chapter.id!!.hashCode()
}
}
}

View File

@ -141,4 +141,4 @@ class TrackController : NucleusController<TrackPresenter>(),
const val TAG_SEARCH_CONTROLLER = "track_search_controller"
}
}
}

View File

@ -1,8 +1,10 @@
package eu.kanade.tachiyomi.ui.migration
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga
import androidx.recyclerview.widget.RecyclerView
@ -36,4 +38,4 @@ class MangaItem(val manga: Manga) : AbstractFlexibleItem<MangaHolder>() {
override fun hashCode(): Int {
return manga.id!!.hashCode()
}
}
}

View File

@ -1,8 +1,10 @@
package eu.kanade.tachiyomi.ui.migration
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractHeaderItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.base.holder.BaseFlexibleViewHolder
import kotlinx.android.synthetic.main.catalogue_main_controller_card.*

View File

@ -1,8 +1,10 @@
package eu.kanade.tachiyomi.ui.migration
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractSectionableItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.Source
import androidx.recyclerview.widget.RecyclerView
@ -40,4 +42,4 @@ data class SourceItem(val source: Source, val header: SelectionHeader? = null) :
holder.bind(this)
}
}
}

View File

@ -24,6 +24,7 @@ import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy
import java.util.concurrent.PriorityBlockingQueue
import java.util.concurrent.atomic.AtomicInteger
import kotlin.math.min
/**
* Loader used to load chapters from an online source.
@ -48,19 +49,20 @@ class HttpPageLoader(
* Preferences helper.
*/
private val preferences by injectLazy<PreferencesHelper>()
private val preloadSize = 4
init {
subscriptions += Observable.defer { Observable.just(queue.take().page) }
.filter { it.status == Page.QUEUE }
.concatMap { source.fetchImageFromCacheThenNet(it) }
.repeat()
.subscribeOn(Schedulers.io())
.subscribe({
}, { error ->
if (error !is InterruptedException) {
Timber.e(error)
}
})
.filter { it.status == Page.QUEUE }
.concatMap { source.fetchImageFromCacheThenNet(it) }
.repeat()
.subscribeOn(Schedulers.io())
.subscribe({
}, { error ->
if (error !is InterruptedException) {
Timber.e(error)
}
})
}
/**
@ -92,13 +94,13 @@ class HttpPageLoader(
*/
override fun getPages(): Observable<List<ReaderPage>> {
return chapterCache
.getPageListFromCache(chapter.chapter)
.onErrorResumeNext { source.fetchPageList(chapter.chapter) }
.map { pages ->
pages.mapIndexed { index, page -> // Don't trust sources and use our own indexing
ReaderPage(index, page.url, page.imageUrl)
.getPageListFromCache(chapter.chapter)
.onErrorResumeNext { source.fetchPageList(chapter.chapter) }
.map { pages ->
pages.mapIndexed { index, page -> // Don't trust sources and use our own indexing
ReaderPage(index, page.url, page.imageUrl)
}
}
}
}
/**
@ -122,29 +124,41 @@ class HttpPageLoader(
val statusSubject = SerializedSubject(PublishSubject.create<Int>())
page.setStatusSubject(statusSubject)
val queuedPages = mutableListOf<PriorityPage>()
if (page.status == Page.QUEUE) {
queue.offer(PriorityPage(page, 1))
queuedPages += PriorityPage(page, 1).also { queue.offer(it) }
}
preloadNextPages(page, 4)
queuedPages += preloadNextPages(page, preloadSize)
statusSubject.startWith(page.status)
.doOnUnsubscribe {
queuedPages.forEach {
if (it.page.status == Page.QUEUE) {
queue.remove(it)
}
}
}
}
.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
}
/**
* Preloads the given [amount] of pages after the [currentPage] with a lower priority.
* @return a list of [PriorityPage] that were added to the [queue]
*/
private fun preloadNextPages(currentPage: ReaderPage, amount: Int) {
private fun preloadNextPages(currentPage: ReaderPage, amount: Int): List<PriorityPage> {
val pageIndex = currentPage.index
val pages = currentPage.chapter.pages ?: return
if (pageIndex == pages.lastIndex) return
val nextPages = pages.subList(pageIndex + 1, Math.min(pageIndex + 1 + amount, pages.size))
for (nextPage in nextPages) {
if (nextPage.status == Page.QUEUE) {
queue.offer(PriorityPage(nextPage, 0))
}
}
val pages = currentPage.chapter.pages ?: return emptyList()
if (pageIndex == pages.lastIndex) return emptyList()
return pages
.subList(pageIndex + 1, min(pageIndex + 1 + amount, pages.size))
.mapNotNull {
if (it.status == Page.QUEUE) {
PriorityPage(it, 0).apply { queue.offer(this) }
} else null
}
}
/**
@ -160,7 +174,7 @@ class HttpPageLoader(
/**
* Data class used to keep ordering of pages in order to maintain priority.
*/
private data class PriorityPage(
private class PriorityPage(
val page: ReaderPage,
val priority: Int
): Comparable<PriorityPage> {

View File

@ -3,8 +3,10 @@ package eu.kanade.tachiyomi.ui.recent_updates
import android.text.format.DateUtils
import android.view.View
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractHeaderItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.davidea.viewholders.FlexibleViewHolder
import eu.kanade.tachiyomi.R
import java.util.*
@ -47,4 +49,4 @@ class DateItem(val date: Date) : AbstractHeaderItem<DateItem.Holder>() {
section_text.text = DateUtils.getRelativeTimeSpanString(item.date.time, now, DateUtils.DAY_IN_MILLIS)
}
}
}
}

View File

@ -1,8 +1,10 @@
package eu.kanade.tachiyomi.ui.recent_updates
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractSectionableItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Chapter
import eu.kanade.tachiyomi.data.database.models.Manga
@ -52,4 +54,4 @@ class RecentChapterItem(val chapter: Chapter, val manga: Manga, header: DateItem
return chapter.id!!.hashCode()
}
}
}

View File

@ -148,4 +148,4 @@ class RecentlyReadController : NucleusController<RecentlyReadPresenter>(),
}
}
}
}

View File

@ -1,8 +1,10 @@
package eu.kanade.tachiyomi.ui.recently_read
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
import eu.davidea.flexibleadapter.items.IFlexible
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.MangaChapterHistory
import androidx.recyclerview.widget.RecyclerView
@ -36,4 +38,4 @@ class RecentlyReadItem(val mch: MangaChapterHistory) : AbstractFlexibleItem<Rece
override fun hashCode(): Int {
return mch.manga.id!!.hashCode()
}
}
}

View File

@ -48,4 +48,4 @@ class AnilistLoginActivity : AppCompatActivity() {
startActivity(intent)
}
}
}

View File

@ -47,4 +47,4 @@ class BangumiLoginActivity : AppCompatActivity() {
startActivity(intent)
}
}
}

View File

@ -60,11 +60,17 @@ fun initDialog(dialogPreference: DialogPreference) {
}
inline fun <P : Preference> PreferenceGroup.initThenAdd(p: P, block: P.() -> Unit): P {
return p.apply { block(); addPreference(this); }
return p.apply {
block()
this.isIconSpaceReserved = false
addPreference(this) }
}
inline fun <P : Preference> PreferenceGroup.addThenInit(p: P, block: P.() -> Unit): P {
return p.apply { addPreference(this); block() }
return p.apply {
this.isIconSpaceReserved = false
addPreference(this)
block() }
}
inline fun Preference.onClick(crossinline block: () -> Unit) {

View File

@ -89,4 +89,4 @@ abstract class SettingsController : PreferenceController() {
fun <T> Observable<T>.subscribeUntilDestroy(onNext: (T) -> Unit): Subscription {
return subscribe(onNext).also { untilDestroySubscriptions.add(it) }
}
}
}

View File

@ -1,7 +1,6 @@
package eu.kanade.tachiyomi.ui.setting
import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferenceKeys
import eu.kanade.tachiyomi.data.updater.UpdaterJob
@ -67,4 +66,4 @@ class SettingsMainController : SettingsController() {
private fun navigateTo(controller: SettingsController) {
router.pushController(controller.withFadeTransaction())
}
}
}

View File

@ -243,4 +243,4 @@ class SettingsSourcesController : SettingsController(),
fun from(i: Int): SourcesSort? = values().find { it.value == i }
}
}
}
}

View File

@ -45,7 +45,7 @@ class SettingsTrackingController : SettingsController(),
.setToolbarColor(context.getResourceColor(R.attr.colorPrimary))
.build()
tabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY)
tabsIntent.launchUrl(activity, AnilistApi.authUrl())
tabsIntent.launchUrl(activity!!, AnilistApi.authUrl())
}
}
trackPreference(trackManager.kitsu) {
@ -61,7 +61,7 @@ class SettingsTrackingController : SettingsController(),
.setToolbarColor(context.getResourceColor(R.attr.colorPrimary))
.build()
tabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY)
tabsIntent.launchUrl(activity, ShikimoriApi.authUrl())
tabsIntent.launchUrl(activity!!, ShikimoriApi.authUrl())
}
}
trackPreference(trackManager.bangumi) {
@ -70,7 +70,7 @@ class SettingsTrackingController : SettingsController(),
.setToolbarColor(context.getResourceColor(R.attr.colorPrimary))
.build()
tabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY)
tabsIntent.launchUrl(activity, BangumiApi.authUrl())
tabsIntent.launchUrl(activity!!, BangumiApi.authUrl())
}
}
}

View File

@ -47,4 +47,4 @@ class ShikimoriLoginActivity : AppCompatActivity() {
startActivity(intent)
}
}
}

View File

@ -16,4 +16,4 @@ fun ImageView.setVectorCompat(@DrawableRes drawable: Int, tint: Int? = null) {
vector?.setTint(tint)
}
setImageDrawable(vector)
}
}

View File

@ -23,4 +23,4 @@ fun Element.attrOrText(css: String): String {
*/
fun Response.asJsoup(html: String? = null): Document {
return Jsoup.parse(html ?: body!!.string(), request.url.toString())
}
}

View File

@ -42,4 +42,4 @@ class AutofitRecyclerView @JvmOverloads constructor(context: Context, attrs: Att
}
}
}
}

View File

@ -30,4 +30,4 @@ class CustomLayoutFilePickerFragment : FilePickerFragment() {
else -> return super.onCreateViewHolder(parent, viewType)
}
}
}
}

View File

@ -20,4 +20,4 @@ class DrawerSwipeCloseListener(
drawer.setDrawerLockMode(androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_LOCKED_CLOSED, drawerView)
}
}
}
}

View File

@ -45,4 +45,4 @@ class ElevationAppBarLayout @JvmOverloads constructor(
}
}
}
}

View File

@ -267,4 +267,4 @@ open class ExtendedNavigationView @JvmOverloads constructor(
}
}
}

View File

@ -31,4 +31,4 @@ abstract class FABAnimationBase : FloatingActionButton.Behavior() {
abstract fun animateOut(button: FloatingActionButton)
abstract fun animateIn(button: FloatingActionButton)
}
}

View File

@ -84,4 +84,4 @@ class FABAnimationUpDown @JvmOverloads constructor(ctx: Context, attrs: Attribut
rect.set(child.left, child.top + 100, child.right, child.bottom - 1000)
return true
}
}
}

View File

@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.widget
import android.annotation.SuppressLint
import android.content.Context
import com.google.android.material.R
import com.google.android.material.internal.ScrimInsetsFrameLayout
import com.google.android.material.textfield.TextInputLayout
import androidx.core.view.ViewCompat
import androidx.recyclerview.widget.LinearLayoutManager
@ -13,6 +12,7 @@ import android.util.AttributeSet
import android.view.View
import android.view.ViewGroup
import android.widget.*
import com.google.android.material.internal.ScrimInsetsFrameLayout
import eu.kanade.tachiyomi.util.inflate
import eu.kanade.tachiyomi.R as TR
@ -156,4 +156,4 @@ open class SimpleNavigationView @JvmOverloads constructor(
const val VIEW_TYPE_LIST = 106
}
}
}

View File

@ -23,4 +23,4 @@ class IntListPreference @JvmOverloads constructor(context: Context, attrs: Attri
defaultReturnValue
}
}
}
}

View File

@ -54,4 +54,4 @@ class LoginCheckBoxPreference @JvmOverloads constructor(
super.notifyChanged()
}
}
}

View File

@ -122,4 +122,4 @@ CompoundButton.OnCheckedChangeListener {
defaultValue as Boolean)
}
}
}

View File

@ -23,4 +23,4 @@
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -12,4 +12,4 @@ android:layout_height="wrap_content">
android:paddingTop="4dp"
android:clipToPadding="false"
tools:listitem="@layout/catalogue_global_search_controller_card" />
</FrameLayout>
</FrameLayout>

View File

@ -46,4 +46,4 @@
android:clipToPadding="false"
tools:listitem="@layout/catalogue_global_search_controller_card_item" />
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -52,4 +52,4 @@
app:layout_constraintTop_toBottomOf="@+id/itemImage"
tools:text="Sample title" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -114,4 +114,4 @@
</FrameLayout>
</FrameLayout>
</FrameLayout>

View File

@ -12,4 +12,4 @@
android:clipToPadding="false"
tools:listitem="@layout/catalogue_main_controller_card" />
</FrameLayout>
</FrameLayout>

View File

@ -29,4 +29,4 @@
android:layout_gravity="center"
android:layout_height="wrap_content" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -55,4 +55,4 @@
app:layout_anchorGravity="bottom|right|end"
app:srcCompat="@drawable/ic_play_arrow_white_24dp"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -52,4 +52,4 @@
android:padding="8dp"
app:srcCompat="@drawable/ic_chevron_right_double_black_24dp" />
</LinearLayout>
</LinearLayout>

View File

@ -21,4 +21,4 @@
tools:text="Title"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
</FrameLayout>

View File

@ -13,4 +13,4 @@
android:clipToPadding="false"
tools:listitem="@layout/extension_card_header"/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View File

@ -102,4 +102,4 @@
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -11,4 +11,4 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</eu.kanade.tachiyomi.ui.library.LibraryCategoryView>
</eu.kanade.tachiyomi.ui.library.LibraryCategoryView>

View File

@ -63,4 +63,4 @@
app:menu="@menu/menu_navigation"/>
</androidx.drawerlayout.widget.DrawerLayout>
</FrameLayout>
</FrameLayout>

View File

@ -3,4 +3,4 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/manga_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent" />

View File

@ -27,4 +27,4 @@
</FrameLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View File

@ -85,4 +85,4 @@
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -23,4 +23,4 @@
android:layout_gravity="center"
android:layout_height="wrap_content"/>
</FrameLayout>
</FrameLayout>

View File

@ -69,4 +69,4 @@
android:text="@string/action_resume"/>
</RelativeLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView>

View File

@ -22,4 +22,4 @@
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
</LinearLayout>

View File

@ -188,4 +188,4 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView>

View File

@ -16,5 +16,7 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX support
android.enableJetifier=true
android.useAndroidX=true
android.useAndroidX=true