Project

General

Profile

« Previous | Next » 

Revision 1c89e2a7

Added by Leszek Koltunski almost 2 years ago

What's new dialog
Bump version to 1.12.0

View differences:

build.gradle
15 15
        applicationId "org.distorted.magic"
16 16
        minSdkVersion 21
17 17
        targetSdkVersion 32
18
        versionCode 66
19
        versionName "1.11.6"
18
        versionCode 67
19
        versionName "1.12.0"
20 20
    }
21 21

  
22 22
    buildTypes {
src/main/java/org/distorted/dialogs/RubikDialogSolvers.java
67 67

  
68 68
  public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
69 69
    {
70
    int minH  = (int)(mHeight*0.250f);
71 70
    int margin= (int)(mHeight*0.010f);
72 71
    int textH = (int)(mHeight*0.035f);
73 72
    int buttH = (int)(mHeight*0.060f);
......
78 77
    TextView text  = view.findViewById(R.id.dialog_scrollable_message);
79 78
    text.setVisibility(View.GONE);
80 79

  
81
    layout.setMinimumHeight(minH);
82
    view.setMinimumHeight(minH);
83

  
84 80
    LinearLayout.LayoutParams pV = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT );
85 81
    pV.setMargins(margin, margin, margin, 0);
82
    LinearLayout.LayoutParams pL = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT );
83
    pL.setMargins(margin, margin, margin, margin);
86 84
    LinearLayout.LayoutParams pT = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, textH );
87 85
    LinearLayout.LayoutParams pB = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, buttH );
88 86
    pB.setMargins(0,2*margin,0,0);
......
96 94
      int object = solver.getObject();
97 95
      int title  = solver.getTitle();
98 96
      int description = solver.getDescription();
99
      RubikDialogSolverView pane = new RubikDialogSolverView(ract,this,i,object,title,description, padd, font, pV,pT,pB);
97
      RubikDialogSolverView pane = new RubikDialogSolverView(ract,this,i,object,title,description, padd, font, (i==num-1?pL:pV),pT,pB);
100 98
      layout.addView(pane.getView());
101 99
      }
102 100
    }
src/main/java/org/distorted/dialogs/RubikDialogStarsExplain.java
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.util.TypedValue;
14
import android.view.View;
15
import android.widget.TextView;
16

  
17
import androidx.fragment.app.FragmentActivity;
18

  
19
import org.distorted.main.R;
20

  
21
///////////////////////////////////////////////////////////////////////////////////////////////////
22

  
23
public class RubikDialogStarsExplain extends RubikDialogAbstract
24
  {
25
  public int getResource()      { return R.layout.dialog_stars_explain; }
26
  public int getTitleResource() { return -1; }
27
  public boolean hasArgument()  { return false; }
28
  public int getPositive()      { return R.string.ok; }
29
  public int getNegative()      { return -1; }
30

  
31
///////////////////////////////////////////////////////////////////////////////////////////////////
32

  
33
  public void positiveAction()
34
    {
35

  
36
    }
37

  
38
///////////////////////////////////////////////////////////////////////////////////////////////////
39

  
40
  public void negativeAction()
41
    {
42

  
43
    }
44

  
45
///////////////////////////////////////////////////////////////////////////////////////////////////
46

  
47
  public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
48
    {
49
    TextView text = view.findViewById(R.id.stars_dialog_explain);
50
    text.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
51
    }
52
  }
src/main/java/org/distorted/dialogs/RubikDialogUpdates.java
117 117

  
118 118
      LinearLayout.LayoutParams pV = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, mSize );
119 119
      pV.setMargins(mMargin, mMargin, mMargin, 0);
120
      LinearLayout.LayoutParams pL = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, mSize );
121
      pL.setMargins(mMargin, mMargin, mMargin, mMargin);
120 122
      LinearLayout.LayoutParams pT = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, textH );
121 123
      LinearLayout.LayoutParams pB = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, buttH );
122 124

  
......
137 139
          {
138 140
          RubikUpdates.UpdateInfo info = updates.getStartedUpdate(i);
139 141
          RubikDialogUpdateView rubikView = new RubikDialogUpdateView();
140
          View pane = rubikView.createView(act,info,mFontSize,mPadding,pV,pT,pB);
142
          View pane = rubikView.createView(act,info,mFontSize,mPadding,(i==numS-1?pL:pV),pT,pB);
141 143
          mLayout.addView(pane);
142 144
          mPanes.add(rubikView);
143 145
          }
src/main/java/org/distorted/dialogs/RubikDialogWhatsNew.java
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.main.R;
22
import org.distorted.main.RubikActivity;
23

  
24
///////////////////////////////////////////////////////////////////////////////////////////////////
25

  
26
public class RubikDialogWhatsNew extends RubikDialogAbstract
27
  {
28
  private static final String[] MESSAGES =
29
      {
30
      "1.11.6",
31

  
32
      "1. This dialog :)\n" +
33
      "2. UI ready for NEW SOLVERS\n" +
34
      "3. Important fix for a bug which used to let players solve any scramble with just one move\n" +
35
      "4. UI fixes for squarish screens\n" +
36
      "5. Preparation for Penrose Cubes.\n",
37

  
38
      "current",
39
      };
40

  
41
  private int mLowerVersion, mUpperVersion;
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.65f,mWidth*0.98f );
56
      window.setAttributes(params);
57
      }
58
    }
59

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

  
62
  public int getResource()      { return R.layout.dialog_scrollable_panes; }
63
  public int getTitleResource() { return R.string.whatsnew; }
64
  public boolean hasArgument()  { return true; }
65
  public int getPositive()      { return R.string.ok; }
66
  public int getNegative()      { return -1; }
67

  
68
///////////////////////////////////////////////////////////////////////////////////////////////////
69

  
70
  public void positiveAction()
71
    {
72

  
73
    }
74

  
75
///////////////////////////////////////////////////////////////////////////////////////////////////
76

  
77
  public void negativeAction()
78
    {
79

  
80
    }
81

  
82
///////////////////////////////////////////////////////////////////////////////////////////////////
83

  
84
  public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
85
    {
86
    int margin= (int)(mHeight*0.010f);
87
    int titleH= (int)(mHeight*0.035f);
88
    int padd  = (int)(mHeight*0.010f);
89

  
90
    LinearLayout layout= view.findViewById(R.id.dialog_scrollable_main_layout);
91
    TextView text  = view.findViewById(R.id.dialog_scrollable_message);
92
    text.setVisibility(View.GONE);
93

  
94
    LinearLayout.LayoutParams pV = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT );
95
    pV.setMargins(margin, margin, margin, 0);
96
    LinearLayout.LayoutParams pL = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT );
97
    pL.setMargins(margin, margin, margin, margin);
98
    LinearLayout.LayoutParams pT = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, titleH );
99
    LinearLayout.LayoutParams pM = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT );
100
    pV.setMargins(margin, margin, margin, margin);
101

  
102
    parseArgument(mArgument);
103
    RubikActivity ract = (RubikActivity) getContext();
104

  
105
    for(int i=mLowerVersion; i<mUpperVersion; i+=2)
106
      {
107
      String lower   = MESSAGES[i];
108
      String message = MESSAGES[i+1];
109
      String upper   = MESSAGES[i+2];
110

  
111
      RubikDialogWhatsNewView pane = new RubikDialogWhatsNewView(ract,lower,upper,message,padd,(i==mUpperVersion-1 ? pL:pV),pT,pM);
112
      layout.addView(pane.getView());
113
      }
114
    }
115

  
116
///////////////////////////////////////////////////////////////////////////////////////////////////
117

  
118
  private void parseArgument(String argument)
119
    {
120
    String[] parts = argument.split(" ");
121

  
122
    if( parts.length==2 )
123
      {
124
      mLowerVersion = findVersion(parts[0]);
125
      mUpperVersion = findVersion(parts[1]);
126
      }
127
    }
128

  
129
///////////////////////////////////////////////////////////////////////////////////////////////////
130

  
131
  private int findVersion(String version)
132
    {
133
    int len = MESSAGES.length;
134

  
135
    for(int i=0; i<len; i++)
136
      {
137
      if( MESSAGES[i].equals(version) ) return i;
138
      }
139

  
140
    return len-1;
141
    }
142

  
143
///////////////////////////////////////////////////////////////////////////////////////////////////
144

  
145
  public static String getDialogTag()
146
    {
147
    return "DialogSolvers";
148
    }
149
  }
src/main/java/org/distorted/dialogs/RubikDialogWhatsNewView.java
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.view.View;
13
import android.widget.LinearLayout;
14
import android.widget.TextView;
15

  
16
import org.distorted.main.R;
17
import org.distorted.main.RubikActivity;
18

  
19
///////////////////////////////////////////////////////////////////////////////////////////////////
20

  
21
public class RubikDialogWhatsNewView
22
  {
23
  private final View mView;
24

  
25
///////////////////////////////////////////////////////////////////////////////////////////////////
26

  
27
  public RubikDialogWhatsNewView(final RubikActivity act, String lower, String upper, String message, int padding,
28
                                 LinearLayout.LayoutParams pView, LinearLayout.LayoutParams pTitle, LinearLayout.LayoutParams pMessage )
29
    {
30
    mView = act.getLayoutInflater().inflate(R.layout.dialog_whatsnew_pane, null);
31
    mView.setLayoutParams(pView);
32
    mView.setPadding(padding,padding,padding,padding);
33

  
34
    TextView titleView = mView.findViewById(R.id.whatsnew_pane_title);
35
    titleView.setText(lower+" -> "+upper);
36
    titleView.setLayoutParams(pTitle);
37

  
38
    TextView messView = mView.findViewById(R.id.whatsnew_pane_message);
39
    messView.setText(message);
40
    messView.setLayoutParams(pMessage);
41
    }
42

  
43
///////////////////////////////////////////////////////////////////////////////////////////////////
44

  
45
  public View getView()
46
    {
47
    return mView;
48
    }
49
  }
src/main/java/org/distorted/main/RubikActivity.java
35 35

  
36 36
import org.distorted.config.ConfigActivity;
37 37
import org.distorted.bandaged.BandagedCreatorActivity;
38
import org.distorted.dialogs.RubikDialogStarsExplain;
38
import org.distorted.dialogs.RubikDialogWhatsNew;
39 39
import org.distorted.library.main.DistortedLibrary;
40 40

  
41 41
import org.distorted.library.main.DistortedScreen;
......
272 272
      changeIfDifferent(object,view.getObjectControl());
273 273

  
274 274
      if( mIsChinese && !mPolicyAccepted ) privacyPolicy();
275

  
276
      if( USE_IAP )
275
      else
277 276
        {
278
        if( mOldVersion!=null && !mOldVersion.equals("") && oldVersionLessThan(1,11,5) && !mCurrVersion.equals("1.11.4") )
277
        if( !mOldVersion.equals(mCurrVersion) )
279 278
          {
280
          explainStars();
279
          displayNovelties();
281 280
          }
282 281
        else
283 282
          {
284
          view.setShowStars();
283
          if( USE_IAP ) view.setShowStars();
285 284
          }
286 285
        }
287 286
      }
......
296 295

  
297 296
///////////////////////////////////////////////////////////////////////////////////////////////////
298 297

  
299
    private void explainStars()
298
    private void displayNovelties()
300 299
      {
301
      RubikDialogStarsExplain staDiag = new RubikDialogStarsExplain();
302
      staDiag.show(getSupportFragmentManager(), null);
300
      Bundle bundle = new Bundle();
301
      bundle.putString("argument",mOldVersion+" "+mCurrVersion);
302
      RubikDialogWhatsNew newDialog = new RubikDialogWhatsNew();
303
      newDialog.setArguments(bundle);
304
      newDialog.show(getSupportFragmentManager(), RubikDialogWhatsNew.getDialogTag() );
303 305
      }
304 306

  
305 307
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/res/layout/dialog_scrollable_panes.xml
11 11
        android:layout_width="match_parent"
12 12
        android:layout_height="wrap_content"
13 13
        android:background="@color/black"
14
        android:paddingBottom="8dp"
15 14
        android:orientation="vertical">
16 15

  
17 16
        <TextView
src/main/res/layout/dialog_whatsnew_pane.xml
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout
3
	xmlns:android="http://schemas.android.com/apk/res/android"
4
	android:layout_width="match_parent"
5
	android:layout_height="wrap_content"
6
	android:background="@color/medium_grey"
7
	android:padding="8dp"
8
	android:orientation="vertical">
9

  
10
    <TextView
11
        android:id="@+id/whatsnew_pane_title"
12
    	android:gravity="top|start"
13
    	android:layout_width="match_parent"
14
    	android:layout_height="wrap_content"
15
    	android:singleLine="true"
16
    	android:textStyle="bold"/>
17

  
18
    <TextView
19
    	android:id="@+id/whatsnew_pane_message"
20
    	android:gravity="top|start"
21
    	android:layout_width="match_parent"
22
    	android:layout_height="wrap_content"/>
23

  
24
</LinearLayout>
src/main/res/values-de/strings.xml
48 48
    <string name="install">Installieren</string>
49 49
    <string name="abandon_solve">Give up</string>
50 50
    <string name="use_solver">Benutze</string>
51
    <string name="whatsnew">Was gibt\'s Neues</string>
51 52

  
52 53
    <string name="stars">Sterne</string>
53 54
    <string name="scores">Highscores</string>
src/main/res/values-es/strings.xml
48 48
    <string name="install">Instalar</string>
49 49
    <string name="abandon_solve">Abandonar</string>
50 50
    <string name="use_solver">Utilizar</string>
51
    <string name="whatsnew">Qué hay de nuevo</string>
51 52

  
52 53
    <string name="stars">Estrellas</string>
53 54
    <string name="scores">Leaderboard</string>
src/main/res/values-fr/strings.xml
48 48
    <string name="install">Installer</string>
49 49
    <string name="abandon_solve">Abandonner</string>
50 50
    <string name="use_solver">Utiliser</string>
51
    <string name="whatsnew">Quoi de neuf</string>
51 52

  
52 53
    <string name="stars">Étoiles</string>
53 54
    <string name="scores">Meilleurs scores</string>
src/main/res/values-ja/strings.xml
48 48
    <string name="install">インストール</string>
49 49
    <string name="abandon_solve">あきらめる</string>
50 50
    <string name="use_solver">使用する</string>
51
    <string name="whatsnew">新着情報</string>
51 52

  
52 53
    <string name="stars">星</string>
53 54
    <string name="scores">ハイスコア</string>
src/main/res/values-ko/strings.xml
48 48
    <string name="install">설치</string>
49 49
    <string name="abandon_solve">포기</string>
50 50
    <string name="use_solver">사용</string>
51
    <string name="whatsnew">새로운 기능</string>
51 52

  
52 53
    <string name="stars">별</string>
53 54
    <string name="scores">고득점</string>
src/main/res/values-pl/strings.xml
48 48
    <string name="install">Zainstaluj</string>
49 49
    <string name="abandon_solve">Zrezygnuj</string>
50 50
    <string name="use_solver">Użyj</string>
51
    <string name="whatsnew">Nowości</string>
51 52

  
52 53
    <string name="stars">Gwiazdki</string>
53 54
    <string name="scores">Lista najlepszych</string>
src/main/res/values-ru/strings.xml
48 48
    <string name="install">Установите</string>
49 49
    <string name="abandon_solve">Сдаться</string>
50 50
    <string name="use_solver">Попробуй</string>
51
    <string name="whatsnew">Новинки</string>
51 52

  
52 53
    <string name="stars">Звезды</string>
53 54
    <string name="scores">Высокие баллы</string>
src/main/res/values-zh-rCN/strings.xml
48 48
    <string name="install">安装</string>
49 49
    <string name="abandon_solve">放弃</string>
50 50
    <string name="use_solver">尝试</string>
51
    <string name="whatsnew">新奇事物</string>
51 52

  
52 53
    <string name="stars">星星</string>
53 54
    <string name="scores">高分</string>
src/main/res/values-zh-rTW/strings.xml
48 48
    <string name="install">安裝</string>
49 49
    <string name="abandon_solve">放棄</string>
50 50
    <string name="use_solver">嘗試</string>
51
    <string name="whatsnew">新奇事物</string>
51 52

  
52 53
    <string name="stars">星星</string>
53 54
    <string name="scores">高分</string>
src/main/res/values/strings.xml
50 50
    <string name="install">Install</string>
51 51
    <string name="abandon_solve">Give up</string>
52 52
    <string name="use_solver">Try</string>
53
    <string name="whatsnew">What\'s new</string>
53 54

  
54 55
    <string name="stars">Stars</string>
55 56
    <string name="scores">High Scores</string>
......
98 99
    <string name="opengl_error" translatable="false">Error</string>
99 100
    <string name="opengl_error_text" translatable="false">This device does not support OpenGL 3.0</string>
100 101

  
101
    <string name="solver_generic_error1">Solver for this object and size not implemented yet!</string>
102
    <string name="solver_generic_error1">Solver for this object not implemented yet!</string>
102 103
    <string name="solver_cube3_error1">There are only %1$d %2$s facelets.</string>
103 104
    <string name="solver_cube3_error2">Not all 12 edges exist exactly once!</string>
104 105
    <string name="solver_cube3_error3">One edge has to be flipped!</string>

Also available in: Unified diff