@@ -70,13 +70,13 @@ public BannerView(Context context, AttributeSet attrs, int defStyle) {
7070
7171 protected void onFinishInflate () {
7272 super .onFinishInflate ();
73- Context ctx = getContext ();
74- int width = (int ) getResources ().getDimensionPixelSize (R .dimen .banner_width );
75- int height = (int ) getResources ().getDimensionPixelSize (R .dimen .banner_height );
76- int size = (int ) RowPreferences .getBannersSize (ctx ); // 50 - 200
77- this .getLayoutParams ().height = height * size / 100 ; // px
78- this .getLayoutParams ().width = width * size / 100 ; // px
79- this .requestLayout (); // set new BannerView dimensions
73+ Context ctx = getContext ();
74+ int width = (int ) getResources ().getDimensionPixelSize (R .dimen .banner_width );
75+ int height = (int ) getResources ().getDimensionPixelSize (R .dimen .banner_height );
76+ int size = (int ) RowPreferences .getBannersSize (ctx ); // 50 - 200
77+ this .getLayoutParams ().height = height * size / 100 ; // px
78+ this .getLayoutParams ().width = width * size / 100 ; // px
79+ this .requestLayout (); // set new BannerView dimensions
8080 this .mDimmer = new ViewDimmer (this );
8181 this .mAppBanner = findViewById (R .id .app_banner );
8282 this .mInstallStateOverlay = findViewById (R .id .install_state_overlay );
@@ -85,9 +85,9 @@ protected void onFinishInflate() {
8585 this .mAppBanner .setClipToOutline (true );
8686 this .mDimmer .addDimTarget ((ImageView ) this .mAppBanner );
8787 } else {
88- if (this .mAppBanner instanceof LinearLayout ) {
89- this .mAppBanner .setOutlineProvider (sOutline );
90- this .mAppBanner .setClipToOutline (true );
88+ if (this .mAppBanner instanceof LinearLayout ) {
89+ this .mAppBanner .setOutlineProvider (sOutline );
90+ this .mAppBanner .setClipToOutline (true );
9191 }
9292 View inputBannerView = findViewById (R .id .input_banner );
9393 if (inputBannerView != null ) {
@@ -104,8 +104,8 @@ protected void onFinishInflate() {
104104 }
105105 bannerView = findViewById (R .id .input_image );
106106 if (bannerView instanceof ImageView ) {
107- bannerView .setOutlineProvider (sOutline );
108- bannerView .setClipToOutline (true );
107+ bannerView .setOutlineProvider (sOutline );
108+ bannerView .setClipToOutline (true );
109109 this .mDimmer .addDimTarget ((ImageView ) bannerView );
110110 }
111111 bannerLabel = findViewById (R .id .input_label );
@@ -117,34 +117,36 @@ protected void onFinishInflate() {
117117 }
118118 }
119119 this .mDimmer .setDimLevelImmediate ();
120- float radius = (float ) RowPreferences .getCorners (ctx ); // (float) getResources().getDimensionPixelOffset(R.dimen.banner_corner_radius);
121- int stroke = ( int ) RowPreferences . getFrameWidth ( ctx ); // ( int) getResources().getDimensionPixelSize(R.dimen.banner_frame_stroke) ;
122- int color = ( int ) RowPreferences . getFrameColor ( ctx ); // (int) getResources().getColor(R.color.banner_focus_frame_color );
120+ float radius = (float ) RowPreferences .getCorners (ctx ); // (float) getResources().getDimensionPixelOffset(R.dimen.banner_corner_radius);
121+ int stroke = 2 ;
122+ int color = (int ) getResources ().getColor (R .color .edit_selection_indicator_color );
123123 // edit focus frame (edit_frame_width : edit_frame_height)
124124 View view = findViewById (R .id .edit_focused_frame );
125125 if (view instanceof ImageView ) {
126126 this .mEditFocusFrame = (ImageView ) view ;
127127 view .getLayoutParams ().width = (int ) getResources ().getDimensionPixelSize (R .dimen .edit_frame_width ) * size / 100 ;
128128 view .getLayoutParams ().height = (int ) getResources ().getDimensionPixelSize (R .dimen .edit_frame_height ) * size / 100 ;
129129 view .requestLayout (); // set new edit focus frame dimensions
130- GradientDrawable ef = new GradientDrawable (GradientDrawable .Orientation .TOP_BOTTOM ,new int []{Color .TRANSPARENT ,Color .TRANSPARENT ,Color .TRANSPARENT });
131- ef .setShape (GradientDrawable .RECTANGLE );
132- ef .setStroke (stroke , color );
133- ef .setCornerRadius (radius );
134- this .mEditFocusFrame .setImageDrawable (ef ); // set new edit frame drawable
130+ GradientDrawable ef = new GradientDrawable (GradientDrawable .Orientation .TOP_BOTTOM ,new int []{Color .TRANSPARENT ,Color .TRANSPARENT ,Color .TRANSPARENT });
131+ ef .setShape (GradientDrawable .RECTANGLE );
132+ ef .setStroke (stroke , color ); // fixed width
133+ ef .setCornerRadius (radius * getResources (). getDimensionPixelSize ( R . dimen . edit_frame_width ) / width );
134+ this .mEditFocusFrame .setImageDrawable (ef ); // set new edit frame drawable
135135 }
136136 // focus frame (banner_frame_width : banner_frame_height)
137137 view = findViewById (R .id .banner_focused_frame );
138138 if (view instanceof ImageView ) {
139139 this .mFocusFrame = (ImageView ) view ;
140- view .getLayoutParams ().width = (width + 2 * stroke - (int ) radius / 2 ) * size / 100 ; // px
141- view .getLayoutParams ().height = (height + 2 * stroke - (int ) radius / 2 ) * size / 100 ; // px
142- view .requestLayout (); // set new focus frame dimensions
143- GradientDrawable gd = new GradientDrawable (GradientDrawable .Orientation .TOP_BOTTOM ,new int []{Color .TRANSPARENT ,Color .TRANSPARENT ,Color .TRANSPARENT });
144- gd .setShape (GradientDrawable .RECTANGLE );
145- gd .setStroke (stroke , color ); // setStroke(10, Color.BLACK, 50, 500);
146- gd .setCornerRadius (radius ); // setCornerRadius(10f);
147- this .mFocusFrame .setImageDrawable (gd ); // set new focus frame drawable
140+ stroke = (int ) RowPreferences .getFrameWidth (ctx ); // (int) getResources().getDimensionPixelSize(R.dimen.banner_frame_stroke);
141+ color = (int ) RowPreferences .getFrameColor (ctx ); // (int) getResources().getColor(R.color.banner_focus_frame_color);
142+ view .getLayoutParams ().width = (width + 2 * stroke - (int ) radius / 2 ) * size / 100 ; // px
143+ view .getLayoutParams ().height = (height + 2 * stroke - (int ) radius / 2 ) * size / 100 ; // px
144+ view .requestLayout (); // set new focus frame dimensions
145+ GradientDrawable gd = new GradientDrawable (GradientDrawable .Orientation .TOP_BOTTOM ,new int []{Color .TRANSPARENT ,Color .TRANSPARENT ,Color .TRANSPARENT });
146+ gd .setShape (GradientDrawable .RECTANGLE );
147+ gd .setStroke (stroke * size / 100 , color ); // setStroke(10, Color.BLACK);
148+ gd .setCornerRadius (radius ); // setCornerRadius(10f);
149+ this .mFocusFrame .setImageDrawable (gd ); // set new focus frame drawable
148150 }
149151 }
150152
@@ -241,7 +243,7 @@ protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyF
241243 }
242244 setFocusedFrameState ();
243245 // focus outline
244- if (this .mFocusFrame != null ) { // null for inputs
246+ if (this .mFocusFrame != null ) {
245247 if (hasFocus ())
246248 this .mFocusFrame .setVisibility (0 );
247249 else
0 commit comments