1 |
807d82b7
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2020 Leszek Koltunski //
|
3 |
|
|
// //
|
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 |
fcd5b990
|
Leszek Koltunski
|
package org.distorted.screens;
|
21 |
807d82b7
|
Leszek Koltunski
|
|
22 |
|
|
import android.content.SharedPreferences;
|
23 |
e3c74c0f
|
Leszek Koltunski
|
import android.util.TypedValue;
|
24 |
807d82b7
|
Leszek Koltunski
|
import android.view.LayoutInflater;
|
25 |
|
|
import android.view.View;
|
26 |
|
|
import android.widget.LinearLayout;
|
27 |
|
|
import android.widget.TextView;
|
28 |
|
|
|
29 |
dca3888a
|
Leszek Koltunski
|
import androidx.fragment.app.FragmentManager;
|
30 |
|
|
|
31 |
|
|
import org.distorted.dialogs.RubikDialogNewRecord;
|
32 |
|
|
import org.distorted.dialogs.RubikDialogSolved;
|
33 |
55e6be1d
|
Leszek Koltunski
|
import org.distorted.helpers.TransparentImageButton;
|
34 |
807d82b7
|
Leszek Koltunski
|
import org.distorted.main.R;
|
35 |
|
|
import org.distorted.main.RubikActivity;
|
36 |
|
|
|
37 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
38 |
|
|
|
39 |
fcd5b990
|
Leszek Koltunski
|
public class RubikScreenDone extends RubikScreenAbstract
|
40 |
807d82b7
|
Leszek Koltunski
|
{
|
41 |
dd874ae8
|
Leszek Koltunski
|
private TransparentImageButton mBackButton;
|
42 |
da768c35
|
Leszek Koltunski
|
|
43 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
44 |
|
|
|
45 |
f5da732a
|
Leszek Koltunski
|
void leaveScreen(RubikActivity act)
|
46 |
807d82b7
|
Leszek Koltunski
|
{
|
47 |
|
|
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
51 |
|
|
|
52 |
f5da732a
|
Leszek Koltunski
|
void enterScreen(final RubikActivity act)
|
53 |
807d82b7
|
Leszek Koltunski
|
{
|
54 |
e3c74c0f
|
Leszek Koltunski
|
float width = act.getScreenWidthInPixels();
|
55 |
|
|
float titleSize = width*RubikActivity.TITLE_TEXT_SIZE;
|
56 |
807d82b7
|
Leszek Koltunski
|
LayoutInflater inflater = act.getLayoutInflater();
|
57 |
|
|
|
58 |
|
|
// TOP ////////////////////////////
|
59 |
|
|
LinearLayout layoutTop = act.findViewById(R.id.upperBar);
|
60 |
|
|
layoutTop.removeAllViews();
|
61 |
|
|
TextView label = (TextView)inflater.inflate(R.layout.upper_text, null);
|
62 |
e3c74c0f
|
Leszek Koltunski
|
label.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
|
63 |
807d82b7
|
Leszek Koltunski
|
label.setText(R.string.solved);
|
64 |
|
|
layoutTop.addView(label);
|
65 |
|
|
|
66 |
|
|
// BOT ////////////////////////////
|
67 |
92843d3b
|
Leszek Koltunski
|
LinearLayout layoutBot = act.findViewById(R.id.lowerBar);
|
68 |
|
|
layoutBot.removeAllViews();
|
69 |
807d82b7
|
Leszek Koltunski
|
|
70 |
92843d3b
|
Leszek Koltunski
|
LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1);
|
71 |
4fb1fc0d
|
Leszek Koltunski
|
LinearLayout.LayoutParams paramsR = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,2);
|
72 |
|
|
|
73 |
92843d3b
|
Leszek Koltunski
|
LinearLayout layoutLeft = new LinearLayout(act);
|
74 |
|
|
layoutLeft.setLayoutParams(paramsL);
|
75 |
|
|
LinearLayout layoutRight = new LinearLayout(act);
|
76 |
4fb1fc0d
|
Leszek Koltunski
|
layoutRight.setLayoutParams(paramsR);
|
77 |
807d82b7
|
Leszek Koltunski
|
|
78 |
dd874ae8
|
Leszek Koltunski
|
setupBackButton(act);
|
79 |
ad0c8e0e
|
Leszek Koltunski
|
|
80 |
da768c35
|
Leszek Koltunski
|
layoutRight.addView(mBackButton);
|
81 |
|
|
layoutBot.addView(layoutLeft);
|
82 |
|
|
layoutBot.addView(layoutRight);
|
83 |
|
|
}
|
84 |
807d82b7
|
Leszek Koltunski
|
|
85 |
da768c35
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
86 |
4fb1fc0d
|
Leszek Koltunski
|
|
87 |
dd874ae8
|
Leszek Koltunski
|
private void setupBackButton(final RubikActivity act)
|
88 |
da768c35
|
Leszek Koltunski
|
{
|
89 |
|
|
int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back);
|
90 |
b600ccd9
|
Leszek Koltunski
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
|
91 |
|
|
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
92 |
807d82b7
|
Leszek Koltunski
|
|
93 |
da768c35
|
Leszek Koltunski
|
mBackButton.setOnClickListener( new View.OnClickListener()
|
94 |
807d82b7
|
Leszek Koltunski
|
{
|
95 |
|
|
@Override
|
96 |
|
|
public void onClick(View v)
|
97 |
|
|
{
|
98 |
fcd5b990
|
Leszek Koltunski
|
ScreenList.goBack(act);
|
99 |
da768c35
|
Leszek Koltunski
|
|
100 |
|
|
FragmentManager mana = act.getSupportFragmentManager();
|
101 |
|
|
RubikDialogNewRecord diag1 = (RubikDialogNewRecord) mana.findFragmentByTag(RubikDialogNewRecord.getDialogTag());
|
102 |
|
|
RubikDialogSolved diag2 = (RubikDialogSolved ) mana.findFragmentByTag(RubikDialogSolved.getDialogTag());
|
103 |
|
|
|
104 |
|
|
if( diag1 !=null ) diag1.dismiss();
|
105 |
|
|
if( diag2 !=null ) diag2.dismiss();
|
106 |
807d82b7
|
Leszek Koltunski
|
}
|
107 |
|
|
});
|
108 |
|
|
}
|
109 |
|
|
|
110 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
111 |
|
|
|
112 |
|
|
public void savePreferences(SharedPreferences.Editor editor)
|
113 |
|
|
{
|
114 |
|
|
|
115 |
|
|
}
|
116 |
|
|
|
117 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
118 |
|
|
|
119 |
|
|
public void restorePreferences(SharedPreferences preferences)
|
120 |
|
|
{
|
121 |
|
|
|
122 |
|
|
}
|
123 |
|
|
}
|