Project

General

Profile

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

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

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.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.bandaged.BandagedCreatorActivity;
23
import org.distorted.bandaged.BandagedCreatorRenderer;
24
import org.distorted.main.R;
25

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

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

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

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

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

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

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

    
51
  public void setPositive(AlertDialog.Builder builder)
52
    {
53
    builder.setPositiveButton( R.string.yes, new DialogInterface.OnClickListener()
54
      {
55
      @Override
56
      public void onClick(DialogInterface dialog, int which)
57
        {
58
        BandagedCreatorActivity bact = (BandagedCreatorActivity)getContext();
59

    
60
        if( bact!=null )
61
          {
62
          BandagedCreatorRenderer rend = bact.getRenderer();
63
          rend.saveObject();
64
          }
65
        }
66
      });
67
    }
68

    
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70

    
71
  public void setNegative(AlertDialog.Builder builder)
72
    {
73
    builder.setNegativeButton( R.string.no, new DialogInterface.OnClickListener()
74
      {
75
      @Override
76
      public void onClick(DialogInterface dialog, int which)
77
        {
78

    
79
        }
80
      });
81
    }
82

    
83
///////////////////////////////////////////////////////////////////////////////////////////////////
84

    
85
  public void onShowDialog(DialogInterface dialog, float size)
86
    {
87
    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
88
    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
89
    Button btnNegative = ((AlertDialog)dialog).getButton(Dialog.BUTTON_NEGATIVE);
90
    btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
91
    }
92

    
93
///////////////////////////////////////////////////////////////////////////////////////////////////
94

    
95
  public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
96
    {
97
    TextView save = view.findViewById(R.id.save_object_text);
98
    save.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
99
    }
100
  }
(5-5/25)