mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 06:17:57 +01:00 
			
		
		
		
	Add logo header in more section
This commit is contained in:
		| @@ -1,14 +1,19 @@ | ||||
| package eu.kanade.tachiyomi.ui.more | ||||
|  | ||||
| import android.content.Context | ||||
| import android.util.AttributeSet | ||||
| import androidx.preference.Preference | ||||
| import androidx.preference.PreferenceScreen | ||||
| import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys | ||||
| import eu.kanade.tachiyomi.ui.base.controller.NoToolbarElevationController | ||||
| import eu.kanade.tachiyomi.ui.base.controller.RootController | ||||
| import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction | ||||
| import eu.kanade.tachiyomi.ui.download.DownloadController | ||||
| import eu.kanade.tachiyomi.ui.migration.MigrationController | ||||
| import eu.kanade.tachiyomi.ui.setting.SettingsController | ||||
| import eu.kanade.tachiyomi.ui.setting.SettingsMainController | ||||
| import eu.kanade.tachiyomi.util.preference.add | ||||
| import eu.kanade.tachiyomi.util.preference.iconRes | ||||
| import eu.kanade.tachiyomi.util.preference.iconTint | ||||
| import eu.kanade.tachiyomi.util.preference.onClick | ||||
| @@ -21,13 +26,18 @@ import eu.kanade.tachiyomi.util.system.getResourceColor | ||||
| import eu.kanade.tachiyomi.util.system.openInBrowser | ||||
| import uy.kohesive.injekt.api.get | ||||
|  | ||||
| class MoreController : SettingsController(), RootController { | ||||
| class MoreController : | ||||
|     SettingsController(), | ||||
|     RootController, | ||||
|     NoToolbarElevationController { | ||||
|  | ||||
|     override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) { | ||||
|         titleRes = R.string.label_more | ||||
|  | ||||
|         val tintColor = context.getResourceColor(R.attr.colorAccent) | ||||
|  | ||||
|         add(MoreHeaderPreference(context)) | ||||
|  | ||||
|         switchPreference { | ||||
|             key = Keys.downloadedOnly | ||||
|             titleRes = R.string.label_downloaded_only | ||||
| @@ -83,6 +93,15 @@ class MoreController : SettingsController(), RootController { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private class MoreHeaderPreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : | ||||
|         Preference(context, attrs) { | ||||
|  | ||||
|         init { | ||||
|             layoutResource = R.layout.pref_more_header | ||||
|             isSelectable = false | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     companion object { | ||||
|         private const val URL_HELP = "https://tachiyomi.org/help/" | ||||
|     } | ||||
|   | ||||
| @@ -72,6 +72,13 @@ fun initDialog(dialogPreference: DialogPreference) { | ||||
|     } | ||||
| } | ||||
|  | ||||
| inline fun <P : Preference> PreferenceGroup.add(p: P): P { | ||||
|     return p.apply { | ||||
|         this.isIconSpaceReserved = false | ||||
|         addPreference(this) | ||||
|     } | ||||
| } | ||||
|  | ||||
| inline fun <P : Preference> PreferenceGroup.initThenAdd(p: P, block: P.() -> Unit): P { | ||||
|     return p.apply { | ||||
|         block() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user