Merge branch 'master' of https://github.com/az4521/Tachiyomi
This commit is contained in:
commit
03502f6533
@ -136,7 +136,7 @@ class ExtensionManager(
|
||||
|
||||
// EXH -->
|
||||
fun <T : Extension> Iterable<T>.filterNotBlacklisted(): List<T> {
|
||||
val blacklistEnabled = preferences.eh_enableSourceBlacklist().getOrDefault()
|
||||
val blacklistEnabled = preferences.eh_enableSourceBlacklist().get()
|
||||
return filter {
|
||||
if (it.isBlacklisted(blacklistEnabled)) {
|
||||
XLog.d("[EXH] Removing blacklisted extension: (name: %s, pkgName: %s)!", it.name, it.pkgName)
|
||||
@ -145,8 +145,10 @@ class ExtensionManager(
|
||||
}
|
||||
}
|
||||
|
||||
fun Extension.isBlacklisted(blacklistEnabled: Boolean =
|
||||
preferences.eh_enableSourceBlacklist().getOrDefault()): Boolean {
|
||||
fun Extension.isBlacklisted(
|
||||
blacklistEnabled: Boolean =
|
||||
preferences.eh_enableSourceBlacklist().get()
|
||||
): Boolean {
|
||||
return pkgName in BlacklistedSources.BLACKLISTED_EXTENSIONS && blacklistEnabled
|
||||
}
|
||||
// EXH <--
|
||||
|
@ -394,7 +394,7 @@ class LibraryPresenter(
|
||||
replace: Boolean
|
||||
) {
|
||||
|
||||
val flags = preferences.migrateFlags().getOrDefault()
|
||||
val flags = preferences.migrateFlags().get()
|
||||
val migrateChapters = MigrationFlags.hasChapters(flags)
|
||||
val migrateCategories = MigrationFlags.hasCategories(flags)
|
||||
val migrateTracks = MigrationFlags.hasTracks(flags)
|
||||
|
@ -28,9 +28,9 @@ import eu.kanade.tachiyomi.ui.library.ChangeMangaCategoriesDialog
|
||||
import eu.kanade.tachiyomi.ui.library.LibraryController
|
||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||
import eu.kanade.tachiyomi.ui.migration.manga.design.PreMigrationController
|
||||
import eu.kanade.tachiyomi.ui.recent.history.HistoryController
|
||||
import eu.kanade.tachiyomi.ui.recent.updates.UpdatesController
|
||||
import eu.kanade.tachiyomi.ui.migration.manga.design.PreMigrationController
|
||||
import eu.kanade.tachiyomi.ui.source.SourceController
|
||||
import eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController
|
||||
import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchController
|
||||
@ -328,6 +328,12 @@ class MangaInfoController(private val fromSource: Boolean = false) :
|
||||
thumbnailUrl = manga.thumbnail_url
|
||||
val mangaThumbnail = manga.toMangaThumbnail()
|
||||
|
||||
binding.mangaCoverCard.radius = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
preferences.eh_library_corner_radius().getOrDefault().toFloat(),
|
||||
view.context.resources.displayMetrics
|
||||
)
|
||||
|
||||
GlideApp.with(view.context)
|
||||
.load(mangaThumbnail)
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||
|
@ -73,7 +73,7 @@ class MigrationBottomSheetDialog(
|
||||
* Init general reader preferences.
|
||||
*/
|
||||
private fun initPreferences() {
|
||||
val flags = preferences.migrateFlags().getOrDefault()
|
||||
val flags = preferences.migrateFlags().get()
|
||||
|
||||
mig_chapters.isChecked = MigrationFlags.hasChapters(flags)
|
||||
mig_categories.isChecked = MigrationFlags.hasCategories(flags)
|
||||
|
@ -13,6 +13,7 @@ import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.databinding.PreMigrationControllerBinding
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
import eu.kanade.tachiyomi.ui.base.controller.BaseController
|
||||
@ -24,10 +25,9 @@ import exh.util.doOnApplyWindowInsets
|
||||
import exh.util.marginBottom
|
||||
import exh.util.updateLayoutParams
|
||||
import exh.util.updatePaddingRelative
|
||||
import kotlinx.android.synthetic.main.pre_migration_controller.*
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class PreMigrationController(bundle: Bundle? = null) : BaseController(bundle), FlexibleAdapter
|
||||
class PreMigrationController(bundle: Bundle? = null) : BaseController<PreMigrationControllerBinding>(bundle), FlexibleAdapter
|
||||
.OnItemClickListener, StartMigrationListener {
|
||||
private val sourceManager: SourceManager by injectLazy()
|
||||
private val prefs: PreferencesHelper by injectLazy()
|
||||
@ -43,7 +43,8 @@ class PreMigrationController(bundle: Bundle? = null) : BaseController(bundle), F
|
||||
override fun getTitle() = "Select target sources"
|
||||
|
||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||
return inflater.inflate(R.layout.pre_migration_controller, container, false)
|
||||
binding = PreMigrationControllerBinding.inflate(inflater)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View) {
|
||||
@ -55,24 +56,24 @@ class PreMigrationController(bundle: Bundle? = null) : BaseController(bundle), F
|
||||
this
|
||||
)
|
||||
adapter = ourAdapter
|
||||
recycler.layoutManager = LinearLayoutManager(view.context)
|
||||
recycler.setHasFixedSize(true)
|
||||
recycler.adapter = ourAdapter
|
||||
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
||||
binding.recycler.setHasFixedSize(true)
|
||||
binding.recycler.adapter = ourAdapter
|
||||
ourAdapter.itemTouchHelperCallback = null // Reset adapter touch adapter to fix drag after rotation
|
||||
ourAdapter.isHandleDragEnabled = true
|
||||
dialog = null
|
||||
val fabBaseMarginBottom = fab?.marginBottom ?: 0
|
||||
recycler.doOnApplyWindowInsets { v, insets, padding ->
|
||||
val fabBaseMarginBottom = binding.fab?.marginBottom ?: 0
|
||||
binding.recycler.doOnApplyWindowInsets { v, insets, padding ->
|
||||
|
||||
fab?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
binding.fab?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
bottomMargin = fabBaseMarginBottom + insets.systemWindowInsetBottom
|
||||
}
|
||||
// offset the recycler by the fab's inset + some inset on top
|
||||
v.updatePaddingRelative(bottom = padding.bottom + (fab?.marginBottom ?: 0) +
|
||||
fabBaseMarginBottom + (fab?.height ?: 0))
|
||||
v.updatePaddingRelative(bottom = padding.bottom + (binding.fab?.marginBottom ?: 0) +
|
||||
fabBaseMarginBottom + (binding.fab?.height ?: 0))
|
||||
}
|
||||
|
||||
fab.setOnClickListener {
|
||||
binding.fab.setOnClickListener {
|
||||
if (dialog?.isShowing != true) {
|
||||
dialog = MigrationBottomSheetDialog(activity!!, R.style.SheetDialog, this)
|
||||
dialog?.show()
|
||||
|
@ -20,6 +20,7 @@ import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.databinding.MigrationListControllerBinding
|
||||
import eu.kanade.tachiyomi.smartsearch.SmartSearchEngine
|
||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
@ -41,7 +42,6 @@ import exh.util.await
|
||||
import exh.util.executeOnIO
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
import kotlinx.android.synthetic.main.chapters_controller.*
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@ -56,7 +56,7 @@ import rx.schedulers.Schedulers
|
||||
import timber.log.Timber
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
|
||||
class MigrationListController(bundle: Bundle? = null) : BaseController<MigrationListControllerBinding>(bundle),
|
||||
MigrationProcessAdapter.MigrationProcessInterface, CoroutineScope {
|
||||
|
||||
init {
|
||||
@ -82,7 +82,8 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
|
||||
private var manaulMigrations = 0
|
||||
|
||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||
return inflater.inflate(R.layout.migration_list_controller, container, false)
|
||||
binding = MigrationListControllerBinding.inflate(inflater)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun getTitle(): String? {
|
||||
@ -108,10 +109,10 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
|
||||
|
||||
adapter = MigrationProcessAdapter(this)
|
||||
|
||||
recycler.adapter = adapter
|
||||
recycler.layoutManager = LinearLayoutManager(view.context)
|
||||
recycler.setHasFixedSize(true)
|
||||
recycler.setOnApplyWindowInsetsListener(RecyclerWindowInsetsListener)
|
||||
binding.recycler.adapter = adapter
|
||||
binding.recycler.layoutManager = LinearLayoutManager(view.context)
|
||||
binding.recycler.setHasFixedSize(true)
|
||||
binding.recycler.setOnApplyWindowInsetsListener(RecyclerWindowInsetsListener)
|
||||
|
||||
adapter?.updateDataSet(newMigratingManga.map { it.toModal() })
|
||||
|
||||
|
@ -6,7 +6,6 @@ import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.database.models.MangaCategory
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.ui.migration.MigrationFlags
|
||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@ -97,7 +96,7 @@ class MigrationProcessAdapter(
|
||||
replace: Boolean
|
||||
) {
|
||||
if (controller.config == null) return
|
||||
val flags = preferences.migrateFlags().getOrDefault()
|
||||
val flags = preferences.migrateFlags().get()
|
||||
// Update chapters read
|
||||
if (MigrationFlags.hasChapters(flags)) {
|
||||
val prevMangaChapters = db.getChapters(prevManga).executeAsBlocking()
|
||||
|
@ -48,12 +48,6 @@ class SettingsAdvancedController : SettingsController() {
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
|
||||
titleRes = R.string.pref_category_advanced
|
||||
|
||||
switchPreference {
|
||||
key = "acra.enable"
|
||||
titleRes = R.string.pref_enable_acra
|
||||
summaryRes = R.string.pref_acra_summary
|
||||
defaultValue = true
|
||||
}
|
||||
preference {
|
||||
key = CLEAR_CACHE_KEY
|
||||
titleRes = R.string.pref_clear_chapter_cache
|
||||
|
@ -4,7 +4,7 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.databinding.SmartSearchBinding
|
||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||
@ -13,7 +13,6 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||
import eu.kanade.tachiyomi.ui.source.SourceController
|
||||
import eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import kotlinx.android.synthetic.main.smart_search.appbar
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
@ -23,7 +22,7 @@ import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class SmartSearchController(bundle: Bundle? = null) : NucleusController<SmartSearchPresenter>(), CoroutineScope {
|
||||
class SmartSearchController(bundle: Bundle? = null) : NucleusController<SmartSearchBinding, SmartSearchPresenter>(), CoroutineScope {
|
||||
override val coroutineContext = Job() + Dispatchers.Main
|
||||
|
||||
private val sourceManager: SourceManager by injectLazy()
|
||||
@ -33,8 +32,10 @@ class SmartSearchController(bundle: Bundle? = null) : NucleusController<SmartSea
|
||||
ARG_SMART_SEARCH_CONFIG
|
||||
)
|
||||
|
||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup) =
|
||||
inflater.inflate(R.layout.smart_search, container, false)!!
|
||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||
binding = SmartSearchBinding.inflate(inflater)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun getTitle() = source?.name ?: ""
|
||||
|
||||
@ -43,7 +44,7 @@ class SmartSearchController(bundle: Bundle? = null) : NucleusController<SmartSea
|
||||
override fun onViewCreated(view: View) {
|
||||
super.onViewCreated(view)
|
||||
|
||||
appbar.bringToFront()
|
||||
binding.appbar.bringToFront()
|
||||
|
||||
if (source == null || smartSearchConfig == null) {
|
||||
router.popCurrentController()
|
||||
|
@ -11,7 +11,6 @@ import com.ms_square.debugoverlay.OverlayModule
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
@ -58,7 +57,7 @@ class EHDebugModeOverlay(private val context: Context) : OverlayModule<String>(n
|
||||
<b>Version code:</b> ${BuildConfig.VERSION_CODE}<br>
|
||||
<b>Commit SHA:</b> ${BuildConfig.COMMIT_SHA}<br>
|
||||
<b>Log level:</b> ${EHLogLevel.currentLogLevel.name.toLowerCase()}<br>
|
||||
<b>Source blacklist:</b> ${prefs.eh_enableSourceBlacklist().getOrDefault().asEnabledString()}
|
||||
<b>Source blacklist:</b> ${prefs.eh_enableSourceBlacklist().get().asEnabledString()}
|
||||
""".trimIndent()
|
||||
|
||||
private fun Boolean.asEnabledString() = if (this) "enabled" else "disabled"
|
||||
|
@ -5,7 +5,6 @@ import android.os.Bundle
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.bluelinelabs.conductor.Router
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
@ -32,7 +31,7 @@ class WarnConfigureDialogController : DialogController() {
|
||||
|
||||
companion object {
|
||||
fun uploadSettings(router: Router) {
|
||||
if (Injekt.get<PreferencesHelper>().eh_showSettingsUploadWarning().getOrDefault())
|
||||
if (Injekt.get<PreferencesHelper>().eh_showSettingsUploadWarning().get())
|
||||
WarnConfigureDialogController().showDialog(router)
|
||||
else
|
||||
ConfiguringDialogController().showDialog(router)
|
||||
|
@ -5,6 +5,7 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import eu.kanade.tachiyomi.ui.base.controller.BaseController
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@ -12,7 +13,7 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.cancel
|
||||
|
||||
abstract class BaseExhController(bundle: Bundle? = null) : BaseController(bundle), CoroutineScope {
|
||||
abstract class BaseExhController<VB : ViewBinding>(bundle: Bundle? = null) : BaseController<VB>(bundle), CoroutineScope {
|
||||
abstract val layoutId: Int
|
||||
@LayoutRes get
|
||||
|
||||
|
@ -5,29 +5,26 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.jakewharton.rxbinding.view.clicks
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.databinding.EhFragmentBatchAddBinding
|
||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||
import eu.kanade.tachiyomi.util.lang.combineLatest
|
||||
import eu.kanade.tachiyomi.util.lang.launchInUI
|
||||
import eu.kanade.tachiyomi.util.lang.plusAssign
|
||||
import kotlinx.android.synthetic.main.eh_fragment_batch_add.view.btn_add_galleries
|
||||
import kotlinx.android.synthetic.main.eh_fragment_batch_add.view.galleries_box
|
||||
import kotlinx.android.synthetic.main.eh_fragment_batch_add.view.input_title_view
|
||||
import kotlinx.android.synthetic.main.eh_fragment_batch_add.view.progress_bar
|
||||
import kotlinx.android.synthetic.main.eh_fragment_batch_add.view.progress_dismiss_btn
|
||||
import kotlinx.android.synthetic.main.eh_fragment_batch_add.view.progress_log
|
||||
import kotlinx.android.synthetic.main.eh_fragment_batch_add.view.progress_log_wrapper
|
||||
import kotlinx.android.synthetic.main.eh_fragment_batch_add.view.progress_text
|
||||
import kotlinx.android.synthetic.main.eh_fragment_batch_add.view.progress_title_view
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import reactivecircus.flowbinding.android.view.clicks
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.subscriptions.CompositeSubscription
|
||||
|
||||
/**
|
||||
* Batch add screen
|
||||
*/
|
||||
class BatchAddController : NucleusController<BatchAddPresenter>() {
|
||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup) =
|
||||
inflater.inflate(R.layout.eh_fragment_batch_add, container, false)!!
|
||||
class BatchAddController : NucleusController<EhFragmentBatchAddBinding, BatchAddPresenter>() {
|
||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||
binding = EhFragmentBatchAddBinding.inflate(inflater)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun getTitle() = "Batch add"
|
||||
|
||||
@ -37,13 +34,17 @@ class BatchAddController : NucleusController<BatchAddPresenter>() {
|
||||
super.onViewCreated(view)
|
||||
|
||||
with(view) {
|
||||
btn_add_galleries.clicks().subscribeUntilDestroy {
|
||||
addGalleries(galleries_box.text.toString())
|
||||
}
|
||||
binding.btnAddGalleries.clicks()
|
||||
.onEach {
|
||||
addGalleries(binding.galleriesBox.text.toString())
|
||||
}
|
||||
.launchInUI()
|
||||
|
||||
progress_dismiss_btn.clicks().subscribeUntilDestroy {
|
||||
presenter.currentlyAddingRelay.call(BatchAddPresenter.STATE_PROGRESS_TO_INPUT)
|
||||
}
|
||||
binding.progressDismissBtn.clicks()
|
||||
.onEach {
|
||||
presenter.currentlyAddingRelay.call(BatchAddPresenter.STATE_PROGRESS_TO_INPUT)
|
||||
}
|
||||
.launchInUI()
|
||||
|
||||
val progressSubscriptions = CompositeSubscription()
|
||||
|
||||
@ -55,34 +56,34 @@ class BatchAddController : NucleusController<BatchAddPresenter>() {
|
||||
showProgress(this)
|
||||
progressSubscriptions += presenter.progressRelay
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.combineLatest(presenter.progressTotalRelay, { progress, total ->
|
||||
.combineLatest(presenter.progressTotalRelay) { progress, total ->
|
||||
// Show hide dismiss button
|
||||
progress_dismiss_btn.visibility =
|
||||
if (progress == total)
|
||||
View.VISIBLE
|
||||
else View.GONE
|
||||
binding.progressDismissBtn.visibility =
|
||||
if (progress == total)
|
||||
View.VISIBLE
|
||||
else View.GONE
|
||||
|
||||
formatProgress(progress, total)
|
||||
}).subscribeUntilDestroy {
|
||||
progress_text.text = it
|
||||
}.subscribeUntilDestroy {
|
||||
binding.progressText.text = it
|
||||
}
|
||||
|
||||
progressSubscriptions += presenter.progressTotalRelay
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeUntilDestroy {
|
||||
progress_bar.max = it
|
||||
binding.progressBar.max = it
|
||||
}
|
||||
|
||||
progressSubscriptions += presenter.progressRelay
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribeUntilDestroy {
|
||||
progress_bar.progress = it
|
||||
binding.progressBar.progress = it
|
||||
}
|
||||
|
||||
presenter.eventRelay
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribeUntilDestroy {
|
||||
progress_log.append("$it\n")
|
||||
binding.progressLog.append("$it\n")
|
||||
}?.let {
|
||||
progressSubscriptions += it
|
||||
}
|
||||
@ -96,18 +97,18 @@ class BatchAddController : NucleusController<BatchAddPresenter>() {
|
||||
|
||||
private val View.progressViews
|
||||
get() = listOf(
|
||||
progress_title_view,
|
||||
progress_log_wrapper,
|
||||
progress_bar,
|
||||
progress_text,
|
||||
progress_dismiss_btn
|
||||
binding.progressTitleView,
|
||||
binding.progressLogWrapper,
|
||||
binding.progressBar,
|
||||
binding.progressText,
|
||||
binding.progressDismissBtn
|
||||
)
|
||||
|
||||
private val View.inputViews
|
||||
get() = listOf(
|
||||
input_title_view,
|
||||
galleries_box,
|
||||
btn_add_galleries
|
||||
binding.inputTitleView,
|
||||
binding.galleriesBox,
|
||||
binding.btnAddGalleries
|
||||
)
|
||||
|
||||
private var List<View>.visibility: Int
|
||||
|
@ -5,28 +5,28 @@ import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.databinding.EhActivityInterceptBinding
|
||||
import eu.kanade.tachiyomi.ui.base.activity.BaseRxActivity
|
||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||
import eu.kanade.tachiyomi.util.view.gone
|
||||
import eu.kanade.tachiyomi.util.view.visible
|
||||
import kotlinx.android.synthetic.main.eh_activity_intercept.intercept_progress
|
||||
import kotlinx.android.synthetic.main.eh_activity_intercept.intercept_status
|
||||
import kotlinx.android.synthetic.main.eh_activity_intercept.toolbar
|
||||
import nucleus.factory.RequiresPresenter
|
||||
import rx.Subscription
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
|
||||
@RequiresPresenter(InterceptActivityPresenter::class)
|
||||
class InterceptActivity : BaseRxActivity<InterceptActivityPresenter>() {
|
||||
class InterceptActivity : BaseRxActivity<EhActivityInterceptBinding, InterceptActivityPresenter>() {
|
||||
private var statusSubscription: Subscription? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.eh_activity_intercept)
|
||||
|
||||
binding = EhActivityInterceptBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
// Show back button
|
||||
setSupportActionBar(toolbar)
|
||||
setSupportActionBar(binding.toolbar)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
|
||||
processLink()
|
||||
@ -34,8 +34,8 @@ class InterceptActivity : BaseRxActivity<InterceptActivityPresenter>() {
|
||||
|
||||
private fun processLink() {
|
||||
if (Intent.ACTION_VIEW == intent.action) {
|
||||
intercept_progress.visible()
|
||||
intercept_status.text = "Loading gallery..."
|
||||
binding.interceptProgress.visible()
|
||||
binding.interceptStatus.text = "Loading gallery..."
|
||||
presenter.loadGallery(intent.dataString)
|
||||
}
|
||||
}
|
||||
@ -56,8 +56,8 @@ class InterceptActivity : BaseRxActivity<InterceptActivityPresenter>() {
|
||||
.subscribe {
|
||||
when (it) {
|
||||
is InterceptResult.Success -> {
|
||||
intercept_progress.gone()
|
||||
intercept_status.text = "Launching app..."
|
||||
binding.interceptProgress.gone()
|
||||
binding.interceptStatus.text = "Launching app..."
|
||||
onBackPressed()
|
||||
startActivity(Intent(this, MainActivity::class.java)
|
||||
.setAction(MainActivity.SHORTCUT_MANGA)
|
||||
@ -65,8 +65,8 @@ class InterceptActivity : BaseRxActivity<InterceptActivityPresenter>() {
|
||||
.putExtra(MangaController.MANGA_EXTRA, it.mangaId))
|
||||
}
|
||||
is InterceptResult.Failure -> {
|
||||
intercept_progress.gone()
|
||||
intercept_status.text = "Error: ${it.reason}"
|
||||
binding.interceptProgress.gone()
|
||||
binding.interceptStatus.text = "Error: ${it.reason}"
|
||||
MaterialDialog.Builder(this)
|
||||
.title("Error")
|
||||
.content("Could not open this gallery:\n\n${it.reason}")
|
||||
|
@ -6,11 +6,17 @@ import com.bluelinelabs.conductor.Router
|
||||
import com.bluelinelabs.conductor.RouterTransaction
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
object LockActivityDelegate {
|
||||
private val preferences by injectLazy<PreferencesHelper>()
|
||||
|
||||
val uiScope = CoroutineScope(Dispatchers.Main)
|
||||
|
||||
var willLock: Boolean = true
|
||||
|
||||
fun doLock(router: Router, animate: Boolean = false) {
|
||||
@ -19,14 +25,15 @@ object LockActivityDelegate {
|
||||
}
|
||||
|
||||
fun onCreate(activity: FragmentActivity) {
|
||||
preferences.secureScreen().asObservable()
|
||||
.subscribe {
|
||||
preferences.secureScreen().asFlow()
|
||||
.onEach {
|
||||
if (it) {
|
||||
activity.window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
|
||||
} else {
|
||||
activity.window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
||||
}
|
||||
}
|
||||
.launchIn(uiScope)
|
||||
}
|
||||
|
||||
fun onResume(activity: FragmentActivity, router: Router) {
|
||||
|
@ -13,20 +13,20 @@ import com.mattprecious.swirl.SwirlView
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.databinding.ActivityLockBinding
|
||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||
import exh.util.dpToPx
|
||||
import kotlinx.android.synthetic.main.activity_lock.view.indicator_dots
|
||||
import kotlinx.android.synthetic.main.activity_lock.view.pin_lock_view
|
||||
import kotlinx.android.synthetic.main.activity_lock.view.swirl_container
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class LockController : NucleusController<LockPresenter>() {
|
||||
class LockController : NucleusController<ActivityLockBinding, LockPresenter>() {
|
||||
|
||||
val prefs: PreferencesHelper by injectLazy()
|
||||
|
||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup) =
|
||||
inflater.inflate(R.layout.activity_lock, container, false)!!
|
||||
|
||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||
binding = ActivityLockBinding.inflate(inflater)
|
||||
return binding.root
|
||||
}
|
||||
override fun createPresenter() = LockPresenter()
|
||||
|
||||
override fun getTitle() = "Application locked"
|
||||
@ -41,10 +41,10 @@ class LockController : NucleusController<LockPresenter>() {
|
||||
|
||||
with(view) {
|
||||
// Setup pin lock
|
||||
pin_lock_view.attachIndicatorDots(indicator_dots)
|
||||
binding.pinLockView.attachIndicatorDots(binding.indicatorDots)
|
||||
|
||||
pin_lock_view.pinLength = prefs.eh_lockLength().getOrDefault()
|
||||
pin_lock_view.setPinLockListener(object : PinLockListener {
|
||||
binding.pinLockView.pinLength = prefs.eh_lockLength().getOrDefault()
|
||||
binding.pinLockView.setPinLockListener(object : PinLockListener {
|
||||
override fun onEmpty() {}
|
||||
|
||||
override fun onComplete(pin: String) {
|
||||
@ -60,7 +60,7 @@ class LockController : NucleusController<LockPresenter>() {
|
||||
.positiveText("Ok")
|
||||
.autoDismiss(true)
|
||||
.show()
|
||||
pin_lock_view.resetPinLockView()
|
||||
binding.pinLockView.resetPinLockView()
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,8 +76,8 @@ class LockController : NucleusController<LockPresenter>() {
|
||||
with(view) {
|
||||
// Fingerprint
|
||||
if (presenter.useFingerprint) {
|
||||
swirl_container.visibility = View.VISIBLE
|
||||
swirl_container.removeAllViews()
|
||||
binding.swirlContainer.visibility = View.VISIBLE
|
||||
binding.swirlContainer.removeAllViews()
|
||||
val icon = SwirlView(context).apply {
|
||||
val size = dpToPx(context, 60)
|
||||
layoutParams = (layoutParams ?: ViewGroup.LayoutParams(
|
||||
@ -97,7 +97,7 @@ class LockController : NucleusController<LockPresenter>() {
|
||||
this@with.swirl_container.cardElevation = 0f
|
||||
setState(SwirlView.State.OFF, true)
|
||||
}
|
||||
swirl_container.addView(icon)
|
||||
binding.swirlContainer.addView(icon)
|
||||
icon.setState(SwirlView.State.ON)
|
||||
RxReprint.authenticate()
|
||||
.subscribeUntilDetach {
|
||||
@ -118,7 +118,7 @@ class LockController : NucleusController<LockPresenter>() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
swirl_container.visibility = View.GONE
|
||||
binding.swirlContainer.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ import android.view.ViewGroup
|
||||
import android.webkit.CookieManager
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.databinding.EhActivityLoginBinding
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
||||
@ -17,14 +17,6 @@ import eu.kanade.tachiyomi.util.view.gone
|
||||
import eu.kanade.tachiyomi.util.view.visible
|
||||
import exh.uconfig.WarnConfigureDialogController
|
||||
import java.net.HttpCookie
|
||||
import kotlinx.android.synthetic.main.eh_activity_login.view.advanced_options
|
||||
import kotlinx.android.synthetic.main.eh_activity_login.view.btn_advanced
|
||||
import kotlinx.android.synthetic.main.eh_activity_login.view.btn_alt_login
|
||||
import kotlinx.android.synthetic.main.eh_activity_login.view.btn_cancel
|
||||
import kotlinx.android.synthetic.main.eh_activity_login.view.btn_close
|
||||
import kotlinx.android.synthetic.main.eh_activity_login.view.btn_recheck
|
||||
import kotlinx.android.synthetic.main.eh_activity_login.view.btn_skip_restyle
|
||||
import kotlinx.android.synthetic.main.eh_activity_login.view.webview
|
||||
import timber.log.Timber
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
@ -32,7 +24,7 @@ import uy.kohesive.injekt.injectLazy
|
||||
* LoginController
|
||||
*/
|
||||
|
||||
class LoginController : NucleusController<LoginPresenter>() {
|
||||
class LoginController : NucleusController<EhActivityLoginBinding, LoginPresenter>() {
|
||||
val preferenceManager: PreferencesHelper by injectLazy()
|
||||
|
||||
val sourceManager: SourceManager by injectLazy()
|
||||
@ -41,39 +33,41 @@ class LoginController : NucleusController<LoginPresenter>() {
|
||||
|
||||
override fun createPresenter() = LoginPresenter()
|
||||
|
||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup) =
|
||||
inflater.inflate(R.layout.eh_activity_login, container, false)!!
|
||||
override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View {
|
||||
binding = EhActivityLoginBinding.inflate(inflater)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View) {
|
||||
super.onViewCreated(view)
|
||||
|
||||
with(view) {
|
||||
btn_cancel.setOnClickListener { router.popCurrentController() }
|
||||
binding.btnCancel.setOnClickListener { router.popCurrentController() }
|
||||
|
||||
btn_advanced.setOnClickListener {
|
||||
advanced_options.visible()
|
||||
webview.gone()
|
||||
btn_advanced.isEnabled = false
|
||||
btn_cancel.isEnabled = false
|
||||
binding.btnAdvanced.setOnClickListener {
|
||||
binding.advancedOptions.visible()
|
||||
binding.webview.gone()
|
||||
binding.btnAdvanced.isEnabled = false
|
||||
binding.btnCancel.isEnabled = false
|
||||
}
|
||||
|
||||
btn_close.setOnClickListener {
|
||||
binding.btnClose.setOnClickListener {
|
||||
hideAdvancedOptions(this)
|
||||
}
|
||||
|
||||
btn_recheck.setOnClickListener {
|
||||
binding.btnRecheck.setOnClickListener {
|
||||
hideAdvancedOptions(this)
|
||||
webview.loadUrl("https://exhentai.org/")
|
||||
binding.webview.loadUrl("https://exhentai.org/")
|
||||
}
|
||||
|
||||
btn_alt_login.setOnClickListener {
|
||||
binding.btnAltLogin.setOnClickListener {
|
||||
hideAdvancedOptions(this)
|
||||
webview.loadUrl("https://e-hentai.org/bounce_login.php")
|
||||
binding.webview.loadUrl("https://e-hentai.org/bounce_login.php")
|
||||
}
|
||||
|
||||
btn_skip_restyle.setOnClickListener {
|
||||
binding.btnSkipRestyle.setOnClickListener {
|
||||
hideAdvancedOptions(this)
|
||||
webview.loadUrl("https://forums.e-hentai.org/index.php?act=Login&$PARAM_SKIP_INJECT=true")
|
||||
binding.webview.loadUrl("https://forums.e-hentai.org/index.php?act=Login&$PARAM_SKIP_INJECT=true")
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
@ -91,29 +85,28 @@ class LoginController : NucleusController<LoginPresenter>() {
|
||||
|
||||
private fun hideAdvancedOptions(view: View) {
|
||||
with(view) {
|
||||
advanced_options.gone()
|
||||
webview.visible()
|
||||
btn_advanced.isEnabled = true
|
||||
btn_cancel.isEnabled = true
|
||||
binding.advancedOptions.gone()
|
||||
binding.webview.visible()
|
||||
binding.btnAdvanced.isEnabled = true
|
||||
binding.btnCancel.isEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
fun startWebview(view: View) {
|
||||
with(view) {
|
||||
webview.settings.javaScriptEnabled = true
|
||||
webview.settings.domStorageEnabled = true
|
||||
binding.webview.settings.javaScriptEnabled = true
|
||||
binding.webview.settings.domStorageEnabled = true
|
||||
|
||||
webview.loadUrl("https://forums.e-hentai.org/index.php?act=Login")
|
||||
binding.webview.loadUrl("https://forums.e-hentai.org/index.php?act=Login")
|
||||
|
||||
webview.webViewClient = object : WebViewClient() {
|
||||
binding.webview.webViewClient = object : WebViewClient() {
|
||||
override fun onPageFinished(view: WebView, url: String) {
|
||||
super.onPageFinished(view, url)
|
||||
Timber.d(url)
|
||||
val parsedUrl = Uri.parse(url)
|
||||
if (parsedUrl.host.equals("forums.e-hentai.org", ignoreCase = true)) {
|
||||
// Hide distracting content
|
||||
if (!parsedUrl.queryParameterNames.contains(PARAM_SKIP_INJECT) &&
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
|
||||
if (!parsedUrl.queryParameterNames.contains(PARAM_SKIP_INJECT))
|
||||
view.evaluateJavascript(HIDE_JS, null)
|
||||
|
||||
// Check login result
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 60 KiB |
@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?selectable_library_drawable">
|
||||
android:background="@drawable/library_item_selector">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/card"
|
||||
@ -42,7 +42,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/manga_chapters"
|
||||
style="@style/TextAppearance.Regular.Caption.Light"
|
||||
style="@style/TextAppearance.Regular.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/md_teal_500"
|
||||
@ -60,7 +60,7 @@
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/title"
|
||||
style="@style/TextAppearance.Regular.Body1.Light"
|
||||
style="@style/TextAppearance.Regular.Body1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
|
@ -309,16 +309,6 @@
|
||||
|
||||
<style name="FilePickerAlertDialogTheme" parent="Theme.MaterialComponents.Light.Dialog.Alert" />
|
||||
|
||||
<style name="reader_settings_popup_animation">
|
||||
<item name="android:windowEnterAnimation">@anim/enter_from_right</item>
|
||||
<item name="android:windowExitAnimation">@anim/exit_to_right</item>
|
||||
</style>
|
||||
|
||||
<style name="reader_brightness_popup_animation">
|
||||
<item name="android:windowEnterAnimation">@anim/enter_from_left</item>
|
||||
<item name="android:windowExitAnimation">@anim/exit_to_left</item>
|
||||
</style>
|
||||
|
||||
<style name="SheetDialog" parent="Theme.Design.Light.BottomSheetDialog">
|
||||
<!--<item name="android:windowCloseOnTouchOutside">false</item>-->
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user