Project

General

Profile

« Previous | Next » 

Revision 0d3cb968

Added by Leszek Koltunski about 18 hours ago

  • ID 0d3cb968dde8f4cf156cfab327fa8433b00f79c9
  • Parent 1ae7c033

Change the size of dialog's button strings to before showing the dialog, to avoid the flicker.

View differences:

src/main/java/org/distorted/dialogs/DialogAbstract.java
57 57
    return "";
58 58
    }
59 59

  
60
///////////////////////////////////////////////////////////////////////////////////////////////////
61

  
62
  @Override
63
  public void onStart()
64
    {
65
    super.onStart();
66

  
67
    AlertDialog dialog = (AlertDialog) getDialog();
68
    if (dialog != null)
69
      {
70
      Button pos = dialog.getButton(Dialog.BUTTON_POSITIVE);
71
      if( pos!=null ) pos.setTextSize(TypedValue.COMPLEX_UNIT_PX, mButSize);
72
      Button neg = dialog.getButton(Dialog.BUTTON_NEGATIVE);
73
      if( neg!=null ) neg.setTextSize(TypedValue.COMPLEX_UNIT_PX, mButSize);
74
      }
75
    }
76

  
60 77
///////////////////////////////////////////////////////////////////////////////////////////////////
61 78

  
62 79
  @NonNull
......
154 171
      window.getDecorView().setSystemUiVisibility(MainActivity.FLAGS);
155 172
      }
156 173

  
157
    dialog.setOnShowListener(new DialogInterface.OnShowListener()
158
      {
159
      @Override
160
      public void onShow(DialogInterface dialog)
161
        {
162
        if( positive>=0 )
163
          {
164
          Button btnPositive = ((AlertDialog)dialog).getButton(Dialog.BUTTON_POSITIVE);
165
          btnPositive.setTextSize(TypedValue.COMPLEX_UNIT_PX, mButSize);
166
          }
167
        if( negative>=0 )
168
          {
169
          Button btnNegative = ((AlertDialog)dialog).getButton(Dialog.BUTTON_NEGATIVE);
170
          btnNegative.setTextSize(TypedValue.COMPLEX_UNIT_PX, mButSize);
171
          }
172
        }
173
      });
174

  
175 174
    return dialog;
176 175
    }
177 176
  }

Also available in: Unified diff