Revision 94ff5962
Added by Leszek Koltunski 9 months ago
src/main/java/org/distorted/config/ConfigScreenPane.java | ||
---|---|---|
26 | 26 |
public static final float[] BORDER_STEPS = { 0.50f, 0.75f, 1.00f, 1.50f, 2.00f }; |
27 | 27 |
public static final float[] CORNER_STEPS = { 0.00f, 0.50f, 1.00f, 1.50f, 2.00f }; |
28 | 28 |
|
29 |
private static final float PADDING_RATIO = 0.016f;
|
|
29 |
private static final float PADDING_RATIO = 0.010f;
|
|
30 | 30 |
private static final float TEXT_RATIO = 0.025f; |
31 | 31 |
|
32 | 32 |
private final SeekBar mSeekBarBorders, mSeekBarCorners; |
... | ... | |
55 | 55 |
float textSize = height*TEXT_RATIO; |
56 | 56 |
int padding = (int)(height*PADDING_RATIO); |
57 | 57 |
|
58 |
LinearLayout configLayout = act.findViewById(R.id.configLayout); |
|
59 |
configLayout.setPadding(padding,padding,padding,padding); |
|
58 |
///// UPPER LAYOUT ///////////////////////////////// |
|
59 |
LinearLayout configLayoutU = act.findViewById(R.id.configLayoutUpper); |
|
60 |
configLayoutU.setPadding(padding,padding,padding,padding); |
|
60 | 61 |
|
61 |
LinearLayout.LayoutParams paramsLayout = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1.00f);
|
|
62 |
paramsLayout.bottomMargin = padding; |
|
63 |
paramsLayout.topMargin = 0; |
|
64 |
paramsLayout.leftMargin = padding; |
|
65 |
paramsLayout.rightMargin = padding; |
|
62 |
LinearLayout.LayoutParams paramsLayoutU = (LinearLayout.LayoutParams)configLayoutU.getLayoutParams();
|
|
63 |
paramsLayoutU.bottomMargin = padding;
|
|
64 |
paramsLayoutU.topMargin = 0;
|
|
65 |
paramsLayoutU.leftMargin = padding;
|
|
66 |
paramsLayoutU.rightMargin = padding;
|
|
66 | 67 |
|
67 |
configLayout.setLayoutParams(paramsLayout);
|
|
68 |
configLayoutU.setLayoutParams(paramsLayoutU);
|
|
68 | 69 |
|
69 |
TextView textStickers = configLayout.findViewById(R.id.configTextStickers); |
|
70 |
textStickers.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); |
|
71 |
TextView textBorder = configLayout.findViewById(R.id.configTextBorder); |
|
70 |
TextView textBorder = configLayoutU.findViewById(R.id.configTextBorder); |
|
72 | 71 |
textBorder.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); |
73 |
TextView textCorner = configLayout.findViewById(R.id.configTextCorner); |
|
72 |
TextView textCorner = configLayoutU.findViewById(R.id.configTextCorner);
|
|
74 | 73 |
textCorner.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); |
75 | 74 |
|
76 |
mSeekBarBorders = configLayout.findViewById(R.id.configSeekBarBorder); |
|
75 |
mSeekBarBorders = configLayoutU.findViewById(R.id.configSeekBarBorder);
|
|
77 | 76 |
mCurrentBorders = mSeekBarBorders.getProgress(); |
78 | 77 |
|
79 | 78 |
mSeekBarBorders.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() |
... | ... | |
94 | 93 |
} |
95 | 94 |
}); |
96 | 95 |
|
97 |
mSeekBarCorners = configLayout.findViewById(R.id.configSeekBarCorner); |
|
96 |
mSeekBarCorners = configLayoutU.findViewById(R.id.configSeekBarCorner);
|
|
98 | 97 |
mCurrentCorners = mSeekBarCorners.getProgress(); |
99 | 98 |
|
100 | 99 |
mSeekBarCorners.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() |
... | ... | |
113 | 112 |
act.recreateStickers(mCurrentBorders,mCurrentCorners); |
114 | 113 |
} |
115 | 114 |
}); |
115 |
|
|
116 |
///// LOWER LAYOUT ///////////////////////////////// |
|
117 |
LinearLayout configLayoutL = act.findViewById(R.id.configLayoutLower); |
|
118 |
configLayoutL.setPadding(padding,padding,padding,padding); |
|
119 |
|
|
120 |
LinearLayout.LayoutParams paramsLayoutL = (LinearLayout.LayoutParams)configLayoutL.getLayoutParams(); |
|
121 |
paramsLayoutL.bottomMargin = padding; |
|
122 |
paramsLayoutL.topMargin = 0; |
|
123 |
paramsLayoutL.leftMargin = padding; |
|
124 |
paramsLayoutL.rightMargin = padding; |
|
125 |
|
|
126 |
configLayoutL.setLayoutParams(paramsLayoutL); |
|
116 | 127 |
} |
117 | 128 |
} |
src/main/res/layout/config.xml | ||
---|---|---|
10 | 10 |
android:id="@+id/configSurfaceView" |
11 | 11 |
android:layout_width="match_parent" |
12 | 12 |
android:layout_height="0dp" |
13 |
android:layout_weight="1.3"/>
|
|
13 |
android:layout_weight="3"/> |
|
14 | 14 |
|
15 | 15 |
<LinearLayout |
16 |
android:id="@+id/configLayout" |
|
16 |
android:id="@+id/configLayoutUpper"
|
|
17 | 17 |
android:layout_width="match_parent" |
18 | 18 |
android:layout_height="0dp" |
19 |
android:layout_weight="1.0"
|
|
19 |
android:layout_weight="0.75"
|
|
20 | 20 |
android:layout_marginLeft="5dp" |
21 | 21 |
android:layout_marginRight="5dp" |
22 | 22 |
android:layout_marginBottom="5dp" |
... | ... | |
25 | 25 |
android:background="@color/grey" |
26 | 26 |
android:orientation="vertical" > |
27 | 27 |
|
28 |
<TextView |
|
29 |
android:id="@+id/configTextStickers" |
|
30 |
android:layout_width="fill_parent" |
|
31 |
android:layout_height="wrap_content" |
|
32 |
android:gravity="center" |
|
33 |
android:textSize="26sp" |
|
34 |
android:text="@string/config_stickers"/> |
|
35 |
|
|
36 | 28 |
<LinearLayout |
37 | 29 |
android:layout_width="match_parent" |
38 | 30 |
android:layout_height="wrap_content" |
39 | 31 |
android:layout_margin="5dp" |
40 | 32 |
android:paddingLeft="5dp" |
41 | 33 |
android:paddingRight="5dp" |
42 |
android:background="@color/grey" |
|
43 | 34 |
android:orientation="horizontal" > |
44 | 35 |
|
45 | 36 |
<TextView |
... | ... | |
66 | 57 |
android:layout_margin="5dp" |
67 | 58 |
android:paddingLeft="5dp" |
68 | 59 |
android:paddingRight="5dp" |
69 |
android:background="@color/grey" |
|
70 | 60 |
android:orientation="horizontal" > |
71 | 61 |
|
72 | 62 |
<TextView |
... | ... | |
88 | 78 |
</LinearLayout> |
89 | 79 |
</LinearLayout> |
90 | 80 |
|
81 |
<LinearLayout |
|
82 |
android:id="@+id/configLayoutLower" |
|
83 |
android:layout_width="match_parent" |
|
84 |
android:layout_height="0dp" |
|
85 |
android:layout_weight="2" |
|
86 |
android:layout_marginLeft="5dp" |
|
87 |
android:layout_marginRight="5dp" |
|
88 |
android:layout_marginBottom="5dp" |
|
89 |
android:paddingLeft="5dp" |
|
90 |
android:paddingRight="5dp" |
|
91 |
android:background="@color/grey" |
|
92 |
android:orientation="vertical" > |
|
93 |
</LinearLayout> |
|
94 |
|
|
91 | 95 |
<LinearLayout |
92 | 96 |
android:id="@+id/lowerBar" |
93 | 97 |
android:layout_width="match_parent" |
src/main/res/layout/object_popup.xml | ||
---|---|---|
52 | 52 |
|
53 | 53 |
<Button |
54 | 54 |
android:id="@+id/objectConfig" |
55 |
android:text="@string/object_config"
|
|
55 |
android:text="@string/config_stickers"
|
|
56 | 56 |
android:layout_width="match_parent" |
57 | 57 |
android:layout_height="wrap_content" |
58 | 58 |
android:paddingRight="10dp" |
Also available in: Unified diff
progress with configurable stickers