package Ġeu . kan ade . t ach iy omi . data . preference Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . SharedPreferences Ċ import Ġandroid . net . Uri Ċ import Ġandroid . os . Build Ċ import Ġandroid . os . Environment Ċ import Ġandroidx . appcompat . app . AppCompat Delegate Ċ import Ġandroidx . core . content . edit Ċ import Ġandroidx . preference . Preference Manager Ċ import Ġcom . f 2 pr ate ek . rx . preferences . Preference Ċ import Ġcom . f 2 pr ate ek . rx . preferences . Rx SharedPreferences Ċ import Ġcom . tf cp or ci unc ula . flow . Flow SharedPreferences Ċ import Ġeu . kan ade . t ach iy omi . Build Config Ċ import Ġeu . kan ade . t ach iy omi . R Ċ import Ġeu . kan ade . t ach iy omi . data . database . models . M anga Ċ import Ġeu . kan ade . t ach iy omi . data . track . Track Service Ċ import Ġeu . kan ade . t ach iy omi . source . Source Ċ import Ġeu . kan ade . t ach iy omi . data . updater . Auto Updater Job Ċ import Ġeu . kan ade . t ach iy omi . ui . library . filter . Filter Bottom Sheet Ċ import Ġeu . kan ade . t ach iy omi . ui . reader . settings . Orientation Type Ċ import Ġeu . kan ade . t ach iy omi . ui . reader . settings . Page Layout Ċ import Ġeu . kan ade . t ach iy omi . ui . reader . settings . Reader Bottom Button Ċ import Ġeu . kan ade . t ach iy omi . ui . reader . settings . Reading Mode Type Ċ import Ġeu . kan ade . t ach iy omi . ui . reader . viewer . Viewer Navigation Ċ import Ġeu . kan ade . t ach iy omi . ui . recent s . Recent M anga Adapter Ċ import Ġeu . kan ade . t ach iy omi . util . system . Themes Ċ import Ġkotlinx . coroutines . Coroutine Scope Ċ import Ġkotlinx . coroutines . Job Ċ import Ġkotlinx . coroutines . flow . Flow Ċ import Ġkotlinx . coroutines . flow . launch In Ċ import Ġkotlinx . coroutines . flow . on Each Ċ import Ġjava . io . File Ċ import Ġjava . text . DateFormat Ċ import Ġjava . text . SimpleDateFormat Ċ import Ġjava . util . Locale Ċ import Ġeu . kan ade . t ach iy omi . data . preference . Preference Keys Ġas ĠKeys Ċ Ċ fun Ġ< T > ĠPreference < T >. get OrDefault (): ĠT Ġ= Ġget () Ġ?: ĠdefaultValue () !! Ċ Ċ fun Ġ< T > Ġcom . tf cp or ci unc ula . flow . Preference < T >. as Immediate Flow ( block : Ġ( value : ĠT ) Ġ-> ĠUnit ): ĠFlow < T > Ġ{ ĊĠĠĠ Ġblock ( get ()) ĊĠĠĠ Ġreturn Ġas Flow () ĊĠĠĠĠĠĠĠ Ġ. on Each Ġ{ Ġblock ( it ) Ġ} Ċ } Ċ Ċ fun Ġ< T > Ġcom . tf cp or ci unc ula . flow . Preference < T >. as Immediate Flow In ( ĊĠĠĠ Ġscope : ĠCor outine Scope , ĊĠĠĠ Ġblock : Ġ( value : ĠT ) Ġ-> ĠUnit , Ċ ): ĠJob Ġ{ ĊĠĠĠ Ġblock ( get ()) ĊĠĠĠ Ġreturn Ġas Flow () ĊĠĠĠĠĠĠĠ Ġ. on Each Ġ{ Ġblock ( it ) Ġ} ĊĠĠĠĠĠĠĠ Ġ. launch In ( scope ) Ċ } Ċ Ċ fun Ġcom . tf cp or ci unc ula . flow . Preference < Boolean >. toggle () Ġ= Ġset (! get ()) Ċ Ċ private Ġclass ĠDate Format Converter Ġ: ĠPreference . Adapter < DateFormat > Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġget ( key : ĠString , Ġpreferences : ĠSharedPreferences ): ĠDate Format Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠdateFormat Ġ= Ġpreferences . getString ( Keys . date Format , Ġ"") !! ĊĊĠĠĠĠĠĠĠ Ġif Ġ( date Format Ġ!= Ġ"") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠSimpleDateFormat ( date Format , ĠLocale . getDefault ()) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġreturn ĠDate Format . getDate Instance ( DateFormat . SHORT ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġset ( key : ĠString , Ġvalue : ĠDate Format , Ġeditor : ĠSharedPreferences . Editor ) Ġ{ ĊĠĠĠĠĠĠĠ Ġ// ĠNo - op ĊĠĠĠ Ġ} Ċ } Ċ Ċ operator Ġfun Ġ< T > Ġcom . tf cp or ci unc ula . flow . Preference < Set < T >> . plus Assign ( item : ĠT ) Ġ{ ĊĠĠĠ Ġset ( get () Ġ+ Ġitem ) Ċ } Ċ Ċ operator Ġfun Ġ< T > Ġcom . tf cp or ci unc ula . flow . Preference < Set < T >> . minus Assign ( item : ĠT ) Ġ{ ĊĠĠĠ Ġset ( get () Ġ- Ġitem ) Ċ } Ċ Ċ operator Ġfun Ġ< T > Ġcom . tf cp or ci unc ula . flow . Preference < Set < T >> . plus Assign ( item : ĠCollection < T >) Ġ{ ĊĠĠĠ Ġset ( get () Ġ+ Ġitem ) Ċ } Ċ Ċ operator Ġfun Ġ< T > Ġcom . tf cp or ci unc ula . flow . Preference < Set < T >> . minus Assign ( item : ĠCollection < T >) Ġ{ ĊĠĠĠ Ġset ( get () Ġ- Ġitem ) Ċ } Ċ Ċ class ĠPreferences Helper ( val Ġcontext : ĠContext ) Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġprefs Ġ= ĠPreference Manager . getDefault SharedPreferences ( context ) ĊĠĠĠ Ġprivate Ġval Ġrx Prefs Ġ= ĠRx SharedPreferences . create ( prefs ) ĊĠĠĠ Ġprivate Ġval Ġflow Prefs Ġ= ĠFlow SharedPreferences ( prefs ) ĊĊĠĠĠ Ġprivate Ġval Ġdefault Folder Ġ= Ġcontext . getString ( R . string . app _ name ) Ġ+ Ġwhen Ġ( Build Config . DEBUG ) Ġ{ ĊĠĠĠĠĠĠĠ Ġtrue Ġ-> Ġ"_ DEBUG " ĊĠĠĠĠĠĠĠ Ġfalse Ġ-> Ġ"" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġdefault Downloads Dir Ġ= ĠUri . from File ( ĊĠĠĠĠĠĠĠ ĠFile ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠEnvironment . get External Storage Directory (). absolute Path Ġ+ ĠFile . separator Ġ+ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdefault Folder , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" downloads " ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġprivate Ġval Ġdefault Backup Dir Ġ= ĠUri . from File ( ĊĠĠĠĠĠĠĠ ĠFile ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠEnvironment . get External Storage Directory (). absolute Path Ġ+ ĠFile . separator Ġ+ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdefault Folder , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" backup " ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġfun Ġget Int ( key : ĠString , Ġdefault : ĠInt ?) Ġ= Ġrx Prefs . getInteger ( key , Ġdefault ) ĊĠĠĠ Ġfun ĠgetString Pref ( key : ĠString , Ġdefault : ĠString ?) Ġ= Ġrx Prefs . getString ( key , Ġdefault ) ĊĠĠĠ Ġfun ĠgetString Set ( key : ĠString , Ġdefault : ĠSet < String >) Ġ= Ġrx Prefs . getString Set ( key , Ġdefault ) ĊĊĠĠĠ Ġfun Ġstarting Tab () Ġ= Ġflow Prefs . getInt ( Keys . starting Tab , Ġ 0 ) ĊĠĠĠ Ġfun Ġback Returns To Start () Ġ= Ġflow Prefs . getBoolean ( Keys . back To Start , Ġtrue ) ĊĊĠĠĠ Ġfun Ġhas Denied A 1 1 File Permission () Ġ= Ġflow Prefs . getBoolean ( Keys . den ied A 1 1 File Permission , Ġfalse ) ĊĊĠĠĠ Ġfun Ġclear () Ġ= Ġprefs . edit (). clear (). apply () ĊĊĠĠĠ Ġfun Ġold Theme () Ġ= Ġprefs . getInt ( Keys . theme , Ġ 5 ) ĊĊĠĠĠ Ġfun Ġnight Mode () Ġ= Ġflow Prefs . getInt ( Keys . night Mode , ĠAppCompat Delegate . MODE _ N IGHT _ FOLLOW _ SYSTEM ) ĊĊĠĠĠ Ġfun Ġtheme Dark A mo led () Ġ= Ġflow Prefs . getBoolean ( Keys . theme Dark A mo led , Ġfalse ) ĊĊĠĠĠ Ġval Ġis On A 1 2 Ġ= ĠBuild . VERSION . SDK _ INT Ġ>= ĠBuild . VERSION _ CODES . S ĊĠĠĠ Ġfun Ġlight Theme () Ġ= Ġflow Prefs . get Enum ( Keys . light Theme , Ġif Ġ( is On A 1 2 ) ĠThe mes . MON ET Ġelse ĠThe mes . DEFAULT ) ĊĠĠĠ Ġfun Ġdark Theme () Ġ= Ġflow Prefs . get Enum ( Keys . dark Theme , Ġif Ġ( is On A 1 2 ) ĠThe mes . MON ET Ġelse ĠThe mes . DEFAULT ) ĊĊĠĠĠ Ġfun Ġpage Transitions () Ġ= Ġflow Prefs . getBoolean ( Keys . enable Transitions , Ġtrue ) ĊĊĠĠĠ Ġfun Ġpager Cut out Behavior () Ġ= Ġflow Prefs . getInt ( Keys . pager Cut out Behavior , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġdouble Tap Anim Speed () Ġ= Ġflow Prefs . getInt ( Keys . double Tap Animation Speed , Ġ 5 0 0 ) ĊĊĠĠĠ Ġfun Ġshow Page Number () Ġ= Ġflow Prefs . getBoolean ( Keys . show Page Number , Ġtrue ) ĊĊĠĠĠ Ġfun Ġtrue Color () Ġ= Ġflow Prefs . getBoolean ( Keys . true Color , Ġfalse ) ĊĊĠĠĠ Ġfun Ġfullscreen () Ġ= Ġflow Prefs . getBoolean ( Keys . fullscreen , Ġtrue ) ĊĊĠĠĠ Ġfun Ġkeep Screen On () Ġ= Ġflow Prefs . getBoolean ( Keys . keep Screen On , Ġtrue ) ĊĊĠĠĠ Ġfun Ġcustom Brightness () Ġ= Ġflow Prefs . getBoolean ( Keys . custom Brightness , Ġfalse ) ĊĊĠĠĠ Ġfun Ġcustom Brightness Value () Ġ= Ġflow Prefs . getInt ( Keys . custom Brightness Value , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġcolor Filter () Ġ= Ġflow Prefs . getBoolean ( Keys . color Filter , Ġfalse ) ĊĊĠĠĠ Ġfun Ġcolor Filter Value () Ġ= Ġflow Prefs . getInt ( Keys . color Filter Value , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġcolor Filter Mode () Ġ= Ġflow Prefs . getInt ( Keys . color Filter Mode , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġdefault Reading Mode () Ġ= Ġprefs . getInt ( Keys . default Reading Mode , ĠReading Mode Type . RIGHT _ TO _ LEFT . flag Value ) ĊĊĠĠĠ Ġfun Ġdefault Orientation Type () Ġ= Ġflow Prefs . getInt ( Keys . default Orientation Type , ĠOrientation Type . FREE . flag Value ) ĊĊĠĠĠ Ġfun Ġimage Scale Type () Ġ= Ġflow Prefs . getInt ( Keys . image Scale Type , Ġ 1 ) ĊĊĠĠĠ Ġfun Ġzoom Start () Ġ= Ġflow Prefs . getInt ( Keys . zoom Start , Ġ 1 ) ĊĊĠĠĠ Ġfun Ġreader Theme () Ġ= Ġflow Prefs . getInt ( Keys . reader Theme , Ġ 2 ) ĊĊĠĠĠ Ġfun Ġcrop B orders () Ġ= Ġflow Prefs . getBoolean ( Keys . crop B orders , Ġfalse ) ĊĊĠĠĠ Ġfun Ġcrop B orders Web to on () Ġ= Ġflow Prefs . getBoolean ( Keys . crop B orders Web to on , Ġfalse ) ĊĊĠĠĠ Ġfun Ġweb to on Side Padding () Ġ= Ġflow Prefs . getInt ( Keys . web to on Side Padding , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġweb to on Enable Zoom Out () Ġ= Ġflow Prefs . getBoolean ( Keys . web to on Enable Zoom Out , Ġfalse ) ĊĊĠĠĠ Ġfun Ġread With T apping () Ġ= Ġflow Prefs . getBoolean ( Keys . read With T apping , Ġtrue ) ĊĊĠĠĠ Ġfun Ġread With Long Tap () Ġ= Ġflow Prefs . getBoolean ( Keys . read With Long Tap , Ġtrue ) ĊĊĠĠĠ Ġfun Ġread With Volume Keys () Ġ= Ġflow Prefs . getBoolean ( Keys . read With Volume Keys , Ġfalse ) ĊĊĠĠĠ Ġfun Ġread With Volume Keys In verted () Ġ= Ġflow Prefs . getBoolean ( Keys . read With Volume Keys In verted , Ġfalse ) ĊĊĠĠĠ Ġfun Ġnavigation Mode Pager () Ġ= Ġflow Prefs . getInt ( Keys . navigation Mode Pager , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġnavigation Mode Web to on () Ġ= Ġflow Prefs . getInt ( Keys . navigation Mode Web to on , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġpager Nav In verted () Ġ= ĊĠĠĠĠĠĠĠ Ġflow Prefs . get Enum ( Keys . pager Nav In verted , ĠViewer Navigation . T apping Invert Mode . NONE ) ĊĊĠĠĠ Ġfun Ġweb to on Nav In verted () Ġ= ĊĠĠĠĠĠĠĠ Ġflow Prefs . get Enum ( Keys . web to on Nav In verted , ĠViewer Navigation . T apping Invert Mode . NONE ) ĊĊĠĠĠ Ġfun Ġpage Layout () Ġ= Ġflow Prefs . getInt ( Keys . page Layout , ĠPage Layout . AUT OM AT IC . value ) ĊĊĠĠĠ Ġfun Ġinvert Double Pages () Ġ= Ġflow Prefs . getBoolean ( Keys . invert Double Pages , Ġfalse ) ĊĊĠĠĠ Ġfun Ġreader Bottom Buttons () Ġ= Ġflow Prefs . getString Set ( ĊĠĠĠĠĠĠĠ ĠKeys . reader Bottom Buttons , ĊĠĠĠĠĠĠĠ ĠReader Bottom Button . BUTTON S _ DEFAULT S ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġfun Ġshow Navigation Overlay New User () Ġ= ĊĠĠĠĠĠĠĠ Ġflow Prefs . getBoolean ( Keys . show Navigation Overlay New User , Ġtrue ) ĊĊĠĠĠ Ġfun Ġshow Navigation Overlay New User Web to on () Ġ= ĊĠĠĠĠĠĠĠ Ġflow Prefs . getBoolean ( Keys . show Navigation Overlay New User Web to on , Ġtrue ) ĊĊĠĠĠ Ġfun Ġpreload Size () Ġ= Ġflow Prefs . getInt ( Keys . preload Size , Ġ 6 ) ĊĊĠĠĠ Ġfun Ġupdate Only Non Completed () Ġ= Ġprefs . getBoolean ( Keys . update Only Non Completed , Ġfalse ) ĊĊĠĠĠ Ġfun Ġauto Update Track () Ġ= Ġprefs . getBoolean ( Keys . auto Update Track , Ġtrue ) ĊĊĠĠĠ Ġfun Ġauto Add Track () Ġ= Ġprefs . getBoolean ( Keys . auto Add Track , Ġtrue ) ĊĊĠĠĠ Ġfun Ġtrack ings ToAdd Online () Ġ= Ġflow Prefs . getString Set ( Keys . track ings ToAdd Online , Ġempty Set ()) ĊĊĠĠĠ Ġfun Ġlast Used Catalog ue Source () Ġ= Ġflow Prefs . getLong ( Keys . last Used Catalog ue Source , Ġ- 1 ) ĊĊĠĠĠ Ġfun Ġlast Used Category () Ġ= Ġrx Prefs . getInteger ( Keys . last Used Category , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġlast Used Sources () Ġ= Ġflow Prefs . getString Set (" last _ used _ sources ", Ġempty Set ()) ĊĊĠĠĠ Ġfun Ġlast Version Code () Ġ= Ġrx Prefs . getInteger (" last _ version _ code ", Ġ 0 ) ĊĊĠĠĠ Ġfun Ġbrowse As List () Ġ= Ġflow Prefs . getBoolean ( Keys . catalog ue As List , Ġfalse ) ĊĊĠĠĠ Ġfun Ġbrowse Show Library () Ġ= Ġflow Prefs . getBoolean ( Keys . catalog ue Show Library , Ġtrue ) ĊĊĠĠĠ Ġfun Ġenabled Languages () Ġ= ĊĠĠĠĠĠĠĠ Ġflow Prefs . getString Set ( Keys . enabled Languages , Ġset Of (" en ", ĠLocale . getDefault (). language )) ĊĊĠĠĠ Ġfun Ġsource Sorting () Ġ= Ġrx Prefs . getInteger ( Keys . sources Sort , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġsource Username ( source : ĠSource ) Ġ= Ġprefs . getString ( Keys . source Username ( source . id ), Ġ"") ĊĊĠĠĠ Ġfun Ġsource Password ( source : ĠSource ) Ġ= Ġprefs . getString ( Keys . source Password ( source . id ), Ġ"") ĊĊĠĠĠ Ġfun Ġset Source Credentials ( source : ĠSource , Ġusername : ĠString , Ġpassword : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġprefs . edit () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. putString ( Keys . source Username ( source . id ), Ġusername ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. putString ( Keys . source Password ( source . id ), Ġpassword ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. apply () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġtrack Username ( sync : ĠTrack Service ) Ġ= Ġprefs . getString ( Keys . track Username ( sync . id ), Ġ"") ĊĊĠĠĠ Ġfun Ġtrack Password ( sync : ĠTrack Service ) Ġ= Ġprefs . getString ( Keys . track Password ( sync . id ), Ġ"") ĊĊĠĠĠ Ġfun Ġset Track Credentials ( sync : ĠTrack Service , Ġusername : ĠString , Ġpassword : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġprefs . edit () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. putString ( Keys . track Username ( sync . id ), Ġusername ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. putString ( Keys . track Password ( sync . id ), Ġpassword ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. apply () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġtrack Token ( sync : ĠTrack Service ) Ġ= Ġflow Prefs . getString ( Keys . track Token ( sync . id ), Ġ"") ĊĊĠĠĠ Ġfun Ġan il ist Score Type () Ġ= Ġrx Prefs . getString (" an il ist _ score _ type ", Ġ" POINT _ 1 0 ") ĊĊĠĠĠ Ġfun Ġbackups Directory () Ġ= Ġflow Prefs . getString ( Keys . backup Directory , Ġdefault Backup Dir . toString ()) ĊĊĠĠĠ Ġfun ĠdateFormat ( format : ĠString Ġ= Ġflow Prefs . getString ( Keys . date Format , Ġ""). get ()): ĠDate Format Ġ= ĊĠĠĠĠĠĠĠ Ġwhen Ġ( format ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"" Ġ-> ĠDate Format . getDate Instance ( DateFormat . SHORT ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> ĠSimpleDateFormat ( format , ĠLocale . getDefault ()) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdownloads Directory () Ġ= ĊĠĠĠĠĠĠĠ Ġrx Prefs . getString ( Keys . downloads Directory , Ġdefault Downloads Dir . toString ()) ĊĊĠĠĠ Ġfun Ġdownload Only Over Wifi () Ġ= Ġprefs . getBoolean ( Keys . download Only Over Wifi , Ġtrue ) ĊĊĠĠĠ Ġfun Ġfolder Per M anga () Ġ= Ġprefs . getBoolean ( Keys . folder Per M anga , Ġfalse ) ĊĊĠĠĠ Ġfun Ġlibrary Search Suggestion () Ġ= Ġflow Prefs . getString ( Keys . library Search Suggestion , Ġ"") ĊĊĠĠĠ Ġfun Ġshow Library Search Suggestions () Ġ= ĊĠĠĠĠĠĠĠ Ġflow Prefs . getBoolean ( Keys . show Library Search Suggestions , Ġfalse ) ĊĊĠĠĠ Ġfun Ġlast Library Suggestion () Ġ= Ġflow Prefs . getLong (" last _ library _ suggestion ", Ġ 0 L ) ĊĊĠĠĠ Ġfun ĠnumberOf Backups () Ġ= Ġflow Prefs . getInt ( Keys . numberOf Backups , Ġ 1 ) ĊĊĠĠĠ Ġfun Ġbackup Interval () Ġ= Ġflow Prefs . getInt ( Keys . backup Interval , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġremove After Read Slots () Ġ= Ġprefs . getInt ( Keys . remove After Read Slots , Ġ- 1 ) ĊĊĠĠĠ Ġfun Ġremove After Marked As Read () Ġ= Ġprefs . getBoolean ( Keys . remove After Marked As Read , Ġfalse ) ĊĊĠĠĠ Ġfun Ġlibrary Update Interval () Ġ= Ġrx Prefs . getInteger ( Keys . library Update Interval , Ġ 2 4 ) ĊĊĠĠĠ Ġfun Ġlibrary Update Restriction () Ġ= Ġprefs . getString Set ( Keys . library Update Restriction , Ġempty Set ()) ĊĊĠĠĠ Ġfun Ġlibrary Update Categories () Ġ= Ġflow Prefs . getString Set ( Keys . library Update Categories , Ġempty Set ()) ĊĠĠĠ Ġfun Ġlibrary Update Categories Exclude () Ġ= ĊĠĠĠĠĠĠĠ Ġflow Prefs . getString Set ( Keys . library Update Categories Exclude , Ġempty Set ()) ĊĊĠĠĠ Ġfun Ġlibrary Update Prior it ization () Ġ= Ġrx Prefs . getInteger ( Keys . library Update Prior it ization , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġlibrary Layout () Ġ= Ġflow Prefs . getInt ( Keys . library Layout , Ġ 2 ) ĊĊĠĠĠ Ġfun Ġgrid Size () Ġ= Ġflow Prefs . get Float ( Keys . grid Size , Ġ 1 f ) ĊĊĠĠĠ Ġfun Ġuniform Grid () Ġ= Ġflow Prefs . getBoolean ( Keys . uniform Grid , Ġtrue ) ĊĊĠĠĠ Ġfun Ġdownload Badge () Ġ= Ġrx Prefs . getBoolean ( Keys . download Badge , Ġfalse ) ĊĊĠĠĠ Ġfun Ġfilter Downloaded () Ġ= Ġrx Prefs . getInteger ( Keys . filter Downloaded , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġfilter Un read () Ġ= Ġrx Prefs . getInteger ( Keys . filter Un read , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġfilter Completed () Ġ= Ġrx Prefs . getInteger ( Keys . filter Completed , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġfilter Tracked () Ġ= Ġrx Prefs . getInteger ( Keys . filter Tracked , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġfilter M anga Type () Ġ= Ġrx Prefs . getInteger ( Keys . filter M anga Type , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġfilter Merged () Ġ= Ġrx Prefs . getInteger ( Keys . filter Merged , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġfilter Missing Chapter s () Ġ= Ġrx Prefs . getInteger ( Keys . filter Missing Chapter s , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġlibrary Sorting Mode () Ġ= Ġrx Prefs . getInteger ( Keys . library Sorting Mode , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġlibrary Sorting Ascending () Ġ= Ġrx Prefs . getBoolean (" library _ sorting _ ascending ", Ġtrue ) ĊĊĠĠĠ Ġfun Ġautomatic Updates () Ġ= Ġprefs . getBoolean ( Keys . automatic Updates , Ġtrue ) ĊĊĠĠĠ Ġfun Ġcollapsed Categories () Ġ= Ġrx Prefs . getString Set (" collapsed _ categories ", Ġmutable Set Of ()) ĊĊĠĠĠ Ġfun Ġcollapsed Dynamic Categories () Ġ= ĊĠĠĠĠĠĠĠ Ġflow Prefs . getString Set (" collapsed _ dynamic _ categories ", Ġmutable Set Of ()) ĊĊĠĠĠ Ġfun Ġcollapsed Dynamic At Bottom () Ġ= Ġflow Prefs . getBoolean (" collapsed _ dynamic _ at _ bottom ", Ġfalse ) ĊĊĠĠĠ Ġfun Ġhidden Sources () Ġ= Ġflow Prefs . getString Set (" hidden _ catalog ues ", Ġmutable Set Of ()) ĊĊĠĠĠ Ġfun Ġpinned Catalog ues () Ġ= Ġflow Prefs . getString Set (" pinned _ catalog ues ", Ġmutable Set Of ()) ĊĊĠĠĠ Ġfun Ġdownload New () Ġ= Ġflow Prefs . getBoolean ( Keys . download New , Ġfalse ) ĊĊĠĠĠ Ġfun Ġdownload New Categories () Ġ= Ġflow Prefs . getString Set ( Keys . download New Categories , Ġempty Set ()) ĊĠĠĠ Ġfun Ġdownload New Categories Exclude () Ġ= ĊĠĠĠĠĠĠĠ Ġflow Prefs . getString Set ( Keys . download New Categories Exclude , Ġempty Set ()) ĊĊĠĠĠ Ġfun Ġlang () Ġ= Ġprefs . getString ( Keys . lang , Ġ"") ĊĊĠĠĠ Ġfun Ġlang sTo Show () Ġ= Ġflow Prefs . getString ( Keys . lang To Show , Ġ" en ") ĊĊĠĠĠ Ġfun Ġdefault Category () Ġ= Ġprefs . getInt ( Keys . default Category , Ġ- 1 ) ĊĊĠĠĠ Ġfun Ġskip Read () Ġ= Ġprefs . getBoolean ( Keys . skip Read , Ġfalse ) ĊĊĠĠĠ Ġfun Ġskip Filtered () Ġ= Ġprefs . getBoolean ( Keys . skip Filtered , Ġtrue ) ĊĊĠĠĠ Ġfun Ġuse Bio metrics () Ġ= Ġrx Prefs . getBoolean ( Keys . use Bio metrics , Ġfalse ) ĊĊĠĠĠ Ġfun Ġlock After () Ġ= Ġrx Prefs . getInteger ( Keys . lock After , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġlast Unlock () Ġ= Ġrx Prefs . getLong ( Keys . last Unlock , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġsecure Screen () Ġ= Ġrx Prefs . getBoolean ( Keys . secure Screen , Ġfalse ) ĊĊĠĠĠ Ġfun Ġhide Notification Content () Ġ= Ġprefs . getBoolean ( Keys . hide Notification Content , Ġfalse ) ĊĊĠĠĠ Ġfun Ġremove Articles () Ġ= Ġrx Prefs . getBoolean ( Keys . remove Articles , Ġfalse ) ĊĊĠĠĠ Ġfun Ġmigrate Flags () Ġ= Ġrx Prefs . getInteger (" migrate _ flags ", ĠInt . MAX _ VALUE ) ĊĊĠĠĠ Ġfun Ġtrusted Signatures () Ġ= Ġrx Prefs . getString Set (" trusted _ signatures ", Ġempty Set ()) ĊĊĠĠĠ Ġ// Ġusing Ġstring Ġinstead Ġof Ġset Ġso Ġit Ġis Ġordered ĊĠĠĠ Ġfun Ġmigration Sources () Ġ= Ġflow Prefs . getString (" migrate _ sources ", Ġ"") ĊĊĠĠĠ Ġfun Ġuse Source With Most () Ġ= Ġrx Prefs . getBoolean (" use _ source _ with _ most ", Ġfalse ) ĊĊĠĠĠ Ġfun Ġskip Pre Migration () Ġ= Ġrx Prefs . getBoolean ( Keys . skip Pre Migration , Ġfalse ) ĊĊĠĠĠ Ġfun Ġdefault M anga Order () Ġ= Ġrx Prefs . getString (" default _ manga _ order ", Ġ"") ĊĊĠĠĠ Ġfun Ġrefresh Cover s Too () Ġ= Ġrx Prefs . getBoolean ( Keys . refresh Cover s Too , Ġtrue ) ĊĊĠĠĠ Ġfun Ġupdate On Refresh () Ġ= Ġrx Prefs . getInteger ( Keys . update On Refresh , Ġ- 1 ) ĊĊĠĠĠ Ġfun Ġextension Updates Count () Ġ= Ġrx Prefs . getInteger (" ext _ updates _ count ", Ġ 0 ) ĊĊĠĠĠ Ġfun Ġrecent s ViewType () Ġ= Ġflow Prefs . getInt (" recent s _ view _ type ", Ġ 0 ) ĊĊĠĠĠ Ġfun Ġshow Recent s Downloads () Ġ= ĊĠĠĠĠĠĠĠ Ġflow Prefs . get Enum ( Keys . show DL s In Recent s , ĠRecent M anga Adapter . Show Recent s DL s . All ) ĊĊĠĠĠ Ġfun Ġshow Recent s Rem History () Ġ= Ġflow Prefs . getBoolean ( Keys . show Rem History In Recent s , Ġtrue ) ĊĊĠĠĠ Ġfun Ġshow Read In All Recent s () Ġ= Ġflow Prefs . getBoolean ( Keys . show Read In All Recent s , Ġfalse ) ĊĊĠĠĠ Ġfun Ġshow Updated Time () Ġ= Ġflow Prefs . getBoolean ( Keys . show Updated Time , Ġfalse ) ĊĊĠĠĠ Ġfun Ġgroup Chapter s Updates () Ġ= Ġflow Prefs . getBoolean ( Keys . group Chapter s Updates , Ġfalse ) ĊĊĠĠĠ Ġfun Ġgroup Chapter s History () Ġ= Ġflow Prefs . getBoolean ( Keys . group Chapter s History , Ġtrue ) ĊĊĠĠĠ Ġfun Ġshow Title First In Recent s () Ġ= Ġflow Prefs . getBoolean ( Keys . show Title First In Recent s , Ġfalse ) ĊĊĠĠĠ Ġfun Ġlast Ext Check () Ġ= Ġrx Prefs . getLong (" last _ ext _ check ", Ġ 0 ) ĊĊĠĠĠ Ġfun Ġlast App Check () Ġ= Ġflow Prefs . getLong (" last _ app _ check ", Ġ 0 ) ĊĊĠĠĠ Ġfun Ġunread Badge Type () Ġ= Ġflow Prefs . getInt (" unread _ badge _ type ", Ġ 2 ) ĊĊĠĠĠ Ġfun Ġcategory NumberOf Items () Ġ= Ġflow Prefs . getBoolean ( Keys . category NumberOf Items , Ġfalse ) ĊĊĠĠĠ Ġfun Ġhide Start Reading Button () Ġ= Ġflow Prefs . getBoolean (" hide _ reading _ button ", Ġfalse ) ĊĊĠĠĠ Ġfun Ġalways Show Chapter Transition () Ġ= Ġflow Prefs . getBoolean ( Keys . always Show Chapter Transition , Ġtrue ) ĊĊĠĠĠ Ġfun Ġdelete Removed Chapter s () Ġ= Ġflow Prefs . getInt ( Keys . delete Removed Chapter s , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġshow All Categories () Ġ= Ġflow Prefs . getBoolean (" show _ all _ categories ", Ġtrue ) ĊĊĠĠĠ Ġfun Ġhop per Gravity () Ġ= Ġflow Prefs . getInt (" hop per _ gravity ", Ġ 1 ) ĊĊĠĠĠ Ġfun Ġfilter Order () Ġ= Ġflow Prefs . getString (" filter _ order ", ĠFilter Bottom Sheet . Filters . DEFAULT _ ORDER ) ĊĊĠĠĠ Ġfun Ġhop per Long Press Action () Ġ= Ġflow Prefs . getInt ( Keys . hop per Long Press , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġhide Hop per () Ġ= Ġflow Prefs . getBoolean (" hide _ hop per ", Ġfalse ) ĊĊĠĠĠ Ġfun Ġauto hide Hop per () Ġ= Ġflow Prefs . getBoolean ( Keys . auto Hide Hop per , Ġtrue ) ĊĊĠĠĠ Ġfun Ġgroup Library By () Ġ= Ġflow Prefs . getInt (" group _ library _ by ", Ġ 0 ) ĊĊĠĠĠ Ġfun Ġshow Category In Title () Ġ= Ġflow Prefs . getBoolean (" category _ in _ title ", Ġfalse ) ĊĊĠĠĠ Ġfun Ġonly Search Pin ned () Ġ= Ġflow Prefs . getBoolean ( Keys . only Search Pin ned , Ġfalse ) ĊĊĠĠĠ Ġfun Ġshow Library Update Errors () Ġ= Ġprefs . getBoolean ( Keys . show Library Update Errors , Ġfalse ) ĊĊĠĠĠ Ġ// ĠTutorial Ġpreferences ĊĠĠĠ Ġfun Ġshown Filter Tutorial () Ġ= Ġflow Prefs . getBoolean (" shown _ filter _ tutorial ", Ġfalse ) ĊĊĠĠĠ Ġfun Ġshown Chapter Swipe Tutorial () Ġ= Ġflow Prefs . getBoolean (" shown _ swipe _ tutorial ", Ġfalse ) ĊĊĠĠĠ Ġfun Ġshown Download Queue Tutorial () Ġ= Ġflow Prefs . getBoolean (" shown _ download _ queue ", Ġfalse ) ĊĊĠĠĠ Ġfun Ġshown Long Press Category Tutorial () Ġ= Ġflow Prefs . getBoolean (" shown _ long _ press _ category ", Ġfalse ) ĊĊĠĠĠ Ġfun Ġshown Hop per Swipe Tutorial () Ġ= Ġflow Prefs . getBoolean (" shown _ hop per _ swipe ", Ġfalse ) ĊĊĠĠĠ Ġfun Ġhide Bottom Nav On Scroll () Ġ= Ġflow Prefs . getBoolean ( Keys . hide Bottom Nav On Scroll , Ġtrue ) ĊĊĠĠĠ Ġfun Ġside Nav Icon Alignment () Ġ= Ġflow Prefs . getInt ( Keys . side Nav Icon Alignment , Ġ 1 ) ĊĊĠĠĠ Ġfun Ġcreate Legacy Backup () Ġ= Ġflow Prefs . getBoolean ( Keys . create Legacy Backup , Ġtrue ) ĊĠĠĠ Ġfun Ġdo h Provider () Ġ= Ġprefs . getInt ( Keys . do h Provider , Ġ- 1 ) ĊĊĠĠĠ Ġfun Ġshow Series In Shortcut s () Ġ= Ġprefs . getBoolean ( Keys . show Series In Shortcut s , Ġtrue ) ĊĠĠĠ Ġfun Ġopen Chapter In Shortcut s () Ġ= Ġprefs . getBoolean ( Keys . open Chapter In Shortcut s , Ġtrue ) ĊĊĠĠĠ Ġfun Ġin cognito Mode () Ġ= Ġflow Prefs . getBoolean ( Keys . in cognito Mode , Ġfalse ) ĊĊĠĠĠ Ġfun Ġshould Auto Update () Ġ= Ġprefs . getInt ( Keys . should Auto Update , ĠAuto Updater Job . ONLY _ ON _ UN METER ED ) ĊĊĠĠĠ Ġfun Ġfilter Chapter By Read () Ġ= Ġflow Prefs . getInt ( Keys . default Chapter Filter By Read , ĠM anga . SHOW _ ALL ) ĊĊĠĠĠ Ġfun Ġfilter Chapter By Downloaded () Ġ= Ġflow Prefs . getInt ( Keys . default Chapter Filter By Downloaded , ĠM anga . SHOW _ ALL ) ĊĊĠĠĠ Ġfun Ġfilter Chapter By Book marked () Ġ= Ġflow Prefs . getInt ( Keys . default Chapter Filter By Book marked , ĠM anga . SHOW _ ALL ) ĊĊĠĠĠ Ġfun Ġsort Chapter Order () Ġ= Ġflow Prefs . getInt ( Keys . default Chapter Sort By Source Or Number , ĠM anga . CH AP TER _ SORT ING _ SOURCE ) ĊĊĠĠĠ Ġfun Ġhide Chapter Title sBy Default () Ġ= Ġflow Prefs . getBoolean ( Keys . hide Chapter Titles , Ġfalse ) ĊĊĠĠĠ Ġfun Ġchapter s Desc As Default () Ġ= Ġflow Prefs . getBoolean ( Keys . chapter s Desc As Default , Ġtrue ) ĊĊĠĠĠ Ġfun Ġsort Chapter By Ascending Or Descending () Ġ= Ġprefs . getInt ( Keys . default Chapter Sort By Ascending Or Descending , ĠM anga . CH AP TER _ SORT _ DESC ) ĊĊĠĠĠ Ġfun Ġlow Quality Cover s () Ġ= Ġprefs . getBoolean ( Keys . low Quality Cover s , Ġfalse ) ĊĊĠĠĠ Ġfun Ġdata Saver () Ġ= Ġprefs . getBoolean ( Keys . data Saver , Ġfalse ) ĊĊĠĠĠ Ġfun Ġuse Port 4 4 3 Only () Ġ= Ġprefs . getBoolean ( Keys . enable Port 4 4 3 Only , Ġfalse ) ĊĊĠĠĠ Ġfun Ġlog Level () Ġ= Ġprefs . getInt ( Keys . logLevel , Ġ 0 ) ĊĊĠĠĠ Ġfun Ġshow Content Rating Filter (): ĠBoolean Ġ= Ġprefs . getBoolean ( Keys . show Content Rating Filter , Ġtrue ) ĊĊĠĠĠ Ġfun ĠaddTo Library As Pl anned To Read (): ĠBoolean Ġ= ĊĠĠĠĠĠĠĠ Ġprefs . getBoolean ( Keys . addTo Library As Pl anned To Read , Ġfalse ) ĊĊĠĠĠ Ġfun Ġcontent Rating Selections (): ĠMutable Set < String > Ġ= ĊĠĠĠĠĠĠĠ Ġprefs . getString Set ( Keys . content Rating , Ġset Of (" safe ", Ġ" suggest ive ")) !! ĊĊĠĠĠ Ġfun Ġsession Token () Ġ= Ġprefs . getString ( Keys . session Token , Ġ"") ĊĊĠĠĠ Ġfun Ġrefresh Token () Ġ= Ġprefs . getString ( Keys . refresh Token , Ġ"") ĊĊĠĠĠ Ġfun Ġset Tokens ( refresh : ĠString , Ġsession : ĠString ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtime Ġ= Ġif Ġ( refresh . isBlank () Ġ&& Ġsession . isBlank ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠ 0 ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠSystem . currentTimeMillis () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġprefs . edit () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. putString ( Keys . session Token , Ġsession ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. putString ( Keys . refresh Token , Ġrefresh ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. put Long ( Keys . last RefreshToken Time , Ġtime ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. apply () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġlast Refresh Time (): ĠLong Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġprefs . getLong ( Keys . last RefreshToken Time , Ġ 0 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġreading Sync (): ĠBoolean Ġ= Ġprefs . getBoolean ( Keys . reading Sync , Ġfalse ) ĊĊĠĠĠ Ġfun Ġm anga dex Sync To Library Indexes () Ġ= ĊĠĠĠĠĠĠĠ Ġflow Prefs . getString Set ( Keys . manga dex Sync To Library Indexes , Ġempty Set ()) Ċ } Ċ