1 |
1c89e2a7
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
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 |
34d6b123
|
Leszek Koltunski
|
import android.content.pm.PackageInfo;
|
14 |
|
|
import android.content.pm.PackageManager;
|
15 |
e71baee1
|
Leszek Koltunski
|
import android.content.res.Resources;
|
16 |
1c89e2a7
|
Leszek Koltunski
|
import android.view.View;
|
17 |
|
|
import android.view.Window;
|
18 |
|
|
import android.view.WindowManager;
|
19 |
|
|
|
20 |
|
|
import androidx.fragment.app.FragmentActivity;
|
21 |
|
|
|
22 |
|
|
import org.distorted.main.R;
|
23 |
|
|
import org.distorted.main.RubikActivity;
|
24 |
|
|
|
25 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
26 |
|
|
|
27 |
e71baee1
|
Leszek Koltunski
|
public class RubikDialogAbout extends RubikDialogAbstract
|
28 |
1c89e2a7
|
Leszek Koltunski
|
{
|
29 |
e71baee1
|
Leszek Koltunski
|
private static final String WHATS_NEW =
|
30 |
76856be3
|
Leszek Koltunski
|
"1. Implement 2x2x3, Pyraminx & Skewb Diamond solvers.\n" +
|
31 |
|
|
"2. Connect the solvers to the scrambling engine. Which means: from now on, " +
|
32 |
c69ea8e1
|
Leszek Koltunski
|
"all puzzles which have a solver implemented will be perfectly scrambled " +
|
33 |
|
|
" - i.e. any scramble at Level 7 will always require exactly 7 moves to solve. " +
|
34 |
|
|
"Which also means that in some point in the future, we'll have to clear the High Scores.\n" +
|
35 |
e71baee1
|
Leszek Koltunski
|
"3. Implement Icosamate & Master Icosamate";
|
36 |
1c89e2a7
|
Leszek Koltunski
|
|
37 |
e71baee1
|
Leszek Koltunski
|
private static final String WHATS_COMING =
|
38 |
b3091b98
|
Leszek Koltunski
|
"1. Implemented Pocket Cube, Skewb solvers.\n" +
|
39 |
34d6b123
|
Leszek Koltunski
|
"2. Support for adjustable stickers.\n" +
|
40 |
|
|
"3. In-game currency (stars)\n" +
|
41 |
e71baee1
|
Leszek Koltunski
|
"4. More objects (Penrose Cubes, higher-order Jings, Ghost Cubes, more Mirrors, more Mixups)";
|
42 |
1c89e2a7
|
Leszek Koltunski
|
|
43 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
44 |
|
|
|
45 |
|
|
@Override
|
46 |
|
|
public void onResume()
|
47 |
|
|
{
|
48 |
|
|
super.onResume();
|
49 |
|
|
|
50 |
|
|
Window window = getDialog().getWindow();
|
51 |
|
|
|
52 |
|
|
if( window!=null )
|
53 |
|
|
{
|
54 |
|
|
WindowManager.LayoutParams params = window.getAttributes();
|
55 |
e71baee1
|
Leszek Koltunski
|
params.width = (int)Math.min( mHeight*0.60f,mWidth*0.90f );
|
56 |
1c89e2a7
|
Leszek Koltunski
|
window.setAttributes(params);
|
57 |
|
|
}
|
58 |
|
|
}
|
59 |
|
|
|
60 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
61 |
|
|
|
62 |
e71baee1
|
Leszek Koltunski
|
public int getResource() { return R.layout.dialog_about; }
|
63 |
|
|
public int getTitleResource() { return PARAMETRIC_TITLE; }
|
64 |
1c89e2a7
|
Leszek Koltunski
|
public boolean hasArgument() { return true; }
|
65 |
|
|
public int getPositive() { return R.string.ok; }
|
66 |
|
|
public int getNegative() { return -1; }
|
67 |
e71baee1
|
Leszek Koltunski
|
public void positiveAction() { }
|
68 |
|
|
public void negativeAction() { }
|
69 |
1c89e2a7
|
Leszek Koltunski
|
|
70 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
71 |
|
|
|
72 |
34d6b123
|
Leszek Koltunski
|
private String findCurrentVersion(RubikActivity act)
|
73 |
1c89e2a7
|
Leszek Koltunski
|
{
|
74 |
34d6b123
|
Leszek Koltunski
|
String version;
|
75 |
|
|
try
|
76 |
1c89e2a7
|
Leszek Koltunski
|
{
|
77 |
34d6b123
|
Leszek Koltunski
|
PackageInfo pInfo = act.getPackageManager().getPackageInfo( act.getPackageName(), 0);
|
78 |
|
|
version= pInfo.versionName;
|
79 |
1c89e2a7
|
Leszek Koltunski
|
}
|
80 |
34d6b123
|
Leszek Koltunski
|
catch (PackageManager.NameNotFoundException e)
|
81 |
|
|
{
|
82 |
|
|
version= "unknown";
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
return version;
|
86 |
1c89e2a7
|
Leszek Koltunski
|
}
|
87 |
|
|
|
88 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
89 |
|
|
|
90 |
e71baee1
|
Leszek Koltunski
|
@Override
|
91 |
|
|
String getTitleString(FragmentActivity act)
|
92 |
1c89e2a7
|
Leszek Koltunski
|
{
|
93 |
e71baee1
|
Leszek Koltunski
|
Resources res= getResources();
|
94 |
|
|
RubikActivity ract= (RubikActivity) getContext();
|
95 |
|
|
String version= ract!=null ? findCurrentVersion(ract) : "unknown";
|
96 |
|
|
return res.getString(R.string.ab_placeholder,version);
|
97 |
|
|
}
|
98 |
1c89e2a7
|
Leszek Koltunski
|
|
99 |
e71baee1
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
100 |
1c89e2a7
|
Leszek Koltunski
|
|
101 |
e71baee1
|
Leszek Koltunski
|
public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
|
102 |
|
|
{
|
103 |
|
|
int margin= (int)(mHeight*0.010f);
|
104 |
|
|
int titleH= (int)(mHeight*0.035f);
|
105 |
|
|
int padd = (int)(mHeight*0.010f);
|
106 |
1c89e2a7
|
Leszek Koltunski
|
}
|
107 |
|
|
|
108 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
109 |
|
|
|
110 |
|
|
public static String getDialogTag()
|
111 |
|
|
{
|
112 |
e71baee1
|
Leszek Koltunski
|
return "DialogAbout";
|
113 |
1c89e2a7
|
Leszek Koltunski
|
}
|
114 |
|
|
}
|