From b1b97c19d4311ccd2222dff8de26e9a499fe63e5 Mon Sep 17 00:00:00 2001 From: Bram van de Kerkhof Date: Wed, 13 Apr 2016 14:08:07 +0200 Subject: [PATCH] Added option to check if connected to power before updating. closes #192 (#229) --- app/src/main/AndroidManifest.xml | 8 +- .../data/library/LibraryUpdateService.kt | 115 ++++++++++++++---- .../data/preference/PreferencesHelper.kt | 8 +- .../tachiyomi/ui/library/LibraryFragment.kt | 2 +- .../eu/kanade/tachiyomi/util/DeviceUtil.kt | 24 ++++ .../eu/kanade/tachiyomi/util/NetworkUtil.java | 16 --- .../ic_refresh_grey_24dp_img.png | Bin 0 -> 1088 bytes .../ic_warning_white_24dp_img.png | Bin 0 -> 325 bytes .../ic_refresh_grey_24dp_img.png | Bin 0 -> 632 bytes .../ic_warning_white_24dp_img.png | Bin 0 -> 236 bytes .../ic_refresh_grey_24dp_img.png | Bin 0 -> 1339 bytes .../ic_warning_white_24dp_img.png | Bin 0 -> 364 bytes .../ic_refresh_grey_24dp_img.png | Bin 0 -> 2341 bytes .../ic_warning_white_24dp_img.png | Bin 0 -> 473 bytes .../ic_refresh_grey_24dp_img.png | Bin 0 -> 2429 bytes .../ic_warning_white_24dp_img.png | Bin 0 -> 590 bytes app/src/main/res/values/keys.xml | 5 +- app/src/main/res/values/strings.xml | 6 + app/src/main/res/xml/pref_general.xml | 29 +++-- .../data/library/LibraryUpdateAlarmTest.java | 1 + 20 files changed, 152 insertions(+), 62 deletions(-) create mode 100644 app/src/main/java/eu/kanade/tachiyomi/util/DeviceUtil.kt delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/util/NetworkUtil.java create mode 100644 app/src/main/res/drawable-hdpi/ic_refresh_grey_24dp_img.png create mode 100644 app/src/main/res/drawable-hdpi/ic_warning_white_24dp_img.png create mode 100644 app/src/main/res/drawable-mdpi/ic_refresh_grey_24dp_img.png create mode 100644 app/src/main/res/drawable-mdpi/ic_warning_white_24dp_img.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_refresh_grey_24dp_img.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_warning_white_24dp_img.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_refresh_grey_24dp_img.png create mode 100644 app/src/main/res/drawable-xxhdpi/ic_warning_white_24dp_img.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_refresh_grey_24dp_img.png create mode 100644 app/src/main/res/drawable-xxxhdpi/ic_warning_white_24dp_img.png diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ce1af58505..7f9ce9ad97 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ - + @@ -12,9 +12,9 @@ + android:name=".data.library.LibraryUpdateService$LibraryUpdateReceiver"> () val failedUpdates = ArrayList() - val cancelIntent = PendingIntent.getBroadcast(this, 0, - Intent(this, CancelUpdateReceiver::class.java), 0) + val cancelIntent = getLibraryUpdateReceiverIntent(LibraryUpdateReceiver.CANCEL_LIBRARY_UPDATE) // Get the manga list that is going to be updated. val allLibraryMangas = db.getFavoriteMangas().executeAsBlocking() @@ -179,16 +209,17 @@ class LibraryUpdateService : Service() { // Notify manga that will update. .doOnNext { showProgressNotification(it, count.andIncrement, toUpdate.size, cancelIntent) } // Update the chapters of the manga. - .concatMap { manga -> updateManga(manga) - // If there's any error, return empty update and continue. - .onErrorReturn { - failedUpdates.add(manga) - Pair(0, 0) - } - // Filter out mangas without new chapters (or failed). - .filter { pair -> pair.first > 0 } - // Convert to the manga that contains new chapters. - .map { manga } + .concatMap { manga -> + updateManga(manga) + // If there's any error, return empty update and continue. + .onErrorReturn { + failedUpdates.add(manga) + Pair(0, 0) + } + // Filter out mangas without new chapters (or failed). + .filter { pair -> pair.first > 0 } + // Convert to the manga that contains new chapters. + .map { manga } } // Add manga with new chapters to the list. .doOnNext { newUpdates.add(it) } @@ -288,7 +319,27 @@ class LibraryUpdateService : Service() { setContentTitle(manga.title) setProgress(total, current, false) setOngoing(true) - addAction(R.drawable.ic_clear_grey_24dp_img, getString(R.string.action_cancel), cancelIntent) + addAction(R.drawable.ic_clear_grey_24dp_img, getString(android.R.string.cancel), cancelIntent) + } + notificationManager.notify(UPDATE_NOTIFICATION_ID, n) + } + + /** + * Show warning message when library can't be updated + * @param warningTitle title of warning + * @param warningBody warning information + * @param pendingIntent Intent called when action clicked + */ + private fun showWarningNotification(warningTitle: String, warningBody: String, pendingIntent: PendingIntent? = null) { + val n = notification() { + setSmallIcon(R.drawable.ic_warning_white_24dp_img) + setContentTitle(warningTitle) + setStyle(NotificationCompat.BigTextStyle().bigText(warningBody)) + setContentIntent(notificationIntent) + if (pendingIntent != null) { + addAction(R.drawable.ic_refresh_grey_24dp_img, getString(R.string.action_force), pendingIntent) + } + setAutoCancel(true) } notificationManager.notify(UPDATE_NOTIFICATION_ID, n) } @@ -341,23 +392,37 @@ class LibraryUpdateService : Service() { * @param intent the intent received. */ override fun onReceive(context: Context, intent: Intent) { - if (NetworkUtil.isNetworkConnected(context)) { + if (DeviceUtil.isNetworkConnected(context)) { AndroidComponentUtil.toggleComponent(context, this.javaClass, false) context.startService(getIntent(context)) } } } - class CancelUpdateReceiver : BroadcastReceiver() { + /** + * Class that triggers the library to update. + */ + class LibraryUpdateReceiver : BroadcastReceiver() { + companion object { + // Cancel library update action + val CANCEL_LIBRARY_UPDATE = "eu.kanade.CANCEL_LIBRARY_UPDATE" + // Force library update + val FORCE_LIBRARY_UPDATE = "eu.kanade.FORCE_LIBRARY_UPDATE" + } /** - * Method called when user stops the update. + * Method called when user wants a library update. * @param context the application context. * @param intent the intent received. */ override fun onReceive(context: Context, intent: Intent) { - LibraryUpdateService.stop(context) - context.notificationManager.cancel(UPDATE_NOTIFICATION_ID) + when (intent.action) { + CANCEL_LIBRARY_UPDATE -> { + LibraryUpdateService.stop(context) + context.notificationManager.cancel(UPDATE_NOTIFICATION_ID) + } + FORCE_LIBRARY_UPDATE -> LibraryUpdateService.start(context, true) + } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt index abf7b963e4..d7821d1ba3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt @@ -197,16 +197,20 @@ class PreferencesHelper(private val context: Context) { return prefs.getBoolean(getKey(R.string.pref_remove_after_marked_as_read_key), false) } + fun updateOnlyWhenCharging(): Boolean { + return prefs.getBoolean(getKey(R.string.pref_update_only_when_charging_key), false) + } + fun libraryUpdateInterval(): Preference { return rxPrefs.getInteger(getKey(R.string.pref_library_update_interval_key), 0) } fun filterDownloaded(): Preference { - return rxPrefs.getBoolean(getKey(R.string.pref_filter_downloaded), false) + return rxPrefs.getBoolean(getKey(R.string.pref_filter_downloaded_key), false) } fun filterUnread(): Preference { - return rxPrefs.getBoolean(getKey(R.string.pref_filter_unread), false) + return rxPrefs.getBoolean(getKey(R.string.pref_filter_unread_key), false) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryFragment.kt index cf267b2de9..afe18b30e5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryFragment.kt @@ -207,7 +207,7 @@ class LibraryFragment : BaseRxFragment(), ActionMode.Callback // Apply filter onFilterCheckboxChanged() } - R.id.action_refresh -> LibraryUpdateService.start(activity) + R.id.action_refresh -> LibraryUpdateService.start(activity, true) // Force refresh R.id.action_edit_categories -> { val intent = CategoryActivity.newIntent(activity) startActivity(intent) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/DeviceUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/DeviceUtil.kt new file mode 100644 index 0000000000..beab475dd6 --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/util/DeviceUtil.kt @@ -0,0 +1,24 @@ +package eu.kanade.tachiyomi.util + +import android.content.Context +import android.content.Intent +import android.content.IntentFilter +import android.net.ConnectivityManager +import android.os.BatteryManager + +object DeviceUtil { + fun isPowerConnected(context: Context): Boolean { + val intent = context.registerReceiver(null, IntentFilter(Intent.ACTION_BATTERY_CHANGED)) + intent?.let { + val plugged = it.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1) + return plugged == BatteryManager.BATTERY_PLUGGED_AC || plugged == BatteryManager.BATTERY_PLUGGED_USB + } + return false + } + + fun isNetworkConnected(context: Context): Boolean { + val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager + val activeNetwork = cm.activeNetworkInfo + return activeNetwork != null && activeNetwork.isConnectedOrConnecting + } +} \ No newline at end of file diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/NetworkUtil.java b/app/src/main/java/eu/kanade/tachiyomi/util/NetworkUtil.java deleted file mode 100644 index 3ecac2f72b..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/util/NetworkUtil.java +++ /dev/null @@ -1,16 +0,0 @@ -package eu.kanade.tachiyomi.util; - -import android.content.Context; -import android.net.ConnectivityManager; -import android.net.NetworkInfo; - -public class NetworkUtil { - - public static boolean isNetworkConnected(Context context) { - ConnectivityManager cm = - (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); - NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); - return activeNetwork != null && activeNetwork.isConnectedOrConnecting(); - } - -} \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/ic_refresh_grey_24dp_img.png b/app/src/main/res/drawable-hdpi/ic_refresh_grey_24dp_img.png new file mode 100644 index 0000000000000000000000000000000000000000..8ee62066432de973239afeeaeabed75bfb7e8d3b GIT binary patch literal 1088 zcmV-G1i$-x?h}AV~LR{HwKt@9nCYz8Z zW;g3gLHlB$Ekx9ZQZU6g1*PqSFG{PZkchA$W@cyZ%p5txrY4)Dn-%gPWMCNBd+zt0 z^WAUHxd=P_;11)%E135wSN2g03J4_V~UJ49qVgMqfoymvaYO`@lami1;yIS34)lYr>rZC0**}}w1OP0{+NUVWH2}D+F&^vLf8sdK zNj^NzTuS*;p-|W^c-km&*^iu6xe+{k;INEQENiudna?HZxDB)9J`9 zYouMb6{n}ChaAT#)Gc^^Wo6}6(=<2LypgnAF5h&^S_`jr8BR=0d?Tei%$pJM*<3C+ z*DQPXc`B6}^gQn!DdjE0u~;nrN<{lP16|iUdwY9tG$R-vAHRo)js-!WH;cv5(NUX- z5?q#T+nQ;bezQ%jtfOUFHUK1eljAr$LJ&#B6(p0%ySlr(ueXw6vskX+G7&w(fyrd@ z`D`|Oq1mQZ*7*!R2*dDw-V~3=Kd)A+C$?+TMk01sGMSu3#HVCBd_I5eX1msP{U`vOMZ`Ee$}kKbhm~rz`sG$rmPxA9v&zZ20VL_95}yxMrX*z#t_?h-;A5<(mSfJYJWZX&t^ zSy-Y)MEr?}=7kVnc%JuNBk-0IwPMZf#O~fro2vBxm*^h@i3xS3Aroo<0000I-oI literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/ic_warning_white_24dp_img.png b/app/src/main/res/drawable-hdpi/ic_warning_white_24dp_img.png new file mode 100644 index 0000000000000000000000000000000000000000..55c68431b19365d5da5b5a47aa133357ac9fab25 GIT binary patch literal 325 zcmV-L0lNN)P)9gB+3ebu&_IBx0|o$J-6HY z=Xt$*-Y4?;NPii1>hed4XPzj@7rO*@i&DL-lqeNj_B6u2ksj)L-F zi?~g>qslvRZ&c-qV{DG(h6Q@q^q7|mZb@^a(XmE|48m458p^Z?kwI9CvPQu^5i*F{ zQ#NM!BtiyJA51F?m&C{*?n1v~g#;NSEh`;G9!Zcv(gQ`Mp@EBS*)c&I7j4F6!zr## zl*AH!tYl!X1^@s6IQ*`u0006%NklsV~d)mec9=Gd%fOS0CbyGBG;_Z1zYBt3#uz)l zn^*w*{eI7N-Md08+KRrWX|B7jyG%s)tJP|Gw_pthgH_RURQ9GA5zsJ$=YY;A%3NbP@3}06ZCw z#~%Se&SWyDiRcCqE!nmm1Av#QRBEwUEY7wKljAt|5b>5Q%NUErqQHn1h9UUA51eyC z#C6VjS=V(p8ni$AZ8RDS0FWo5D~NcUNNDi87-s;m>h=0Ij}GH6Z7)IEdgd2Yb{S@y SRIFS80000)BogIeir+Q|{1s+#q4)-lrx$$U1W45!CSZqy6iDMtL9bbxQQqTH{ b|1NT}Ni8n0URPBDbUuTptDnm{r-UW|3PMv) literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_refresh_grey_24dp_img.png b/app/src/main/res/drawable-xhdpi/ic_refresh_grey_24dp_img.png new file mode 100644 index 0000000000000000000000000000000000000000..848f2fb5a3e7271d5386e71c949a0fc64c646037 GIT binary patch literal 1339 zcmV-B1;qM^P)SV>^sqg5CBUqfW%)D9vW{7nRTXgIVwcMWE|=?PLdbJIpKpl=XKVjQ zU}9q8L0Oi+-rU@5FO(S(mno(5f*^cD2w5B&8oJFk866$%5JmA(0C?;q$}xkx}Ck`Hd#i*a~m5Q^O~lW^o6ErQd3h?HvmK_ zr5*e}EKYdv-2RSa%;&AGtv_V5+2aK=&b!_2H!6v0{=4z<@q>hrPZ06xQa;=!Ff}#x zzOL&7EXth=5kDLp9PF<(2$&ikkLOnaI8tnn904XhA>cky1TkW41eZftB^;L`oS zx~_NTj$AYvy#N4b9Y9r8Z>+DcAJa6gY-d{uNlnuZ9yoB|x?vdYe5oHE9`1JtuzJnv zcJ4SbmTtFu!SDCKSP4M6H4_sPpJy_eQ`|aT6vg{k!rM+dkw_$ph{KK>So`F5yQh3U zUvD{pQtuOq#N7@!-{t|p`EWRVE@!OsF^dIRmaie=!(2dus;UdCtE;b7>kcNn*Xx}# zP4kp#nmJY3zJeeu>bicy3Gy9jHyVu|p_E<)fDW!WfubmXAmYf{+S**X)4|#>uh-jc z+jh(_j5gMUa@TE96i)<$!9TZSp-{d^B=P_NT;@qI_KKpgsplpD%o9Sc5JJ9ZK4i)@ zHa2#OqWF*`NlySkHzA}=*SF^o2ZFWmC&S_Jbslrq!o!rXZTnN+9lTrE)FTK&?&r)7 z%u?3S@^W)WZV?e*2!%q+g$9=#%_K=05d`5aO6hjBESMLzeOu%?LBzOen(y$VSy=`6 z1$i}sl+tcQR7*CPcZV6BQaUG!Vk{I2{a&&dReHo&^XhWBp3RS6Yz#Zh;v{eRKl!ok xM@0PAvaCy$o|-*vK6W#5*2Uoy7nE002ovPDHLkV1h+ZYYPAX literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/ic_warning_white_24dp_img.png b/app/src/main/res/drawable-xhdpi/ic_warning_white_24dp_img.png new file mode 100644 index 0000000000000000000000000000000000000000..a43fa3c27d451e56094e5f182d1820b5424f2987 GIT binary patch literal 364 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA0wn)(8}cwPFdBQhIEGX(zBy~icQ8Ss{o^vv zcE7ndBxcUsd7zw;?*OX>gZKl6m)_Mj_wyHnbY@Kdom|q>Q!N! zuKrSPN6~>vYs7*aW;d*1iZVJdZ%>)ffeC*S0>n4$oFpH!;WcA$*Q_gyHuprn9=gna zO{M$)$*^4x(>I6+T)N2I7r@of%(q~H3B#+)ak5d297i1l-t1R+#Vl%>6z}j+pLI=# z1bas^mq5_tiscN7s(qFW9-Ya23_*`0*gblaWfe^ON*k_NTw??Z%;)iFP3C6^dU%7m zA;jVv1F{^uN8{r)*^ekp6x00ZyC8Qbxrq8qfR%h9ZNftDnm{r-UW| DcZiV2 literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_refresh_grey_24dp_img.png b/app/src/main/res/drawable-xxhdpi/ic_refresh_grey_24dp_img.png new file mode 100644 index 0000000000000000000000000000000000000000..945fd729df553cc523b9ded776034b3fc19770b0 GIT binary patch literal 2341 zcmV+=3EK9FP)@Q+SK=bR{(v-U15^a5Eovc=+TiA+=lJ5Yedi=v z3)dgrn@6Eg!glqi4YutV)19-nZSoT2K10}9N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)3y{Awh5ZGN`U*CV#1L*DTjd0EndQTx;*H1PyG~9R91L*1L zsdXIZRj;9nqWlX0)<+_db5}D6Nujkuh?f!Z=Bz9aaXJ_bHiSZ=8So*r2~Ov($*To8()oKqBKb2uFSv!4kUdrUkY|Cp@wan5h>EUu|2%7I8E(&GZS z!?x{b03eG-(x6~4cr+Lcey6UkuDB~xk*EyA&{nKi@yyK3%*Grl{-Y?$y-iI`f6V}p zm-;hj&Ljcgu^d?`1OkBr__@3I+lJ+2eX}srN%)U*E?O@#m>j>dqX-+laWkrKRPE?tfVT48yoi)3hfMaf>W1 zdhW<_KMWC3%f*WqPcAl{ByC1UMr2{(fN7eydwXp3UVZ;L0C*@Ci;d?5AU}3?c7BG4 zo<_u*yhoS(KM)AWewN%X-HTN#k{fpA%9W4Xw%sCWBb$XeF8bp{^sQJd_WP`Om5ZF6 zot@t!qTXElVRlc*e%3J|gh52_gu~%fK_s6YEDO4h(sitXTjIrm5=r^46XZ@xf@p!yO)3i+haJLX*vuT>E z@|-quYS}c|AB)8<@qR%MxJT>I(2(p(CJ?bYU%f{5vnnborWj+RjIn<>j`Ig1Iz2f# z`IccAlakwK&z`+a*LB$}`8*=tMMR&FEn3HMs%1rPp1RNs5$&s~sY&LGLknITC7py2 zPt3M~vNrZyP;L{uqM{pX`ZO-zFd3XK$kr?(wnU@RcM8#0 zFaURh4-XH^o`P(X%KP+s09aSZ#IvW1yhyzS0Kc;=>y2W9V^IKHLx~96+S;mhU6;Y< zW+M6$0Bk_SHAEz<-R|kdiRdi=7$Kt9RaHGrMDoTr7L7(P_@PR^#VH9ufh)cw!^;4c zWLXPPTJ}Hzi?t*}%N|&gWi3Ey*#iYE){+b@dtgbHwE(5pya)ad44M=iKQdfC00000 LNkvXXu0mjf-oa=S literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_warning_white_24dp_img.png b/app/src/main/res/drawable-xxhdpi/ic_warning_white_24dp_img.png new file mode 100644 index 0000000000000000000000000000000000000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&m~E!UdS*w6WlMAN`tM&sJY*lNF*=?=1)e6QZ;kf zQ55Az6B83BvR*)MPYC&4p-?z)MElzKk5Rv+6KuA_WHOoIoNG>z>y7+>j!;ch-re0z zb&3tB^|NQsE-}W2F=5-l;iE_6Z@66-7zgHI4iC@8jjG5CBxO)U903 zV2rKZx^>I&Ow$wqDhO8d@oK5-c4j=s26!8n<^b@9 zqA2|+v;~c;G&j_|DId_vC*ZQ#$T7D1j<-5$H^0zV)UU{?PE5UMrCz$iUpxJ9&Tq%# zanp%hrWv4ufzbi)0T_iyn}fG2G}c3t8)=^C7)`J&1AqL%Q%u;# z^}W^pYyqHlg41R~2!*-I0tu%rms;{pP6R7Y#DIier zOu1anv^(c$ivf*5ArPV{jsO4x@ro4?EtK8noM$SP%4)lU+lm5a2Rb`DJA@7iZ+_K6 zn$cWc?>pW>!WGbOsaL;ZK0A6WYz~D954NB>A{1pUY zLzd+yPHEcqRM@Q6U)FLRXF#_D;{wp_8tU};Tn2O+;cjo=Wk9!UsMF(f8PI8jyS;sv v0o|^lPLI!JK&KJz_V!%{bi0N+J-+_|H$KE{8xJ-600000NkvXXu0mjf^__;J literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/ic_warning_white_24dp_img.png b/app/src/main/res/drawable-xxxhdpi/ic_warning_white_24dp_img.png new file mode 100644 index 0000000000000000000000000000000000000000..8683a2ea9ad340635e32632d7b1f5234f567d796 GIT binary patch literal 590 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD0wg^q?%&M7z$EJF;uuoF_~yJJ-@yV2hmXrV z+x_O=keE4h=YjuBG7a1X40;C`cQCL&U^sK8C&y>5l}YBjm7OM6uU&ZZd(!{+b01hv zOO2csD$m2V{G80IGmp>l`oBLQ(=hW|qnaXvBJW)0=pgA{=31d3PTN}M^nG);@b;XP z%9Q$0IqB&6>Y&O4oUnB8F`s4L4{U3W86LLw+dq4vO2uZi62-ZW~as!d{Nx;Ld# z@Puqc@KLW<4%267C0QA<_l1;But@mP{&P$G@ol^;jsh&An}q`8x*8(wYO7d%q*=jDrtIxvIH0W4kk)?u{C7bU_KKDUhFQ!uP7Vxb8RZle8lExq3kWzA zH@I_fEU-MF%))X(=7As+QwHA$4n{_(^1kEhya^dba-SJm)E*o1J7ieN{bp!d_IM+| z0)&~?b6jqgpJHmt$7n@j4dY6|3>|cN|31qJ1pref_library_columns_landscape_key pref_library_update_interval_key pref_update_only_non_completed_key + pref_update_only_when_charging_key pref_auto_update_manga_sync_key pref_ask_update_manga_sync_key pref_theme_key @@ -30,8 +31,8 @@ pref_reader_theme_key pref_image_decoder_key pref_seamless_mode_key - pref_filter_downloaded - pref_filter_unread + pref_filter_downloaded_key + pref_filter_unread_key pref_download_directory_key pref_download_slots_key diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6e23653c05..fa73030f7e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -50,6 +50,7 @@ Change display mode Cancel Sort + Force refresh Deleting… @@ -72,6 +73,7 @@ Default Library update frequency Only update incomplete manga + Only update when charging Manual Hourly Every 2 hours @@ -256,6 +258,10 @@ New chapters found for: Failed to update manga: Please add the manga to your library before doing this + Sync canceled + Not connected to AC power + Sync canceled + Connection not available Select cover image diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml index 7450c8bf2f..72584f3bf3 100644 --- a/app/src/main/res/xml/pref_general.xml +++ b/app/src/main/res/xml/pref_general.xml @@ -3,30 +3,35 @@ xmlns:android="http://schemas.android.com/apk/res/android"> + android:title="@string/pref_library_columns"/> + android:key="@string/pref_library_update_interval_key" + android:summary="%s" + android:title="@string/pref_library_update_interval"/> + android:key="@string/pref_theme_key" + android:summary="%s" + android:title="@string/pref_theme"/> + android:title="@string/pref_update_only_non_completed"/> + + \ No newline at end of file diff --git a/app/src/test/java/eu/kanade/tachiyomi/data/library/LibraryUpdateAlarmTest.java b/app/src/test/java/eu/kanade/tachiyomi/data/library/LibraryUpdateAlarmTest.java index ea5d04019b..d6f7115fe6 100644 --- a/app/src/test/java/eu/kanade/tachiyomi/data/library/LibraryUpdateAlarmTest.java +++ b/app/src/test/java/eu/kanade/tachiyomi/data/library/LibraryUpdateAlarmTest.java @@ -101,6 +101,7 @@ public class LibraryUpdateAlarmTest { @Test public void testLibraryUpdateServiceIsStartedWhenUpdateIntentIsReceived() { Intent intent = new Intent(context, LibraryUpdateService.class); + intent.putExtra("is_forced", false); assertThat(app.getNextStartedService()).isNotEqualTo(intent); LibraryUpdateAlarm alarm = new LibraryUpdateAlarm();