Add icons for settings
Cette révision appartient à :
Parent
5fe1799dab
révision
e198f7e671
8 fichiers modifiés avec 85 ajouts et 0 suppressions
|
@ -229,6 +229,7 @@ class CataloguePresenter : BasePresenter<CatalogueFragment>() {
|
|||
source.fetchSearchManga(nextMangasPage, query)
|
||||
|
||||
return observable.subscribeOn(Schedulers.io())
|
||||
.doOnNext { if (it.mangas.isEmpty()) throw Exception("Empty page") }
|
||||
.doOnNext { lastMangasPage = it }
|
||||
.flatMap { Observable.from(it.mangas) }
|
||||
.map { networkToLocalManga(it) }
|
||||
|
|
|
@ -2,10 +2,14 @@ package eu.kanade.tachiyomi.ui.setting
|
|||
|
||||
import android.os.Bundle
|
||||
import android.support.annotation.CallSuper
|
||||
import android.support.graphics.drawable.VectorDrawableCompat
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.support.v7.preference.XpPreferenceFragment
|
||||
import android.view.View
|
||||
import eu.kanade.tachiyomi.R
|
||||
import net.xpece.android.support.preference.PreferenceIconHelper
|
||||
import net.xpece.android.support.preference.PreferenceScreenNavigationStrategy
|
||||
import net.xpece.android.support.preference.Util
|
||||
import rx.subscriptions.CompositeSubscription
|
||||
|
||||
open class SettingsFragment : XpPreferenceFragment() {
|
||||
|
@ -20,6 +24,10 @@ open class SettingsFragment : XpPreferenceFragment() {
|
|||
|
||||
lateinit var subscriptions: CompositeSubscription
|
||||
|
||||
private val iconTint by lazy { ContextCompat.getColorStateList(
|
||||
context, Util.resolveResourceId(context, R.attr.colorAccent, 0))
|
||||
}
|
||||
|
||||
override final fun onCreatePreferences2(savedState: Bundle?, rootKey: String?) {
|
||||
subscriptions = CompositeSubscription()
|
||||
|
||||
|
@ -31,6 +39,18 @@ open class SettingsFragment : XpPreferenceFragment() {
|
|||
addPreferencesFromResource(R.xml.pref_advanced)
|
||||
addPreferencesFromResource(R.xml.pref_about)
|
||||
|
||||
// Add an icon to each subscreen
|
||||
for ((screen, drawable) in getSubscreenIcons()) {
|
||||
val icon = VectorDrawableCompat.create(resources, drawable, context.theme) ?: continue
|
||||
|
||||
PreferenceIconHelper(findPreference(screen)).apply {
|
||||
isIconPaddingEnabled = true
|
||||
setIcon(icon)
|
||||
tintList = iconTint
|
||||
isIconTintEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
// Setup root preference title.
|
||||
preferenceScreen.title = activity.title
|
||||
|
||||
|
@ -52,4 +72,14 @@ open class SettingsFragment : XpPreferenceFragment() {
|
|||
super.onDestroyView()
|
||||
}
|
||||
|
||||
private fun getSubscreenIcons() = listOf(
|
||||
"general_screen" to R.drawable.ic_tune_black_24dp,
|
||||
"reader_screen" to R.drawable.ic_chrome_reader_mode_black_24dp,
|
||||
"downloads_screen" to R.drawable.ic_file_download_black_24dp,
|
||||
"sources_screen" to R.drawable.ic_language_black_24dp,
|
||||
"sync_screen" to R.drawable.ic_sync_black_24dp,
|
||||
"advanced_screen" to R.drawable.ic_code_black_24dp,
|
||||
"about_screen" to R.drawable.ic_help_black_24dp
|
||||
)
|
||||
|
||||
}
|
9
app/src/main/res/drawable/ic_chrome_reader_mode_black_24dp.xml
Fichier normal
9
app/src/main/res/drawable/ic_chrome_reader_mode_black_24dp.xml
Fichier normal
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M13,12h7v1.5h-7zM13,9.5h7L20,11h-7zM13,14.5h7L20,16h-7zM21,4L3,4c-1.1,0 -2,0.9 -2,2v13c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2L23,6c0,-1.1 -0.9,-2 -2,-2zM21,19h-9L12,6h9v13z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_code_black_24dp.xml
Fichier normal
9
app/src/main/res/drawable/ic_code_black_24dp.xml
Fichier normal
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M9.4,16.6L4.8,12l4.6,-4.6L8,6l-6,6 6,6 1.4,-1.4zM14.6,16.6l4.6,-4.6 -4.6,-4.6L16,6l6,6 -6,6 -1.4,-1.4z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_help_black_24dp.xml
Fichier normal
9
app/src/main/res/drawable/ic_help_black_24dp.xml
Fichier normal
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,19h-2v-2h2v2zM15.07,11.25l-0.9,0.92C13.45,12.9 13,13.5 13,15h-2v-0.5c0,-1.1 0.45,-2.1 1.17,-2.83l1.24,-1.26c0.37,-0.36 0.59,-0.86 0.59,-1.41 0,-1.1 -0.9,-2 -2,-2s-2,0.9 -2,2L8,9c0,-2.21 1.79,-4 4,-4s4,1.79 4,4c0,0.88 -0.36,1.68 -0.93,2.25z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_language_black_24dp.xml
Fichier normal
9
app/src/main/res/drawable/ic_language_black_24dp.xml
Fichier normal
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM18.92,8h-2.95c-0.32,-1.25 -0.78,-2.45 -1.38,-3.56 1.84,0.63 3.37,1.91 4.33,3.56zM12,4.04c0.83,1.2 1.48,2.53 1.91,3.96h-3.82c0.43,-1.43 1.08,-2.76 1.91,-3.96zM4.26,14C4.1,13.36 4,12.69 4,12s0.1,-1.36 0.26,-2h3.38c-0.08,0.66 -0.14,1.32 -0.14,2 0,0.68 0.06,1.34 0.14,2L4.26,14zM5.08,16h2.95c0.32,1.25 0.78,2.45 1.38,3.56 -1.84,-0.63 -3.37,-1.9 -4.33,-3.56zM8.03,8L5.08,8c0.96,-1.66 2.49,-2.93 4.33,-3.56C8.81,5.55 8.35,6.75 8.03,8zM12,19.96c-0.83,-1.2 -1.48,-2.53 -1.91,-3.96h3.82c-0.43,1.43 -1.08,2.76 -1.91,3.96zM14.34,14L9.66,14c-0.09,-0.66 -0.16,-1.32 -0.16,-2 0,-0.68 0.07,-1.35 0.16,-2h4.68c0.09,0.65 0.16,1.32 0.16,2 0,0.68 -0.07,1.34 -0.16,2zM14.59,19.56c0.6,-1.11 1.06,-2.31 1.38,-3.56h2.95c-0.96,1.65 -2.49,2.93 -4.33,3.56zM16.36,14c0.08,-0.66 0.14,-1.32 0.14,-2 0,-0.68 -0.06,-1.34 -0.14,-2h3.38c0.16,0.64 0.26,1.31 0.26,2s-0.1,1.36 -0.26,2h-3.38z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_sync_black_24dp.xml
Fichier normal
9
app/src/main/res/drawable/ic_sync_black_24dp.xml
Fichier normal
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,4L12,1L8,5l4,4L12,6c3.31,0 6,2.69 6,6 0,1.01 -0.25,1.97 -0.7,2.8l1.46,1.46C19.54,15.03 20,13.57 20,12c0,-4.42 -3.58,-8 -8,-8zM12,18c-3.31,0 -6,-2.69 -6,-6 0,-1.01 0.25,-1.97 0.7,-2.8L5.24,7.74C4.46,8.97 4,10.43 4,12c0,4.42 3.58,8 8,8v3l4,-4 -4,-4v3z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_tune_black_24dp.xml
Fichier normal
9
app/src/main/res/drawable/ic_tune_black_24dp.xml
Fichier normal
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M3,17v2h6v-2L3,17zM3,5v2h10L13,5L3,5zM13,21v-2h8v-2h-8v-2h-2v6h2zM7,9v2L3,11v2h4v2h2L9,9L7,9zM21,13v-2L11,11v2h10zM15,9h2L17,7h4L21,5h-4L17,3h-2v6z"/>
|
||||
</vector>
|
Référencer dans un nouveau ticket