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/RubikDialogStarsStatus.java
10 10
package org.distorted.dialogs;
11 11

  
12 12
import android.app.Dialog;
13
import android.content.Context;
14
import android.content.DialogInterface;
15
import android.util.DisplayMetrics;
16
import android.util.TypedValue;
17 13
import android.view.View;
18 14
import android.view.Window;
19 15
import android.view.WindowManager;
20
import android.widget.Button;
21 16
import android.widget.LinearLayout;
22 17
import android.widget.TextView;
23 18

  
24
import androidx.appcompat.app.AlertDialog;
25 19
import androidx.fragment.app.FragmentActivity;
26 20

  
27 21
import org.distorted.external.RubikScores;
......
37 31
    super.onResume();
38 32

  
39 33
    Window window = getDialog().getWindow();
40
    Context context = getContext();
41 34

  
42
    if( window!=null && context!=null )
35
    if( window!=null )
43 36
      {
44 37
      WindowManager.LayoutParams params = window.getAttributes();
45 38
      params.width  = (int)Math.min( mHeight*0.65f,mWidth*0.95f );
......
50 43

  
51 44
///////////////////////////////////////////////////////////////////////////////////////////////////
52 45

  
53
  public int getResource()
54
    {
55
    return R.layout.dialog_stars_status;
56
    }
57

  
58
///////////////////////////////////////////////////////////////////////////////////////////////////
59

  
60
  public int getTitleResource()
61
    {
62
    return -1;
63
    }
64

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

  
67
  public boolean hasArgument()
68
    {
69
    return false;
70
    }
46
  public int getResource()      { return R.layout.dialog_stars_status; }
47
  public int getTitleResource() { return -1; }
48
  public boolean hasArgument()  { return false; }
49
  public int getPositive()      { return R.string.ok; }
50
  public int getNegative()      { return -1; }
71 51

  
72 52
///////////////////////////////////////////////////////////////////////////////////////////////////
73 53

  
74
  public void setPositive(AlertDialog.Builder builder)
54
  public void positiveAction()
75 55
    {
76
    builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
77
      {
78
      @Override
79
      public void onClick(DialogInterface dialog, int which)
80
        {
81 56

  
82
        }
83
      });
84 57
    }
85 58

  
86 59
///////////////////////////////////////////////////////////////////////////////////////////////////
87 60

  
88
  public void setNegative(AlertDialog.Builder builder)
61
  public void negativeAction()
89 62
    {
90 63

  
91 64
    }
92 65

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

  
95
  public void onShowDialog(DialogInterface dialog, float size)
96
    {
97
    Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
98
    btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
99
    }
100

  
101 66
///////////////////////////////////////////////////////////////////////////////////////////////////
102 67

  
103 68
  public void prepareBody(Dialog dialog, View view, FragmentActivity act, float size)

Also available in: Unified diff