aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/compatibility/AndroidLevel13Emulation.java
blob: 8e2e7eca5e402504729151a4ce488a7e1653f1e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package cgeo.geocaching.compatibility;

import cgeo.geocaching.CgeoApplication;

import android.content.Context;
import android.graphics.Point;
import android.view.Display;
import android.view.WindowManager;

@SuppressWarnings("deprecation")
class AndroidLevel13Emulation implements AndroidLevel13Interface {

    @Override
    public int getDisplayWidth() {
        return getDisplay().getWidth();
    }

    @Override
    public Point getDisplaySize() {
        final Display display = getDisplay();
        return new Point(display.getWidth(), display.getHeight());
    }

    private static Display getDisplay() {
        return ((WindowManager) CgeoApplication.getInstance().getSystemService(Context.WINDOW_SERVICE))
                .getDefaultDisplay();
    }
}