Project

General

Profile

Download (4.28 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / dialogs / RubikDialogAbout.java @ e71baee1

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.content.pm.PackageInfo;
14
import android.content.pm.PackageManager;
15
import android.content.res.Resources;
16
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
public class RubikDialogAbout extends RubikDialogAbstract
28
  {
29
  private static final String WHATS_NEW =
30
      "1. Implement 2x2x3, Pyraminx & Skewb Diamond solvers.\n" +
31
      "2. Connect the solvers to the scrambling engine. Which means: from now on, " +
32
       "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
      "3. Implement Icosamate & Master Icosamate";
36

    
37
  private static final String WHATS_COMING =
38
      "1. Implemented Pocket Cube, Skewb solvers.\n" +
39
      "2. Support for adjustable stickers.\n" +
40
      "3. In-game currency (stars)\n" +
41
      "4. More objects (Penrose Cubes, higher-order Jings, Ghost Cubes, more Mirrors, more Mixups)";
42

    
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
      params.width  = (int)Math.min( mHeight*0.60f,mWidth*0.90f );
56
      window.setAttributes(params);
57
      }
58
    }
59

    
60
///////////////////////////////////////////////////////////////////////////////////////////////////
61

    
62
  public int getResource()      { return R.layout.dialog_about; }
63
  public int getTitleResource() { return PARAMETRIC_TITLE; }
64
  public boolean hasArgument()  { return true; }
65
  public int getPositive()      { return R.string.ok; }
66
  public int getNegative()      { return -1; }
67
  public void positiveAction()  { }
68
  public void negativeAction()  { }
69

    
70
///////////////////////////////////////////////////////////////////////////////////////////////////
71

    
72
  private String findCurrentVersion(RubikActivity act)
73
    {
74
    String version;
75
    try
76
      {
77
      PackageInfo pInfo = act.getPackageManager().getPackageInfo( act.getPackageName(), 0);
78
      version= pInfo.versionName;
79
      }
80
    catch (PackageManager.NameNotFoundException e)
81
      {
82
      version= "unknown";
83
      }
84

    
85
    return version;
86
    }
87

    
88
///////////////////////////////////////////////////////////////////////////////////////////////////
89

    
90
  @Override
91
  String getTitleString(FragmentActivity act)
92
    {
93
    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

    
99
///////////////////////////////////////////////////////////////////////////////////////////////////
100

    
101
  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
    }
107

    
108
///////////////////////////////////////////////////////////////////////////////////////////////////
109

    
110
  public static String getDialogTag()
111
    {
112
    return "DialogAbout";
113
    }
114
  }
(2-2/26)