Project

General

Profile

« Previous | Next » 

Revision 90fd47b0

Added by Leszek Koltunski over 4 years ago

Lots of bugfixes.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogAbout.java
50 50

  
51 51
    if( window!=null )
52 52
      {
53
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
54
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
55 53
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
56 54
      }
57 55
    }
src/main/java/org/distorted/dialogs/RubikDialogEffects.java
49 49
  {
50 50
  private TextView[] mDurationText;
51 51

  
52
///////////////////////////////////////////////////////////////////////////////////////////////////
53

  
54
  @Override
55
  public void onStart()
56
    {
57
    super.onStart();
58

  
59
    Dialog dialog = getDialog();
60
    dialog.setCanceledOnTouchOutside(false);
61

  
62
    Window window = dialog.getWindow();
63

  
64
    if( window!=null )
65
      {
66
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
67
      }
68
    }
69

  
52 70
///////////////////////////////////////////////////////////////////////////////////////////////////
53 71

  
54 72
  private void addSettingsSection(FragmentActivity act, LinearLayout layout, int index)
......
197 215
    mDurationText = new TextView[BaseEffect.Type.LENGTH];
198 216
    }
199 217

  
200
///////////////////////////////////////////////////////////////////////////////////////////////////
201

  
202
  @Override
203
  public void onStart()
204
    {
205
    super.onStart();
206

  
207
    Dialog dialog = getDialog();
208
    dialog.setCanceledOnTouchOutside(false);
209

  
210
    Window window = dialog.getWindow();
211

  
212
    if( window!=null )
213
      {
214
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
215
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
216
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
217
      }
218
    }
219

  
220 218
///////////////////////////////////////////////////////////////////////////////////////////////////
221 219

  
222 220
  @NonNull
src/main/java/org/distorted/dialogs/RubikDialogNewRecord.java
55 55

  
56 56
    if( window!=null )
57 57
      {
58
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
59
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
60 58
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
61 59
      }
62 60
    }
src/main/java/org/distorted/dialogs/RubikDialogScoresPagerAdapter.java
86 86

  
87 87
    switch(errorNumber)
88 88
      {
89
      case '1': message("Client error");
89
      case '1': message("Network error");
90 90
                break;
91 91
      case '2': RubikScores scores = RubikScores.getInstance();
92 92
                Bundle bundle = new Bundle();
src/main/java/org/distorted/dialogs/RubikDialogSetName.java
47 47

  
48 48
public class RubikDialogSetName extends AppCompatDialogFragment
49 49
  {
50
  private EditText mEdit;
51

  
52
///////////////////////////////////////////////////////////////////////////////////////////////////
53

  
50 54
  @Override
51 55
  public void onStart()
52 56
    {
......
56 60

  
57 61
    if (dialog != null)
58 62
      {
59
      Button positiveButton = dialog.getButton(Dialog.BUTTON_POSITIVE);
60
      positiveButton.setEnabled(false);
61 63
      dialog.setCanceledOnTouchOutside(false);
62 64

  
63 65
      Window window = dialog.getWindow();
64 66

  
65 67
      if( window!=null )
66 68
        {
67
        window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
68
                        WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
69 69
        window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
70 70
        }
71 71
      }
72

  
73
    Button positiveButton = dialog.getButton(Dialog.BUTTON_POSITIVE);
74

  
75
    if( positiveButton!=null )
76
      {
77
      String editName = mEdit.getText().toString();
78
      positiveButton.setEnabled(editName.length()>0);
79
      }
72 80
    }
73 81

  
74 82
///////////////////////////////////////////////////////////////////////////////////////////////////
......
101 109

  
102 110
    final View view = inflater.inflate(R.layout.dialog_set_name, null);
103 111
    TextView text = view.findViewById(R.id.set_name_message);
112
    mEdit = view.findViewById(R.id.set_name);
104 113

  
105 114
    if( first )
106 115
      {
......
118 127
      @Override
119 128
      public void onClick(DialogInterface dialog, int which)
120 129
        {
121
        RubikActivity act = (RubikActivity)getActivity();
122
        RubikState.switchState(act,RubikState.PLAY);
123

  
124
        EditText edit = view.findViewById(R.id.set_name);
125
        String name = edit.getText().toString();
126
        RubikScores.getInstance().setName(name);
127

  
128
        RubikStatePlay play = (RubikStatePlay) RubikState.PLAY.getStateClass();
129
        int object = play.getObject();
130
        int size   = play.getSize();
131
        int sizeIndex = RubikObjectList.getSizeIndex(object,size);
132

  
133
        Bundle bundle = new Bundle();
134
        bundle.putInt("tab", RubikObjectList.pack(object,sizeIndex) );
135
        bundle.putBoolean("submitting", true);
136

  
137
        RubikDialogScores scores = new RubikDialogScores();
138
        scores.setArguments(bundle);
139
        scores.show(act.getSupportFragmentManager(), null);
130
        String name = mEdit.getText().toString();
131

  
132
        if( name.length()>0 )
133
          {
134
          RubikActivity act = (RubikActivity)getActivity();
135
          RubikState.switchState(act,RubikState.PLAY);
136
          RubikScores.getInstance().setName(name);
137
          RubikStatePlay play = (RubikStatePlay) RubikState.PLAY.getStateClass();
138

  
139
          int object = play.getObject();
140
          int size   = play.getSize();
141
          int sizeIndex = RubikObjectList.getSizeIndex(object,size);
142

  
143
          Bundle bundle = new Bundle();
144
          bundle.putInt("tab", RubikObjectList.pack(object,sizeIndex) );
145
          bundle.putBoolean("submitting", true);
146

  
147
          RubikDialogScores scores = new RubikDialogScores();
148
          scores.setArguments(bundle);
149
          scores.show(act.getSupportFragmentManager(), null);
150
          }
140 151
        }
141 152
      });
142 153

  
......
144 155
    final Dialog dialog = builder.create();
145 156
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
146 157

  
147
    EditText edit = view.findViewById(R.id.set_name);
148
    edit.requestFocus();
158
    mEdit.requestFocus();
149 159

  
150
    edit.addTextChangedListener(new TextWatcher()
160
    mEdit.addTextChangedListener(new TextWatcher()
151 161
      {
152 162
      @Override
153 163
      public void afterTextChanged(Editable s) {}
src/main/java/org/distorted/dialogs/RubikDialogSolved.java
52 52

  
53 53
    if( window!=null )
54 54
      {
55
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
56
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
57 55
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
58 56
      }
59 57
    }
src/main/java/org/distorted/dialogs/RubikDialogSolverError.java
50 50

  
51 51
    if( window!=null )
52 52
      {
53
      window.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
54
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
55 53
      window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
56 54
      }
57 55
    }
src/main/java/org/distorted/scores/RubikScoresDownloader.java
139 139
      mReceiver.error("1");
140 140
      return false;
141 141
      }
142
    else if( len==1 )
142
    else if( len<=2 )
143 143
      {
144 144
      mReceiver.error(mScores);
145 145
      return false;

Also available in: Unified diff