1313
1414import android .content .Context ;
1515import android .graphics .Canvas ;
16+ import android .graphics .Color ;
1617import android .graphics .Paint ;
1718import android .graphics .RectF ;
1819import android .view .MotionEvent ;
@@ -30,8 +31,8 @@ public class BannerView extends View implements OnTouchListener {
3031 private RectF rectangle_icon ;
3132 private RectF rectangle_text1 ;
3233 private RectF rectangle_text2 ;
33- private RectF rectangle_type1 ;
34- private RectF rectangle_type2 ;
34+ // private RectF rectangle_type1;
35+ // private RectF rectangle_type2;
3536
3637 private IButtonArea buttonarea_icon ;
3738 private IButtonArea buttonarea_text1 ;
@@ -69,8 +70,8 @@ public BannerView(Context context, IConfigurationColours _coloursCfg, IHomeAdInf
6970 rectangle_icon = new RectF ();
7071 rectangle_text1 = new RectF ();
7172 rectangle_text2 = new RectF ();
72- rectangle_type1 = new RectF ();
73- rectangle_type2 = new RectF ();
73+ // rectangle_type1 = new RectF();
74+ // rectangle_type2 = new RectF();
7475
7576 paint_background = new Paint ();
7677
@@ -87,9 +88,9 @@ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
8788
8889 //if (!initialized) {
8990
90- int MARGIN = 1 ;
91+ int MARGIN = 7 ;
9192
92- if (getMeasuredWidth () > getMeasuredHeight ()){
93+ if (getMeasuredWidth () > getMeasuredHeight ()) {
9394
9495 rectf_main .left = 0 ;//1 * getMeasuredWidth() / 6;
9596 rectf_main .right = rectf_main .left + (4 * getMeasuredWidth ()) / 8 ;
@@ -99,42 +100,42 @@ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
99100 } else {
100101
101102 rectf_main .left = 0 ;//1 * getMeasuredWidth() / 19;
102- rectf_main .right = rectf_main .left + ( 17 * getMeasuredWidth ()) / 19 ;
103+ rectf_main .right = rectf_main .left + getMeasuredWidth ();
103104
104105 rectf_main .top = 0 ;
105106 rectf_main .bottom = rectf_main .top + (2 * getMeasuredHeight ()) / 19 ;
106107 }
107108
108109
109- rectf_main_inner .left = rectf_main .left + 5 ;
110- rectf_main_inner .right = rectf_main .right - 5 ;
111- rectf_main_inner .top = rectf_main .top + 5 ;
112- rectf_main_inner .bottom = rectf_main .bottom - 5 ;
110+ rectf_main_inner .left = rectf_main .left + 0 ;
111+ rectf_main_inner .right = rectf_main .right - 0 ;
112+ rectf_main_inner .top = rectf_main .top + 0 ;
113+ rectf_main_inner .bottom = rectf_main .bottom - 0 ;
113114
114115
115116 rectangle_icon .top = rectf_main_inner .top + MARGIN ;
116117 rectangle_icon .bottom = rectf_main_inner .bottom - MARGIN ;
117118 rectangle_icon .left = rectf_main_inner .left + MARGIN ;
118119 rectangle_icon .right = rectangle_icon .left + (rectangle_icon .bottom - rectangle_icon .top ) - MARGIN ;
119120
120- rectangle_type1 .top = rectf_main_inner .top + MARGIN ;
121+ /* rectangle_type1.top = rectf_main_inner.top + MARGIN;
121122 rectangle_type1.bottom = rectf_main_inner.top + (rectf_main_inner.bottom - rectf_main_inner.top) / 2 - MARGIN / 2;
122123 rectangle_type1.right = rectf_main_inner.right - MARGIN;
123124 rectangle_type1.left = rectangle_type1.right - (rectangle_icon.bottom - rectangle_icon.top);// + MARGIN;
124-
125+
125126 rectangle_type2.top = rectf_main_inner.top + (rectf_main_inner.bottom - rectf_main_inner.top) / 2 + MARGIN / 2;
126127 rectangle_type2.bottom = rectf_main_inner.bottom - MARGIN;
127128 rectangle_type2.right = rectf_main_inner.right - MARGIN;
128- rectangle_type2 .left = rectangle_type2 .right - (rectangle_icon .bottom - rectangle_icon .top );// + MARGIN;
129-
129+ rectangle_type2.left = rectangle_type2.right - (rectangle_icon.bottom - rectangle_icon.top);// + MARGIN;*/
130+
130131
131132 rectangle_text1 .left = rectangle_icon .right + MARGIN ;
132- rectangle_text1 .right = rectangle_type1 . left - MARGIN ;
133+ rectangle_text1 .right = rectf_main_inner . right - MARGIN ;
133134 rectangle_text1 .top = rectf_main_inner .top + MARGIN ;
134135 rectangle_text1 .bottom = rectf_main_inner .top + (rectf_main_inner .bottom - rectf_main_inner .top ) / 2 - MARGIN / 2 ;
135136
136137 rectangle_text2 .left = rectangle_icon .right + MARGIN ;
137- rectangle_text2 .right = rectangle_type1 . left - MARGIN ;
138+ rectangle_text2 .right = rectf_main_inner . right - MARGIN ;
138139 rectangle_text2 .top = rectf_main_inner .top + (rectf_main_inner .bottom - rectf_main_inner .top ) / 2 + MARGIN / 2 ;
139140 rectangle_text2 .bottom = rectf_main_inner .bottom - MARGIN ;
140141
@@ -148,24 +149,30 @@ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
148149 );
149150
150151 String appName = getResources ().getString (adInfo .getName ());
151- appName = appName .substring (0 , Math .min (appName .length (), 25 ));
152- appName += " ..." ;
152+ if (appName .length () > 50 ) {
153+ appName = appName .substring (0 , Math .min (appName .length (), 50 ));
154+ appName += " ..." ;
155+ }
153156 buttonarea_text1 = new TextArea (rectangle_text1 , true , appName ,
154157 //coloursCfg.getColour_Delimiter(), coloursCfg.getColour_Square_White(), coloursCfg.getColour_Square_ValidSelection());
155158 coloursCfg .getColour_Delimiter (),
156159 coloursCfg .getColour_Square_White ());
157160
158161 String promoText1 = getResources ().getString (adInfo .getDescription_Line1 ());
159- promoText1 = promoText1 .substring (0 , Math .min (promoText1 .length (), 50 ));
160- promoText1 += " ..." ;
162+ if (promoText1 .length () > 100 ) {
163+ promoText1 = promoText1 .substring (0 , Math .min (promoText1 .length (), 100 ));
164+ promoText1 += " ..." ;
165+ }
161166 buttonarea_text2 = new TextArea (rectangle_text2 , true , promoText1 ,
162167 //coloursCfg.getColour_Delimiter(), coloursCfg.getColour_Square_White(), coloursCfg.getColour_Square_ValidSelection());
163168 coloursCfg .getColour_Delimiter (),
164169 coloursCfg .getColour_Square_White ());
165170
166171 String promoText2 = getResources ().getString (adInfo .getDescription_Line2 ());
167- promoText2 = promoText2 .substring (0 , Math .min (promoText2 .length (), 50 ));
168- promoText2 += " ..." ;
172+ if (promoText2 .length () > 100 ) {
173+ promoText2 = promoText2 .substring (0 , Math .min (promoText2 .length (), 100 ));
174+ promoText2 += " ..." ;
175+ }
169176 buttonarea_text3 = new TextArea (rectangle_text2 , true , promoText2 ,
170177 //coloursCfg.getColour_Delimiter(), coloursCfg.getColour_Square_White(), coloursCfg.getColour_Square_ValidSelection());
171178 coloursCfg .getColour_Delimiter (),
@@ -174,7 +181,7 @@ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
174181 current_text2 = buttonarea_text2 ;
175182
176183
177- if (adInfo .isPaid ()) {
184+ /* if (adInfo.isPaid()) {
178185
179186 buttonarea_type1 = new TextArea(rectangle_type1, true, getResources().getString(R.string.label_advertising_paid_1),
180187 coloursCfg.getColour_Delimiter(),
@@ -199,7 +206,7 @@ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
199206 coloursCfg.getColour_Delimiter(),
200207 coloursCfg.getColour_Square_MarkingSelection());
201208 }
202- }
209+ }*/
203210
204211
205212 //initialized = true;
@@ -239,8 +246,8 @@ protected synchronized void onDraw(Canvas canvas) {
239246 buttonarea_icon .draw (canvas );
240247 buttonarea_text1 .draw (canvas );
241248 current_text2 .draw (canvas );
242- buttonarea_type1 .draw (canvas );
243- buttonarea_type2 .draw (canvas );
249+ // buttonarea_type1.draw(canvas);
250+ // buttonarea_type2.draw(canvas);
244251
245252 invalidate ();
246253 //System.out.println("View_Achievements_And_Leaderboards_Base> onDraw in rect=" + rectf_main);
0 commit comments