Project

General

Profile

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

magiccube / src / main / java / org / distorted / dialogs / RubikDialogError.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 android.util.TypedValue;
15
import android.view.View;
16
import android.widget.Button;
17
import android.widget.TextView;
18

    
19
import androidx.appcompat.app.AlertDialog;
20
import androidx.fragment.app.FragmentActivity;
21

    
22
import org.distorted.main.R;
23

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

    
26
public class RubikDialogError extends RubikDialogAbstract
27
  {
28
  public int getResource()
29
    {
30
    return R.layout.dialog_error;
31
    }
32

    
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34

    
35
  public int getTitleResource()
36
    {
37
    return R.string.opengl_error;
38
    }
39

    
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41

    
42
  public boolean hasArgument()
43
    {
44
    return false;
45
    }
46

    
47
///////////////////////////////////////////////////////////////////////////////////////////////////
48

    
49
  public void setPositive(AlertDialog.Builder builder)
50
    {
51
    final FragmentActivity act = getActivity();
52

    
53
    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
54
      {
55
      @Override
56
      public void onClick(DialogInterface dialog, int which)
57
        {
58
        if( act!=null ) act.finish();
59
        }
60
      });
61
    }
62

    
63
///////////////////////////////////////////////////////////////////////////////////////////////////
64

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

    
68
    }
69

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

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

    
78
///////////////////////////////////////////////////////////////////////////////////////////////////
79

    
80
  public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
81
    {
82
    TextView text = view.findViewById(R.id.error_string);
83
    text.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
84
    text.setText(R.string.opengl_error_text);
85
    }
86
  }
(6-6/25)