Project

General

Profile

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

magiccube / src / main / java / org / distorted / dialogs / RubikDialogSolved.java @ c02fa107

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.content.DialogInterface;
14
import androidx.fragment.app.FragmentActivity;
15
import androidx.appcompat.app.AlertDialog;
16

    
17
import android.util.TypedValue;
18
import android.view.View;
19
import android.widget.Button;
20
import android.widget.TextView;
21

    
22
import org.distorted.main.R;
23
import org.distorted.main.RubikActivity;
24
import org.distorted.screens.ScreenList;
25

    
26
///////////////////////////////////////////////////////////////////////////////////////////////////
27

    
28
public class RubikDialogSolved extends RubikDialogAbstract
29
  {
30
  public int getResource()
31
    {
32
    return R.layout.dialog_solved;
33
    }
34

    
35
///////////////////////////////////////////////////////////////////////////////////////////////////
36

    
37
  public int getTitleResource()
38
    {
39
    return R.string.solved;
40
    }
41

    
42
///////////////////////////////////////////////////////////////////////////////////////////////////
43

    
44
  public boolean hasArgument()
45
    {
46
    return true;
47
    }
48

    
49
///////////////////////////////////////////////////////////////////////////////////////////////////
50

    
51
  public void setPositive(AlertDialog.Builder builder)
52
    {
53
    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
54
      {
55
      @Override
56
      public void onClick(DialogInterface dialog, int which)
57
        {
58
        RubikActivity act = (RubikActivity)getActivity();
59
        ScreenList.switchScreen(act, ScreenList.PLAY);
60
        }
61
      });
62
    }
63

    
64
///////////////////////////////////////////////////////////////////////////////////////////////////
65

    
66
  public void setNegative(AlertDialog.Builder builder)
67
    {
68

    
69
    }
70

    
71
///////////////////////////////////////////////////////////////////////////////////////////////////
72

    
73
  public void onShowDialog(DialogInterface dialog, float size)
74
    {
75
    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
76
    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
77
    }
78

    
79
///////////////////////////////////////////////////////////////////////////////////////////////////
80

    
81
  public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
82
    {
83
    TextView text = view.findViewById(R.id.solved_time);
84
    text.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
85
    text.setText(getString(R.string.ti_placeholder, mArgument));
86
    }
87

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

    
90
  public static String getDialogTag()
91
    {
92
    return "DialogSolved";
93
    }
94
  }
(17-17/25)