Revision 1b3cbd5b
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/main/RubikActivity.java | ||
---|---|---|
25 | 25 |
import androidx.appcompat.app.AppCompatActivity; |
26 | 26 |
import android.view.View; |
27 | 27 |
|
28 |
import com.google.firebase.analytics.FirebaseAnalytics; |
|
29 |
|
|
28 | 30 |
import org.distorted.dialogs.RubikDialogAbout; |
29 | 31 |
import org.distorted.dialogs.RubikDialogScores; |
30 | 32 |
import org.distorted.dialogs.RubikDialogEffects; |
... | ... | |
43 | 45 |
public class RubikActivity extends AppCompatActivity |
44 | 46 |
{ |
45 | 47 |
private boolean mJustStarted; |
48 |
private FirebaseAnalytics mFirebaseAnalytics; |
|
46 | 49 |
|
47 | 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
48 | 51 |
|
... | ... | |
54 | 57 |
setContentView(R.layout.main); |
55 | 58 |
|
56 | 59 |
mJustStarted = true; |
60 |
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); |
|
57 | 61 |
} |
58 | 62 |
|
59 | 63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
174 | 178 |
|
175 | 179 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
176 | 180 |
// PUBLIC API |
181 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
182 |
|
|
183 |
public FirebaseAnalytics getAnalytics() |
|
184 |
{ |
|
185 |
return mFirebaseAnalytics; |
|
186 |
} |
|
187 |
|
|
177 | 188 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
178 | 189 |
|
179 | 190 |
public RubikObject getObject() |
src/main/java/org/distorted/states/RubikState.java | ||
---|---|---|
20 | 20 |
package org.distorted.states; |
21 | 21 |
|
22 | 22 |
import android.content.SharedPreferences; |
23 |
import android.os.Bundle; |
|
24 |
|
|
25 |
import com.google.firebase.analytics.FirebaseAnalytics; |
|
26 |
|
|
23 | 27 |
import org.distorted.main.RubikActivity; |
24 | 28 |
import static org.distorted.main.RubikSurfaceView.*; |
25 | 29 |
|
... | ... | |
113 | 117 |
{ |
114 | 118 |
if( next!=null ) |
115 | 119 |
{ |
120 |
FirebaseAnalytics analytics = act.getAnalytics(); |
|
121 |
|
|
122 |
if( analytics!=null ) |
|
123 |
{ |
|
124 |
Bundle bundle = new Bundle(); |
|
125 |
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, next.toString()); |
|
126 |
analytics.logEvent(FirebaseAnalytics.Event.LEVEL_START, bundle); |
|
127 |
} |
|
128 |
|
|
116 | 129 |
if( mCurrState!=null ) mCurrState.leaveState(act); |
117 | 130 |
next.enterState(act); |
118 | 131 |
mCurrState = next; |
src/main/java/org/distorted/states/RubikStatePlay.java | ||
---|---|---|
23 | 23 |
import android.content.SharedPreferences; |
24 | 24 |
import android.graphics.drawable.BitmapDrawable; |
25 | 25 |
import android.os.Build; |
26 |
import android.os.Bundle; |
|
26 | 27 |
import android.util.DisplayMetrics; |
27 | 28 |
import android.view.Gravity; |
28 | 29 |
import android.view.LayoutInflater; |
... | ... | |
35 | 36 |
import android.widget.PopupWindow; |
36 | 37 |
import androidx.appcompat.widget.AppCompatSpinner; |
37 | 38 |
|
39 |
import com.google.firebase.analytics.FirebaseAnalytics; |
|
40 |
|
|
38 | 41 |
import org.distorted.main.R; |
39 | 42 |
import org.distorted.main.RubikActivity; |
40 | 43 |
import org.distorted.objects.RubikObjectList; |
... | ... | |
280 | 283 |
{ |
281 | 284 |
if( act.getPostRender().canPlay() && RubikState.getCurrentState()==RubikState.PLAY ) |
282 | 285 |
{ |
286 |
FirebaseAnalytics analytics = act.getAnalytics(); |
|
287 |
|
|
288 |
if( analytics!=null ) |
|
289 |
{ |
|
290 |
String name = RubikObjectList.getObject(obj).name()+"_"+sizes[size]; |
|
291 |
Bundle bundle = new Bundle(); |
|
292 |
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name); |
|
293 |
analytics.logEvent(FirebaseAnalytics.Event.SELECT_ITEM, bundle); |
|
294 |
} |
|
295 |
|
|
283 | 296 |
mObject = obj; |
284 | 297 |
mSize = sizes[size]; |
285 | 298 |
act.changeObject(list,sizes[size]); |
Also available in: Unified diff
Report an Analytics event when a user changes State or Object.