From 62cd2e4809c46bccc023f03c9dfc5305a80bae08 Mon Sep 17 00:00:00 2001 From: onlymash Date: Sun, 25 Mar 2018 23:34:32 +0800 Subject: [PATCH] add app shortcuts --- app/src/debug/res/xml-v25/shortcuts.xml | 30 ++++++++++++++ app/src/main/AndroidManifest.xml | 26 ++++++++++++ .../shortcuts/StartAllDownloadActivity.java | 38 ++++++++++++++++++ .../shortcuts/StopAllDownloadActivity.java | 36 +++++++++++++++++ .../mipmap-anydpi-v26/ic_shortcut_start.xml | 5 +++ .../mipmap-anydpi-v26/ic_shortcut_stop.xml | 5 +++ .../ic_shortcut_start_foreground.png | Bin 0 -> 572 bytes .../ic_shortcut_stop_foreground.png | Bin 0 -> 358 bytes .../ic_shortcut_start_foreground.png | Bin 0 -> 356 bytes .../ic_shortcut_stop_foreground.png | Bin 0 -> 218 bytes .../ic_shortcut_start_foreground.png | Bin 0 -> 741 bytes .../ic_shortcut_stop_foreground.png | Bin 0 -> 489 bytes .../ic_shortcut_start_foreground.png | Bin 0 -> 1422 bytes .../ic_shortcut_stop_foreground.png | Bin 0 -> 868 bytes .../ic_shortcut_start_foreground.png | Bin 0 -> 2225 bytes .../ic_shortcut_stop_foreground.png | Bin 0 -> 1410 bytes .../res/values/ic_shortcut_background.xml | 4 ++ app/src/main/res/xml-v25/shortcuts.xml | 30 ++++++++++++++ 18 files changed, 174 insertions(+) create mode 100644 app/src/debug/res/xml-v25/shortcuts.xml create mode 100644 app/src/main/java/com/hippo/ehviewer/shortcuts/StartAllDownloadActivity.java create mode 100644 app/src/main/java/com/hippo/ehviewer/shortcuts/StopAllDownloadActivity.java create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_shortcut_start.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_shortcut_stop.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_shortcut_start_foreground.png create mode 100644 app/src/main/res/mipmap-hdpi/ic_shortcut_stop_foreground.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_shortcut_start_foreground.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_shortcut_stop_foreground.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_shortcut_start_foreground.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_shortcut_stop_foreground.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_shortcut_start_foreground.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_shortcut_stop_foreground.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_shortcut_start_foreground.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_shortcut_stop_foreground.png create mode 100644 app/src/main/res/values/ic_shortcut_background.xml create mode 100644 app/src/main/res/xml-v25/shortcuts.xml diff --git a/app/src/debug/res/xml-v25/shortcuts.xml b/app/src/debug/res/xml-v25/shortcuts.xml new file mode 100644 index 000000000..557a49084 --- /dev/null +++ b/app/src/debug/res/xml-v25/shortcuts.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d7067dbd3..50ecb9fbc 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -48,6 +48,9 @@ + + @@ -144,6 +147,29 @@ android:theme="@style/AppTheme.NoActionBar" android:label="@string/hosts"/> + + + + + + + + + + + + diff --git a/app/src/main/java/com/hippo/ehviewer/shortcuts/StartAllDownloadActivity.java b/app/src/main/java/com/hippo/ehviewer/shortcuts/StartAllDownloadActivity.java new file mode 100644 index 000000000..6cec580a9 --- /dev/null +++ b/app/src/main/java/com/hippo/ehviewer/shortcuts/StartAllDownloadActivity.java @@ -0,0 +1,38 @@ +/* + * Copyright 2018 Hippo Seven + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hippo.ehviewer.shortcuts; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; + +import com.hippo.ehviewer.download.DownloadService; + +/** + * Created by onlymash on 3/25/18. + */ + +public class StartAllDownloadActivity extends Activity{ + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + Intent intent = new Intent(this, DownloadService.class); + intent.setAction(DownloadService.ACTION_START_ALL); + startService(intent); + finish(); + } +} diff --git a/app/src/main/java/com/hippo/ehviewer/shortcuts/StopAllDownloadActivity.java b/app/src/main/java/com/hippo/ehviewer/shortcuts/StopAllDownloadActivity.java new file mode 100644 index 000000000..befb5c16e --- /dev/null +++ b/app/src/main/java/com/hippo/ehviewer/shortcuts/StopAllDownloadActivity.java @@ -0,0 +1,36 @@ +/* + * Copyright 2018 Hippo Seven + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.hippo.ehviewer.shortcuts; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; + +import com.hippo.ehviewer.download.DownloadService; + +/** + * Created by onlymash on 3/25/18. + */ + +public class StopAllDownloadActivity extends Activity { + + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + stopService(new Intent(this, DownloadService.class)); + finish(); + } +} diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_shortcut_start.xml b/app/src/main/res/mipmap-anydpi-v26/ic_shortcut_start.xml new file mode 100644 index 000000000..84f2dbd1b --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_shortcut_start.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_shortcut_stop.xml b/app/src/main/res/mipmap-anydpi-v26/ic_shortcut_stop.xml new file mode 100644 index 000000000..fcbed2bb6 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_shortcut_stop.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_shortcut_start_foreground.png b/app/src/main/res/mipmap-hdpi/ic_shortcut_start_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..cad62f37db0649f37ab3574e916a79f17ef9938f GIT binary patch literal 572 zcmeAS@N?(olHy`uVBq!ia0vp^i$Iuz4M-mPBqq(kz{Kq7;uunK>+M~8Bj-SgV-JnF ztg62BZ%JE%1yN_e`_xsh8eaN^Da6 z_Bm$R+f2!Ra~Xk?0{fTm)t{VpUr~_nV|LuB5);kG2bUdIl6-XjeqaC7O_n7IDb6u$ zmAO})?T*yVTT`_{@yOFv>1KCIJ5rqg?0vOUYK^teB*lMcnnU?bTYgxsk6%46a`V#! z&$f)K&aOb4(ylu5D(>5T)!A1u>T5t?M;?ec9c_F0VdG(SnMdoRZNqF^oVUDMxJY37 zV@5s2Fu_Hk{Q|2wFEYnCt;t(c)e>>JqQSf4>zUU{dbS5tkJNO`QxQq3ko&`>eB{ma zsp~91r@D4rGhdU_@!7RSUF??A7h!pAsYlP3wy(4O? zA8JklG6i@)p7moUHx3vIVCg!0D>0Y AhX4Qo literal 0 HcmV?d00001 diff --git a/app/src/main/res/mipmap-hdpi/ic_shortcut_stop_foreground.png b/app/src/main/res/mipmap-hdpi/ic_shortcut_stop_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..0b6aab6925a4d0568c4e3790124f707f026fe6ca GIT binary patch literal 358 zcmeAS@N?(olHy`uVBq!ia0vp^i$Iuz4M-mPBqq(kz^Lo#;uunK>+Pk5ybTUK4j0cI zkjj{r#3hpuAk!7AD9doU_{rWSn=+5~1GV4>4U@L{UHrDw=DXpP{O5V+-~O3bAhLm3c>{xPY|BQ`$dE5Jk1Cf$Kd2YoQ7j5H2pQ~` zzU5qc_n7k%i*1)}-haMR)iWpIbj{h%G0x>r1C5&2eh#eNygqZ+2MfuA*D6`W7PjA(jK7{8 zOMb=z;uJHr05Ob)u&w?7SG>RY_Ylix`!mx{%-?_bSNmG_Z%dsG?hE~o-mtLt>sCAE x8KJfsK&%4AFt!?y55h2hTc|9u#~2tU)iPT@m~}FssdFkw!qe5yWt~$(696+WhPeO$ literal 0 HcmV?d00001 diff --git a/app/src/main/res/mipmap-mdpi/ic_shortcut_stop_foreground.png b/app/src/main/res/mipmap-mdpi/ic_shortcut_stop_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..92b3e5f3b857e5352023b13c249da5036b654b2d GIT binary patch literal 218 zcmeAS@N?(olHy`uVBq!ia0vp^IUvlz1|<8_!p{P!g`O^sAr-gY-rmUBU?9+Tv0le} zd$732vEnHzO=~CUDZD>edR+A9D;1zpWT5i&R?xZXykqZH&EE5BV}E;g@aH${c6BB+ zajHoG@r(oxAZ}6wV$L>@Ac%pBK&XFVdQ&MBb@ E0OTe{4FCWD literal 0 HcmV?d00001 diff --git a/app/src/main/res/mipmap-xhdpi/ic_shortcut_start_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_shortcut_start_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..275363af4d9f120e56598a1f015dae8ad457b20f GIT binary patch literal 741 zcmeAS@N?(olHy`uVBq!ia0vp^H$a$!4M=t>=)PrOU|Qqp;uunK>+M}bJ(fU;10U5z zrpPo17qIQx%i#BrFM5Kc;_VH_g0o+2e=HEw$Q|%nBf@&One^Y9$$NhMowPpG=BInj zZyQZUpn>E9hj(qR`k_xfUwywW!?tCu7T@wl-%B6<7>0^h^RXx~%|7qGs{68uM2>|- zhW&=4HvaXCWG!SmIM>WvA2Rp;vWp3)6&-&!>OM2Q`ZREsPne9@7Wo@Va+iE}zCECz zwju3ay7u3X6;}^})o8{}-Ob0J#FYK)vX}fLrp=ey`9Q>j18cr4Y(6mS=e)YJze{R& zJ}y}J_rSk(U+!LVPf%?1y>qGk1yF@xL`A~ssdce$tV>wL%s)@93(c{r0kZNpPqpLF zDY*kweDLu!J0@;7Au)O>xH8qbpUmCq7L^d0z9Z*W3=gZb)mkkCz*Z*Q(y zGi|PF_hI^+pC~wkJzZh?0UHZu$HvM6HYTRe4|rHupIx(N0V#HD-1(J{5kx>)U?s(` zWt%_-G#prSPf^8S`#r@28(sj_kef(=`u_Z4v^wzO$JexzyFsRSy85}Sb4q9e0LXS4 A9{>OV literal 0 HcmV?d00001 diff --git a/app/src/main/res/mipmap-xhdpi/ic_shortcut_stop_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_shortcut_stop_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..12b6ad78939c611593ef69b92547b60bb4d59ea5 GIT binary patch literal 489 zcmeAS@N?(olHy`uVBq!ia0vp^H$a$!4M=t>=)PrOVBFy8;uunK>+NMjt`-LY*MpWV z)lXdyo^be}(iV5>&fLDU)AS`m9G5$rpULJ0>LMH5%bNRbTVHy~w#tro5$~6lui5?Z z=YeC3&x_7|`nwY<;+VkXoWR7~$jJjiENTW2BrxLu1UZ0JAQZ8%F$qfm5r`1*KXi zQU!tyQXycOKr0n!(IHS654He)y!;X~Eb% zab;y~JB|t%-h(TkIh7xk*njUT)WqO7c6mqR%WgMPCJIpO9oF;BaO{WI7d{%iW6MHL zAyyqV1DoxA6k58ML$g!;!%kh~HJZRe-M@IUH;A7fBf%EuTJK&cS)EH{&;h>5;(730 zd3l*2Ayg`0rn;qIY)6+Ny0rb-H741(Be&m#8Kz7Dhl`;paT@E_&gLA17%z?bGc7KV zfe^d454v`aCnuH8-jo`oBMF6`gWcvfgdI^9nDIC;m@G*Z?!9(vl?I5q{ATAur8$bU zoh>ZKH58hD*45X^SAzA#Ynlfq;|n3_$ndYll~H%bbA7;qwZpVEs`QBf?o@!8-9Ddp8X{84mZ(5V<{nF#LFsh3D*{7{R})USYjZbl zgqtWB>8Tp)*%miTgs67*y{)f0KnGawzS?Rh-ws#bhU)bsPvGcw#ZXpd6*(Ly6-;vK zbe3Gwi=mA8o=$Q*W2-@IFhdBtE-Fo5#Hq{Xa1r9W`i9NZ3E?~hgf+<|GGGZFbECRA z4Mm!{Kgr=H7Gmf<_l^byOx3(A7|qe>Mt+*@qe?R^Idyrz z=x0DgJIWNyBnZLKmoyZK+!o__Ys}zAJJF&QUo@jBGD6;Z)1-%Xzuh`78#uj& zBJi*SZiAs!73)e5@J0MYo!TZX^bC%b(V2&d$69C_UhWwWYY2mB7V5tE>S$afc`hBn zMfUw%D;CXM{j7Y|dBwublCUMKsj9N6P|#{eT=u+dtluxrZq&Ifbzx{eYBw4N3oHaA z<4}voS4ozL4-#GT#jOdUSMovRB=Rs@Cj6S8>yQ17?TqZy$s1j|r}HIEQt#|NSt>Yh zO6q`?qUAY40|-jcf10(B23ECbv$DqWH$dB1Y$HX%(5oJi+tij!nIc3{-hGl)eO@LE zm(jtQx+JP?^Nt5{7^__rBoc}Zg`N2LIa}&-v^{!`5!KM^B({J literal 0 HcmV?d00001 diff --git a/app/src/main/res/mipmap-xxhdpi/ic_shortcut_stop_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_shortcut_stop_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..8af287e5a508230123c6c5eba7cc58d3312714ab GIT binary patch literal 868 zcmeAS@N?(olHy`uVBq!ia0y~yU~~at4mO}j{44ik3=GWLo-U3d6}R4AxyX4yLBPdv z_vWT6Q&ua4rP->5Z4^v(1XGhn2hdCppnlZo0GdZtg3`d7!1Ji* p?h3ivd++<@u@8cz2XunpXC@!*${6p4^;sYXdAjq9NYrB;>}TA3C$qp}Yw-sxOpeOQ!~;RkH(xYg_n zBaO^DrfqW)b(FrmR{% zk?c!G5M*Lf;!-w(5ES@#+Hx=+*?rHwsUD(> zL{5yMbdkmI^}c)G5dweFN}pI?XY>C0E7lJ=N#1cvm>X6!IHD-dj(1Bw*rsI6%`+H?pj2x126fM2fZ?G7Ieb&w4hHvs1JNK54l{|fu2B$Q-R5{wxNoR^P zDtC^qQ_756=Rn+p%QKu15^b6YTxc7xa}>$2AgAq!XA1VCs@W1>(m-8^fI}vKadqaI zHd2tHsn`9}t9Si=utAKZU>BSrbJHOj^%;sv&EL+ap4YN#=CN$stTX*40pn$qM@{H z*cWUkoFQ)N9V6i^TW%pCC>+l|W6aL6U2*4;2s>Qo6 ze}b#Ebu3SQ3iOFXfgnC&&rLcg=Xo-{9v2Xm3Joqkf3eJU_ZdnnW+y)AgW>YWnBt`F z&blgD|HjwrJwHmpP8Q#o;S>=iP0-5jOiJW=?KJCz->M%D5=pe;>jE-UtPgn8T&lSe z??Ee$zc*x@wI!+R?Le*$h}mVE_3Hu{&f)I z@5raF?*Z3RWxzeBS5#~Kfk=?z_{aj5d7Gn(;sp>TI+L&4TFlGgNZ%GJDT7MJHsVmuh$&tx3PySI

9NoU^*M=i+IUnIQhd@j0Y|&2}p? z@9Hb{6c6SKaXW}r-Z+)vDLO_kQ(?^}$O|TDEGbJRbY@KftLcdjJ3c literal 0 HcmV?d00001 diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_shortcut_stop_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_shortcut_stop_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..1a5ce20c0819e5ec9eb1bcd69cd888c6d1831c33 GIT binary patch literal 1410 zcmeAS@N?(olHy`uVBq!ia0y~yVB7%09Be?56MhC-3=FKEo-U3d6}R4AJ;>W)z{B8Z z?!v#tS#^dv*UFY(4JCs2&wBiGFI&1rDJR^w)_zlbM|MON7Y+8`n2t5wnf#+Ij}PQ=Pgg&ebxsLQ06u}&pa1{> literal 0 HcmV?d00001 diff --git a/app/src/main/res/values/ic_shortcut_background.xml b/app/src/main/res/values/ic_shortcut_background.xml new file mode 100644 index 000000000..d533a7125 --- /dev/null +++ b/app/src/main/res/values/ic_shortcut_background.xml @@ -0,0 +1,4 @@ + + + #F5F5F5 + \ No newline at end of file diff --git a/app/src/main/res/xml-v25/shortcuts.xml b/app/src/main/res/xml-v25/shortcuts.xml new file mode 100644 index 000000000..35ebc94df --- /dev/null +++ b/app/src/main/res/xml-v25/shortcuts.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + +