Project

General

Profile

« Previous | Next » 

Revision f8a21f6b

Added by Leszek Koltunski over 1 year ago

Unify all dialogs.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogAbandon.java
10 10
package org.distorted.dialogs;
11 11

  
12 12
import android.app.Dialog;
13
import android.content.DialogInterface;
14
import android.util.TypedValue;
15 13
import android.view.View;
16
import android.widget.Button;
17 14

  
18
import androidx.appcompat.app.AlertDialog;
19 15
import androidx.fragment.app.FragmentActivity;
20 16

  
21 17
import org.distorted.main.R;
......
26 22

  
27 23
public class RubikDialogAbandon extends RubikDialogAbstract
28 24
  {
29
  public int getResource()
30
    {
31
    return R.layout.abandon_solve;
32
    }
33

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

  
36
  public int getTitleResource()
37
    {
38
    return -1;
39
    }
40

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

  
43
  public boolean hasArgument()
44
    {
45
    return false;
46
    }
25
  public int getResource()      { return R.layout.abandon_solve; }
26
  public int getTitleResource() { return -1; }
27
  public boolean hasArgument()  { return false; }
28
  public int getPositive()      { return R.string.yes; }
29
  public int getNegative()      { return R.string.no; }
47 30

  
48 31
///////////////////////////////////////////////////////////////////////////////////////////////////
49 32

  
50
  public void setPositive(AlertDialog.Builder builder)
33
  public void positiveAction()
51 34
    {
52 35
    final RubikActivity ract = (RubikActivity)getContext();
53

  
54
    builder.setPositiveButton( R.string.yes, new DialogInterface.OnClickListener()
55
      {
56
      @Override
57
      public void onClick(DialogInterface dialog, int which)
58
        {
59
        ScreenList.goBack(ract);
60
        }
61
      });
36
    ScreenList.goBack(ract);
62 37
    }
63 38

  
64 39
///////////////////////////////////////////////////////////////////////////////////////////////////
65 40

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

  
74
        }
75
      });
76
    }
77

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

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

  
88 46
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff