Revision 14da3188
Added by Leszek Koltunski 9 months ago
src/main/java/org/distorted/config/ConfigActivity.java | ||
---|---|---|
20 | 20 |
import androidx.appcompat.app.AppCompatActivity; |
21 | 21 |
|
22 | 22 |
import org.distorted.dialogs.RubikDialogError; |
23 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
24 | 23 |
import org.distorted.library.main.DistortedLibrary; |
25 | 24 |
import org.distorted.main.MainActivity; |
26 | 25 |
import org.distorted.main.R; |
... | ... | |
41 | 40 |
public static final int FLAGS = MainActivity.FLAGS; |
42 | 41 |
|
43 | 42 |
private static int mScreenWidth, mScreenHeight; |
44 |
private int mCurrentApiVersion; |
|
45 | 43 |
private ConfigScreen mScreen; |
44 |
private ConfigScreenPane mPane; |
|
45 |
private int mCurrentApiVersion; |
|
46 | 46 |
private int mObjectOrdinal; |
47 | 47 |
|
48 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
154 | 154 |
|
155 | 155 |
if( mScreen==null ) mScreen = new ConfigScreen(); |
156 | 156 |
mScreen.onAttachedToWindow(this,mObjectOrdinal); |
157 |
mPane = new ConfigScreenPane(this,mObjectOrdinal); |
|
157 | 158 |
|
158 | 159 |
if( mObjectOrdinal>=0 && mObjectOrdinal< RubikObjectList.getNumObjects() ) |
159 | 160 |
{ |
... | ... | |
204 | 205 |
return view.getRenderer(); |
205 | 206 |
} |
206 | 207 |
|
208 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
209 |
|
|
210 |
public void recreateStickers(int borders, int corners) |
|
211 |
{ |
|
212 |
ObjectControl control = getControl(); |
|
213 |
|
|
214 |
float border_step = ConfigScreenPane.BORDER_STEPS[borders]; |
|
215 |
float corner_step = ConfigScreenPane.CORNER_STEPS[corners]; |
|
216 |
|
|
217 |
control.recreateSticker(border_step,corner_step); |
|
218 |
} |
|
219 |
|
|
220 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
221 |
|
|
222 |
public void resetUI() |
|
223 |
{ |
|
224 |
mPane.resetUI(); |
|
225 |
} |
|
226 |
|
|
207 | 227 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
208 | 228 |
|
209 | 229 |
public int getScreenWidthInPixels() |
src/main/java/org/distorted/config/ConfigScreen.java | ||
---|---|---|
20 | 20 |
public class ConfigScreen |
21 | 21 |
{ |
22 | 22 |
private TransparentImageButton mBackButton, mResetButton; |
23 |
private ConfigScreenPane mPane; |
|
24 | 23 |
|
25 | 24 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
26 | 25 |
|
... | ... | |
84 | 83 |
layout.addView(layoutLeft); |
85 | 84 |
layout.addView(layoutMid); |
86 | 85 |
layout.addView(layoutRight); |
87 |
|
|
88 |
mPane = new ConfigScreenPane(act,objectOrdinal); |
|
89 | 86 |
} |
90 | 87 |
} |
src/main/java/org/distorted/config/ConfigScreenPane.java | ||
---|---|---|
1 | 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2 |
// Copyright 2020 Leszek Koltunski //
|
|
2 |
// Copyright 2024 Leszek Koltunski //
|
|
3 | 3 |
// // |
4 | 4 |
// This file is part of Magic Cube. // |
5 | 5 |
// // |
... | ... | |
9 | 9 |
|
10 | 10 |
package org.distorted.config; |
11 | 11 |
|
12 |
import static org.distorted.objects.RubikObjectCategories.DIFF_IDS; |
|
13 |
import static org.distorted.objects.RubikObjectCategories.DIFF_IMAGES; |
|
14 |
|
|
15 |
import android.graphics.PorterDuff; |
|
16 | 12 |
import android.util.TypedValue; |
17 |
import android.widget.ImageView; |
|
18 | 13 |
import android.widget.LinearLayout; |
14 |
import android.widget.SeekBar; |
|
19 | 15 |
import android.widget.TextView; |
20 | 16 |
|
21 | 17 |
import org.distorted.main.R; |
22 |
import org.distorted.objectlib.json.JsonReader; |
|
23 |
import org.distorted.objects.RubikObject; |
|
24 |
import org.distorted.objects.RubikObjectList; |
|
25 |
|
|
26 |
import java.io.InputStream; |
|
27 | 18 |
|
28 | 19 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
29 |
// TODO |
|
30 | 20 |
|
31 | 21 |
public class ConfigScreenPane |
32 | 22 |
{ |
33 |
private static final int NUM_IDS = DIFF_IDS.length; |
|
23 |
public static final int DEFAULT_BORDERS = 2; |
|
24 |
public static final int DEFAULT_CORNERS = 2; |
|
25 |
|
|
26 |
public static final float[] BORDER_STEPS = { 0.0f, 0.5f, 1.0f, 1.5f, 2.0f }; |
|
27 |
public static final float[] CORNER_STEPS = { 0.0f, 0.5f, 1.0f, 1.5f, 2.0f }; |
|
28 |
|
|
34 | 29 |
private static final float PADDING_RATIO = 0.016f; |
35 | 30 |
private static final float TEXT_RATIO = 0.025f; |
36 | 31 |
|
32 |
private final SeekBar mSeekBarBorders, mSeekBarCorners; |
|
33 |
private int mCurrentBorders, mCurrentCorners; |
|
34 |
|
|
37 | 35 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
38 | 36 |
|
39 | 37 |
void updatePane(ConfigActivity act, int objectOrdinal) |
... | ... | |
41 | 39 |
|
42 | 40 |
} |
43 | 41 |
|
42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
43 |
|
|
44 |
void resetUI() |
|
45 |
{ |
|
46 |
mSeekBarBorders.setProgress(DEFAULT_BORDERS); |
|
47 |
mSeekBarCorners.setProgress(DEFAULT_CORNERS); |
|
48 |
} |
|
49 |
|
|
44 | 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
45 | 51 |
|
46 | 52 |
ConfigScreenPane(final ConfigActivity act, int objectOrdinal) |
... | ... | |
62 | 68 |
|
63 | 69 |
TextView textStickers = configLayout.findViewById(R.id.configTextStickers); |
64 | 70 |
textStickers.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); |
71 |
TextView textBorder = configLayout.findViewById(R.id.configTextBorder); |
|
72 |
textBorder.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); |
|
73 |
TextView textCorner = configLayout.findViewById(R.id.configTextCorner); |
|
74 |
textCorner.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); |
|
75 |
|
|
76 |
mSeekBarBorders = configLayout.findViewById(R.id.configSeekBarBorder); |
|
77 |
mCurrentBorders = mSeekBarBorders.getProgress(); |
|
78 |
|
|
79 |
mSeekBarBorders.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() |
|
80 |
{ |
|
81 |
@Override |
|
82 |
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) |
|
83 |
{ |
|
84 |
mCurrentBorders = progress; |
|
85 |
} |
|
86 |
|
|
87 |
@Override |
|
88 |
public void onStartTrackingTouch(SeekBar seekBar) {} |
|
89 |
|
|
90 |
@Override |
|
91 |
public void onStopTrackingTouch(SeekBar seekBar) |
|
92 |
{ |
|
93 |
act.recreateStickers(mCurrentBorders,mCurrentCorners); |
|
94 |
} |
|
95 |
}); |
|
96 |
|
|
97 |
mSeekBarCorners = configLayout.findViewById(R.id.configSeekBarCorner); |
|
98 |
mCurrentCorners = mSeekBarCorners.getProgress(); |
|
99 |
|
|
100 |
mSeekBarCorners.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() |
|
101 |
{ |
|
102 |
@Override |
|
103 |
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) |
|
104 |
{ |
|
105 |
mCurrentCorners = progress; |
|
106 |
} |
|
107 |
|
|
108 |
@Override |
|
109 |
public void onStartTrackingTouch(SeekBar seekBar) {} |
|
110 |
@Override |
|
111 |
public void onStopTrackingTouch(SeekBar seekBar) |
|
112 |
{ |
|
113 |
act.recreateStickers(mCurrentBorders,mCurrentCorners); |
|
114 |
} |
|
115 |
}); |
|
65 | 116 |
} |
66 | 117 |
} |
src/main/java/org/distorted/config/ConfigSurfaceView.java | ||
---|---|---|
69 | 69 |
|
70 | 70 |
void resetObject() |
71 | 71 |
{ |
72 |
// TODO |
|
72 |
ConfigActivity act = (ConfigActivity)getContext(); |
|
73 |
act.recreateStickers(ConfigScreenPane.DEFAULT_BORDERS,ConfigScreenPane.DEFAULT_CORNERS); |
|
74 |
act.resetUI(); |
|
73 | 75 |
} |
74 | 76 |
|
75 | 77 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/res/layout/config.xml | ||
---|---|---|
33 | 33 |
android:textSize="26sp" |
34 | 34 |
android:text="@string/config_stickers"/> |
35 | 35 |
|
36 |
<LinearLayout |
|
37 |
android:layout_width="match_parent" |
|
38 |
android:layout_height="wrap_content" |
|
39 |
android:layout_margin="5dp" |
|
40 |
android:paddingLeft="5dp" |
|
41 |
android:paddingRight="5dp" |
|
42 |
android:background="@color/grey" |
|
43 |
android:orientation="horizontal" > |
|
44 |
|
|
45 |
<TextView |
|
46 |
android:id="@+id/configTextBorder" |
|
47 |
android:layout_width="wrap_content" |
|
48 |
android:layout_height="wrap_content" |
|
49 |
android:gravity="center_vertical|start" |
|
50 |
android:textSize="26sp" |
|
51 |
android:text="@string/config_border"/> |
|
52 |
|
|
53 |
<SeekBar |
|
54 |
android:id="@+id/configSeekBarBorder" |
|
55 |
style="@style/Widget.AppCompat.SeekBar.Discrete" |
|
56 |
android:layout_width="119dp" |
|
57 |
android:layout_height="match_parent" |
|
58 |
android:gravity="center_vertical|end" |
|
59 |
android:max="4" |
|
60 |
android:progress="2" /> |
|
61 |
</LinearLayout> |
|
62 |
|
|
63 |
<LinearLayout |
|
64 |
android:layout_width="match_parent" |
|
65 |
android:layout_height="wrap_content" |
|
66 |
android:layout_margin="5dp" |
|
67 |
android:paddingLeft="5dp" |
|
68 |
android:paddingRight="5dp" |
|
69 |
android:background="@color/grey" |
|
70 |
android:orientation="horizontal" > |
|
71 |
|
|
72 |
<TextView |
|
73 |
android:id="@+id/configTextCorner" |
|
74 |
android:layout_width="wrap_content" |
|
75 |
android:layout_height="wrap_content" |
|
76 |
android:gravity="center_vertical|start" |
|
77 |
android:textSize="26sp" |
|
78 |
android:text="@string/config_corner"/> |
|
79 |
|
|
80 |
<SeekBar |
|
81 |
android:id="@+id/configSeekBarCorner" |
|
82 |
style="@style/Widget.AppCompat.SeekBar.Discrete" |
|
83 |
android:layout_width="119dp" |
|
84 |
android:layout_height="match_parent" |
|
85 |
android:gravity="center_vertical|end" |
|
86 |
android:max="4" |
|
87 |
android:progress="2" /> |
|
88 |
</LinearLayout> |
|
36 | 89 |
</LinearLayout> |
37 | 90 |
|
38 | 91 |
<LinearLayout |
src/main/res/values-de/strings.xml | ||
---|---|---|
86 | 86 |
<string name="config_mesh_fast">Schelles</string> |
87 | 87 |
<string name="config_mesh_nice">Hübsches</string> |
88 | 88 |
<string name="config_stickers">Aufkleber</string> |
89 |
<string name="config_border">Ränder</string> |
|
90 |
<string name="config_corner">Ecken</string> |
|
89 | 91 |
|
90 | 92 |
<string name="sort_classic">klassisch</string> |
91 | 93 |
<string name="sort_shape">form</string> |
src/main/res/values-es/strings.xml | ||
---|---|---|
86 | 86 |
<string name="config_mesh_fast">Rápida</string> |
87 | 87 |
<string name="config_mesh_nice">Bonita</string> |
88 | 88 |
<string name="config_stickers">Pegatinas</string> |
89 |
<string name="config_border">Bordes</string> |
|
90 |
<string name="config_corner">Esquinas</string> |
|
89 | 91 |
|
90 | 92 |
<string name="sort_classic">clásico</string> |
91 | 93 |
<string name="sort_shape">forma</string> |
src/main/res/values-fr/strings.xml | ||
---|---|---|
86 | 86 |
<string name="config_mesh_fast">Rapide</string> |
87 | 87 |
<string name="config_mesh_nice">Belle</string> |
88 | 88 |
<string name="config_stickers">Autocollants</string> |
89 |
<string name="config_border">Bordures</string> |
|
90 |
<string name="config_corner">Coins</string> |
|
89 | 91 |
|
90 | 92 |
<string name="sort_classic">classique</string> |
91 | 93 |
<string name="sort_shape">forme</string> |
src/main/res/values-ja/strings.xml | ||
---|---|---|
86 | 86 |
<string name="config_mesh_fast">速い</string> |
87 | 87 |
<string name="config_mesh_nice">良い</string> |
88 | 88 |
<string name="config_stickers">ステッカー</string> |
89 |
<string name="config_border">枠線</string> |
|
90 |
<string name="config_corner">角</string> |
|
89 | 91 |
|
90 | 92 |
<string name="sort_classic">古典学</string> |
91 | 93 |
<string name="sort_shape">形</string> |
src/main/res/values-ko/strings.xml | ||
---|---|---|
86 | 86 |
<string name="config_mesh_fast">빠른</string> |
87 | 87 |
<string name="config_mesh_nice">멋진</string> |
88 | 88 |
<string name="config_stickers">스티커</string> |
89 |
<string name="config_border">테두리</string> |
|
90 |
<string name="config_corner">모서리</string> |
|
89 | 91 |
|
90 | 92 |
<string name="sort_classic">전통적인</string> |
91 | 93 |
<string name="sort_shape">모양</string> |
src/main/res/values-pl/strings.xml | ||
---|---|---|
86 | 86 |
<string name="config_mesh_fast">Szybka</string> |
87 | 87 |
<string name="config_mesh_nice">Ładna</string> |
88 | 88 |
<string name="config_stickers">Naklejki</string> |
89 |
<string name="config_border">Brzegi</string> |
|
90 |
<string name="config_corner">Rogi</string> |
|
89 | 91 |
|
90 | 92 |
<string name="sort_classic">klasycznie</string> |
91 | 93 |
<string name="sort_shape">kształt</string> |
src/main/res/values-ru/strings.xml | ||
---|---|---|
86 | 86 |
<string name="config_mesh_fast">Быстрая</string> |
87 | 87 |
<string name="config_mesh_nice">Красивая</string> |
88 | 88 |
<string name="config_stickers">Наклейки</string> |
89 |
<string name="config_border">Границы</string> |
|
90 |
<string name="config_corner">Углы</string> |
|
89 | 91 |
|
90 | 92 |
<string name="sort_classic">классик</string> |
91 | 93 |
<string name="sort_shape">форма</string> |
src/main/res/values-zh-rCN/strings.xml | ||
---|---|---|
86 | 86 |
<string name="config_mesh_fast">快</string> |
87 | 87 |
<string name="config_mesh_nice">好的</string> |
88 | 88 |
<string name="config_stickers">贴纸</string> |
89 |
<string name="config_border">边框</string> |
|
90 |
<string name="config_corner">角</string> |
|
89 | 91 |
|
90 | 92 |
<string name="sort_classic">經典的</string> |
91 | 93 |
<string name="sort_shape">形狀</string> |
src/main/res/values-zh-rTW/strings.xml | ||
---|---|---|
86 | 86 |
<string name="config_mesh_fast">快</string> |
87 | 87 |
<string name="config_mesh_nice">好的</string> |
88 | 88 |
<string name="config_stickers">貼紙</string> |
89 |
<string name="config_border">邊框</string> |
|
90 |
<string name="config_corner">角</string> |
|
89 | 91 |
|
90 | 92 |
<string name="sort_classic">经典的</string> |
91 | 93 |
<string name="sort_shape">形状</string> |
src/main/res/values/strings.xml | ||
---|---|---|
110 | 110 |
<string name="config_mesh_fast">Fast</string> |
111 | 111 |
<string name="config_mesh_nice">Nice</string> |
112 | 112 |
<string name="config_stickers">Stickers</string> |
113 |
<string name="config_border">Borders</string> |
|
114 |
<string name="config_corner">Corners</string> |
|
113 | 115 |
|
114 | 116 |
<string name="sort_classic">classic</string> |
115 | 117 |
<string name="sort_shape">shape</string> |
Also available in: Unified diff
More support for configuring the stickers.