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 |
0c52af30
|
Leszek Koltunski
|
import android.os.Bundle;
|
18 |
1c04d054
|
leszek
|
import android.util.TypedValue;
|
19 |
0254cfd7
|
Leszek Koltunski
|
import android.view.View;
|
20 |
1cb36646
|
Leszek Koltunski
|
import android.view.ViewGroup;
|
21 |
|
|
import android.widget.LinearLayout;
|
22 |
1c04d054
|
leszek
|
import android.widget.ScrollView;
|
23 |
|
|
import android.widget.TextView;
|
24 |
0c52af30
|
Leszek Koltunski
|
|
25 |
b42c8399
|
leszek
|
import androidx.annotation.NonNull;
|
26 |
e019c70b
|
Leszek Koltunski
|
|
27 |
1b3cbd5b
|
Leszek Koltunski
|
import com.google.firebase.analytics.FirebaseAnalytics;
|
28 |
a59f38d6
|
Leszek Koltunski
|
import com.google.firebase.inappmessaging.FirebaseInAppMessaging;
|
29 |
1b3cbd5b
|
Leszek Koltunski
|
|
30 |
7ee8337b
|
leszek
|
import org.distorted.bandaged.BandagedActivity;
|
31 |
58fd2ec0
|
leszek
|
import org.distorted.config.ConfigActivity;
|
32 |
a5972f92
|
leszek
|
import org.distorted.helpers.BaseActivity;
|
33 |
5b22f901
|
leszek
|
import org.distorted.info.InfoActivity;
|
34 |
8477cf44
|
leszek
|
import org.distorted.dialogs.DialogAbout;
|
35 |
|
|
import org.distorted.dialogs.DialogCreators;
|
36 |
|
|
import org.distorted.dialogs.DialogExit;
|
37 |
|
|
import org.distorted.dialogs.DialogScores;
|
38 |
|
|
import org.distorted.dialogs.DialogUpdates;
|
39 |
7ff3cacb
|
leszek
|
import org.distorted.helpers.RubikNetwork;
|
40 |
|
|
import org.distorted.helpers.RubikScores;
|
41 |
|
|
import org.distorted.helpers.RubikUpdates;
|
42 |
1c04d054
|
leszek
|
import org.distorted.messaging.RubikInAppMessanging;
|
43 |
7ee8337b
|
leszek
|
import org.distorted.objects.RubikObject;
|
44 |
d433b50e
|
Leszek Koltunski
|
import org.distorted.objects.RubikObjectList;
|
45 |
7e9d918b
|
leszek
|
import org.distorted.patterns.PatternActivity;
|
46 |
|
|
import org.distorted.play.PlayActivity;
|
47 |
|
|
import org.distorted.solvers.SolverActivity;
|
48 |
eaf87d1d
|
Leszek Koltunski
|
import org.distorted.tutorials.TutorialActivity;
|
49 |
211b48f2
|
Leszek Koltunski
|
|
50 |
0c52af30
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
51 |
|
|
|
52 |
8477cf44
|
leszek
|
public class MainActivity extends BaseActivity implements RubikNetwork.Updatee, DialogScores.ScoresInvoker
|
53 |
0c52af30
|
Leszek Koltunski
|
{
|
54 |
c3ffcf58
|
Leszek Koltunski
|
private boolean mJustStarted;
|
55 |
1b3cbd5b
|
Leszek Koltunski
|
private FirebaseAnalytics mFirebaseAnalytics;
|
56 |
d05e7629
|
Leszek Koltunski
|
private String mOldVersion, mCurrVersion;
|
57 |
1c04d054
|
leszek
|
private TextView mBubbleUpdates;
|
58 |
|
|
private int mNumUpdates;
|
59 |
c02235d5
|
leszek
|
private int mCurrentObject;
|
60 |
1c04d054
|
leszek
|
private MainScrollGrid mGrid;
|
61 |
def32b2c
|
leszek
|
private int mSortMode;
|
62 |
c3ffcf58
|
Leszek Koltunski
|
|
63 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
64 |
|
|
|
65 |
0c52af30
|
Leszek Koltunski
|
@Override
|
66 |
34747dd1
|
Leszek Koltunski
|
protected void onCreate(Bundle savedState)
|
67 |
0c52af30
|
Leszek Koltunski
|
{
|
68 |
e8f3534d
|
leszek
|
super.onCreate(savedState);
|
69 |
cb30e768
|
leszek
|
setContentView(R.layout.main);
|
70 |
c3ffcf58
|
Leszek Koltunski
|
|
71 |
c02235d5
|
leszek
|
mCurrentObject = 0;
|
72 |
c3ffcf58
|
Leszek Koltunski
|
mJustStarted = true;
|
73 |
1b3cbd5b
|
Leszek Koltunski
|
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
|
74 |
e3c74c0f
|
Leszek Koltunski
|
|
75 |
a5972f92
|
leszek
|
hideNavigationBar();
|
76 |
e8f6670f
|
Leszek Koltunski
|
cutoutHack();
|
77 |
1c04d054
|
leszek
|
computeHeights();
|
78 |
a59f38d6
|
Leszek Koltunski
|
|
79 |
9881dc03
|
leszek
|
getWindowWidth(getResources().getConfiguration());
|
80 |
|
|
|
81 |
e9e744f7
|
Leszek Koltunski
|
mCurrVersion = getAppVers();
|
82 |
|
|
|
83 |
c02235d5
|
leszek
|
mBubbleUpdates = findViewById(R.id.bubbleUpdates);
|
84 |
|
|
mBubbleUpdates.setVisibility(View.INVISIBLE);
|
85 |
|
|
mNumUpdates = 0;
|
86 |
|
|
|
87 |
83018ac4
|
Leszek Koltunski
|
Thread thread = new Thread()
|
88 |
|
|
{
|
89 |
|
|
public void run()
|
90 |
|
|
{
|
91 |
|
|
RubikInAppMessanging listener = new RubikInAppMessanging();
|
92 |
|
|
FirebaseInAppMessaging.getInstance().addClickListener(listener);
|
93 |
|
|
}
|
94 |
|
|
};
|
95 |
|
|
|
96 |
|
|
thread.start();
|
97 |
0254cfd7
|
Leszek Koltunski
|
}
|
98 |
|
|
|
99 |
598de3ee
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
100 |
|
|
// this does not include possible insets
|
101 |
|
|
|
102 |
1c04d054
|
leszek
|
private void computeHeights()
|
103 |
598de3ee
|
Leszek Koltunski
|
{
|
104 |
b42c8399
|
leszek
|
LinearLayout.LayoutParams pU = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, RATIO_BAR);
|
105 |
214e301a
|
Leszek Koltunski
|
LinearLayout layoutTop = findViewById(R.id.upperBar);
|
106 |
b42c8399
|
leszek
|
layoutTop.setLayoutParams(pU);
|
107 |
1c04d054
|
leszek
|
|
108 |
b42c8399
|
leszek
|
LinearLayout.LayoutParams pS = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1-2*RATIO_BAR);
|
109 |
1c04d054
|
leszek
|
ScrollView scroll = findViewById(R.id.objectScroll);
|
110 |
b42c8399
|
leszek
|
scroll.setLayoutParams(pS);
|
111 |
|
|
|
112 |
|
|
LinearLayout.LayoutParams pL = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, RATIO_BAR);
|
113 |
|
|
LinearLayout layoutBot = findViewById(R.id.lowerBar);
|
114 |
|
|
layoutBot.setLayoutParams(pL);
|
115 |
598de3ee
|
Leszek Koltunski
|
}
|
116 |
|
|
|
117 |
b42c8399
|
leszek
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
118 |
|
|
|
119 |
|
|
@Override
|
120 |
|
|
public void onConfigurationChanged(@NonNull Configuration conf)
|
121 |
|
|
{
|
122 |
|
|
super.onConfigurationChanged(conf);
|
123 |
|
|
getWindowWidth(conf);
|
124 |
8c4e4bf4
|
leszek
|
if( mGrid!=null ) mGrid.updateGrid(this,mScreenWidth,mDarkC,mPassedC);
|
125 |
b42c8399
|
leszek
|
}
|
126 |
|
|
|
127 |
0c52af30
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
128 |
|
|
|
129 |
|
|
@Override
|
130 |
|
|
protected void onPause()
|
131 |
|
|
{
|
132 |
82f42eeb
|
Leszek Koltunski
|
super.onPause();
|
133 |
6a083c6a
|
Leszek Koltunski
|
RubikNetwork.onPause();
|
134 |
33499c56
|
Leszek Koltunski
|
savePreferences();
|
135 |
0c52af30
|
Leszek Koltunski
|
}
|
136 |
|
|
|
137 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
138 |
|
|
|
139 |
|
|
@Override
|
140 |
|
|
protected void onResume()
|
141 |
|
|
{
|
142 |
|
|
super.onResume();
|
143 |
51853bf2
|
Leszek Koltunski
|
|
144 |
9881dc03
|
leszek
|
restorePreferences(mJustStarted);
|
145 |
1c04d054
|
leszek
|
|
146 |
9b6f8f18
|
leszek
|
mGrid = new MainScrollGrid();
|
147 |
8c4e4bf4
|
leszek
|
mGrid.createGrid(this,mScreenWidth,mSortMode,mDarkC,mPassedC);
|
148 |
9b6f8f18
|
leszek
|
|
149 |
c02235d5
|
leszek
|
RubikNetwork network = RubikNetwork.getInstance();
|
150 |
|
|
network.signUpForUpdates(this);
|
151 |
1c04d054
|
leszek
|
|
152 |
c3ffcf58
|
Leszek Koltunski
|
if( mJustStarted )
|
153 |
|
|
{
|
154 |
|
|
mJustStarted = false;
|
155 |
72d3d383
|
leszek
|
|
156 |
|
|
network.downloadUpdates(this);
|
157 |
82ce8e64
|
Leszek Koltunski
|
RubikScores scores = RubikScores.getInstance();
|
158 |
|
|
scores.incrementNumRuns();
|
159 |
|
|
scores.setCountry(this);
|
160 |
c3ffcf58
|
Leszek Koltunski
|
}
|
161 |
|
|
|
162 |
ada8ab26
|
leszek
|
if( !mOldVersion.equals(mCurrVersion) ) displayNovelties();
|
163 |
0c52af30
|
Leszek Koltunski
|
}
|
164 |
d05e7629
|
Leszek Koltunski
|
|
165 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
166 |
|
|
|
167 |
1c89e2a7
|
Leszek Koltunski
|
private void displayNovelties()
|
168 |
d05e7629
|
Leszek Koltunski
|
{
|
169 |
1c89e2a7
|
Leszek Koltunski
|
Bundle bundle = new Bundle();
|
170 |
34d6b123
|
Leszek Koltunski
|
bundle.putString("argument",mOldVersion);
|
171 |
8477cf44
|
leszek
|
DialogAbout newDialog = new DialogAbout();
|
172 |
1c89e2a7
|
Leszek Koltunski
|
newDialog.setArguments(bundle);
|
173 |
8477cf44
|
leszek
|
newDialog.show(getSupportFragmentManager(), DialogAbout.getDialogTag());
|
174 |
d05e7629
|
Leszek Koltunski
|
}
|
175 |
|
|
|
176 |
0c52af30
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
177 |
|
|
|
178 |
|
|
@Override
|
179 |
|
|
protected void onDestroy()
|
180 |
|
|
{
|
181 |
|
|
super.onDestroy();
|
182 |
|
|
}
|
183 |
|
|
|
184 |
4c9947bd
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
185 |
|
|
|
186 |
b20e89d2
|
Leszek Koltunski
|
private String getAppVers()
|
187 |
4c9947bd
|
Leszek Koltunski
|
{
|
188 |
b20e89d2
|
Leszek Koltunski
|
try
|
189 |
|
|
{
|
190 |
|
|
PackageInfo pInfo = getPackageManager().getPackageInfo( getPackageName(), 0);
|
191 |
|
|
return pInfo.versionName;
|
192 |
|
|
}
|
193 |
1c04d054
|
leszek
|
catch( PackageManager.NameNotFoundException e )
|
194 |
b20e89d2
|
Leszek Koltunski
|
{
|
195 |
|
|
return "unknown";
|
196 |
|
|
}
|
197 |
4c9947bd
|
Leszek Koltunski
|
}
|
198 |
|
|
|
199 |
33499c56
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
200 |
|
|
|
201 |
|
|
private void savePreferences()
|
202 |
|
|
{
|
203 |
9881dc03
|
leszek
|
SharedPreferences.Editor editor = mPreferences.edit();
|
204 |
33499c56
|
Leszek Koltunski
|
|
205 |
e9e744f7
|
Leszek Koltunski
|
editor.putString("appVersion", mCurrVersion );
|
206 |
def32b2c
|
leszek
|
editor.putInt("sortMode", mSortMode);
|
207 |
b1e9596b
|
Leszek Koltunski
|
|
208 |
400ff34d
|
Leszek Koltunski
|
RubikObjectList.savePreferences(editor);
|
209 |
2e3488f6
|
Leszek Koltunski
|
|
210 |
7480fbab
|
Leszek Koltunski
|
boolean success = editor.commit();
|
211 |
|
|
if( !success ) android.util.Log.e("D", "Failed to save preferences");
|
212 |
33499c56
|
Leszek Koltunski
|
}
|
213 |
|
|
|
214 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
215 |
|
|
|
216 |
9881dc03
|
leszek
|
private void restorePreferences(boolean justStarted)
|
217 |
33499c56
|
Leszek Koltunski
|
{
|
218 |
9881dc03
|
leszek
|
mOldVersion = mPreferences.getString("appVersion","");
|
219 |
|
|
mSortMode = mPreferences.getInt("sortMode", MainSettingsPopup.SORT_DEFAULT);
|
220 |
872307fe
|
Leszek Koltunski
|
|
221 |
9881dc03
|
leszek
|
RubikObjectList.restorePreferences(this,mPreferences,justStarted);
|
222 |
e9e744f7
|
Leszek Koltunski
|
RubikScores scores = RubikScores.getInstance();
|
223 |
9881dc03
|
leszek
|
scores.restorePreferences(mPreferences);
|
224 |
e9e744f7
|
Leszek Koltunski
|
|
225 |
|
|
if( scores.isVerified() )
|
226 |
|
|
{
|
227 |
|
|
FirebaseAnalytics analytics = getAnalytics();
|
228 |
|
|
analytics.setUserId(scores.getName());
|
229 |
|
|
}
|
230 |
|
|
}
|
231 |
ee4e7896
|
Leszek Koltunski
|
|
232 |
e9e744f7
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
233 |
ee4e7896
|
Leszek Koltunski
|
|
234 |
b42c8399
|
leszek
|
private void updateBubble(int num)
|
235 |
e9e744f7
|
Leszek Koltunski
|
{
|
236 |
b42c8399
|
leszek
|
runOnUiThread(new Runnable()
|
237 |
|
|
{
|
238 |
|
|
@Override
|
239 |
|
|
public void run()
|
240 |
|
|
{
|
241 |
|
|
mNumUpdates = num;
|
242 |
00fcfefa
|
Leszek Koltunski
|
|
243 |
b42c8399
|
leszek
|
if( num>0 )
|
244 |
|
|
{
|
245 |
|
|
String shownNum = String.valueOf(num);
|
246 |
|
|
mBubbleUpdates.setText(shownNum);
|
247 |
|
|
mBubbleUpdates.setVisibility(View.VISIBLE);
|
248 |
|
|
int height = (int)(0.05f*mScreenWidth);
|
249 |
|
|
mBubbleUpdates.setTextSize(TypedValue.COMPLEX_UNIT_PX,height);
|
250 |
|
|
}
|
251 |
|
|
else
|
252 |
|
|
{
|
253 |
|
|
mBubbleUpdates.setVisibility(View.INVISIBLE);
|
254 |
|
|
}
|
255 |
|
|
}
|
256 |
|
|
});
|
257 |
f3e12931
|
Leszek Koltunski
|
}
|
258 |
|
|
|
259 |
2e3488f6
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
260 |
b42c8399
|
leszek
|
// PUBLIC API
|
261 |
2d9fc972
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
262 |
|
|
|
263 |
b42c8399
|
leszek
|
public FirebaseAnalytics getAnalytics()
|
264 |
2d9fc972
|
Leszek Koltunski
|
{
|
265 |
b42c8399
|
leszek
|
return mFirebaseAnalytics;
|
266 |
2d9fc972
|
Leszek Koltunski
|
}
|
267 |
|
|
|
268 |
c02235d5
|
leszek
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
269 |
|
|
|
270 |
|
|
public int getObjectOrdinal()
|
271 |
|
|
{
|
272 |
|
|
return mCurrentObject;
|
273 |
|
|
}
|
274 |
|
|
|
275 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
276 |
|
|
|
277 |
|
|
public void setCurrentObject(int current)
|
278 |
|
|
{
|
279 |
|
|
mCurrentObject = current;
|
280 |
|
|
}
|
281 |
|
|
|
282 |
1b3cbd5b
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
283 |
|
|
|
284 |
b710a574
|
leszek
|
public void switchToTutorial(int objectOrdinal)
|
285 |
1b3cbd5b
|
Leszek Koltunski
|
{
|
286 |
1c04d054
|
leszek
|
Intent intent = new Intent(this, TutorialActivity.class);
|
287 |
|
|
intent.putExtra("obj", objectOrdinal);
|
288 |
|
|
startActivity(intent);
|
289 |
1b3cbd5b
|
Leszek Koltunski
|
}
|
290 |
|
|
|
291 |
598de3ee
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
292 |
|
|
|
293 |
5b22f901
|
leszek
|
public void switchToInfo(int objectOrdinal)
|
294 |
598de3ee
|
Leszek Koltunski
|
{
|
295 |
5b22f901
|
leszek
|
Intent intent = new Intent(this, InfoActivity.class);
|
296 |
1c04d054
|
leszek
|
intent.putExtra("obj", objectOrdinal);
|
297 |
|
|
startActivity(intent);
|
298 |
598de3ee
|
Leszek Koltunski
|
}
|
299 |
|
|
|
300 |
58fd2ec0
|
leszek
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
301 |
|
|
|
302 |
|
|
public void switchToConfig(int objectOrdinal)
|
303 |
|
|
{
|
304 |
|
|
Intent intent = new Intent(this, ConfigActivity.class);
|
305 |
|
|
intent.putExtra("obj", objectOrdinal);
|
306 |
|
|
startActivity(intent);
|
307 |
|
|
}
|
308 |
|
|
|
309 |
a6d3b158
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
310 |
|
|
|
311 |
1c04d054
|
leszek
|
public void switchToBandagedCreator(int objectOrdinal)
|
312 |
aa171dee
|
Leszek Koltunski
|
{
|
313 |
7ee8337b
|
leszek
|
Intent intent = new Intent(this, BandagedActivity.class);
|
314 |
1c04d054
|
leszek
|
intent.putExtra("obj", objectOrdinal);
|
315 |
|
|
startActivity(intent);
|
316 |
8becce57
|
Leszek Koltunski
|
}
|
317 |
|
|
|
318 |
d7f0c07d
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
319 |
|
|
|
320 |
cb30e768
|
leszek
|
public void switchToSolver(int objectOrdinal)
|
321 |
d7f0c07d
|
Leszek Koltunski
|
{
|
322 |
cb30e768
|
leszek
|
Intent intent = new Intent(this, SolverActivity.class);
|
323 |
1c04d054
|
leszek
|
intent.putExtra("obj", objectOrdinal);
|
324 |
|
|
startActivity(intent);
|
325 |
d7f0c07d
|
Leszek Koltunski
|
}
|
326 |
|
|
|
327 |
e9245b7b
|
leszek
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
328 |
|
|
|
329 |
|
|
public void switchToPattern(int objectOrdinal)
|
330 |
|
|
{
|
331 |
|
|
Intent intent = new Intent(this, PatternActivity.class);
|
332 |
|
|
intent.putExtra("obj", objectOrdinal);
|
333 |
|
|
startActivity(intent);
|
334 |
|
|
}
|
335 |
|
|
|
336 |
7ee8337b
|
leszek
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
337 |
|
|
|
338 |
1a206525
|
leszek
|
public void switchToPlay(RubikObject object, int ordinal, int scrambles, int level)
|
339 |
7ee8337b
|
leszek
|
{
|
340 |
5a2a7682
|
leszek
|
boolean local = object.isLocal();
|
341 |
|
|
String name = local ? object.getLowerName() : object.getUpperName();
|
342 |
|
|
|
343 |
7ee8337b
|
leszek
|
Intent intent = new Intent(this, PlayActivity.class);
|
344 |
7bb30586
|
leszek
|
intent.putExtra("level", level);
|
345 |
5a2a7682
|
leszek
|
intent.putExtra("name", name );
|
346 |
7ee8337b
|
leszek
|
intent.putExtra("scrambles", scrambles);
|
347 |
5a2a7682
|
leszek
|
intent.putExtra("local", local );
|
348 |
1a206525
|
leszek
|
intent.putExtra("ordinal", ordinal );
|
349 |
7ee8337b
|
leszek
|
startActivity(intent);
|
350 |
|
|
}
|
351 |
|
|
|
352 |
8ba7aeb1
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
353 |
|
|
|
354 |
1c04d054
|
leszek
|
public void onScores(View v)
|
355 |
8ba7aeb1
|
Leszek Koltunski
|
{
|
356 |
1c04d054
|
leszek
|
Bundle sBundle = new Bundle();
|
357 |
|
|
sBundle.putString("argument", "false");
|
358 |
8477cf44
|
leszek
|
DialogScores scores = new DialogScores();
|
359 |
1c04d054
|
leszek
|
scores.setArguments(sBundle);
|
360 |
|
|
scores.show(getSupportFragmentManager(), null);
|
361 |
aa171dee
|
Leszek Koltunski
|
}
|
362 |
|
|
|
363 |
12a991f2
|
leszek
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
364 |
|
|
|
365 |
|
|
public void onSettings(View v)
|
366 |
|
|
{
|
367 |
840ad93e
|
leszek
|
int sw = (int)(345*mDensity + 0.5f);
|
368 |
236cc1c1
|
leszek
|
int sh = (int)(188*mDensity + 0.5f);
|
369 |
12a991f2
|
leszek
|
|
370 |
c820515c
|
leszek
|
int vw = v.getWidth();
|
371 |
|
|
|
372 |
9b6f8f18
|
leszek
|
MainSettingsPopup popup = new MainSettingsPopup(this,mSortMode,mCurrentTheme,sw,sh);
|
373 |
2eb70e4a
|
leszek
|
popup.displayPopup(this,v,((vw-sw)/2),0);
|
374 |
12a991f2
|
leszek
|
}
|
375 |
|
|
|
376 |
aa171dee
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
377 |
|
|
|
378 |
1c04d054
|
leszek
|
public void onUpdates(View v)
|
379 |
769d7b9f
|
Leszek Koltunski
|
{
|
380 |
8477cf44
|
leszek
|
DialogUpdates diag = new DialogUpdates();
|
381 |
|
|
diag.show( getSupportFragmentManager(), DialogUpdates.getDialogTag());
|
382 |
b20e89d2
|
Leszek Koltunski
|
}
|
383 |
|
|
|
384 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
385 |
7eae2d49
|
Leszek Koltunski
|
|
386 |
1c04d054
|
leszek
|
public void onExit(View v)
|
387 |
b20e89d2
|
Leszek Koltunski
|
{
|
388 |
8477cf44
|
leszek
|
DialogExit diag = new DialogExit();
|
389 |
1c04d054
|
leszek
|
diag.show(getSupportFragmentManager(), null);
|
390 |
2e8ec627
|
Leszek Koltunski
|
}
|
391 |
|
|
|
392 |
b1e9596b
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
393 |
|
|
|
394 |
1c04d054
|
leszek
|
public void onAbout(View v)
|
395 |
b6468abb
|
Leszek Koltunski
|
{
|
396 |
8477cf44
|
leszek
|
DialogAbout diag = new DialogAbout();
|
397 |
1c04d054
|
leszek
|
diag.show(getSupportFragmentManager(), null);
|
398 |
b6468abb
|
Leszek Koltunski
|
}
|
399 |
1237d25d
|
Leszek Koltunski
|
|
400 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
401 |
|
|
|
402 |
1c04d054
|
leszek
|
public void onBandage(View v)
|
403 |
1237d25d
|
Leszek Koltunski
|
{
|
404 |
8477cf44
|
leszek
|
DialogCreators diag = new DialogCreators();
|
405 |
|
|
diag.show(getSupportFragmentManager(), DialogCreators.getDialogTag());
|
406 |
9530f6b0
|
Leszek Koltunski
|
}
|
407 |
|
|
|
408 |
c7238c67
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
409 |
|
|
|
410 |
1c04d054
|
leszek
|
public void receiveUpdate(RubikUpdates updates)
|
411 |
c7238c67
|
Leszek Koltunski
|
{
|
412 |
1c04d054
|
leszek
|
int num = updates.getCompletedNumber();
|
413 |
|
|
updateBubble(num);
|
414 |
c7238c67
|
Leszek Koltunski
|
}
|
415 |
|
|
|
416 |
41a5dd89
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
417 |
|
|
|
418 |
1c04d054
|
leszek
|
public void objectDownloaded(String shortName)
|
419 |
41a5dd89
|
Leszek Koltunski
|
{
|
420 |
1c04d054
|
leszek
|
mNumUpdates--;
|
421 |
|
|
updateBubble(mNumUpdates);
|
422 |
8c4e4bf4
|
leszek
|
mGrid.updateGrid(this,mScreenWidth,mDarkC,mPassedC);
|
423 |
41a5dd89
|
Leszek Koltunski
|
}
|
424 |
67d7fb28
|
Leszek Koltunski
|
|
425 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
426 |
|
|
|
427 |
1c04d054
|
leszek
|
public int getType()
|
428 |
67d7fb28
|
Leszek Koltunski
|
{
|
429 |
1c04d054
|
leszek
|
return 0;
|
430 |
67d7fb28
|
Leszek Koltunski
|
}
|
431 |
|
|
|
432 |
def32b2c
|
leszek
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
433 |
|
|
|
434 |
|
|
public void sortObjectsBy(int sortMode)
|
435 |
|
|
{
|
436 |
|
|
mSortMode = sortMode;
|
437 |
8c4e4bf4
|
leszek
|
mGrid.createGrid(this,mScreenWidth,mSortMode,mDarkC,mPassedC);
|
438 |
def32b2c
|
leszek
|
}
|
439 |
|
|
|
440 |
67d7fb28
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
441 |
|
|
|
442 |
1c04d054
|
leszek
|
public void errorUpdate()
|
443 |
67d7fb28
|
Leszek Koltunski
|
{
|
444 |
1c04d054
|
leszek
|
android.util.Log.e("D", "NewRubikActivity: Error receiving downloaded objects update");
|
445 |
67d7fb28
|
Leszek Koltunski
|
}
|
446 |
0c52af30
|
Leszek Koltunski
|
}
|