11package org .metatrans .commons .ads .impl .providers .home_ads ;
22
33
4- import org .metatrans .commons .R ;
54import org .metatrans .commons .cfg .colours .IConfigurationColours ;
65//import org.metatrans.commons.cfg.publishedapp.IPublishedApplication;
76import org .metatrans .commons .cfg .publishedapp .IHomeAdInfo ;
@@ -29,6 +28,7 @@ public class BannerView extends View implements OnTouchListener {
2928 private RectF rectf_main ;
3029 private RectF rectf_main_inner ;
3130 private RectF rectangle_icon ;
31+ private RectF rectangle_text_frame ;
3232 private RectF rectangle_text1 ;
3333 private RectF rectangle_text2 ;
3434 //private RectF rectangle_type1;
@@ -41,7 +41,7 @@ public class BannerView extends View implements OnTouchListener {
4141 private IButtonArea buttonarea_type1 ;
4242 private IButtonArea buttonarea_type2 ;
4343
44- protected Paint paint_background ;
44+ protected Paint paint ;
4545
4646 private IConfigurationColours coloursCfg ;
4747 private IHomeAdInfo adInfo ;
@@ -68,14 +68,15 @@ public BannerView(Context context, IConfigurationColours _coloursCfg, IHomeAdInf
6868 rectf_main = new RectF ();
6969 rectf_main_inner = new RectF ();
7070 rectangle_icon = new RectF ();
71+ rectangle_text_frame = new RectF ();
7172 rectangle_text1 = new RectF ();
7273 rectangle_text2 = new RectF ();
7374 //rectangle_type1 = new RectF();
7475 //rectangle_type2 = new RectF();
7576
76- paint_background = new Paint ();
77+ paint = new Paint ();
7778
78- colour_area = coloursCfg .getColour_Background ();
79+ colour_area = coloursCfg .getColour_Delimiter ();
7980
8081 setOnTouchListener (this );
8182 }
@@ -128,7 +129,7 @@ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
128129 rectangle_type2.right = rectf_main_inner.right - MARGIN;
129130 rectangle_type2.left = rectangle_type2.right - (rectangle_icon.bottom - rectangle_icon.top);// + MARGIN;*/
130131
131-
132+
132133 rectangle_text1 .left = rectangle_icon .right + MARGIN ;
133134 rectangle_text1 .right = rectf_main_inner .right - MARGIN ;
134135 rectangle_text1 .top = rectf_main_inner .top + MARGIN ;
@@ -138,45 +139,50 @@ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
138139 rectangle_text2 .right = rectf_main_inner .right - MARGIN ;
139140 rectangle_text2 .top = rectf_main_inner .top + (rectf_main_inner .bottom - rectf_main_inner .top ) / 2 + MARGIN / 2 ;
140141 rectangle_text2 .bottom = rectf_main_inner .bottom - MARGIN ;
141-
142-
142+
143+ rectangle_text_frame .left = rectangle_text1 .left ;
144+ rectangle_text_frame .right = rectangle_text1 .right ;
145+ rectangle_text_frame .top = rectangle_text1 .top ;
146+ rectangle_text_frame .bottom = rectangle_text2 .bottom ;
147+
148+
143149 buttonarea_icon = new ButtonAreaClick_Image (rectangle_icon ,
144150 BitmapUtils .fromResource (getContext (), adInfo .getIconResID ()),
145- coloursCfg .getColour_Delimiter (),
146- //coloursCfg.getColour_Square_Black(),
151+ coloursCfg .getColour_Background (),
147152 coloursCfg .getColour_Square_White (),
148153 false
149154 );
150155
151156 String appName = getResources ().getString (adInfo .getName ());
152- if (appName .length () > 50 ) {
153- appName = appName .substring (0 , Math .min (appName .length (), 50 ));
157+ if (appName .length () > 30 ) {
158+ appName = appName .substring (0 , Math .min (appName .length (), 30 ));
154159 appName += " ..." ;
155160 }
156161 buttonarea_text1 = new TextArea (rectangle_text1 , true , appName ,
157- // coloursCfg.getColour_Delimiter (), coloursCfg.getColour_Square_White(), coloursCfg.getColour_Square_ValidSelection());
158- coloursCfg . getColour_Delimiter (),
159- coloursCfg .getColour_Square_White ());
162+ coloursCfg .getColour_Background (),
163+ //Color.rgb(186,255,201));
164+ coloursCfg .getColour_Square_ValidSelection ());
160165
161166 String promoText1 = getResources ().getString (adInfo .getDescription_Line1 ());
162- if (promoText1 .length () > 100 ) {
163- promoText1 = promoText1 .substring (0 , Math .min (promoText1 .length (), 100 ));
167+ if (promoText1 .length () > 60 ) {
168+ promoText1 = promoText1 .substring (0 , Math .min (promoText1 .length (), 60 ));
164169 promoText1 += " ..." ;
165170 }
166171 buttonarea_text2 = new TextArea (rectangle_text2 , true , promoText1 ,
167- // coloursCfg.getColour_Delimiter (), coloursCfg.getColour_Square_White(), coloursCfg.getColour_Square_ValidSelection());
168- coloursCfg . getColour_Delimiter (),
169- coloursCfg .getColour_Square_White ());
172+ coloursCfg .getColour_Background (),
173+ //Color.rgb(255,223,186));
174+ coloursCfg .getColour_Square_MarkingSelection ());
170175
171176 String promoText2 = getResources ().getString (adInfo .getDescription_Line2 ());
172- if (promoText2 .length () > 100 ) {
173- promoText2 = promoText2 .substring (0 , Math .min (promoText2 .length (), 100 ));
177+ if (promoText2 .length () > 60 ) {
178+ promoText2 = promoText2 .substring (0 , Math .min (promoText2 .length (), 60 ));
174179 promoText2 += " ..." ;
175180 }
176181 buttonarea_text3 = new TextArea (rectangle_text2 , true , promoText2 ,
177182 //coloursCfg.getColour_Delimiter(), coloursCfg.getColour_Square_White(), coloursCfg.getColour_Square_ValidSelection());
178- coloursCfg .getColour_Delimiter (),
179- coloursCfg .getColour_Square_White ());
183+ coloursCfg .getColour_Background (),
184+ //Color.rgb(186,225,255));
185+ coloursCfg .getColour_Square_InvalidSelection ());
180186
181187 current_text2 = buttonarea_text2 ;
182188
@@ -226,31 +232,40 @@ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
226232 protected synchronized void onDraw (Canvas canvas ) {
227233
228234 counter_switch --;
235+
229236 if (counter_switch <= 0 ) {
237+
230238 counter_switch = MAX_COUNTER_SWITCH ;
239+
231240 if (current_text2 == buttonarea_text2 ) {
241+
232242 current_text2 = buttonarea_text3 ;
243+
233244 } else {
245+
234246 current_text2 = buttonarea_text2 ;
235247 }
236248 }
237-
249+
250+
238251 super .onDraw (canvas );
252+
253+
254+ paint .setColor (coloursCfg .getColour_Delimiter ());
255+ DrawingUtils .drawRoundRectangle (canvas , paint , rectf_main );
239256
240- paint_background .setColor (coloursCfg . getColour_Delimiter () );
241- DrawingUtils .drawRoundRectangle (canvas , paint_background , rectf_main );
242-
243- paint_background .setColor (colour_area );
244- DrawingUtils .drawRoundRectangle (canvas , paint_background , rectf_main_inner );
245-
257+ paint .setColor (colour_area );
258+ DrawingUtils .drawRoundRectangle (canvas , paint , rectf_main_inner );
259+
260+ paint .setColor (coloursCfg . getColour_Delimiter () );
261+ DrawingUtils .drawRoundRectangle (canvas , paint , rectangle_text_frame , 50 );
262+
246263 buttonarea_icon .draw (canvas );
247264 buttonarea_text1 .draw (canvas );
248265 current_text2 .draw (canvas );
249- //buttonarea_type1.draw(canvas);
250- //buttonarea_type2.draw(canvas);
251-
266+
267+
252268 invalidate ();
253- //System.out.println("View_Achievements_And_Leaderboards_Base> onDraw in rect=" + rectf_main);
254269 }
255270
256271
0 commit comments