1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2023 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.os;
|
11
|
|
12
|
import android.app.Activity;
|
13
|
import android.util.DisplayMetrics;
|
14
|
import java.lang.ref.WeakReference;
|
15
|
import org.distorted.objectlib.helpers.OperatingSystemInterface;
|
16
|
|
17
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
18
|
|
19
|
public class OSInterface implements OperatingSystemInterface
|
20
|
{
|
21
|
private final WeakReference<Activity> mAct;
|
22
|
|
23
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
24
|
|
25
|
public OSInterface(Activity act)
|
26
|
{
|
27
|
mAct = new WeakReference<>(act);
|
28
|
}
|
29
|
|
30
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
31
|
|
32
|
public int getScreenDensity()
|
33
|
{
|
34
|
DisplayMetrics dm = new DisplayMetrics();
|
35
|
mAct.get().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
36
|
return dm.densityDpi;
|
37
|
}
|
38
|
}
|