Project

General

Profile

« Previous | Next » 

Revision 1250d52b

Added by Leszek Koltunski about 6 hours ago

minor

View differences:

src/main/java/org/distorted/dialogs/DialogAbandon.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 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
import org.distorted.play.PlayActivity;
21
import org.distorted.play.ScreenList;
22
import org.distorted.play.ScreenSolving;
23

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

  
26
public class DialogAbandon extends DialogAbstract
27
  {
28
  public int getResource()      { return R.layout.dialog_message; }
29
  public int getTitleResource() { return R.string.abandon_solve; }
30
  public boolean hasArgument()  { return false; }
31
  public int getPositive()      { return R.string.yes; }
32
  public int getNeutral()       { return R.string.cancel; }
33
  public int getNegative()      { return R.string.no; }
34
  public void neutralAction()   { }
35

  
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37

  
38
  public void negativeAction()
39
    {
40
    final PlayActivity act = (PlayActivity)getContext();
41
    ScreenList.goBack(act);
42
    }
43

  
44
///////////////////////////////////////////////////////////////////////////////////////////////////
45

  
46
  public void positiveAction()
47
    {
48
    final PlayActivity act = (PlayActivity)getContext();
49

  
50
    if( act!=null )
51
      {
52
      ScreenSolving solving = (ScreenSolving)ScreenList.SOLV.getScreenClass();
53
      int time = solving.stopTimerAndGetRecord();
54
      act.rememberSolve(time);
55
      ScreenList.goBack(act);
56
      }
57
    }
58

  
59
///////////////////////////////////////////////////////////////////////////////////////////////////
60

  
61
  public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
62
    {
63
    TextView mess = view.findViewById(R.id.dialog_message);
64
    mess.setText(R.string.come_back_later);
65
    mess.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
66
    }
67
  }
src/main/java/org/distorted/dialogs/DialogAbout.java
33 33
public class DialogAbout extends DialogAbstract
34 34
  {
35 35
  private static final String WHATS_NEW =
36
      "1. If you made at least 7 moves, then the solve attempt gets automatically remembered. You can resume your solve at any later time.\n" +
36
      "1. You can now save your ongoing solves and resume them at any later time.\n" +
37 37
      "2. A fix to the solved-state detection of the Container.\n" +
38 38
      "3. Every tutorial has been checked and a few non-working ones have beed replaced.\n" +
39 39
      "4. Fixes for scrambling: now (almost!) every puzzle should scramble perfectly, i.e. every scramble in level N should be exactly N moves from the solved state."
src/main/java/org/distorted/dialogs/DialogRememberSolve.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 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
import org.distorted.play.PlayActivity;
21
import org.distorted.play.ScreenList;
22
import org.distorted.play.ScreenSolving;
23

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

  
26
public class DialogRememberSolve extends DialogAbstract
27
  {
28
  public int getResource()      { return R.layout.dialog_message; }
29
  public int getTitleResource() { return R.string.abandon_solve; }
30
  public boolean hasArgument()  { return false; }
31
  public int getPositive()      { return R.string.yes; }
32
  public int getNeutral()       { return R.string.cancel; }
33
  public int getNegative()      { return R.string.no; }
34
  public void neutralAction()   { }
35

  
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37

  
38
  public void negativeAction()
39
    {
40
    final PlayActivity act = (PlayActivity)getContext();
41
    ScreenList.goBack(act);
42
    }
43

  
44
///////////////////////////////////////////////////////////////////////////////////////////////////
45

  
46
  public void positiveAction()
47
    {
48
    final PlayActivity act = (PlayActivity)getContext();
49

  
50
    if( act!=null )
51
      {
52
      ScreenSolving solving = (ScreenSolving)ScreenList.SOLV.getScreenClass();
53
      int time = solving.stopTimerAndGetRecord();
54
      act.rememberSolve(time);
55
      ScreenList.goBack(act);
56
      }
57
    }
58

  
59
///////////////////////////////////////////////////////////////////////////////////////////////////
60

  
61
  public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
62
    {
63
    TextView mess = view.findViewById(R.id.dialog_message);
64
    mess.setText(R.string.come_back_later);
65
    mess.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
66
    }
67
  }
src/main/java/org/distorted/play/ScreenSolving.java
17 17
import android.widget.LinearLayout;
18 18
import android.widget.TextView;
19 19

  
20
import org.distorted.dialogs.DialogAbandon;
20
import org.distorted.dialogs.DialogRememberSolve;
21 21
import org.distorted.helpers.RubikScores;
22 22
import org.distorted.helpers.TransparentImageButton;
23 23
import org.distorted.main.R;
......
85 85
        {
86 86
        if( mMovesController.getNumMoves() > MOVES_THRESHHOLD )
87 87
          {
88
          DialogAbandon abaDiag = new DialogAbandon();
88
          DialogRememberSolve abaDiag = new DialogRememberSolve();
89 89
          abaDiag.show(act.getSupportFragmentManager(), null);
90 90
          }
91 91
        else

Also available in: Unified diff