1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2023 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.dialogs;
|
11
|
|
12
|
import android.util.TypedValue;
|
13
|
import android.view.View;
|
14
|
import android.widget.Button;
|
15
|
import android.widget.ImageView;
|
16
|
import android.widget.LinearLayout;
|
17
|
import android.widget.TextView;
|
18
|
|
19
|
import org.distorted.main.R;
|
20
|
import org.distorted.main_old.RubikActivity;
|
21
|
import org.distorted.objects.RubikObject;
|
22
|
import org.distorted.objects.RubikObjectList;
|
23
|
import org.distorted.screens.ScreenList;
|
24
|
|
25
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
26
|
|
27
|
public class RubikDialogSolverView
|
28
|
{
|
29
|
private final View mView;
|
30
|
|
31
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
32
|
|
33
|
public RubikDialogSolverView(final RubikActivity act, final RubikDialogSolvers dialog, int index, int object,
|
34
|
int title, int desc, int padding, int fontSize, LinearLayout.LayoutParams pView,
|
35
|
LinearLayout.LayoutParams pText, LinearLayout.LayoutParams pButt )
|
36
|
{
|
37
|
mView = act.getLayoutInflater().inflate(R.layout.dialog_solvers_pane, null);
|
38
|
mView.setLayoutParams(pView);
|
39
|
mView.setPadding(padding,padding,padding,padding);
|
40
|
|
41
|
TextView titleView = mView.findViewById(R.id.solvers_pane_title);
|
42
|
titleView.setText(title);
|
43
|
TextView descView = mView.findViewById(R.id.solvers_pane_description);
|
44
|
descView.setText(desc);
|
45
|
|
46
|
titleView.setLayoutParams(pText);
|
47
|
|
48
|
ImageView icon = mView.findViewById(R.id.solvers_pane_image);
|
49
|
RubikObject robject = RubikObjectList.getObject(object);
|
50
|
if( robject!=null ) robject.setIconTo(act,icon);
|
51
|
|
52
|
Button button = mView.findViewById(R.id.solvers_pane_button);
|
53
|
|
54
|
button.setOnClickListener( new View.OnClickListener()
|
55
|
{
|
56
|
@Override
|
57
|
public void onClick(View v)
|
58
|
{
|
59
|
dialog.dismiss();
|
60
|
act.setSolverIndex(index);
|
61
|
ScreenList.switchScreen(act, ScreenList.SVER);
|
62
|
}
|
63
|
});
|
64
|
|
65
|
button.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
|
66
|
button.setLayoutParams(pButt);
|
67
|
}
|
68
|
|
69
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
70
|
|
71
|
public View getView()
|
72
|
{
|
73
|
return mView;
|
74
|
}
|
75
|
}
|