Project

General

Profile

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

magiccube / src / main / java / org / distorted / purchase / PurchaseObjectLibInterface.java @ ce31f774

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2021 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// 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
///////////////////////////////////////////////////////////////////////////////////////////////////
9

    
10
package org.distorted.purchase;
11

    
12
import android.util.DisplayMetrics;
13

    
14
import com.google.firebase.crashlytics.FirebaseCrashlytics;
15

    
16
import org.distorted.objectlib.BuildConfig;
17
import org.distorted.objectlib.helpers.ObjectLibInterface;
18

    
19
import java.lang.ref.WeakReference;
20

    
21
///////////////////////////////////////////////////////////////////////////////////////////////////
22

    
23
public class PurchaseObjectLibInterface implements ObjectLibInterface
24
{
25
  private final WeakReference<PurchaseActivity> mAct;
26

    
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

    
29
  PurchaseObjectLibInterface(PurchaseActivity act)
30
    {
31
    mAct = new WeakReference<>(act);
32
    }
33

    
34
///////////////////////////////////////////////////////////////////////////////////////////////////
35

    
36
  public void onWinEffectFinished(long startTime, long endTime, String debug, int scrambleNum) { }
37
  public void onScrambleEffectFinished() { }
38
  public void onBeginRotation() { }
39
  public void onSolved() { }
40
  public void onObjectCreated(long time) { }
41
  public void onReplaceModeDown(int cubit, int face) { }
42
  public void onReplaceModeUp() { }
43
  public void onFinishRotation(int axis, int row, int angle) { }
44
  public void failedToDrag() { }
45
  public void reportJSONError(String error, int ordinal) { }
46
  public void reportBlockProblem(int type, int place, long pause, long resume, long time) { }
47

    
48
///////////////////////////////////////////////////////////////////////////////////////////////////
49

    
50
  public void reportProblem(String problem, boolean reportException)
51
    {
52
    if( BuildConfig.DEBUG )
53
      {
54
      android.util.Log.e("interface", problem);
55
      }
56
    else
57
      {
58
      if( reportException )
59
        {
60
        Exception ex = new Exception(problem);
61
        FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
62
        crashlytics.setCustomKey("problem" , problem);
63
        crashlytics.recordException(ex);
64
        }
65
      else
66
        {
67
        FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
68
        crashlytics.log(problem);
69
        }
70
      }
71
    }
72

    
73
///////////////////////////////////////////////////////////////////////////////////////////////////
74

    
75
  public int getScreenDensity()
76
    {
77
    DisplayMetrics dm = new DisplayMetrics();
78
    mAct.get().getWindowManager().getDefaultDisplay().getMetrics(dm);
79
    return dm.densityDpi;
80
    }
81
}
(2-2/6)