1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2022 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.app.Dialog;
|
13
|
import android.view.View;
|
14
|
import android.view.Window;
|
15
|
import android.view.WindowManager;
|
16
|
import android.widget.LinearLayout;
|
17
|
import android.widget.TextView;
|
18
|
|
19
|
import androidx.fragment.app.FragmentActivity;
|
20
|
|
21
|
import org.distorted.external.RubikScores;
|
22
|
import org.distorted.main.R;
|
23
|
|
24
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
25
|
|
26
|
public class RubikDialogStarsStatus extends RubikDialogAbstract
|
27
|
{
|
28
|
@Override
|
29
|
public void onResume()
|
30
|
{
|
31
|
super.onResume();
|
32
|
|
33
|
Window window = getDialog().getWindow();
|
34
|
|
35
|
if( window!=null )
|
36
|
{
|
37
|
WindowManager.LayoutParams params = window.getAttributes();
|
38
|
params.width = (int)Math.min( mHeight*0.65f,mWidth*0.95f );
|
39
|
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
40
|
window.setAttributes(params);
|
41
|
}
|
42
|
}
|
43
|
|
44
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
45
|
|
46
|
public int getResource() { return R.layout.dialog_stars_status; }
|
47
|
public int getTitleResource() { return -1; }
|
48
|
public boolean hasArgument() { return false; }
|
49
|
public int getPositive() { return R.string.ok; }
|
50
|
public int getNegative() { return -1; }
|
51
|
|
52
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
53
|
|
54
|
public void positiveAction()
|
55
|
{
|
56
|
|
57
|
}
|
58
|
|
59
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
60
|
|
61
|
public void negativeAction()
|
62
|
{
|
63
|
|
64
|
}
|
65
|
|
66
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
67
|
|
68
|
public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
|
69
|
{
|
70
|
int height = (int)(mHeight*0.110f);
|
71
|
int margin = (int)(mHeight*0.007f);
|
72
|
|
73
|
LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
|
74
|
params1.setMargins(margin, margin, margin, margin);
|
75
|
LinearLayout.LayoutParams params2 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,height);
|
76
|
params2.setMargins(margin, margin, margin, margin);
|
77
|
|
78
|
LinearLayout lm = view.findViewById(R.id.stars_main);
|
79
|
lm.setPadding(margin,margin,margin,margin);
|
80
|
|
81
|
LinearLayout ls = view.findViewById(R.id.stars_strings);
|
82
|
ls.setLayoutParams(params1);
|
83
|
LinearLayout l1 = view.findViewById(R.id.stars_layout_1);
|
84
|
l1.setLayoutParams(params2);
|
85
|
LinearLayout l2 = view.findViewById(R.id.stars_layout_2);
|
86
|
l2.setLayoutParams(params2);
|
87
|
LinearLayout l3 = view.findViewById(R.id.stars_layout_3);
|
88
|
l3.setLayoutParams(params2);
|
89
|
|
90
|
int number = RubikScores.getInstance().getNumStars();
|
91
|
TextView v = view.findViewById(R.id.stars_string1);
|
92
|
v.setText(getString(R.string.buy_string1,number));
|
93
|
}
|
94
|
}
|