Project

General

Profile

« Previous | Next » 

Revision 32fbd026

Added by Leszek Koltunski almost 3 years ago

Downloaded Objects: bugfix.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogUpdateView.java
139 139
    mBar.setVisibility(View.VISIBLE);
140 140
    }
141 141

  
142
///////////////////////////////////////////////////////////////////////////////////////////////////
143

  
144
  private void displayError(int error)
145
    {
146
    Activity act = mAct.get();
147

  
148
    act.runOnUiThread(new Runnable()
149
      {
150
      @Override
151
      public void run()
152
        {
153
        mDescription.setTextColor(Color.parseColor("#ff0000"));
154
        mDescription.setText(error);
155
        }
156
      });
157
    }
158

  
159
///////////////////////////////////////////////////////////////////////////////////////////////////
160

  
161
  private void makeProgress(int progress, int message)
162
    {
163
    Activity act = mAct.get();
164

  
165
    act.runOnUiThread(new Runnable()
166
      {
167
      @Override
168
      public void run()
169
        {
170
        mBar.setProgress(progress);
171
        mDescription.setText(message);
172
        }
173
      });
174
    }
175

  
142 176
///////////////////////////////////////////////////////////////////////////////////////////////////
143 177

  
144 178
  public void jsonDownloaded()
145 179
    {
146 180
    if( mInfo.mUpdateObject && mInfo.mObjectStream==null )
147 181
      {
148
      mDescription.setTextColor(Color.parseColor("#ff0000"));
149
      mDescription.setText(R.string.networkError);
182
      displayError(R.string.networkError);
150 183
      }
151 184
    else
152 185
      {
153
      mBar.setProgress(50);
154
      mDescription.setText(R.string.installing);
155

  
186
      makeProgress(50,R.string.installing);
156 187
      RubikFiles files = RubikFiles.getInstance();
157 188
      boolean oSuccess=true, eSuccess=true;
158 189

  
......
181 212

  
182 213
      if( mIconSaved || oSuccess || eSuccess )
183 214
        {
184
        mBar.setProgress(75);
185
        mDescription.setText(R.string.configuring);
215
        makeProgress(75,R.string.configuring);
216

  
217
        android.util.Log.e("D", "1");
218

  
186 219
        RubikObjectList.addDownloadedObject(mInfo.mObjectShortName,mInfo.mNumScrambles, mInfo.mObjectMinorVersion,
187 220
                                            mInfo.mExtrasMinorVersion, mIconSaved, oSuccess, eSuccess);
188 221

  
222
        android.util.Log.e("D", "2");
223

  
189 224
        RubikNetwork network = RubikNetwork.getInstance();
190 225
        network.updateDone(mInfo.mObjectShortName);
191 226

  
227
        android.util.Log.e("D", "3");
228

  
192 229
        RubikScreenPlay play = (RubikScreenPlay)ScreenList.PLAY.getScreenClass();
193 230
        play.recreatePopup();
194 231

  
195
        mBar.setProgress(100);
196
        mDescription.setText(R.string.success);
232
        android.util.Log.e("D", "4");
233

  
234
        makeProgress(100,R.string.success);
235

  
236
        android.util.Log.e("D", "5");
197 237
        }
198 238
      else
199 239
        {
200
        mDescription.setTextColor(Color.parseColor("#ff0000"));
201
        mDescription.setText(R.string.saveError);
240
        displayError(R.string.saveError);
202 241
        }
203 242
      }
204 243
    }

Also available in: Unified diff