1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2020 Leszek Koltunski //
|
3
|
// //
|
4
|
// This file is part of Magic Cube. //
|
5
|
// //
|
6
|
// Magic Cube is proprietary software licensed under an EULA which you should have received //
|
7
|
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html //
|
8
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
9
|
|
10
|
package org.distorted.screens;
|
11
|
|
12
|
import android.content.SharedPreferences;
|
13
|
import android.util.TypedValue;
|
14
|
import android.view.LayoutInflater;
|
15
|
import android.view.View;
|
16
|
import android.widget.LinearLayout;
|
17
|
import android.widget.TextView;
|
18
|
|
19
|
import androidx.fragment.app.FragmentManager;
|
20
|
|
21
|
import org.distorted.dialogs.RubikDialogNewRecord;
|
22
|
import org.distorted.dialogs.RubikDialogSolved;
|
23
|
import org.distorted.helpers.TransparentImageButton;
|
24
|
import org.distorted.main.R;
|
25
|
import org.distorted.main.RubikActivity;
|
26
|
|
27
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
28
|
|
29
|
public class RubikScreenDone extends RubikScreenAbstract
|
30
|
{
|
31
|
private TransparentImageButton mBackButton;
|
32
|
|
33
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
34
|
|
35
|
void leaveScreen(RubikActivity act)
|
36
|
{
|
37
|
|
38
|
}
|
39
|
|
40
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
41
|
|
42
|
void enterScreen(final RubikActivity act)
|
43
|
{
|
44
|
float width = act.getScreenWidthInPixels();
|
45
|
float titleSize = width*RubikActivity.TITLE_TEXT_SIZE;
|
46
|
LayoutInflater inflater = act.getLayoutInflater();
|
47
|
|
48
|
// TOP ////////////////////////////
|
49
|
LinearLayout layoutTop = act.findViewById(R.id.upperBar);
|
50
|
layoutTop.removeAllViews();
|
51
|
TextView label = (TextView)inflater.inflate(R.layout.upper_text, null);
|
52
|
label.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleSize);
|
53
|
label.setText(R.string.solved);
|
54
|
layoutTop.addView(label);
|
55
|
|
56
|
// BOT ////////////////////////////
|
57
|
LinearLayout layoutBot = act.findViewById(R.id.lowerBar);
|
58
|
layoutBot.removeAllViews();
|
59
|
|
60
|
LinearLayout.LayoutParams paramsL = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1);
|
61
|
LinearLayout.LayoutParams paramsR = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,2);
|
62
|
|
63
|
LinearLayout layoutLeft = new LinearLayout(act);
|
64
|
layoutLeft.setLayoutParams(paramsL);
|
65
|
LinearLayout layoutRight = new LinearLayout(act);
|
66
|
layoutRight.setLayoutParams(paramsR);
|
67
|
|
68
|
setupBackButton(act);
|
69
|
|
70
|
layoutRight.addView(mBackButton);
|
71
|
layoutBot.addView(layoutLeft);
|
72
|
layoutBot.addView(layoutRight);
|
73
|
}
|
74
|
|
75
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
76
|
|
77
|
private void setupBackButton(final RubikActivity act)
|
78
|
{
|
79
|
int icon = RubikActivity.getDrawable(R.drawable.ui_small_back,R.drawable.ui_medium_back, R.drawable.ui_big_back, R.drawable.ui_huge_back);
|
80
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT,1.0f);
|
81
|
mBackButton = new TransparentImageButton(act, icon, TransparentImageButton.GRAVITY_MIDDLE, params);
|
82
|
|
83
|
mBackButton.setOnClickListener( new View.OnClickListener()
|
84
|
{
|
85
|
@Override
|
86
|
public void onClick(View v)
|
87
|
{
|
88
|
ScreenList.goBack(act);
|
89
|
|
90
|
FragmentManager mana = act.getSupportFragmentManager();
|
91
|
RubikDialogNewRecord diag1 = (RubikDialogNewRecord) mana.findFragmentByTag(RubikDialogNewRecord.getDialogTag());
|
92
|
RubikDialogSolved diag2 = (RubikDialogSolved ) mana.findFragmentByTag(RubikDialogSolved.getDialogTag());
|
93
|
|
94
|
if( diag1 !=null ) diag1.dismiss();
|
95
|
if( diag2 !=null ) diag2.dismiss();
|
96
|
}
|
97
|
});
|
98
|
}
|
99
|
|
100
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
101
|
|
102
|
public void savePreferences(SharedPreferences.Editor editor)
|
103
|
{
|
104
|
|
105
|
}
|
106
|
|
107
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
108
|
|
109
|
public void restorePreferences(SharedPreferences preferences)
|
110
|
{
|
111
|
|
112
|
}
|
113
|
}
|