Project

General

Profile

Download (16.6 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / main / MainActivity.java @ 97201782

1 0c52af30 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2 1c04d054 leszek
// Copyright 2023 Leszek Koltunski                                                               //
3 0c52af30 Leszek Koltunski
//                                                                                               //
4 fdec60a3 Leszek Koltunski
// This file is part of Magic Cube.                                                              //
5 0c52af30 Leszek Koltunski
//                                                                                               //
6 296219b4 Leszek Koltunski
// Magic Cube is proprietary software licensed under an EULA which you should have received      //
7
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
8 0c52af30 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
9
10 1f9772f3 Leszek Koltunski
package org.distorted.main;
11 0c52af30 Leszek Koltunski
12 b6468abb Leszek Koltunski
import android.content.Intent;
13 33499c56 Leszek Koltunski
import android.content.SharedPreferences;
14 4c9947bd Leszek Koltunski
import android.content.pm.PackageInfo;
15
import android.content.pm.PackageManager;
16 b42c8399 leszek
import android.content.res.Configuration;
17 b1e9596b Leszek Koltunski
import android.os.Build;
18 0c52af30 Leszek Koltunski
import android.os.Bundle;
19 e3c74c0f Leszek Koltunski
import android.util.DisplayMetrics;
20 1c04d054 leszek
import android.util.TypedValue;
21 fd0b901a Leszek Koltunski
import android.view.DisplayCutout;
22 0254cfd7 Leszek Koltunski
import android.view.View;
23 1cb36646 Leszek Koltunski
import android.view.ViewGroup;
24 c9556e1e Leszek Koltunski
import android.view.WindowManager;
25 1cb36646 Leszek Koltunski
import android.widget.LinearLayout;
26 1c04d054 leszek
import android.widget.ScrollView;
27
import android.widget.TextView;
28 0c52af30 Leszek Koltunski
29 b42c8399 leszek
import androidx.annotation.NonNull;
30 e019c70b Leszek Koltunski
import androidx.appcompat.app.AppCompatActivity;
31 ada8ab26 leszek
import androidx.preference.PreferenceManager;
32 e019c70b Leszek Koltunski
33 1b3cbd5b Leszek Koltunski
import com.google.firebase.analytics.FirebaseAnalytics;
34 a59f38d6 Leszek Koltunski
import com.google.firebase.inappmessaging.FirebaseInAppMessaging;
35 1b3cbd5b Leszek Koltunski
36 7ee8337b leszek
import org.distorted.bandaged.BandagedActivity;
37 1c04d054 leszek
import org.distorted.config.ConfigActivity;
38 e71baee1 Leszek Koltunski
import org.distorted.dialogs.RubikDialogAbout;
39 1c04d054 leszek
import org.distorted.dialogs.RubikDialogCreators;
40
import org.distorted.dialogs.RubikDialogExit;
41
import org.distorted.dialogs.RubikDialogScores;
42
import org.distorted.dialogs.RubikDialogUpdates;
43 acabdd83 Leszek Koltunski
import org.distorted.external.RubikNetwork;
44 1c04d054 leszek
import org.distorted.external.RubikScores;
45
import org.distorted.external.RubikUpdates;
46
import org.distorted.messaging.RubikInAppMessanging;
47 7ee8337b leszek
import org.distorted.objects.RubikObject;
48 d433b50e Leszek Koltunski
import org.distorted.objects.RubikObjectList;
49 e9245b7b leszek
import org.distorted.patternui.PatternActivity;
50 7ee8337b leszek
import org.distorted.playui.PlayActivity;
51 cb30e768 leszek
import org.distorted.solverui.SolverActivity;
52 eaf87d1d Leszek Koltunski
import org.distorted.tutorials.TutorialActivity;
53 211b48f2 Leszek Koltunski
54 0c52af30 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
55
56 1c04d054 leszek
public class MainActivity extends AppCompatActivity implements RubikNetwork.Updatee
57 0c52af30 Leszek Koltunski
{
58 1c04d054 leszek
    public static final float RATIO_BAR = 0.080f;
59 af7b68e6 Leszek Koltunski
    public static final int FLAGS =  View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
60 ffd68f35 Leszek Koltunski
                                   | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
61
                                   | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
62
                                   | View.SYSTEM_UI_FLAG_FULLSCREEN
63
                                   | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
64
65 c3ffcf58 Leszek Koltunski
    private boolean mJustStarted;
66 1b3cbd5b Leszek Koltunski
    private FirebaseAnalytics mFirebaseAnalytics;
67 0254cfd7 Leszek Koltunski
    private int mCurrentApiVersion;
68 d05e7629 Leszek Koltunski
    private String mOldVersion, mCurrVersion;
69 b42c8399 leszek
    private int mScreenWidth;
70 1c04d054 leszek
    private TextView mBubbleUpdates;
71
    private int mNumUpdates;
72
    private MainScrollGrid mGrid;
73 c3ffcf58 Leszek Koltunski
74
///////////////////////////////////////////////////////////////////////////////////////////////////
75
76 0c52af30 Leszek Koltunski
    @Override
77 34747dd1 Leszek Koltunski
    protected void onCreate(Bundle savedState)
78 0c52af30 Leszek Koltunski
      {
79 34747dd1 Leszek Koltunski
      super.onCreate(savedState);
80 dd874ae8 Leszek Koltunski
      setTheme(R.style.MaterialThemeNoActionBar);
81 cb30e768 leszek
      setContentView(R.layout.main);
82 a7327225 leszek
      hideNavigationBar();
83 c3ffcf58 Leszek Koltunski
84
      mJustStarted = true;
85 1b3cbd5b Leszek Koltunski
      mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
86 e3c74c0f Leszek Koltunski
87 e8f6670f Leszek Koltunski
      cutoutHack();
88 1c04d054 leszek
      computeHeights();
89 a59f38d6 Leszek Koltunski
90 e9e744f7 Leszek Koltunski
      mCurrVersion = getAppVers();
91
92 83018ac4 Leszek Koltunski
      Thread thread = new Thread()
93
        {
94
        public void run()
95
          {
96
          RubikInAppMessanging listener = new RubikInAppMessanging();
97
          FirebaseInAppMessaging.getInstance().addClickListener(listener);
98
          }
99
        };
100
101
      thread.start();
102 0254cfd7 Leszek Koltunski
      }
103
104 598de3ee Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
105
// this does not include possible insets
106
107 1c04d054 leszek
    private void computeHeights()
108 598de3ee Leszek Koltunski
      {
109 b42c8399 leszek
      LinearLayout.LayoutParams pU = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, RATIO_BAR);
110 214e301a Leszek Koltunski
      LinearLayout layoutTop = findViewById(R.id.upperBar);
111 b42c8399 leszek
      layoutTop.setLayoutParams(pU);
112 1c04d054 leszek
113 b42c8399 leszek
      LinearLayout.LayoutParams pS = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1-2*RATIO_BAR);
114 1c04d054 leszek
      ScrollView scroll = findViewById(R.id.objectScroll);
115 b42c8399 leszek
      scroll.setLayoutParams(pS);
116
117
      LinearLayout.LayoutParams pL = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, RATIO_BAR);
118
      LinearLayout layoutBot = findViewById(R.id.lowerBar);
119
      layoutBot.setLayoutParams(pL);
120 598de3ee Leszek Koltunski
      }
121
122 0254cfd7 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
123
124
    private void hideNavigationBar()
125
      {
126 c9556e1e Leszek Koltunski
      mCurrentApiVersion = Build.VERSION.SDK_INT;
127 0254cfd7 Leszek Koltunski
128
      if(mCurrentApiVersion >= Build.VERSION_CODES.KITKAT)
129
        {
130
        final View decorView = getWindow().getDecorView();
131
132 c9556e1e Leszek Koltunski
        decorView.setSystemUiVisibility(FLAGS);
133
134 0254cfd7 Leszek Koltunski
        decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener()
135
          {
136
          @Override
137
          public void onSystemUiVisibilityChange(int visibility)
138
            {
139
            if((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0)
140
              {
141 ffd68f35 Leszek Koltunski
              decorView.setSystemUiVisibility(FLAGS);
142 0254cfd7 Leszek Koltunski
              }
143
            }
144
          });
145
        }
146
      }
147
148 1cb36646 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
149
150
    @Override
151
    public void onAttachedToWindow()
152
      {
153 fd0b901a Leszek Koltunski
      super.onAttachedToWindow();
154
155 b42c8399 leszek
      getWindowWidth(getResources().getConfiguration());
156
      mGrid = new MainScrollGrid();
157
      mGrid.createGrid(this,mScreenWidth);
158
159 ada8ab26 leszek
      if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.P )
160 e8f6670f Leszek Koltunski
        {
161
        DisplayCutout cutout = getWindow().getDecorView().getRootWindowInsets().getDisplayCutout();
162
        int insetHeight = cutout!=null ? cutout.getSafeInsetTop() : 0;
163
164 b42c8399 leszek
        if( insetHeight>0 )
165
          {
166
          LinearLayout.LayoutParams pH = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, RATIO_BAR);
167
          LinearLayout layoutHid = findViewById(R.id.hiddenBar);
168
          layoutHid.setLayoutParams(pH);
169
170
          LinearLayout.LayoutParams pS = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1-3*RATIO_BAR);
171
          ScrollView scroll = findViewById(R.id.objectScroll);
172
          scroll.setLayoutParams(pS);
173
          }
174 e8f6670f Leszek Koltunski
        }
175 1cb36646 Leszek Koltunski
      }
176
177 0254cfd7 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
178 e8f6670f Leszek Koltunski
// do not avoid cutouts
179 c9556e1e Leszek Koltunski
180 e8f6670f Leszek Koltunski
    private void cutoutHack()
181 c9556e1e Leszek Koltunski
      {
182 ada8ab26 leszek
      if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.P )
183 c9556e1e Leszek Koltunski
        {
184
        getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
185
        }
186
      }
187
188 b42c8399 leszek
///////////////////////////////////////////////////////////////////////////////////////////////////
189
190
    private void getWindowWidth(Configuration conf)
191
      {
192
      int dpi = getResources().getDisplayMetrics().densityDpi;
193
      float conv = ((float) dpi/DisplayMetrics.DENSITY_DEFAULT);
194
195
      mScreenWidth = (int) (conf.screenWidthDp*conv + 0.5f);
196
      }
197
198 c9556e1e Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
199 0254cfd7 Leszek Koltunski
200
    @Override
201
    public void onWindowFocusChanged(boolean hasFocus)
202
      {
203
      super.onWindowFocusChanged(hasFocus);
204
205 ada8ab26 leszek
      if( mCurrentApiVersion >= Build.VERSION_CODES.KITKAT && hasFocus )
206 0254cfd7 Leszek Koltunski
        {
207 ffd68f35 Leszek Koltunski
        getWindow().getDecorView().setSystemUiVisibility(FLAGS);
208 0254cfd7 Leszek Koltunski
        }
209
      }
210
211 b42c8399 leszek
///////////////////////////////////////////////////////////////////////////////////////////////////
212
213
    @Override
214
    public void onConfigurationChanged(@NonNull Configuration conf)
215
      {
216
      super.onConfigurationChanged(conf);
217
218
      getWindowWidth(conf);
219
      mGrid.updateGrid(this,mScreenWidth);
220
      }
221
222 0c52af30 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
223
    
224
    @Override
225
    protected void onPause() 
226
      {
227 82f42eeb Leszek Koltunski
      super.onPause();
228 6a083c6a Leszek Koltunski
      RubikNetwork.onPause();
229 33499c56 Leszek Koltunski
      savePreferences();
230 0c52af30 Leszek Koltunski
      }
231
232
///////////////////////////////////////////////////////////////////////////////////////////////////
233
    
234
    @Override
235
    protected void onResume() 
236
      {
237
      super.onResume();
238 51853bf2 Leszek Koltunski
239 6142069a Leszek Koltunski
      SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
240
      restorePreferences(preferences,mJustStarted);
241 1c04d054 leszek
242
      mBubbleUpdates = findViewById(R.id.bubbleUpdates);
243
      mBubbleUpdates.setVisibility(View.INVISIBLE);
244
      mNumUpdates = 0;
245
246 c3ffcf58 Leszek Koltunski
      if( mJustStarted )
247
        {
248
        mJustStarted = false;
249 72d3d383 leszek
250
        RubikNetwork network = RubikNetwork.getInstance();
251
        network.signUpForUpdates(this);
252
        network.downloadUpdates(this);
253 82ce8e64 Leszek Koltunski
        RubikScores scores = RubikScores.getInstance();
254
        scores.incrementNumRuns();
255
        scores.setCountry(this);
256 c3ffcf58 Leszek Koltunski
        }
257
258 ada8ab26 leszek
      if( !mOldVersion.equals(mCurrVersion) ) displayNovelties();
259 0c52af30 Leszek Koltunski
      }
260 d05e7629 Leszek Koltunski
261
///////////////////////////////////////////////////////////////////////////////////////////////////
262
263 1c89e2a7 Leszek Koltunski
    private void displayNovelties()
264 d05e7629 Leszek Koltunski
      {
265 1c89e2a7 Leszek Koltunski
      Bundle bundle = new Bundle();
266 34d6b123 Leszek Koltunski
      bundle.putString("argument",mOldVersion);
267 e71baee1 Leszek Koltunski
      RubikDialogAbout newDialog = new RubikDialogAbout();
268 1c89e2a7 Leszek Koltunski
      newDialog.setArguments(bundle);
269 e71baee1 Leszek Koltunski
      newDialog.show(getSupportFragmentManager(), RubikDialogAbout.getDialogTag() );
270 d05e7629 Leszek Koltunski
      }
271
272 0c52af30 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
273
    
274
    @Override
275
    protected void onDestroy() 
276
      {
277
      super.onDestroy();
278
      }
279
280 4c9947bd Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
281
282 b20e89d2 Leszek Koltunski
    private String getAppVers()
283 4c9947bd Leszek Koltunski
      {
284 b20e89d2 Leszek Koltunski
      try
285
        {
286
        PackageInfo pInfo = getPackageManager().getPackageInfo( getPackageName(), 0);
287
        return pInfo.versionName;
288
        }
289 1c04d054 leszek
      catch( PackageManager.NameNotFoundException e )
290 b20e89d2 Leszek Koltunski
        {
291
        return "unknown";
292
        }
293 4c9947bd Leszek Koltunski
      }
294
295 33499c56 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
296
297
    private void savePreferences()
298
      {
299
      SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
300
      SharedPreferences.Editor editor = preferences.edit();
301
302 e9e744f7 Leszek Koltunski
      editor.putString("appVersion", mCurrVersion );
303 b1e9596b Leszek Koltunski
304 400ff34d Leszek Koltunski
      RubikObjectList.savePreferences(editor);
305 2e3488f6 Leszek Koltunski
306 7480fbab Leszek Koltunski
      boolean success = editor.commit();
307
      if( !success ) android.util.Log.e("D", "Failed to save preferences");
308 33499c56 Leszek Koltunski
      }
309
310
///////////////////////////////////////////////////////////////////////////////////////////////////
311
312 6142069a Leszek Koltunski
    private void restorePreferences(SharedPreferences preferences, boolean justStarted)
313 33499c56 Leszek Koltunski
      {
314 d05e7629 Leszek Koltunski
      mOldVersion = preferences.getString("appVersion","");
315 872307fe Leszek Koltunski
316 7480fbab Leszek Koltunski
      RubikObjectList.restorePreferences(this,preferences,justStarted);
317 e9e744f7 Leszek Koltunski
      RubikScores scores = RubikScores.getInstance();
318
319
      if( scores.isVerified() )
320
        {
321
        FirebaseAnalytics analytics = getAnalytics();
322
        analytics.setUserId(scores.getName());
323
        }
324
      }
325 ee4e7896 Leszek Koltunski
326 e9e744f7 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
327 ee4e7896 Leszek Koltunski
328 b42c8399 leszek
    private void updateBubble(int num)
329 e9e744f7 Leszek Koltunski
      {
330 b42c8399 leszek
      runOnUiThread(new Runnable()
331
        {
332
        @Override
333
        public void run()
334
          {
335
          mNumUpdates = num;
336 00fcfefa Leszek Koltunski
337 b42c8399 leszek
          if( num>0 )
338
            {
339
            String shownNum = String.valueOf(num);
340
            mBubbleUpdates.setText(shownNum);
341
            mBubbleUpdates.setVisibility(View.VISIBLE);
342
            int height = (int)(0.05f*mScreenWidth);
343
            mBubbleUpdates.setTextSize(TypedValue.COMPLEX_UNIT_PX,height);
344
            }
345
          else
346
            {
347
            mBubbleUpdates.setVisibility(View.INVISIBLE);
348
            }
349
          }
350
        });
351 f3e12931 Leszek Koltunski
      }
352
353 2e3488f6 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
354 b42c8399 leszek
// PUBLIC API
355 2d9fc972 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
356
357 b42c8399 leszek
    public FirebaseAnalytics getAnalytics()
358 2d9fc972 Leszek Koltunski
      {
359 b42c8399 leszek
      return mFirebaseAnalytics;
360 2d9fc972 Leszek Koltunski
      }
361
362 1b3cbd5b Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
363
364 b710a574 leszek
    public void switchToTutorial(int objectOrdinal)
365 1b3cbd5b Leszek Koltunski
      {
366 1c04d054 leszek
      Intent intent = new Intent(this, TutorialActivity.class);
367
      intent.putExtra("obj", objectOrdinal);
368
      startActivity(intent);
369 1b3cbd5b Leszek Koltunski
      }
370
371 598de3ee Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
372
373 1c04d054 leszek
    public void switchToConfig(int objectOrdinal)
374 598de3ee Leszek Koltunski
      {
375 1c04d054 leszek
      Intent intent = new Intent(this, ConfigActivity.class);
376
      intent.putExtra("obj", objectOrdinal);
377
      startActivity(intent);
378 598de3ee Leszek Koltunski
      }
379
380 a6d3b158 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
381
382 1c04d054 leszek
    public void switchToBandagedCreator(int objectOrdinal)
383 aa171dee Leszek Koltunski
      {
384 7ee8337b leszek
      Intent intent = new Intent(this, BandagedActivity.class);
385 1c04d054 leszek
      intent.putExtra("obj", objectOrdinal);
386
      startActivity(intent);
387 8becce57 Leszek Koltunski
      }
388
389 d7f0c07d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
390
391 cb30e768 leszek
    public void switchToSolver(int objectOrdinal)
392 d7f0c07d Leszek Koltunski
      {
393 cb30e768 leszek
      Intent intent = new Intent(this, SolverActivity.class);
394 1c04d054 leszek
      intent.putExtra("obj", objectOrdinal);
395
      startActivity(intent);
396 d7f0c07d Leszek Koltunski
      }
397
398 e9245b7b leszek
///////////////////////////////////////////////////////////////////////////////////////////////////
399
400
    public void switchToPattern(int objectOrdinal)
401
      {
402
      Intent intent = new Intent(this, PatternActivity.class);
403
      intent.putExtra("obj", objectOrdinal);
404
      startActivity(intent);
405
      }
406
407 7ee8337b leszek
///////////////////////////////////////////////////////////////////////////////////////////////////
408
409 97201782 leszek
    public void switchToPlay(RubikObject object, int scrambles, int level)
410 7ee8337b leszek
      {
411
      Intent intent = new Intent(this, PlayActivity.class);
412 7bb30586 leszek
      intent.putExtra("level", level);
413 15ed3429 leszek
      intent.putExtra("name", object.getUpperName());
414 7ee8337b leszek
      intent.putExtra("scrambles", scrambles);
415
      intent.putExtra("local", object.isLocal() );
416
      intent.putExtra("ordinal", object.getObjectOrdinal() );
417
      startActivity(intent);
418
      }
419
420 8ba7aeb1 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
421
422 1c04d054 leszek
    public void onScores(View v)
423 8ba7aeb1 Leszek Koltunski
      {
424 1c04d054 leszek
      Bundle sBundle = new Bundle();
425
      sBundle.putString("argument", "false");
426
      RubikDialogScores scores = new RubikDialogScores();
427
      scores.setArguments(sBundle);
428
      scores.show(getSupportFragmentManager(), null);
429 aa171dee Leszek Koltunski
      }
430
431
///////////////////////////////////////////////////////////////////////////////////////////////////
432
433 1c04d054 leszek
    public void onUpdates(View v)
434 769d7b9f Leszek Koltunski
      {
435 1c04d054 leszek
      RubikDialogUpdates diag = new RubikDialogUpdates();
436
      diag.show( getSupportFragmentManager(), RubikDialogUpdates.getDialogTag() );
437 b20e89d2 Leszek Koltunski
      }
438
439
///////////////////////////////////////////////////////////////////////////////////////////////////
440 7eae2d49 Leszek Koltunski
441 1c04d054 leszek
    public void onExit(View v)
442 b20e89d2 Leszek Koltunski
      {
443 1c04d054 leszek
      RubikDialogExit diag = new RubikDialogExit();
444
      diag.show(getSupportFragmentManager(), null);
445 2e8ec627 Leszek Koltunski
      }
446
447 b1e9596b Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
448
449 1c04d054 leszek
    public void onAbout(View v)
450 b6468abb Leszek Koltunski
      {
451 1c04d054 leszek
      RubikDialogAbout diag = new RubikDialogAbout();
452
      diag.show(getSupportFragmentManager(), null);
453 b6468abb Leszek Koltunski
      }
454 1237d25d Leszek Koltunski
455
///////////////////////////////////////////////////////////////////////////////////////////////////
456
457 1c04d054 leszek
    public void onBandage(View v)
458 1237d25d Leszek Koltunski
      {
459 1c04d054 leszek
      RubikDialogCreators diag = new RubikDialogCreators();
460
      diag.show(getSupportFragmentManager(), RubikDialogCreators.getDialogTag() );
461 9530f6b0 Leszek Koltunski
      }
462
463 c7238c67 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
464
465 1c04d054 leszek
    public void receiveUpdate(RubikUpdates updates)
466 c7238c67 Leszek Koltunski
      {
467 1c04d054 leszek
      int num = updates.getCompletedNumber();
468
      updateBubble(num);
469 c7238c67 Leszek Koltunski
      }
470
471 41a5dd89 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
472
473 1c04d054 leszek
    public void objectDownloaded(String shortName)
474 41a5dd89 Leszek Koltunski
      {
475 1c04d054 leszek
      mNumUpdates--;
476
      updateBubble(mNumUpdates);
477 b42c8399 leszek
      mGrid.updateGrid(this,mScreenWidth);
478 41a5dd89 Leszek Koltunski
      }
479 67d7fb28 Leszek Koltunski
480
///////////////////////////////////////////////////////////////////////////////////////////////////
481
482 1c04d054 leszek
    public int getType()
483 67d7fb28 Leszek Koltunski
      {
484 1c04d054 leszek
      return 0;
485 67d7fb28 Leszek Koltunski
      }
486
487
///////////////////////////////////////////////////////////////////////////////////////////////////
488
489 1c04d054 leszek
    public void errorUpdate()
490 67d7fb28 Leszek Koltunski
      {
491 1c04d054 leszek
      android.util.Log.e("D", "NewRubikActivity: Error receiving downloaded objects update");
492 67d7fb28 Leszek Koltunski
      }
493 0c52af30 Leszek Koltunski
}