Project

General

Profile

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

magiccube / src / main / java / org / distorted / dialogs / RubikDialogBandagedDelete.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.main.R;
24

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

    
27
public class RubikDialogBandagedDelete extends RubikDialogAbstract
28
  {
29
  public int getResource()
30
    {
31
    return R.layout.dialog_delete_object;
32
    }
33

    
34
///////////////////////////////////////////////////////////////////////////////////////////////////
35

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

    
41
///////////////////////////////////////////////////////////////////////////////////////////////////
42

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

    
48
///////////////////////////////////////////////////////////////////////////////////////////////////
49

    
50
  public void setPositive(AlertDialog.Builder builder)
51
    {
52
    final String objectName = mArgument;
53

    
54
    builder.setPositiveButton( R.string.yes, new DialogInterface.OnClickListener()
55
      {
56
      @Override
57
      public void onClick(DialogInterface dialog, int which)
58
        {
59
        BandagedCreatorActivity bact = (BandagedCreatorActivity)getContext();
60
        if( bact!=null ) bact.deleteObject(objectName);
61
        }
62
      });
63
    }
64

    
65
///////////////////////////////////////////////////////////////////////////////////////////////////
66

    
67
  public void setNegative(AlertDialog.Builder builder)
68
    {
69
    builder.setNegativeButton( R.string.no, new DialogInterface.OnClickListener()
70
      {
71
      @Override
72
      public void onClick(DialogInterface dialog, int which)
73
        {
74

    
75
        }
76
      });
77
    }
78

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

    
81
  public void onShowDialog(DialogInterface dialog, float size)
82
    {
83
    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
84
    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
85
    Button btnNegative = ((AlertDialog)dialog).getButton(Dialog.BUTTON_NEGATIVE);
86
    btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
87
    }
88

    
89
///////////////////////////////////////////////////////////////////////////////////////////////////
90

    
91
  public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)
92
    {
93
    TextView save = view.findViewById(R.id.delete_object_text);
94
    save.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
95
    }
96

    
97
///////////////////////////////////////////////////////////////////////////////////////////////////
98

    
99
  public static String getDialogTag()
100
    {
101
    return "DialogBandagedDelete";
102
    }
103
  }
(4-4/25)