File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
java/io/snabble/sdk/ui/scanner Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 1010import android .text .Editable ;
1111import android .text .InputFilter ;
1212import android .text .TextWatcher ;
13+ import android .util .DisplayMetrics ;
1314import android .view .Gravity ;
1415import android .view .KeyEvent ;
1516import android .view .View ;
@@ -257,8 +258,14 @@ public void run() {
257258 });
258259 }
259260
260- float density = context .getResources ().getDisplayMetrics ().density ;
261- window .setLayout (Math .round (320 * density ), ViewGroup .LayoutParams .WRAP_CONTENT );
261+ DisplayMetrics dm = context .getResources ().getDisplayMetrics ();
262+ int availableWidth = Math .round (dm .widthPixels / dm .density );
263+ int width = Math .round (320 * dm .density );
264+ if (availableWidth >= 336 ) {
265+ width = Math .round (336 * dm .density );
266+ }
267+
268+ window .setLayout (width , ViewGroup .LayoutParams .WRAP_CONTENT );
262269 }
263270
264271 private void updatePrice () {
Original file line number Diff line number Diff line change 22<RelativeLayout xmlns : android =" http://schemas.android.com/apk/res/android"
33 xmlns : app =" http://schemas.android.com/apk/res-auto"
44 xmlns : tools =" http://schemas.android.com/tools"
5- android : layout_width =" 304dp "
5+ android : layout_width =" 288dp "
66 android : layout_height =" wrap_content"
77 android : layout_gravity =" center"
88 android : focusable =" true"
118118 <android .support.v7.widget.AppCompatButton
119119 android : id =" @+id/addToCart"
120120 style =" @style/SnabbleButton"
121- android : layout_width =" 272dp "
121+ android : layout_width =" match_parent "
122122 android : layout_height =" wrap_content"
123+ android : layout_marginLeft =" 16dp"
124+ android : layout_marginRight =" 16dp"
123125 android : layout_below =" @+id/quantity"
124126 android : layout_centerHorizontal =" true"
125127 android : text =" @string/Snabble.Scanner.addToCart" />
You can’t perform that action at this time.
0 commit comments