1 |
9530f6b0
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
da56b12f
|
Leszek Koltunski
|
// Copyright 2022 Leszek Koltunski //
|
3 |
9530f6b0
|
Leszek Koltunski
|
// //
|
4 |
|
|
// This file is part of Magic Cube. //
|
5 |
|
|
// //
|
6 |
|
|
// Magic Cube is free software: you can redistribute it and/or modify //
|
7 |
|
|
// it under the terms of the GNU General Public License as published by //
|
8 |
|
|
// the Free Software Foundation, either version 2 of the License, or //
|
9 |
|
|
// (at your option) any later version. //
|
10 |
|
|
// //
|
11 |
|
|
// Magic Cube is distributed in the hope that it will be useful, //
|
12 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14 |
|
|
// GNU General Public License for more details. //
|
15 |
|
|
// //
|
16 |
|
|
// You should have received a copy of the GNU General Public License //
|
17 |
|
|
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. //
|
18 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
|
|
|
20 |
|
|
package org.distorted.bandaged;
|
21 |
|
|
|
22 |
|
|
import android.view.View;
|
23 |
|
|
import android.widget.LinearLayout;
|
24 |
|
|
|
25 |
|
|
import org.distorted.helpers.TransparentImageButton;
|
26 |
|
|
import org.distorted.main.R;
|
27 |
|
|
import org.distorted.main.RubikActivity;
|
28 |
550db260
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.FactoryCubit;
|
29 |
9530f6b0
|
Leszek Koltunski
|
|
30 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
31 |
|
|
|
32 |
|
|
public class BandagedCreatorScreen
|
33 |
|
|
{
|
34 |
|
|
private TransparentImageButton mBackButton, mResetButton, mDoneButton;
|
35 |
|
|
private int mBarHeight;
|
36 |
|
|
private float mButtonSize;
|
37 |
|
|
|
38 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
39 |
|
|
|
40 |
|
|
public BandagedCreatorScreen()
|
41 |
|
|
{
|
42 |
|
|
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
46 |
|
|
|
47 |
|
|
private void setupBackButton(final BandagedCreatorActivity act)
|
48 |
|
|
{
|
49 |
|
|
int icon = RubikActivity.getDrawable(R.drawable.ui_small_smallback,R.drawable.ui_medium_smallback, R.drawable.ui_big_smallback, R.drawable.ui_huge_smallback);
|
50 |
|
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
|
51 |
|
|
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
52 |
|
|
|
53 |
|
|
mBackButton.setOnClickListener( new View.OnClickListener()
|
54 |
|
|
{
|
55 |
|
|
@Override
|
56 |
|
|
public void onClick(View v)
|
57 |
|
|
{
|
58 |
|
|
act.finish();
|
59 |
|
|
}
|
60 |
|
|
});
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
64 |
|
|
|
65 |
|
|
private void setupDoneButton(final BandagedCreatorActivity act)
|
66 |
|
|
{
|
67 |
f802924b
|
Leszek Koltunski
|
int icon = RubikActivity.getDrawable(R.drawable.ui_small_done,R.drawable.ui_medium_done, R.drawable.ui_big_done, R.drawable.ui_huge_done);
|
68 |
9530f6b0
|
Leszek Koltunski
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
|
69 |
|
|
mDoneButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
70 |
|
|
|
71 |
|
|
mDoneButton.setOnClickListener( new View.OnClickListener()
|
72 |
|
|
{
|
73 |
|
|
@Override
|
74 |
|
|
public void onClick(View v)
|
75 |
|
|
{
|
76 |
|
|
|
77 |
|
|
}
|
78 |
|
|
});
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
82 |
|
|
|
83 |
|
|
private void setupResetButton(final BandagedCreatorActivity act)
|
84 |
|
|
{
|
85 |
1b185a91
|
Leszek Koltunski
|
int icon = RubikActivity.getDrawable(R.drawable.ui_small_reset,R.drawable.ui_medium_reset, R.drawable.ui_big_reset, R.drawable.ui_huge_reset);
|
86 |
9530f6b0
|
Leszek Koltunski
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT);
|
87 |
|
|
mResetButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
88 |
|
|
|
89 |
|
|
mResetButton.setOnClickListener( new View.OnClickListener()
|
90 |
|
|
{
|
91 |
|
|
@Override
|
92 |
|
|
public void onClick(View v)
|
93 |
|
|
{
|
94 |
550db260
|
Leszek Koltunski
|
FactoryCubit factory = FactoryCubit.getInstance();
|
95 |
|
|
factory.printFaceTransform();
|
96 |
9530f6b0
|
Leszek Koltunski
|
}
|
97 |
|
|
});
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
101 |
|
|
|
102 |
bebd7af5
|
Leszek Koltunski
|
void onAttachedToWindow(final BandagedCreatorActivity act)
|
103 |
9530f6b0
|
Leszek Koltunski
|
{
|
104 |
|
|
int width = act.getScreenWidthInPixels();
|
105 |
|
|
mBarHeight = act.getHeightBar();
|
106 |
|
|
mButtonSize = width*RubikActivity.BUTTON_TEXT_SIZE;
|
107 |
|
|
|
108 |
|
|
LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams(width/4, LinearLayout.LayoutParams.MATCH_PARENT);
|
109 |
|
|
LinearLayout.LayoutParams paramsM = new LinearLayout.LayoutParams(width/2, LinearLayout.LayoutParams.MATCH_PARENT);
|
110 |
|
|
LinearLayout.LayoutParams paramsR = new LinearLayout.LayoutParams(width/4, LinearLayout.LayoutParams.MATCH_PARENT);
|
111 |
|
|
|
112 |
|
|
LinearLayout layoutLeft = new LinearLayout(act);
|
113 |
|
|
layoutLeft.setLayoutParams(paramsL);
|
114 |
|
|
LinearLayout layoutMid = new LinearLayout(act);
|
115 |
|
|
layoutMid.setLayoutParams(paramsM);
|
116 |
|
|
LinearLayout layoutRight= new LinearLayout(act);
|
117 |
|
|
layoutRight.setLayoutParams(paramsR);
|
118 |
|
|
|
119 |
|
|
setupBackButton(act);
|
120 |
|
|
layoutRight.addView(mBackButton);
|
121 |
|
|
setupDoneButton(act);
|
122 |
|
|
layoutMid.addView(mDoneButton);
|
123 |
|
|
setupResetButton(act);
|
124 |
|
|
layoutLeft.addView(mResetButton);
|
125 |
|
|
|
126 |
|
|
LinearLayout layout = act.findViewById(R.id.lowerBar);
|
127 |
|
|
layout.removeAllViews();
|
128 |
|
|
layout.addView(layoutLeft);
|
129 |
|
|
layout.addView(layoutMid);
|
130 |
|
|
layout.addView(layoutRight);
|
131 |
|
|
}
|
132 |
|
|
}
|