Refactor
This commit is contained in:
@@ -6,7 +6,6 @@ plugins {
|
||||
}
|
||||
|
||||
def gitCommits = 'git rev-list --count HEAD'.execute([], rootDir).text.trim().toInteger()
|
||||
def gitBranch = 'git branch --show-current'.execute([], rootDir).text.trim()
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
@@ -98,5 +97,5 @@ dependencies {
|
||||
releaseImplementation 'com.github.ChuckerTeam.Chucker:library-no-op:3.2.0'
|
||||
|
||||
testImplementation 'junit:junit:4.13'
|
||||
testImplementation 'org.json:json:20190722'
|
||||
testImplementation 'org.json:json:20200518'
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:ignore="UnusedAttribute">
|
||||
<activity android:name=".ui.main.MainActivity">
|
||||
<activity android:name=".ui.list.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
@@ -59,7 +59,7 @@
|
||||
android:theme="@android:style/Theme.DeviceDefault.Dialog"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name=".ui.main.list.favourites.categories.CategoriesActivity"
|
||||
android:name="org.koitharu.kotatsu.ui.list.favourites.categories.CategoriesActivity"
|
||||
android:label="@string/favourites_categories"
|
||||
android:windowSoftInputMode="stateAlwaysHidden" />
|
||||
<activity
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.koitharu.kotatsu.core.model.FavouriteCategory
|
||||
import org.koitharu.kotatsu.core.model.Manga
|
||||
import org.koitharu.kotatsu.core.model.MangaHistory
|
||||
import org.koitharu.kotatsu.ui.common.BaseFragment
|
||||
import org.koitharu.kotatsu.ui.main.list.favourites.categories.select.FavouriteCategoriesDialog
|
||||
import org.koitharu.kotatsu.ui.list.favourites.categories.select.FavouriteCategoriesDialog
|
||||
import org.koitharu.kotatsu.ui.reader.ReaderActivity
|
||||
import org.koitharu.kotatsu.ui.search.MangaSearchSheet
|
||||
import org.koitharu.kotatsu.utils.FileSizeUtils
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list
|
||||
package org.koitharu.kotatsu.ui.list
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
@@ -55,6 +55,9 @@ class ListModeSelectDialog : AlertDialogFragment(R.layout.dialog_list_mode), Vie
|
||||
|
||||
private const val TAG = "ListModeSelectDialog"
|
||||
|
||||
fun show(fm: FragmentManager) = ListModeSelectDialog().show(fm, TAG)
|
||||
fun show(fm: FragmentManager) = ListModeSelectDialog()
|
||||
.show(fm,
|
||||
TAG
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main
|
||||
package org.koitharu.kotatsu.ui.list
|
||||
|
||||
import android.app.ActivityOptions
|
||||
import android.content.SharedPreferences
|
||||
@@ -25,11 +25,11 @@ import org.koitharu.kotatsu.core.prefs.AppSection
|
||||
import org.koitharu.kotatsu.core.prefs.AppSettings
|
||||
import org.koitharu.kotatsu.domain.MangaProviderFactory
|
||||
import org.koitharu.kotatsu.ui.common.BaseActivity
|
||||
import org.koitharu.kotatsu.ui.main.list.favourites.FavouritesContainerFragment
|
||||
import org.koitharu.kotatsu.ui.main.list.history.HistoryListFragment
|
||||
import org.koitharu.kotatsu.ui.main.list.local.LocalListFragment
|
||||
import org.koitharu.kotatsu.ui.main.list.remote.RemoteListFragment
|
||||
import org.koitharu.kotatsu.ui.main.tracklogs.FeedFragment
|
||||
import org.koitharu.kotatsu.ui.list.favourites.FavouritesContainerFragment
|
||||
import org.koitharu.kotatsu.ui.list.history.HistoryListFragment
|
||||
import org.koitharu.kotatsu.ui.list.local.LocalListFragment
|
||||
import org.koitharu.kotatsu.ui.list.remote.RemoteListFragment
|
||||
import org.koitharu.kotatsu.ui.list.tracklogs.FeedFragment
|
||||
import org.koitharu.kotatsu.ui.reader.ReaderActivity
|
||||
import org.koitharu.kotatsu.ui.reader.ReaderState
|
||||
import org.koitharu.kotatsu.ui.settings.AppUpdateService
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main
|
||||
package org.koitharu.kotatsu.ui.list
|
||||
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main
|
||||
package org.koitharu.kotatsu.ui.list
|
||||
|
||||
import moxy.viewstate.strategy.alias.OneExecution
|
||||
import org.koitharu.kotatsu.ui.common.BaseMvpView
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list
|
||||
package org.koitharu.kotatsu.ui.list
|
||||
|
||||
import android.view.ViewGroup
|
||||
import coil.api.clear
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list
|
||||
package org.koitharu.kotatsu.ui.list
|
||||
|
||||
import android.view.ViewGroup
|
||||
import org.koitharu.kotatsu.core.model.Manga
|
||||
@@ -14,7 +14,9 @@ class MangaListAdapter(onItemClickListener: OnRecyclerItemClickListener<Manga>)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup) = when(listMode) {
|
||||
ListMode.LIST -> MangaListHolder(parent)
|
||||
ListMode.DETAILED_LIST -> MangaListDetailsHolder(parent)
|
||||
ListMode.DETAILED_LIST -> MangaListDetailsHolder(
|
||||
parent
|
||||
)
|
||||
ListMode.GRID -> MangaGridHolder(parent)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list
|
||||
package org.koitharu.kotatsu.ui.list
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.ViewGroup
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list
|
||||
package org.koitharu.kotatsu.ui.list
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
@@ -32,12 +32,13 @@ import org.koitharu.kotatsu.ui.common.list.decor.ItemTypeDividerDecoration
|
||||
import org.koitharu.kotatsu.ui.common.list.decor.SectionItemDecoration
|
||||
import org.koitharu.kotatsu.ui.common.list.decor.SpacingItemDecoration
|
||||
import org.koitharu.kotatsu.ui.details.MangaDetailsActivity
|
||||
import org.koitharu.kotatsu.ui.main.list.filter.FilterAdapter
|
||||
import org.koitharu.kotatsu.ui.main.list.filter.OnFilterChangedListener
|
||||
import org.koitharu.kotatsu.ui.list.filter.FilterAdapter
|
||||
import org.koitharu.kotatsu.ui.list.filter.OnFilterChangedListener
|
||||
import org.koitharu.kotatsu.utils.UiUtils
|
||||
import org.koitharu.kotatsu.utils.ext.*
|
||||
|
||||
abstract class MangaListFragment<E> : BaseFragment(R.layout.fragment_list), MangaListView<E>,
|
||||
abstract class MangaListFragment<E> : BaseFragment(R.layout.fragment_list),
|
||||
MangaListView<E>,
|
||||
PaginationScrollListener.Callback, OnRecyclerItemClickListener<Manga>,
|
||||
SharedPreferences.OnSharedPreferenceChangeListener, OnFilterChangedListener,
|
||||
SectionItemDecoration.Callback, SwipeRefreshLayout.OnRefreshListener {
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list
|
||||
package org.koitharu.kotatsu.ui.list
|
||||
|
||||
import android.view.ViewGroup
|
||||
import coil.api.clear
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list
|
||||
package org.koitharu.kotatsu.ui.list
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
@@ -32,7 +32,8 @@ import org.koitharu.kotatsu.ui.details.MangaDetailsActivity
|
||||
import org.koitharu.kotatsu.utils.UiUtils
|
||||
import org.koitharu.kotatsu.utils.ext.*
|
||||
|
||||
abstract class MangaListSheet<E> : BaseBottomSheet(R.layout.sheet_list), MangaListView<E>,
|
||||
abstract class MangaListSheet<E> : BaseBottomSheet(R.layout.sheet_list),
|
||||
MangaListView<E>,
|
||||
PaginationScrollListener.Callback, OnRecyclerItemClickListener<Manga>,
|
||||
SharedPreferences.OnSharedPreferenceChangeListener, Toolbar.OnMenuItemClickListener {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list
|
||||
package org.koitharu.kotatsu.ui.list
|
||||
|
||||
import moxy.viewstate.strategy.AddToEndSingleTagStrategy
|
||||
import moxy.viewstate.strategy.AddToEndStrategy
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.favourites
|
||||
package org.koitharu.kotatsu.ui.list.favourites
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
@@ -14,9 +14,9 @@ import org.koitharu.kotatsu.core.model.FavouriteCategory
|
||||
import org.koitharu.kotatsu.domain.favourites.FavouritesRepository
|
||||
import org.koitharu.kotatsu.domain.favourites.OnFavouritesChangeListener
|
||||
import org.koitharu.kotatsu.ui.common.BaseFragment
|
||||
import org.koitharu.kotatsu.ui.main.list.favourites.categories.CategoriesActivity
|
||||
import org.koitharu.kotatsu.ui.main.list.favourites.categories.FavouriteCategoriesPresenter
|
||||
import org.koitharu.kotatsu.ui.main.list.favourites.categories.FavouriteCategoriesView
|
||||
import org.koitharu.kotatsu.ui.list.favourites.categories.CategoriesActivity
|
||||
import org.koitharu.kotatsu.ui.list.favourites.categories.FavouriteCategoriesPresenter
|
||||
import org.koitharu.kotatsu.ui.list.favourites.categories.FavouriteCategoriesView
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.favourites
|
||||
package org.koitharu.kotatsu.ui.list.favourites
|
||||
|
||||
import kotlinx.android.synthetic.main.fragment_list.*
|
||||
import moxy.ktx.moxyPresenter
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.ui.main.list.MangaListFragment
|
||||
import org.koitharu.kotatsu.ui.main.list.MangaListView
|
||||
import org.koitharu.kotatsu.ui.list.MangaListFragment
|
||||
import org.koitharu.kotatsu.ui.list.MangaListView
|
||||
import org.koitharu.kotatsu.utils.ext.withArgs
|
||||
|
||||
class FavouritesListFragment : MangaListFragment<Unit>(), MangaListView<Unit> {
|
||||
class FavouritesListFragment : MangaListFragment<Unit>(),
|
||||
MangaListView<Unit> {
|
||||
|
||||
private val presenter by moxyPresenter(factory = ::FavouritesListPresenter)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.favourites
|
||||
package org.koitharu.kotatsu.ui.list.favourites
|
||||
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -9,7 +9,7 @@ import moxy.presenterScope
|
||||
import org.koitharu.kotatsu.BuildConfig
|
||||
import org.koitharu.kotatsu.domain.favourites.FavouritesRepository
|
||||
import org.koitharu.kotatsu.ui.common.BasePresenter
|
||||
import org.koitharu.kotatsu.ui.main.list.MangaListView
|
||||
import org.koitharu.kotatsu.ui.list.MangaListView
|
||||
|
||||
@InjectViewState
|
||||
class FavouritesListPresenter : BasePresenter<MangaListView<Unit>>() {
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.favourites
|
||||
package org.koitharu.kotatsu.ui.list.favourites
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.favourites.categories
|
||||
package org.koitharu.kotatsu.ui.list.favourites.categories
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.favourites.categories
|
||||
package org.koitharu.kotatsu.ui.list.favourites.categories
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.MotionEvent
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.favourites.categories
|
||||
package org.koitharu.kotatsu.ui.list.favourites.categories
|
||||
|
||||
import android.view.ViewGroup
|
||||
import kotlinx.android.synthetic.main.item_category.*
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.favourites.categories
|
||||
package org.koitharu.kotatsu.ui.list.favourites.categories
|
||||
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.favourites.categories
|
||||
package org.koitharu.kotatsu.ui.list.favourites.categories
|
||||
|
||||
import moxy.MvpView
|
||||
import moxy.viewstate.strategy.AddToEndSingleStrategy
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.favourites.categories.select
|
||||
package org.koitharu.kotatsu.ui.list.favourites.categories.select
|
||||
|
||||
import android.util.SparseBooleanArray
|
||||
import android.view.ViewGroup
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.favourites.categories.select
|
||||
package org.koitharu.kotatsu.ui.list.favourites.categories.select
|
||||
|
||||
import android.view.ViewGroup
|
||||
import kotlinx.android.synthetic.main.item_category_checkable.*
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.favourites.categories.select
|
||||
package org.koitharu.kotatsu.ui.list.favourites.categories.select
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.InputType
|
||||
@@ -12,8 +12,8 @@ import org.koitharu.kotatsu.core.model.FavouriteCategory
|
||||
import org.koitharu.kotatsu.core.model.Manga
|
||||
import org.koitharu.kotatsu.ui.common.BaseBottomSheet
|
||||
import org.koitharu.kotatsu.ui.common.dialog.TextInputDialog
|
||||
import org.koitharu.kotatsu.ui.main.list.favourites.categories.FavouriteCategoriesPresenter
|
||||
import org.koitharu.kotatsu.ui.main.list.favourites.categories.FavouriteCategoriesView
|
||||
import org.koitharu.kotatsu.ui.list.favourites.categories.FavouriteCategoriesPresenter
|
||||
import org.koitharu.kotatsu.ui.list.favourites.categories.FavouriteCategoriesView
|
||||
import org.koitharu.kotatsu.utils.ext.getDisplayMessage
|
||||
import org.koitharu.kotatsu.utils.ext.withArgs
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.favourites.categories.select
|
||||
package org.koitharu.kotatsu.ui.list.favourites.categories.select
|
||||
|
||||
import org.koitharu.kotatsu.core.model.FavouriteCategory
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.filter
|
||||
package org.koitharu.kotatsu.ui.list.filter
|
||||
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.filter
|
||||
package org.koitharu.kotatsu.ui.list.filter
|
||||
|
||||
import android.view.ViewGroup
|
||||
import kotlinx.android.synthetic.main.item_checkable_single.*
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.filter
|
||||
package org.koitharu.kotatsu.ui.list.filter
|
||||
|
||||
import android.view.ViewGroup
|
||||
import kotlinx.android.synthetic.main.item_checkable_single.*
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.filter
|
||||
package org.koitharu.kotatsu.ui.list.filter
|
||||
|
||||
import org.koitharu.kotatsu.core.model.MangaFilter
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.history
|
||||
package org.koitharu.kotatsu.ui.list.history
|
||||
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
@@ -10,11 +10,12 @@ import moxy.ktx.moxyPresenter
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.core.model.Manga
|
||||
import org.koitharu.kotatsu.core.model.MangaHistory
|
||||
import org.koitharu.kotatsu.ui.main.list.MangaListFragment
|
||||
import org.koitharu.kotatsu.ui.main.list.MangaListView
|
||||
import org.koitharu.kotatsu.ui.list.MangaListFragment
|
||||
import org.koitharu.kotatsu.ui.list.MangaListView
|
||||
import org.koitharu.kotatsu.utils.ext.ellipsize
|
||||
|
||||
class HistoryListFragment : MangaListFragment<MangaHistory>(), MangaListView<MangaHistory> {
|
||||
class HistoryListFragment : MangaListFragment<MangaHistory>(),
|
||||
MangaListView<MangaHistory> {
|
||||
|
||||
private val presenter by moxyPresenter(factory = ::HistoryListPresenter)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.history
|
||||
package org.koitharu.kotatsu.ui.list.history
|
||||
|
||||
import android.os.Build
|
||||
import kotlinx.coroutines.CancellationException
|
||||
@@ -13,7 +13,7 @@ import org.koitharu.kotatsu.core.model.Manga
|
||||
import org.koitharu.kotatsu.core.model.MangaHistory
|
||||
import org.koitharu.kotatsu.domain.history.HistoryRepository
|
||||
import org.koitharu.kotatsu.ui.common.BasePresenter
|
||||
import org.koitharu.kotatsu.ui.main.list.MangaListView
|
||||
import org.koitharu.kotatsu.ui.list.MangaListView
|
||||
import org.koitharu.kotatsu.utils.MangaShortcut
|
||||
|
||||
@InjectViewState
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.local
|
||||
package org.koitharu.kotatsu.ui.list.local
|
||||
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.net.Uri
|
||||
@@ -14,7 +14,7 @@ import moxy.ktx.moxyPresenter
|
||||
import org.koitharu.kotatsu.BuildConfig
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.core.model.Manga
|
||||
import org.koitharu.kotatsu.ui.main.list.MangaListFragment
|
||||
import org.koitharu.kotatsu.ui.list.MangaListFragment
|
||||
import org.koitharu.kotatsu.utils.ext.ellipsize
|
||||
import java.io.File
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.local
|
||||
package org.koitharu.kotatsu.ui.list.local
|
||||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
@@ -19,7 +19,7 @@ import org.koitharu.kotatsu.core.prefs.AppSettings
|
||||
import org.koitharu.kotatsu.domain.MangaProviderFactory
|
||||
import org.koitharu.kotatsu.domain.history.HistoryRepository
|
||||
import org.koitharu.kotatsu.ui.common.BasePresenter
|
||||
import org.koitharu.kotatsu.ui.main.list.MangaListView
|
||||
import org.koitharu.kotatsu.ui.list.MangaListView
|
||||
import org.koitharu.kotatsu.utils.MangaShortcut
|
||||
import org.koitharu.kotatsu.utils.MediaStoreCompat
|
||||
import org.koitharu.kotatsu.utils.ext.safe
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.remote
|
||||
package org.koitharu.kotatsu.ui.list.remote
|
||||
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
@@ -6,7 +6,7 @@ import moxy.ktx.moxyPresenter
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.core.model.MangaFilter
|
||||
import org.koitharu.kotatsu.core.model.MangaSource
|
||||
import org.koitharu.kotatsu.ui.main.list.MangaListFragment
|
||||
import org.koitharu.kotatsu.ui.list.MangaListFragment
|
||||
import org.koitharu.kotatsu.ui.search.SearchHelper
|
||||
import org.koitharu.kotatsu.utils.ext.withArgs
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.list.remote
|
||||
package org.koitharu.kotatsu.ui.list.remote
|
||||
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -11,7 +11,7 @@ import org.koitharu.kotatsu.core.model.MangaFilter
|
||||
import org.koitharu.kotatsu.core.model.MangaSource
|
||||
import org.koitharu.kotatsu.domain.MangaProviderFactory
|
||||
import org.koitharu.kotatsu.ui.common.BasePresenter
|
||||
import org.koitharu.kotatsu.ui.main.list.MangaListView
|
||||
import org.koitharu.kotatsu.ui.list.MangaListView
|
||||
|
||||
@InjectViewState
|
||||
class RemoteListPresenter : BasePresenter<MangaListView<Unit>>() {
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.tracklogs
|
||||
package org.koitharu.kotatsu.ui.list.tracklogs
|
||||
|
||||
import android.view.ViewGroup
|
||||
import org.koitharu.kotatsu.core.model.TrackingLogItem
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.tracklogs
|
||||
package org.koitharu.kotatsu.ui.list.tracklogs
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.tracklogs
|
||||
package org.koitharu.kotatsu.ui.list.tracklogs
|
||||
|
||||
import android.view.ViewGroup
|
||||
import coil.api.clear
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.tracklogs
|
||||
package org.koitharu.kotatsu.ui.list.tracklogs
|
||||
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.koitharu.kotatsu.ui.main.tracklogs
|
||||
package org.koitharu.kotatsu.ui.list.tracklogs
|
||||
|
||||
import moxy.viewstate.strategy.AddToEndSingleTagStrategy
|
||||
import moxy.viewstate.strategy.AddToEndStrategy
|
||||
@@ -6,7 +6,7 @@ import androidx.fragment.app.FragmentManager
|
||||
import moxy.ktx.moxyPresenter
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.core.model.MangaSource
|
||||
import org.koitharu.kotatsu.ui.main.list.MangaListSheet
|
||||
import org.koitharu.kotatsu.ui.list.MangaListSheet
|
||||
import org.koitharu.kotatsu.utils.ext.withArgs
|
||||
|
||||
class MangaSearchSheet : MangaListSheet<Unit>() {
|
||||
|
||||
@@ -2,7 +2,7 @@ package org.koitharu.kotatsu.ui.search
|
||||
|
||||
import moxy.ktx.moxyPresenter
|
||||
import org.koitharu.kotatsu.core.model.MangaSource
|
||||
import org.koitharu.kotatsu.ui.main.list.MangaListFragment
|
||||
import org.koitharu.kotatsu.ui.list.MangaListFragment
|
||||
import org.koitharu.kotatsu.utils.ext.withArgs
|
||||
|
||||
class SearchFragment : MangaListFragment<Unit>() {
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.koitharu.kotatsu.BuildConfig
|
||||
import org.koitharu.kotatsu.core.model.MangaSource
|
||||
import org.koitharu.kotatsu.domain.MangaProviderFactory
|
||||
import org.koitharu.kotatsu.ui.common.BasePresenter
|
||||
import org.koitharu.kotatsu.ui.main.list.MangaListView
|
||||
import org.koitharu.kotatsu.ui.list.MangaListView
|
||||
|
||||
@InjectViewState
|
||||
class SearchPresenter : BasePresenter<MangaListView<Unit>>() {
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.koitharu.kotatsu.core.model.MangaSource
|
||||
import org.koitharu.kotatsu.core.prefs.ListMode
|
||||
import org.koitharu.kotatsu.ui.common.BasePreferenceFragment
|
||||
import org.koitharu.kotatsu.ui.common.dialog.StorageSelectDialog
|
||||
import org.koitharu.kotatsu.ui.main.list.ListModeSelectDialog
|
||||
import org.koitharu.kotatsu.ui.list.ListModeSelectDialog
|
||||
import org.koitharu.kotatsu.ui.settings.utils.MultiSummaryProvider
|
||||
import org.koitharu.kotatsu.ui.tracker.TrackWorker
|
||||
import org.koitharu.kotatsu.utils.ext.getStorageName
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package org.koitharu.kotatsu.ui.settings
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.media.RingtoneManager
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import androidx.preference.Preference
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.ui.common.BasePreferenceFragment
|
||||
import org.koitharu.kotatsu.ui.settings.utils.RingtonePickContract
|
||||
import org.koitharu.kotatsu.utils.ext.toUriOrNull
|
||||
|
||||
class NotificationSettingsLegacyFragment : BasePreferenceFragment(R.string.notifications) {
|
||||
@@ -24,43 +21,15 @@ class NotificationSettingsLegacyFragment : BasePreferenceFragment(R.string.notif
|
||||
override fun onPreferenceTreeClick(preference: Preference?): Boolean {
|
||||
return when (preference?.key) {
|
||||
getString(R.string.key_notifications_sound) -> {
|
||||
val intent = Intent(RingtoneManager.ACTION_RINGTONE_PICKER)
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE,
|
||||
RingtoneManager.TYPE_NOTIFICATION)
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true)
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true)
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
|
||||
Settings.System.DEFAULT_NOTIFICATION_URI)
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, preference.title)
|
||||
val existingValue = settings.notificationSound.toUriOrNull()
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, existingValue)
|
||||
startActivityForResult(intent, REQUEST_RINGTONE)
|
||||
registerForActivityResult(RingtonePickContract(preference.title.toString())) { uri ->
|
||||
settings.notificationSound = uri?.toString().orEmpty()
|
||||
findPreference<Preference>(R.string.key_notifications_sound)?.run {
|
||||
summary = RingtoneManager.getRingtone(context, uri).getTitle(context)
|
||||
}
|
||||
}.launch(settings.notificationSound.toUriOrNull())
|
||||
true
|
||||
}
|
||||
else -> super.onPreferenceTreeClick(preference)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
when (requestCode) {
|
||||
REQUEST_RINGTONE -> {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
val uri =
|
||||
data?.getParcelableExtra<Uri>(RingtoneManager.EXTRA_RINGTONE_PICKED_URI)
|
||||
settings.notificationSound = uri?.toString().orEmpty()
|
||||
findPreference<Preference>(R.string.key_notifications_sound)?.run {
|
||||
summary = RingtoneManager.getRingtone(context, uri).getTitle(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
||||
const val REQUEST_RINGTONE = 340
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.koitharu.kotatsu.ui.settings.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.media.RingtoneManager
|
||||
import android.net.Uri
|
||||
import android.provider.Settings
|
||||
import androidx.activity.result.contract.ActivityResultContract
|
||||
|
||||
class RingtonePickContract(private val title: String?) : ActivityResultContract<Uri?, Uri?>() {
|
||||
|
||||
override fun createIntent(context: Context, input: Uri?): Intent {
|
||||
val intent = Intent(RingtoneManager.ACTION_RINGTONE_PICKER)
|
||||
intent.putExtra(
|
||||
RingtoneManager.EXTRA_RINGTONE_TYPE,
|
||||
RingtoneManager.TYPE_NOTIFICATION
|
||||
)
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true)
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true)
|
||||
intent.putExtra(
|
||||
RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
|
||||
Settings.System.DEFAULT_NOTIFICATION_URI
|
||||
)
|
||||
if (title != null) {
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, title)
|
||||
}
|
||||
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, input)
|
||||
return intent
|
||||
}
|
||||
|
||||
override fun parseResult(resultCode: Int, intent: Intent?): Uri? {
|
||||
return intent?.getParcelableExtra<Uri>(RingtoneManager.EXTRA_RINGTONE_PICKED_URI)
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import kotlinx.android.synthetic.main.activity_crash.*
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.ui.main.MainActivity
|
||||
import org.koitharu.kotatsu.ui.list.MainActivity
|
||||
|
||||
class CrashActivity : Activity(), View.OnClickListener {
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ import org.koitharu.kotatsu.core.model.FavouriteCategory
|
||||
import org.koitharu.kotatsu.core.prefs.AppWidgetConfig
|
||||
import org.koitharu.kotatsu.ui.common.BaseActivity
|
||||
import org.koitharu.kotatsu.ui.common.list.OnRecyclerItemClickListener
|
||||
import org.koitharu.kotatsu.ui.main.list.favourites.categories.FavouriteCategoriesPresenter
|
||||
import org.koitharu.kotatsu.ui.main.list.favourites.categories.FavouriteCategoriesView
|
||||
import org.koitharu.kotatsu.ui.list.favourites.categories.FavouriteCategoriesPresenter
|
||||
import org.koitharu.kotatsu.ui.list.favourites.categories.FavouriteCategoriesView
|
||||
import org.koitharu.kotatsu.utils.ext.getDisplayMessage
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.main.MainActivity"
|
||||
tools:context=".ui.list.MainActivity"
|
||||
tools:openDrawer="start">
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
|
||||
Reference in New Issue
Block a user