Project

General

Profile

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

magiccube / src / main / java / org / distorted / main / MainActivity.java @ 12a991f2

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