From bd75699773c8a30f662c7eb0f065fe4a5770a88e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 12 Feb 2015 22:19:17 +0300 Subject: [PATCH] bring widget up to holo ui standards (lol) --- .../fox/ttrss/widget/WidgetUpdateService.java | 26 ++++++-------- .../drawable-hdpi/appwidget_bg_pressed.9.png | Bin 0 -> 798 bytes .../res/drawable-hdpi/appwidget_dark_bg.9.png | Bin 0 -> 731 bytes .../appwidget_dark_bg_focused.9.png | Bin 0 -> 856 bytes .../drawable-xhdpi/appwidget_bg_pressed.9.png | Bin 0 -> 1098 bytes .../drawable-xhdpi/appwidget_dark_bg.9.png | Bin 0 -> 1005 bytes .../appwidget_dark_bg_focused.9.png | Bin 0 -> 1135 bytes .../drawable/appwidget_dark_bg_clickable.xml | 24 +++++++++++++ .../src/main/res/layout/widget_small.xml | 32 +++++++----------- org.fox.ttrss/src/main/res/values/dimens.xml | 1 + .../src/main/res/xml/widget_small.xml | 2 +- 11 files changed, 48 insertions(+), 37 deletions(-) create mode 100644 org.fox.ttrss/src/main/res/drawable-hdpi/appwidget_bg_pressed.9.png create mode 100644 org.fox.ttrss/src/main/res/drawable-hdpi/appwidget_dark_bg.9.png create mode 100644 org.fox.ttrss/src/main/res/drawable-hdpi/appwidget_dark_bg_focused.9.png create mode 100644 org.fox.ttrss/src/main/res/drawable-xhdpi/appwidget_bg_pressed.9.png create mode 100644 org.fox.ttrss/src/main/res/drawable-xhdpi/appwidget_dark_bg.9.png create mode 100644 org.fox.ttrss/src/main/res/drawable-xhdpi/appwidget_dark_bg_focused.9.png create mode 100644 org.fox.ttrss/src/main/res/drawable/appwidget_dark_bg_clickable.xml diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/widget/WidgetUpdateService.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/widget/WidgetUpdateService.java index e45bd301..40f7d100 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/widget/WidgetUpdateService.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/widget/WidgetUpdateService.java @@ -1,14 +1,5 @@ package org.fox.ttrss.widget; -import java.util.HashMap; - -import org.fox.ttrss.ApiRequest; -import org.fox.ttrss.R; -import org.fox.ttrss.util.SimpleLoginManager; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; - import android.app.Service; import android.appwidget.AppWidgetManager; import android.content.ComponentName; @@ -17,9 +8,17 @@ import android.content.SharedPreferences; import android.os.IBinder; import android.preference.PreferenceManager; import android.util.Log; -import android.view.View; import android.widget.RemoteViews; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + +import org.fox.ttrss.ApiRequest; +import org.fox.ttrss.R; +import org.fox.ttrss.util.SimpleLoginManager; + +import java.util.HashMap; + public class WidgetUpdateService extends Service { private final String TAG = this.getClass().getSimpleName(); @@ -51,8 +50,7 @@ public class WidgetUpdateService extends Service { final AppWidgetManager manager = AppWidgetManager.getInstance(this); try { - view.setTextViewText(R.id.counter, String.valueOf("")); - view.setViewVisibility(R.id.progress, View.VISIBLE); + view.setTextViewText(R.id.counter, String.valueOf("...")); manager.updateAppWidget(thisWidget, view); @@ -80,7 +78,6 @@ public class WidgetUpdateService extends Service { if (content != null) { int unread = content.get("unread").getAsInt(); - view.setViewVisibility(R.id.progress, View.GONE); view.setTextViewText(R.id.counter, String.valueOf(unread)); manager.updateAppWidget(thisWidget, view); @@ -91,7 +88,6 @@ public class WidgetUpdateService extends Service { } } - view.setViewVisibility(R.id.progress, View.GONE); view.setTextViewText(R.id.counter, "?"); manager.updateAppWidget(thisWidget, view); } @@ -112,7 +108,6 @@ public class WidgetUpdateService extends Service { @Override protected void onLoginFailed(int requestId, ApiRequest ar) { - view.setViewVisibility(R.id.progress, View.GONE); view.setTextViewText(R.id.counter, "?"); manager.updateAppWidget(thisWidget, view); } @@ -132,7 +127,6 @@ public class WidgetUpdateService extends Service { } catch (Exception e) { e.printStackTrace(); - view.setViewVisibility(R.id.progress, View.GONE); view.setTextViewText(R.id.counter, getString(R.string.app_name)); manager.updateAppWidget(thisWidget, view); diff --git a/org.fox.ttrss/src/main/res/drawable-hdpi/appwidget_bg_pressed.9.png b/org.fox.ttrss/src/main/res/drawable-hdpi/appwidget_bg_pressed.9.png new file mode 100644 index 0000000000000000000000000000000000000000..efacbcfa64bf6abab7c8ca092a0b867ce0529f98 GIT binary patch literal 798 zcmeAS@N?(olHy`uVBq!ia0vp^UO?>2!3HE5uYNiSq*#ibJVQ8upoSx*1IXtr@Q5sC zVBqcqVMgvX}tOOy;spL@)Cd4l~y_h1TEbt z^j2rhU-maoOq&$`iHp6={lo0!q~jt`y;jFbsDAC|wDf29ii1+7+c00e+!A}wT7E{- z&1dhXTU!Uq=%pPK+oXK`*i6Yy{|Y`|+}z!JLRN5RN-B7MC_N#LRq8TzNKDg`53Yq@=i<-o~m?7@Muq}-jqf6nN=Dl9k0FG@g?82chd3V z4P31+%WUGd^)SxhTI1ZR-xc5|cuLdB(p6(Q$5WAobCjk8w-k{nIOWEq#!I>4)*$m# zf26lq{n>sakQ&CgMiSPRm$j+w2oWwYJOG zU45!JBd;v=_K_)HMcYt(Jea*Z6W(nbgXx3Btd=FJ(Qeyfph{ z_xJY4kIvdYn8o0uHu+}j>+O1`zs2*s@7Cy^O_85C+1xxeVcFuR4^3B{|9t!Y`~6iv z9%ve@Nj9mjuHL*X^O@$-&8w=+mYT4aomunj2j3jY1f`$`xgQy6?_Hkwp8FYly)^g! zciRQ8<>xn~+0FM4_Szj9`gYYTKd+UMwd!eQZ=BZVNiknJV|1b0BRwtl_O{de-n%c@ zV7H+}mGNqc)!J37R)ubzcQ#FPX^D>V+Rl#7j?&oWtD;t|(&|2{^toIi^{bj{T3g2v g?2!3HE5uYNiSq*#ibJVQ8upoSx*1IXtr@Q5sC zVBqcqVMg?;kx;+0Egx$4x^?(eagypsW|G zlTA=nlY{01(+Lc&R&PFUvbGknb;;yx=>6}pUYuLQ&b(Oi zH&m%ffJv;Ib=v8t%cgw#^6S^HWM+ofUw=7;?w<4cO0nO$GYeMT$T2%%S#EfYn<0Zi zVQGok+ltR2UXGeic^H@&R=hg=|7+mx(-phq7?L&IcFn!{&Q@-j+>`i&0e(DBk5GYN zG>*}mt2|Fby{(Arz7T)Kz-L)PY-H4Gn;_q$xvn|^v-?(I;HhdZuS$v8zYT9|BR`(FO= z48x2LjRuwnyJz0*II%tG)L8?b*HeO+0>0PVF=T|VzN*wxAd+meYO7qEz^#wwH}8Kf zo8Q5)p*!^K8U_y~qZv0h#I4`1xs=CY=|u)fBkr*7F7jIoeZ9?elF{r5}E*% C{W@6y literal 0 HcmV?d00001 diff --git a/org.fox.ttrss/src/main/res/drawable-hdpi/appwidget_dark_bg_focused.9.png b/org.fox.ttrss/src/main/res/drawable-hdpi/appwidget_dark_bg_focused.9.png new file mode 100644 index 0000000000000000000000000000000000000000..ccc01774571d9270a0a50c6f96332e1a3c5caf5c GIT binary patch literal 856 zcmeAS@N?(olHy`uVBq!ia0vp^UO?>2!3HE5uYNiSq*#ibJVQ8upoSx*1IXtr@Q5sC zVBqcqVMg-fi8lc zp3aWb^&N$mdNSJD+Qu_1>EN2EBowqxJxEKW_0PrJZ{KS6)!I65+&z6U$1E=W^3RiF zB3>u`S(Cf7BK1rUZ%X>Mdov|B-TV3K`hK;g1^z9z#&++DH|*>DaHz-qX2plc>C?Y6 z3O7XWx0%l~*(OS&^s;1RuJON9avT9_i6IJI(@rY$>nPYmkvNMGT2TXIzubJ)UNM;|G(9lqTBN#6g2|MzOCjqy+4 zwS0P2njpD4TF0&>R3qg7N1s#v-!toeJ+zlE67G3-$CfvhVHMMasyQ#~Rh=wdHI{Qc z6TQ@Qtw!@rM;Qo-b~g-MR5f9u|!!mw;^ z(yR%o+l$H%y*PLGU)t-yoz|7xlXvAXuVlH9_Rl8tuyzpdH1_ztb-ywfbf4M9XKPu< z8so=M`Rmtn8|wqR?tIRWcA2`)a>;Dp`sS-^zkmC9_`ThZZROFk4{IN-Xb<64h`sQ9 zkJdEtCx=`$Aa;u)+eT>0$GtU;KOEV&k z=b!Jty)BkO_BH>sbt(%a_}X0qMV79bRvNo}%B7t>Thx@)l&+cduF47*aW$WP*66gu osaLLEXLtlV&Ck^*rhPKMnFT~B)?_bKG!SLbX_3x{!PVe^hyDxC#_0#~NwCC>*KaKKg(rNM(W2m^YGFE;{ z`M$qDJ_RrySfoGynaX@y!*^e^GP)ZT^o|9d<`;BO$XL~q>G#|6q^@ZVAA=}ENmlrz zllKzZ7PYuG{%7G7a0%z}N}6$T4%7%%XI%mwP(pnE*NTB$`?@K7hmLzk8UB_|6( z#W@`Uel8s9v=kOP_s}I+Jg^653yZ=t_96v0x;W&9lHC9GKO~wSPkz`l_eXpAw8RBs zM^sqSI~Qn0oZ^aTzhKmySz_VMvV!Zf5&JQLRLkExb)F|kGTbUN|M0(oZ5m^hMYG(w zdX{4XyQ1z~FZ&sC+d1OC{Lzld$6hKs8b{oByscVN`orV)Q`>|&r4P1Vzh77S{M6Rf zU*G);54t-2QVN%+3gn<>)}-LW9)wyaf)#zyFv8Z=BM(&>-!|~4r zS1!NYk~Qnu(>cYHgKnw*WNPqMGGe{Ja6;wtk6$M~zrS{UiO57o2gVHwHz(Fi3W}N< z#CK-R{IhA=3|t4U9hWPMO)ri8{`gmnOVuQ<1!5C5JsBr3Ce+CI2~7OjSt{$ysB!Xe zVg0$#t>&Bez23zreSPJojUo)8mrYi#d+ix}ed(M87#HJA?ES5At_y1h;1=472!Q69@yt-5C4>e18o zTzRLZ(U~(5UV(xOS54cN%iECnIoq_a?9DUj!(tPr>}QZ!aX;$*_C0#Q!hpfk)z4*} HQ$iB}D;(Nl literal 0 HcmV?d00001 diff --git a/org.fox.ttrss/src/main/res/drawable-xhdpi/appwidget_dark_bg.9.png b/org.fox.ttrss/src/main/res/drawable-xhdpi/appwidget_dark_bg.9.png new file mode 100644 index 0000000000000000000000000000000000000000..7ccb762be038cd3f6ab6f6f2332a38ef5617aac7 GIT binary patch literal 1005 zcmeAS@N?(olHy`uVBq!ia0vp^NkE*&!3HD^Ok5;@6icy_X9x!n)NrJ90QsB+9+AZi z4BVX{%xHe{^jZc6=6+8X$B>FSZ|^wfDTfLi`?&tzYd>qFS(1i3Pvl5wPVhZr95)&sd42l3WZKIdm9=v|5b_ewA*bj7Ra1ip(=ze7XqXWgs||JE@>GUTgs z_FG$n_f{KX^yYV-@YH-7y7uc&10Ic~3#Pn&UnH34_aWZ($h)wXLK&dOjI{eJUd_&& z6(-BD;?I@r&)R}Bl@2j{Q8IFAVOYUnV87hIo zxIOvdJGr%{!V?WPZ@Zf(+weFoiyMdxJglB z!i<}{82&S6Pn__}ogwIGo5TdI08OFRPTr6FAC!G(-#D`G`@GL~JUjh-1buw}sMXp9 ziCFKN)_3muarJE_>m7x}8RUOkhI<^ER(|i#v+q?gH-B?h+~iq5=?0rYON29tINBo|1 zKiwi&AP{#-HG$*cBn9bXseZxeC zhT84N?_{UWQDxGRocCMPV2{buzwGf(oA=(kZ5i>Yiv5R40sC*h)NcZ*yZ*}>v}pY1 z->2JtIsViehJ6++doxPsun85kmvc`!ta<9;oAXBV|8nq1AA0ue*|l@G&Esb5`EhBv z*({rQU$g8G(V(jg%eaMY1XUu8Ua;Of_po+*wA|Z$n}2_Oe*gXdlIQx&4Hq-E+%!4+ z;#9T#-r3u>#c%%jtaSA&@38C1v5Jp86(8K&{6w?(KlAT*|K#V_7JYtjeSS2<-J)r; zKUT!}t4&_JYL%Mi(sa)}hKgfnjxne)Xid6Wu;vC_)X^ZP_o_e2c!8{+em6@{wFPm)L-G9gSYH4g}XsSy8zq_`#PKZ9f zpW$Au#dzSZ?ejOGpWHb_oOovG6d$9jrF;MQ zoZ2GwPyXc9sSn?sn^SCPJT2%`(#8S?zBM)b8W(rQ)-G7X==ocE*5%U%g0G5YfF%Zl Mr>mdKI;Vst0MXpvX8-^I literal 0 HcmV?d00001 diff --git a/org.fox.ttrss/src/main/res/drawable/appwidget_dark_bg_clickable.xml b/org.fox.ttrss/src/main/res/drawable/appwidget_dark_bg_clickable.xml new file mode 100644 index 00000000..7cfc9d2b --- /dev/null +++ b/org.fox.ttrss/src/main/res/drawable/appwidget_dark_bg_clickable.xml @@ -0,0 +1,24 @@ + + + + + + + diff --git a/org.fox.ttrss/src/main/res/layout/widget_small.xml b/org.fox.ttrss/src/main/res/layout/widget_small.xml index ec377296..2ea0e9bd 100644 --- a/org.fox.ttrss/src/main/res/layout/widget_small.xml +++ b/org.fox.ttrss/src/main/res/layout/widget_small.xml @@ -1,42 +1,34 @@ + android:padding="@dimen/widget_margin" + android:layout_width="wrap_content" + android:layout_height="wrap_content" > + android:textColor="@android:color/primary_text_dark" + android:textSize="13sp" /> - - - \ No newline at end of file + diff --git a/org.fox.ttrss/src/main/res/values/dimens.xml b/org.fox.ttrss/src/main/res/values/dimens.xml index 47c82246..71882af8 100644 --- a/org.fox.ttrss/src/main/res/values/dimens.xml +++ b/org.fox.ttrss/src/main/res/values/dimens.xml @@ -2,4 +2,5 @@ 16dp 16dp + 0dp diff --git a/org.fox.ttrss/src/main/res/xml/widget_small.xml b/org.fox.ttrss/src/main/res/xml/widget_small.xml index c41eb3d2..df80ac46 100644 --- a/org.fox.ttrss/src/main/res/xml/widget_small.xml +++ b/org.fox.ttrss/src/main/res/xml/widget_small.xml @@ -3,6 +3,6 @@ android:minHeight="40dp" android:updatePeriodMillis="86400000" android:initialLayout="@layout/widget_small" - android:resizeMode="horizontal|vertical" + android:resizeMode="none" android:widgetCategory="home_screen"> \ No newline at end of file