Project

General

Profile

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

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

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 9530f6b0 Leszek Koltunski
import org.distorted.bandaged.BandagedCreatorActivity;
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 d433b50e Leszek Koltunski
import org.distorted.objects.RubikObjectList;
48 c7238c67 Leszek Koltunski
import org.distorted.purchase.PurchaseActivity;
49 eaf87d1d Leszek Koltunski
import org.distorted.tutorials.TutorialActivity;
50 211b48f2 Leszek Koltunski
51 0c52af30 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
52
53 1c04d054 leszek
public class MainActivity extends AppCompatActivity implements RubikNetwork.Updatee
54 0c52af30 Leszek Koltunski
{
55 1c04d054 leszek
    public static final float RATIO_BAR = 0.080f;
56 af7b68e6 Leszek Koltunski
    public static final int FLAGS =  View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
57 ffd68f35 Leszek Koltunski
                                   | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
58
                                   | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
59
                                   | View.SYSTEM_UI_FLAG_FULLSCREEN
60
                                   | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
61
62 c3ffcf58 Leszek Koltunski
    private boolean mJustStarted;
63 1b3cbd5b Leszek Koltunski
    private FirebaseAnalytics mFirebaseAnalytics;
64 0254cfd7 Leszek Koltunski
    private int mCurrentApiVersion;
65 d05e7629 Leszek Koltunski
    private String mOldVersion, mCurrVersion;
66 67d7fb28 Leszek Koltunski
    private int mSolverIndex;
67 b42c8399 leszek
    private int mScreenWidth;
68 1c04d054 leszek
    private TextView mBubbleUpdates;
69
    private int mNumUpdates;
70
    private MainScrollGrid mGrid;
71 c3ffcf58 Leszek Koltunski
72
///////////////////////////////////////////////////////////////////////////////////////////////////
73
74 0c52af30 Leszek Koltunski
    @Override
75 34747dd1 Leszek Koltunski
    protected void onCreate(Bundle savedState)
76 0c52af30 Leszek Koltunski
      {
77 34747dd1 Leszek Koltunski
      super.onCreate(savedState);
78 dd874ae8 Leszek Koltunski
      setTheme(R.style.MaterialThemeNoActionBar);
79 1c04d054 leszek
      setContentView(R.layout.new_main);
80 a7327225 leszek
      hideNavigationBar();
81 c3ffcf58 Leszek Koltunski
82
      mJustStarted = true;
83 1b3cbd5b Leszek Koltunski
      mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
84 e3c74c0f Leszek Koltunski
85 e8f6670f Leszek Koltunski
      cutoutHack();
86 1c04d054 leszek
      computeHeights();
87 a59f38d6 Leszek Koltunski
88 e9e744f7 Leszek Koltunski
      mCurrVersion = getAppVers();
89 67d7fb28 Leszek Koltunski
      mSolverIndex = 0;
90 e9e744f7 Leszek Koltunski
91 83018ac4 Leszek Koltunski
      Thread thread = new Thread()
92
        {
93
        public void run()
94
          {
95
          RubikInAppMessanging listener = new RubikInAppMessanging();
96
          FirebaseInAppMessaging.getInstance().addClickListener(listener);
97
          }
98
        };
99
100
      thread.start();
101 0254cfd7 Leszek Koltunski
      }
102
103 598de3ee Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
104
// this does not include possible insets
105
106 1c04d054 leszek
    private void computeHeights()
107 598de3ee Leszek Koltunski
      {
108 b42c8399 leszek
      LinearLayout.LayoutParams pU = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, RATIO_BAR);
109 214e301a Leszek Koltunski
      LinearLayout layoutTop = findViewById(R.id.upperBar);
110 b42c8399 leszek
      layoutTop.setLayoutParams(pU);
111 1c04d054 leszek
112 b42c8399 leszek
      LinearLayout.LayoutParams pS = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1-2*RATIO_BAR);
113 1c04d054 leszek
      ScrollView scroll = findViewById(R.id.objectScroll);
114 b42c8399 leszek
      scroll.setLayoutParams(pS);
115
116
      LinearLayout.LayoutParams pL = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, RATIO_BAR);
117
      LinearLayout layoutBot = findViewById(R.id.lowerBar);
118
      layoutBot.setLayoutParams(pL);
119 598de3ee Leszek Koltunski
      }
120
121 0254cfd7 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
122
123
    private void hideNavigationBar()
124
      {
125 c9556e1e Leszek Koltunski
      mCurrentApiVersion = Build.VERSION.SDK_INT;
126 0254cfd7 Leszek Koltunski
127
      if(mCurrentApiVersion >= Build.VERSION_CODES.KITKAT)
128
        {
129
        final View decorView = getWindow().getDecorView();
130
131 c9556e1e Leszek Koltunski
        decorView.setSystemUiVisibility(FLAGS);
132
133 0254cfd7 Leszek Koltunski
        decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener()
134
          {
135
          @Override
136
          public void onSystemUiVisibilityChange(int visibility)
137
            {
138
            if((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0)
139
              {
140 ffd68f35 Leszek Koltunski
              decorView.setSystemUiVisibility(FLAGS);
141 0254cfd7 Leszek Koltunski
              }
142
            }
143
          });
144
        }
145
      }
146
147 1cb36646 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
148
149
    @Override
150
    public void onAttachedToWindow()
151
      {
152 fd0b901a Leszek Koltunski
      super.onAttachedToWindow();
153
154 b42c8399 leszek
      getWindowWidth(getResources().getConfiguration());
155
      mGrid = new MainScrollGrid();
156
      mGrid.createGrid(this,mScreenWidth);
157
158 ada8ab26 leszek
      if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.P )
159 e8f6670f Leszek Koltunski
        {
160
        DisplayCutout cutout = getWindow().getDecorView().getRootWindowInsets().getDisplayCutout();
161
        int insetHeight = cutout!=null ? cutout.getSafeInsetTop() : 0;
162
163 b42c8399 leszek
        if( insetHeight>0 )
164
          {
165
          LinearLayout.LayoutParams pH = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, RATIO_BAR);
166
          LinearLayout layoutHid = findViewById(R.id.hiddenBar);
167
          layoutHid.setLayoutParams(pH);
168
169
          LinearLayout.LayoutParams pS = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1-3*RATIO_BAR);
170
          ScrollView scroll = findViewById(R.id.objectScroll);
171
          scroll.setLayoutParams(pS);
172
          }
173 e8f6670f Leszek Koltunski
        }
174 1cb36646 Leszek Koltunski
      }
175
176 0254cfd7 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
177 e8f6670f Leszek Koltunski
// do not avoid cutouts
178 c9556e1e Leszek Koltunski
179 e8f6670f Leszek Koltunski
    private void cutoutHack()
180 c9556e1e Leszek Koltunski
      {
181 ada8ab26 leszek
      if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.P )
182 c9556e1e Leszek Koltunski
        {
183
        getWindow().getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
184
        }
185
      }
186
187 b42c8399 leszek
///////////////////////////////////////////////////////////////////////////////////////////////////
188
189
    private void getWindowWidth(Configuration conf)
190
      {
191
      int dpi = getResources().getDisplayMetrics().densityDpi;
192
      float conv = ((float) dpi/DisplayMetrics.DENSITY_DEFAULT);
193
194
      mScreenWidth = (int) (conf.screenWidthDp*conv + 0.5f);
195
      }
196
197 c9556e1e Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
198 0254cfd7 Leszek Koltunski
199
    @Override
200
    public void onWindowFocusChanged(boolean hasFocus)
201
      {
202
      super.onWindowFocusChanged(hasFocus);
203
204 ada8ab26 leszek
      if( mCurrentApiVersion >= Build.VERSION_CODES.KITKAT && hasFocus )
205 0254cfd7 Leszek Koltunski
        {
206 ffd68f35 Leszek Koltunski
        getWindow().getDecorView().setSystemUiVisibility(FLAGS);
207 0254cfd7 Leszek Koltunski
        }
208
      }
209
210 b42c8399 leszek
///////////////////////////////////////////////////////////////////////////////////////////////////
211
212
    @Override
213
    public void onConfigurationChanged(@NonNull Configuration conf)
214
      {
215
      super.onConfigurationChanged(conf);
216
217
      getWindowWidth(conf);
218
      mGrid.updateGrid(this,mScreenWidth);
219
      }
220
221 0c52af30 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
222
    
223
    @Override
224
    protected void onPause() 
225
      {
226 82f42eeb Leszek Koltunski
      super.onPause();
227 6a083c6a Leszek Koltunski
      RubikNetwork.onPause();
228 33499c56 Leszek Koltunski
      savePreferences();
229 0c52af30 Leszek Koltunski
      }
230
231
///////////////////////////////////////////////////////////////////////////////////////////////////
232
    
233
    @Override
234
    protected void onResume() 
235
      {
236
      super.onResume();
237 51853bf2 Leszek Koltunski
238 6142069a Leszek Koltunski
      SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
239
      restorePreferences(preferences,mJustStarted);
240 1c04d054 leszek
241
      mBubbleUpdates = findViewById(R.id.bubbleUpdates);
242
      mBubbleUpdates.setVisibility(View.INVISIBLE);
243
      mNumUpdates = 0;
244
245
      RubikNetwork network = RubikNetwork.getInstance();
246
      network.signUpForUpdates(this);
247
      network.downloadUpdates(this);
248
249 c3ffcf58 Leszek Koltunski
      if( mJustStarted )
250
        {
251
        mJustStarted = false;
252 82ce8e64 Leszek Koltunski
        RubikScores scores = RubikScores.getInstance();
253
        scores.incrementNumRuns();
254
        scores.setCountry(this);
255 f12e4de9 Leszek Koltunski
        RubikObjectList.restoreMeshState(preferences);
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 872307fe Leszek Koltunski
      editor.putInt("solverIndex", mSolverIndex );
304 b1e9596b Leszek Koltunski
305 400ff34d Leszek Koltunski
      RubikObjectList.savePreferences(editor);
306 f12e4de9 Leszek Koltunski
      RubikObjectList.saveMeshState(editor);
307 2e3488f6 Leszek Koltunski
308 7480fbab Leszek Koltunski
      boolean success = editor.commit();
309
      if( !success ) android.util.Log.e("D", "Failed to save preferences");
310 33499c56 Leszek Koltunski
      }
311
312
///////////////////////////////////////////////////////////////////////////////////////////////////
313
314 6142069a Leszek Koltunski
    private void restorePreferences(SharedPreferences preferences, boolean justStarted)
315 33499c56 Leszek Koltunski
      {
316 d05e7629 Leszek Koltunski
      mOldVersion = preferences.getString("appVersion","");
317 872307fe Leszek Koltunski
      mSolverIndex = preferences.getInt("solverIndex",0);
318
319 7480fbab Leszek Koltunski
      RubikObjectList.restorePreferences(this,preferences,justStarted);
320 e9e744f7 Leszek Koltunski
      RubikScores scores = RubikScores.getInstance();
321
322
      if( scores.isVerified() )
323
        {
324
        FirebaseAnalytics analytics = getAnalytics();
325
        analytics.setUserId(scores.getName());
326
        }
327
      }
328 ee4e7896 Leszek Koltunski
329 e9e744f7 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
330 ee4e7896 Leszek Koltunski
331 b42c8399 leszek
    private void updateBubble(int num)
332 e9e744f7 Leszek Koltunski
      {
333 b42c8399 leszek
      runOnUiThread(new Runnable()
334
        {
335
        @Override
336
        public void run()
337
          {
338
          mNumUpdates = num;
339 00fcfefa Leszek Koltunski
340 b42c8399 leszek
          if( num>0 )
341
            {
342
            String shownNum = String.valueOf(num);
343
            mBubbleUpdates.setText(shownNum);
344
            mBubbleUpdates.setVisibility(View.VISIBLE);
345
            int height = (int)(0.05f*mScreenWidth);
346
            mBubbleUpdates.setTextSize(TypedValue.COMPLEX_UNIT_PX,height);
347
            }
348
          else
349
            {
350
            mBubbleUpdates.setVisibility(View.INVISIBLE);
351
            }
352
          }
353
        });
354 f3e12931 Leszek Koltunski
      }
355
356 2e3488f6 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
357 b42c8399 leszek
// PUBLIC API
358 2d9fc972 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
359
360 b42c8399 leszek
    public FirebaseAnalytics getAnalytics()
361 2d9fc972 Leszek Koltunski
      {
362 b42c8399 leszek
      return mFirebaseAnalytics;
363 2d9fc972 Leszek Koltunski
      }
364
365 1b3cbd5b Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
366
367 1c04d054 leszek
    public void switchToTutorial(String url, int objectOrdinal)
368 1b3cbd5b Leszek Koltunski
      {
369 1c04d054 leszek
      Intent intent = new Intent(this, TutorialActivity.class);
370
      intent.putExtra("url", url);
371
      intent.putExtra("obj", objectOrdinal);
372
      startActivity(intent);
373 1b3cbd5b Leszek Koltunski
      }
374
375 598de3ee Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
376
377 1c04d054 leszek
    public void switchToConfig(int objectOrdinal)
378 598de3ee Leszek Koltunski
      {
379 1c04d054 leszek
      Intent intent = new Intent(this, ConfigActivity.class);
380
      intent.putExtra("obj", objectOrdinal);
381
      startActivity(intent);
382 598de3ee Leszek Koltunski
      }
383
384 a6d3b158 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
385
386 1c04d054 leszek
    public void switchToBandagedCreator(int objectOrdinal)
387 aa171dee Leszek Koltunski
      {
388 1c04d054 leszek
      Intent intent = new Intent(this, BandagedCreatorActivity.class);
389
      intent.putExtra("obj", objectOrdinal);
390
      startActivity(intent);
391 8becce57 Leszek Koltunski
      }
392
393 d7f0c07d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
394
395 1c04d054 leszek
    public void switchToPurchase(int objectOrdinal)
396 d7f0c07d Leszek Koltunski
      {
397 1c04d054 leszek
      Intent intent = new Intent(this, PurchaseActivity.class);
398
      intent.putExtra("obj", objectOrdinal);
399
      startActivity(intent);
400 d7f0c07d Leszek Koltunski
      }
401
402 f8eece7d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
403
404 1c04d054 leszek
    public void setSolverIndex(int index)
405 f8eece7d Leszek Koltunski
      {
406 1c04d054 leszek
      mSolverIndex = index;
407 f8eece7d Leszek Koltunski
      }
408
409 8becce57 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
410
411 1c04d054 leszek
    public int getSolverIndex()
412 8becce57 Leszek Koltunski
      {
413 1c04d054 leszek
      return mSolverIndex;
414 8ba7aeb1 Leszek Koltunski
      }
415
416
///////////////////////////////////////////////////////////////////////////////////////////////////
417
418 1c04d054 leszek
    public void onScores(View v)
419 8ba7aeb1 Leszek Koltunski
      {
420 1c04d054 leszek
      Bundle sBundle = new Bundle();
421
      sBundle.putString("argument", "false");
422
      RubikDialogScores scores = new RubikDialogScores();
423
      scores.setArguments(sBundle);
424
      scores.show(getSupportFragmentManager(), null);
425 aa171dee Leszek Koltunski
      }
426
427
///////////////////////////////////////////////////////////////////////////////////////////////////
428
429 1c04d054 leszek
    public void onUpdates(View v)
430 769d7b9f Leszek Koltunski
      {
431 1c04d054 leszek
      RubikDialogUpdates diag = new RubikDialogUpdates();
432
      diag.show( getSupportFragmentManager(), RubikDialogUpdates.getDialogTag() );
433 b20e89d2 Leszek Koltunski
      }
434
435
///////////////////////////////////////////////////////////////////////////////////////////////////
436 7eae2d49 Leszek Koltunski
437 1c04d054 leszek
    public void onExit(View v)
438 b20e89d2 Leszek Koltunski
      {
439 1c04d054 leszek
      RubikDialogExit diag = new RubikDialogExit();
440
      diag.show(getSupportFragmentManager(), null);
441 2e8ec627 Leszek Koltunski
      }
442
443 b1e9596b Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
444
445 1c04d054 leszek
    public void onAbout(View v)
446 b6468abb Leszek Koltunski
      {
447 1c04d054 leszek
      RubikDialogAbout diag = new RubikDialogAbout();
448
      diag.show(getSupportFragmentManager(), null);
449 b6468abb Leszek Koltunski
      }
450 1237d25d Leszek Koltunski
451
///////////////////////////////////////////////////////////////////////////////////////////////////
452
453 1c04d054 leszek
    public void onBandage(View v)
454 1237d25d Leszek Koltunski
      {
455 1c04d054 leszek
      RubikDialogCreators diag = new RubikDialogCreators();
456
      diag.show(getSupportFragmentManager(), RubikDialogCreators.getDialogTag() );
457 9530f6b0 Leszek Koltunski
      }
458
459 c7238c67 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
460
461 1c04d054 leszek
    public void receiveUpdate(RubikUpdates updates)
462 c7238c67 Leszek Koltunski
      {
463 1c04d054 leszek
      int num = updates.getCompletedNumber();
464
      updateBubble(num);
465 c7238c67 Leszek Koltunski
      }
466
467 41a5dd89 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
468
469 1c04d054 leszek
    public void objectDownloaded(String shortName)
470 41a5dd89 Leszek Koltunski
      {
471 1c04d054 leszek
      mNumUpdates--;
472
      updateBubble(mNumUpdates);
473 b42c8399 leszek
      mGrid.updateGrid(this,mScreenWidth);
474 41a5dd89 Leszek Koltunski
      }
475 67d7fb28 Leszek Koltunski
476
///////////////////////////////////////////////////////////////////////////////////////////////////
477
478 1c04d054 leszek
    public int getType()
479 67d7fb28 Leszek Koltunski
      {
480 1c04d054 leszek
      return 0;
481 67d7fb28 Leszek Koltunski
      }
482
483
///////////////////////////////////////////////////////////////////////////////////////////////////
484
485 1c04d054 leszek
    public void errorUpdate()
486 67d7fb28 Leszek Koltunski
      {
487 1c04d054 leszek
      android.util.Log.e("D", "NewRubikActivity: Error receiving downloaded objects update");
488 67d7fb28 Leszek Koltunski
      }
489 0c52af30 Leszek Koltunski
}