diff options
Diffstat (limited to 'app/src/main/java/org/pacien/tincapp/context/AppInfo.java')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/context/AppInfo.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/context/AppInfo.java b/app/src/main/java/org/pacien/tincapp/context/AppInfo.java new file mode 100644 index 0000000..075402d --- /dev/null +++ b/app/src/main/java/org/pacien/tincapp/context/AppInfo.java | |||
@@ -0,0 +1,42 @@ | |||
1 | package org.pacien.tincapp.context; | ||
2 | |||
3 | import android.content.res.Resources; | ||
4 | import android.os.Build; | ||
5 | |||
6 | import com.annimon.stream.Stream; | ||
7 | |||
8 | import org.pacien.tincapp.BuildConfig; | ||
9 | import org.pacien.tincapp.R; | ||
10 | |||
11 | /** | ||
12 | * @author pacien | ||
13 | */ | ||
14 | final public class AppInfo { | ||
15 | |||
16 | private AppInfo() { | ||
17 | // static class | ||
18 | } | ||
19 | |||
20 | static public String appVersion(Resources r) { | ||
21 | return r.getString(R.string.info_version_format, | ||
22 | BuildConfig.VERSION_NAME, | ||
23 | BuildConfig.BUILD_TYPE); | ||
24 | } | ||
25 | |||
26 | static public String androidVersion(Resources r) { | ||
27 | return r.getString(R.string.info_running_on_format, | ||
28 | Build.VERSION.CODENAME, | ||
29 | Build.VERSION.RELEASE); | ||
30 | } | ||
31 | |||
32 | static public String supportedABIs(Resources r) { | ||
33 | return r.getString(R.string.info_supported_abis_format, | ||
34 | Stream.of(Build.SUPPORTED_ABIS).reduce((x, y) -> x + "," + y).get()); | ||
35 | } | ||
36 | |||
37 | static public String all(Resources r) { | ||
38 | return Stream.of(appVersion(r), androidVersion(r), supportedABIs(r)) | ||
39 | .reduce((x, y) -> x + '\n' + y).get(); | ||
40 | } | ||
41 | |||
42 | } | ||