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.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, final int index, int object, int title, int desc, int padding, int fontSize,
|
34
|
LinearLayout.LayoutParams pView, LinearLayout.LayoutParams pText, LinearLayout.LayoutParams pButt )
|
35
|
{
|
36
|
mView = act.getLayoutInflater().inflate(R.layout.dialog_solvers_pane, null);
|
37
|
mView.setLayoutParams(pView);
|
38
|
mView.setPadding(padding,padding,padding,padding);
|
39
|
|
40
|
TextView titleView = mView.findViewById(R.id.solvers_pane_title);
|
41
|
titleView.setText(title);
|
42
|
TextView descView = mView.findViewById(R.id.solvers_pane_description);
|
43
|
descView.setText(desc);
|
44
|
|
45
|
titleView.setLayoutParams(pText);
|
46
|
|
47
|
ImageView icon = mView.findViewById(R.id.solvers_pane_image);
|
48
|
RubikObject robject = RubikObjectList.getObject(object);
|
49
|
if( robject!=null ) robject.setIconTo(act,icon);
|
50
|
|
51
|
Button button = mView.findViewById(R.id.solvers_pane_button);
|
52
|
|
53
|
button.setOnClickListener( new View.OnClickListener()
|
54
|
{
|
55
|
@Override
|
56
|
public void onClick(View v)
|
57
|
{
|
58
|
dialog.dismiss();
|
59
|
act.setSolverIndex(index);
|
60
|
ScreenList.switchScreen(act, ScreenList.SVER);
|
61
|
}
|
62
|
});
|
63
|
|
64
|
button.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
|
65
|
button.setLayoutParams(pButt);
|
66
|
}
|
67
|
|
68
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
69
|
|
70
|
public View getView()
|
71
|
{
|
72
|
return mView;
|
73
|
}
|
74
|
}
|