├── .github
├── ci-gradle.properties
└── workflows
│ └── android.yml
├── .gitignore
├── LICENSE
├── Nexus6_framed.png
├── README.md
├── app
├── .gitignore
├── build.gradle.kts
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── uk
│ │ └── co
│ │ └── ianfield
│ │ └── devstat
│ │ └── MainActivityTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── about.html
│ ├── feature_web.png
│ ├── ic_launcher-web.png
│ ├── java
│ │ └── uk
│ │ │ └── co
│ │ │ └── ianfield
│ │ │ └── devstat
│ │ │ ├── AboutActivity.kt
│ │ │ ├── ClipboardActivity.kt
│ │ │ ├── DevStatApplication.kt
│ │ │ ├── MainActivity.kt
│ │ │ ├── StatHelper.kt
│ │ │ ├── StatItemAdapter.kt
│ │ │ ├── di
│ │ │ └── modules
│ │ │ │ └── AppModule.kt
│ │ │ ├── model
│ │ │ └── StatItem.kt
│ │ │ └── widget
│ │ │ ├── InformationPageFragment.kt
│ │ │ └── InformationPagerAdapter.kt
│ └── res
│ │ ├── drawable-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_share_white_24dp.png
│ │ ├── drawable-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_share_white_24dp.png
│ │ ├── drawable-xhdpi-v25
│ │ └── ic_launcher.png
│ │ ├── drawable-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_share_white_24dp.png
│ │ ├── drawable-xxhdpi-v25
│ │ └── ic_launcher.png
│ │ ├── drawable-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_share_white_24dp.png
│ │ ├── drawable-xxxhdpi-v25
│ │ └── ic_launcher.png
│ │ ├── drawable-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_share_white_24dp.png
│ │ ├── drawable
│ │ └── ic_shortcut_copy.xml
│ │ ├── layout
│ │ ├── activity_about.xml
│ │ ├── activity_main.xml
│ │ ├── fragment_information_page.xml
│ │ └── stat_item.xml
│ │ ├── menu
│ │ └── main.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ ├── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ │ └── xml
│ │ └── shortcuts.xml
│ └── test
│ ├── java
│ └── uk
│ │ └── co
│ │ └── ianfield
│ │ └── devstat
│ │ └── model
│ │ └── StatItemTest.kt
│ └── resources
│ └── mockito-extensions
│ └── org.mockito.plugins.MockMaker
├── build.gradle.kts
├── gradle.properties
├── gradle
├── libs.versions.toml
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle.kts
/.github/ci-gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.daemon=false
2 | org.gradle.parallel=true
3 | org.gradle.jvmargs=-Xmx5120m
4 | #org.gradle.workers.max=2
5 |
6 | kotlin.compiler.execution.strategy=in-process
--------------------------------------------------------------------------------
/.github/workflows/android.yml:
--------------------------------------------------------------------------------
1 | name: Android CI
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - master
7 | - develop
8 | push:
9 | branches:
10 | - master
11 |
12 | jobs:
13 | build:
14 | runs-on: ubuntu-latest
15 | steps:
16 | - uses: actions/checkout@v2
17 | - name: set up JDK 17
18 | uses: actions/setup-java@v2
19 | with:
20 | java-version: '17'
21 | distribution: 'zulu'
22 | - uses: actions/cache@v2
23 | with:
24 | path: |
25 | ~/.gradle/caches/modules-*
26 | ~/.gradle/caches/jars-*
27 | ~/.gradle/caches/build-cache-*
28 | key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', 'gradle/libs.versions.toml') }}
29 | restore-keys: |
30 | ${{ runner.os }}-gradle-
31 | - name: Copy CI gradle.properties
32 | run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
33 | - name: Clean
34 | run: ./gradlew clean assembleDebug test
35 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # built application files
2 | *.apk
3 | *.ap_
4 |
5 | # files for the dex VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # generated files
12 | bin/
13 | gen/
14 |
15 | # Local configuration file (sdk path, etc)
16 | local.properties
17 |
18 | # Eclipse project files
19 | .classpath
20 | .project
21 |
22 | # Proguard folder generated by Eclipse
23 | proguard/
24 |
25 | # Intellij project files
26 | *.iml
27 | *.ipr
28 | *.iws
29 | .idea/
30 |
31 | # Android Studio (SDK)
32 | local.properties
33 | /*/local.properties
34 | /*/out
35 | /*/*/build
36 | /*/*/production
37 | .gradle
38 | *.swp
39 | /build
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/Nexus6_framed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/Nexus6_framed.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | DevStat
4 | =======
5 | 
6 |
7 | Android application to quickly query device data. This can also be used to help debug the cause of an app not showing in the Google Play store due to your AndroidManifest.xml settings e.g. Camera auto-focus.
8 |
9 | 
10 |
11 | I'm no longer listing this in Google Play Store.
12 |
13 | ## Information
14 |
15 | ### Screen Metrics
16 |
17 | Width
18 | Height
19 | Display density
20 | Drawable density
21 | Screen size
22 |
23 | ### Software
24 |
25 | Android version
26 | SDK Int
27 | OpenGL ES version
28 |
29 | ### Hardware
30 |
31 | Manufacturer
32 | Device
33 | Model
34 | Brand
35 | Board
36 | Host
37 | Product
38 | Memory class
39 | Large memory class
40 | Maximum memory
41 | Free space
42 | Vibrator presence
43 | Telephony
44 | Autofocus availability
45 | ABIs
46 | Online Processors
47 |
48 | ### Features
49 |
50 | All features available to the device
51 |
52 | ### Crypto
53 | Providers and their set of supported algorithms
54 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /release
3 |
--------------------------------------------------------------------------------
/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | @file:Suppress("UnstableApiUsage")
2 |
3 | plugins {
4 | id("com.android.application")
5 | id("kotlin-android")
6 | id("kotlin-kapt")
7 | id("dagger.hilt.android.plugin")
8 | // id("org.jetbrains.kotlin.android") version "2.1.10" apply false
9 | }
10 |
11 |
12 | android {
13 | compileSdk = 35
14 | buildToolsVersion = "35.0.0"
15 |
16 | namespace = "uk.co.ianfield.devstat"
17 |
18 | compileOptions {
19 | sourceCompatibility = JavaVersion.VERSION_1_8
20 | targetCompatibility = JavaVersion.VERSION_1_8
21 | }
22 |
23 | defaultConfig {
24 | minSdk = 21
25 | targetSdk = 35
26 | applicationId = "uk.co.ianfield.devstat"
27 | versionCode = 26
28 | versionName = "2.4.8"
29 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
30 | testInstrumentationRunnerArguments.putAll(
31 | mapOf(
32 | "clearPackageData" to "true"
33 | )
34 | )
35 |
36 | }
37 | signingConfigs {
38 | create("release") {
39 | storeFile = file(extra["uk.co.ianfield.devstat.keystore.location"].toString())
40 | storePassword = extra["uk.co.ianfield.devstat.keystore.storepass"].toString()
41 | keyPassword = extra["uk.co.ianfield.devstat.keystore.keypass"].toString()
42 | keyAlias = extra["uk.co.ianfield.devstat.keystore.alias"].toString()
43 | }
44 | }
45 | buildFeatures {
46 | viewBinding = true
47 | buildConfig = true
48 | }
49 | buildTypes {
50 | release {
51 | isMinifyEnabled = true
52 | isShrinkResources = true
53 | proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
54 | signingConfig = signingConfigs.getByName("release")
55 | }
56 | }
57 |
58 | // packagingOptions {
59 | // excludes.addAll(mutableSetOf("META-INF/services/javax.annotation.processing.Processor"))
60 | // }
61 |
62 | kotlinOptions {
63 | jvmTarget = "1.8"
64 | }
65 |
66 | testOptions {
67 | execution = "ANDROIDX_TEST_ORCHESTRATOR"
68 | unitTests {
69 | isIncludeAndroidResources = true
70 | }
71 | }
72 |
73 | // sourceSets {
74 | // getByName("androidTest").resources.srcDirs("src/androidTest/res", "src/test/resources")
75 | // }
76 |
77 | }
78 |
79 | dependencies {
80 | implementation(libs.kotlin.stdlib.jdk8)
81 |
82 | implementation(libs.androidx.core.ktx)
83 | implementation(libs.androidx.appcompat)
84 | implementation(libs.androidx.recyclerview)
85 | implementation(libs.material)
86 |
87 | implementation(libs.androidx.core.ktx)
88 |
89 | implementation(libs.hilt.android)
90 | kapt(libs.hilt.android.compiler)
91 | androidTestImplementation(libs.hilt.android.testing)
92 | kaptAndroidTest(libs.hilt.android.compiler)
93 | testImplementation(libs.hilt.android.testing)
94 | kaptTest(libs.hilt.android.compiler)
95 |
96 | testImplementation(libs.junit)
97 | testImplementation(libs.mockito.core)
98 | testImplementation(libs.hamcrest.library)
99 | testImplementation(libs.truth)
100 | testImplementation(libs.androidx.junit)
101 |
102 | androidTestImplementation(libs.junit)
103 |
104 | androidTestImplementation(libs.androidx.espresso.core)
105 | androidTestImplementation(libs.androidx.espresso.intents)
106 | androidTestImplementation(libs.androidx.annotation)
107 | androidTestImplementation(libs.androidx.runner)
108 | androidTestImplementation(libs.androidx.rules)
109 | androidTestImplementation(libs.androidx.junit)
110 | // Set this dependency if you want to use Hamcrest matching
111 | androidTestImplementation(libs.hamcrest.library)
112 |
113 | androidTestUtil(libs.androidx.orchestrator)
114 |
115 | }
116 |
117 | kapt {
118 | correctErrorTypes = true
119 | }
120 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/ianfield/src/android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.kts.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
--------------------------------------------------------------------------------
/app/src/androidTest/java/uk/co/ianfield/devstat/MainActivityTest.kt:
--------------------------------------------------------------------------------
1 | package uk.co.ianfield.devstat
2 |
3 | import androidx.test.core.app.ApplicationProvider
4 | import androidx.test.espresso.Espresso.onView
5 | import androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu
6 | import androidx.test.espresso.action.ViewActions.click
7 | import androidx.test.espresso.intent.Intents
8 | import androidx.test.espresso.intent.Intents.intended
9 | import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent
10 | import androidx.test.espresso.matcher.ViewMatchers.withText
11 | import androidx.test.rule.ActivityTestRule
12 | import androidx.test.ext.junit.runners.AndroidJUnit4
13 | import org.junit.Rule
14 | import org.junit.Test
15 | import org.junit.runner.RunWith
16 |
17 | /**
18 | * Created by Ian on 20/11/2015.
19 | */
20 | @RunWith(AndroidJUnit4::class)
21 | class MainActivityTest {
22 |
23 | @get:Rule
24 | var mActivityRule = ActivityTestRule(MainActivity::class.java)
25 |
26 | @Test
27 | fun checkAboutIsLaunched() {
28 | Intents.init()
29 | openActionBarOverflowOrOptionsMenu(ApplicationProvider.getApplicationContext())
30 | onView(withText(R.string.action_about)).perform(click())
31 | intended(hasComponent(AboutActivity::class.java.name))
32 | Intents.release()
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
16 |
17 |
18 |
19 |
20 |
21 |
23 |
24 |
25 |
28 |
29 |
32 |
33 |
36 |
37 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/assets/about.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
58 |
59 |
60 |
61 |
67 |
68 |
--------------------------------------------------------------------------------
/app/src/main/feature_web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/feature_web.png
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/app/src/main/java/uk/co/ianfield/devstat/AboutActivity.kt:
--------------------------------------------------------------------------------
1 | package uk.co.ianfield.devstat
2 |
3 | import android.os.Bundle
4 | import androidx.appcompat.app.AppCompatActivity
5 | import uk.co.ianfield.devstat.databinding.ActivityAboutBinding
6 |
7 | class AboutActivity : AppCompatActivity() {
8 | private lateinit var binding: ActivityAboutBinding
9 |
10 | override fun onCreate(savedInstanceState: Bundle?) {
11 | super.onCreate(savedInstanceState)
12 | binding = ActivityAboutBinding.inflate(layoutInflater)
13 | setContentView(binding.root)
14 | binding.webView.loadUrl("file:///android_asset/about.html")
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/uk/co/ianfield/devstat/ClipboardActivity.kt:
--------------------------------------------------------------------------------
1 | package uk.co.ianfield.devstat
2 |
3 | import android.annotation.SuppressLint
4 | import android.content.ClipData
5 | import android.content.ClipboardManager
6 | import android.content.Context
7 | import android.os.Bundle
8 | import androidx.appcompat.app.AppCompatActivity
9 | import android.widget.Toast
10 |
11 | import java.util.ArrayList
12 |
13 | import uk.co.ianfield.devstat.model.StatItem
14 |
15 | /**
16 | * Created by ianfield on 29/01/2017.
17 | */
18 |
19 | class ClipboardActivity : AppCompatActivity() {
20 |
21 | @SuppressLint("NewApi") // Always going to be 25+
22 | public override fun onCreate(savedInstanceState: Bundle?) {
23 | super.onCreate(savedInstanceState)
24 |
25 | val statHelper = StatHelper(this)
26 | var clipboardContents = ""
27 |
28 | var list: ArrayList = statHelper.hardwareList
29 | clipboardContents += "${getString(R.string.title_hardware)}\n"
30 | for (item in list) {
31 | clipboardContents += item.toString()
32 | clipboardContents += "\n"
33 | }
34 |
35 | list = statHelper.screenList
36 | clipboardContents += "\n${getString(R.string.title_screen_metrics)}\n"
37 | for (item in list) {
38 | clipboardContents += item.toString()
39 | clipboardContents += "\n"
40 | }
41 |
42 | list = statHelper.softwareList
43 | clipboardContents += "\n${getString(R.string.title_software)}\n"
44 | for (item in list) {
45 | clipboardContents += item.toString()
46 | clipboardContents += "\n"
47 | }
48 |
49 | list = statHelper.featureList
50 | clipboardContents += "\n${getString(R.string.title_crypto)}\n"
51 | for (item in list) {
52 | clipboardContents += item.title
53 | clipboardContents += ":\n"
54 | clipboardContents += item.info
55 | clipboardContents += "\n"
56 | }
57 |
58 | list = statHelper.cryptoList
59 | clipboardContents += String.format("\n%s\n", getString(R.string.title_crypto))
60 | for (item in list) {
61 | clipboardContents += item.title
62 | clipboardContents += ":\n"
63 | clipboardContents += item.info
64 | clipboardContents += "\n"
65 | }
66 |
67 | val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
68 | val clip = ClipData.newPlainText("text label", clipboardContents)
69 | clipboard.setPrimaryClip(clip)
70 |
71 | Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show()
72 | finish()
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/java/uk/co/ianfield/devstat/DevStatApplication.kt:
--------------------------------------------------------------------------------
1 | package uk.co.ianfield.devstat
2 |
3 | import android.app.Activity
4 | import android.app.Application
5 | import android.os.Bundle
6 | import android.util.Log
7 | import dagger.hilt.android.HiltAndroidApp
8 | import org.json.JSONException
9 | import org.json.JSONObject
10 | /**
11 | * Created by Ian Field on 18/03/2016.
12 | */
13 | @HiltAndroidApp
14 | class DevStatApplication : Application() {
15 |
16 | companion object {
17 | const val TAG = "DevStatApplication"
18 | }
19 |
20 | override fun onCreate() {
21 | super.onCreate()
22 |
23 | if (BuildConfig.DEBUG) {
24 | registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
25 | override fun onActivityCreated(activity: Activity, bundle: Bundle?) {
26 | val extras = getJSONFromBundle(activity.intent.extras)
27 | if (extras != null) {
28 | Log.d(TAG, activity.localClassName + " created. Extras: " + extras)
29 | }
30 | }
31 |
32 | override fun onActivityStarted(activity: Activity) {}
33 |
34 | override fun onActivityResumed(activity: Activity) {}
35 |
36 | override fun onActivityPaused(activity: Activity) {}
37 |
38 | override fun onActivityStopped(activity: Activity) {}
39 | override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}
40 |
41 | override fun onActivityDestroyed(activity: Activity) {}
42 | })
43 | }
44 | }
45 |
46 | fun getJSONFromBundle(bundle: Bundle?): String? {
47 | if (bundle == null) {
48 | return null
49 | }
50 | val json = JSONObject()
51 | val keys = bundle.keySet()
52 | keys.forEach { key ->
53 | try {
54 | json.put(key, JSONObject.wrap(bundle.getString(key)))
55 | } catch (e: JSONException) {
56 | //Handle exception here
57 | }
58 |
59 | }
60 | return json.toString()
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/uk/co/ianfield/devstat/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package uk.co.ianfield.devstat
2 |
3 | import android.content.Intent
4 | import android.net.Uri
5 | import android.os.Bundle
6 | import android.provider.Settings
7 | import androidx.appcompat.app.AppCompatActivity
8 | import android.view.Menu
9 | import android.view.MenuItem
10 | import com.google.android.material.tabs.TabLayoutMediator
11 | import dagger.hilt.android.AndroidEntryPoint
12 | import uk.co.ianfield.devstat.databinding.ActivityMainBinding
13 | import uk.co.ianfield.devstat.model.StatItem
14 | import uk.co.ianfield.devstat.widget.InformationPagerAdapter
15 | import java.util.*
16 | import javax.inject.Inject
17 |
18 | @AndroidEntryPoint
19 | class MainActivity : AppCompatActivity() {
20 | private lateinit var binding: ActivityMainBinding
21 |
22 | @Inject lateinit var helper: StatHelper
23 | private lateinit var hardwareStats: ArrayList
24 | private lateinit var screenStats: ArrayList
25 | private lateinit var softwareStats: ArrayList
26 | private lateinit var featureStats: ArrayList
27 | private lateinit var cryptoStats: ArrayList
28 |
29 | override fun onCreate(savedInstanceState: Bundle?) {
30 | super.onCreate(savedInstanceState)
31 | binding = ActivityMainBinding.inflate(layoutInflater)
32 | setContentView(binding.root)
33 | // (application as DevStatApplication).component()!!.inject(this)
34 | binding.sendEmail.setOnClickListener { emailClick() }
35 |
36 | hardwareStats = helper.hardwareList
37 | screenStats = helper.screenList
38 | softwareStats = helper.softwareList
39 | featureStats = helper.featureList
40 | cryptoStats = helper.cryptoList
41 |
42 | // This could probably be done better
43 | val statGroups = ArrayList>()
44 | statGroups.addAll(
45 | listOf(screenStats, softwareStats, hardwareStats, featureStats, cryptoStats)
46 | )
47 |
48 | val tabTitles = intArrayOf(R.string.title_screen_metrics, R.string.title_software, R.string.title_hardware, R.string.title_features, R.string.title_crypto)
49 | binding.viewPager.adapter = InformationPagerAdapter(this,
50 | tabTitles,
51 | statGroups)
52 |
53 | TabLayoutMediator(binding.tabLayout, binding.viewPager) { tab, position ->
54 | tab.text = getString(tabTitles[position])
55 | }.attach()
56 |
57 | }
58 |
59 | override fun onCreateOptionsMenu(menu: Menu): Boolean {
60 | val inflater = menuInflater
61 | inflater.inflate(R.menu.main, menu)
62 | return true
63 | }
64 |
65 | override fun onOptionsItemSelected(item: MenuItem): Boolean {
66 | // Handle item selection
67 | return when (item.itemId) {
68 | R.id.action_about -> {
69 | val intent = Intent(this, AboutActivity::class.java)
70 | startActivity(intent)
71 | true
72 | }
73 | R.id.action_developer -> {
74 | startActivity(Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS))
75 | true
76 | }
77 | else -> super.onOptionsItemSelected(item)
78 | }
79 | }
80 |
81 | fun emailClick() {
82 | val emailIntent = Intent(Intent.ACTION_SENDTO, Uri.fromParts(
83 | "mailto", "", null))
84 | emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.email_subject))
85 |
86 | val stringBuilder = StringBuilder()
87 |
88 | stringBuilder.append(String.format("%s\n", getString(R.string.title_screen_metrics)))
89 | for (item in screenStats) {
90 | stringBuilder.append(item.toString())
91 | stringBuilder.append("\n")
92 | }
93 |
94 | stringBuilder.append(String.format("\n%s\n", getString(R.string.title_software)))
95 | for (item in softwareStats) {
96 | stringBuilder.append(item.toString())
97 | stringBuilder.append("\n")
98 | }
99 |
100 | stringBuilder.append(String.format("\n%s\n", getString(R.string.title_hardware)))
101 | for (item in hardwareStats) {
102 | stringBuilder.append(item.toString())
103 | stringBuilder.append("\n")
104 | }
105 |
106 | stringBuilder.append(String.format("\n%s\n", getString(R.string.title_features)))
107 | for (item in featureStats) {
108 | stringBuilder.apply {
109 | append(item.title)
110 | append(":\n")
111 | append(item.info)
112 | append("\n")
113 | }
114 |
115 | }
116 |
117 | stringBuilder.append(String.format("\n%s\n", getString(R.string.title_crypto)))
118 | for (item in cryptoStats) {
119 | stringBuilder.apply {
120 | append(item.title)
121 | append(":\n")
122 | append(item.info)
123 | append("\n")
124 | }
125 | }
126 |
127 | emailIntent.putExtra(Intent.EXTRA_TEXT, stringBuilder.toString())
128 | startActivity(Intent.createChooser(emailIntent, getString(R.string.send_email)))
129 | }
130 |
131 | }
132 |
--------------------------------------------------------------------------------
/app/src/main/java/uk/co/ianfield/devstat/StatHelper.kt:
--------------------------------------------------------------------------------
1 | @file:Suppress("DEPRECATION")
2 |
3 | package uk.co.ianfield.devstat
4 |
5 | import android.app.ActivityManager
6 | import android.content.Context
7 | import android.content.pm.PackageManager
8 | import android.content.res.Configuration
9 | import android.os.Build
10 | import android.os.Environment
11 | import android.telephony.TelephonyManager
12 | import android.text.TextUtils
13 | import android.util.DisplayMetrics
14 | import android.util.Log
15 | import uk.co.ianfield.devstat.model.StatItem
16 | import java.security.Security
17 | import java.text.DecimalFormat
18 | import java.util.*
19 | import kotlin.math.log10
20 | import kotlin.math.pow
21 |
22 | /**
23 | * Created by IanField90 on 17/06/2014.
24 | */
25 | class StatHelper(private val context: Context) {
26 |
27 | private fun readableFileSize(size: Long): String {
28 | if (size <= 0) {
29 | return "0"
30 | }
31 | val units = arrayOf("B", "kB", "MB", "GB", "TB")
32 | val digitGroups = (log10(size.toDouble()) / log10(1024.0)).toInt()
33 | return DecimalFormat("#,##0.#").format(size / 1024.0.pow(digitGroups.toDouble())) + " " + units[digitGroups]
34 | }
35 |
36 | val softwareList: ArrayList
37 | get() {
38 | val softwareStats = ArrayList()
39 | softwareStats.add(getStatItem(Software.ANDROID_VERSION))
40 | softwareStats.add(getStatItem(Software.SDK_INT))
41 | softwareStats.add(getStatItem(Software.OPEN_GL_ES))
42 | softwareStats.add(getStatItem(Software.GOOGLE_PLAY_SERVICES_VERSION))
43 | softwareStats.add(getStatItem(Software.BUILD_NUMBER))
44 | return softwareStats
45 | }
46 |
47 | fun getStatItem(software: Software): StatItem {
48 | val stat = StatItem()
49 | when (software) {
50 | Software.ANDROID_VERSION -> {
51 | stat.title = context.getString(R.string.android_version)
52 | stat.info = Build.VERSION.RELEASE
53 | }
54 | Software.SDK_INT -> {
55 | stat.title = context.getString(R.string.sdk_int)
56 | stat.info = String.format(Locale.getDefault(), "%d", Build.VERSION.SDK_INT)
57 | }
58 | Software.OPEN_GL_ES -> {
59 | stat.title = context.getString(R.string.opengl_version)
60 | val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
61 | val configurationInfo = activityManager.deviceConfigurationInfo
62 | if (configurationInfo != null) {
63 | stat.info = configurationInfo.glEsVersion
64 | } else {
65 | stat.info = context.getString(R.string.unknown)
66 | }
67 | }
68 | Software.GOOGLE_PLAY_SERVICES_VERSION -> {
69 | stat.title = context.getString(R.string.google_play_services_version)
70 | try {
71 | val info = context.packageManager.getPackageInfo("com.google.android.gms", 0)
72 | stat.info = String.format("%s [%s]", info.versionName, info.versionCode)
73 | } catch (e: PackageManager.NameNotFoundException) {
74 | Log.e(StatHelper::class.java.simpleName, "Unable to find google play services", e)
75 | stat.info = context.getString(R.string.unavailable)
76 | }
77 | }
78 | Software.BUILD_NUMBER -> {
79 | stat.title = context.getString(R.string.build_number)
80 | stat.info = Build.DISPLAY
81 | }
82 | }
83 | return stat
84 | }
85 |
86 | // Hardware
87 | // This is also checked for within
88 | val hardwareList: ArrayList
89 | get() {
90 | val hardwareStats = ArrayList()
91 | hardwareStats.add(getStatItem(Hardware.MANUFACTURER))
92 | hardwareStats.add(getStatItem(Hardware.MODEL))
93 | hardwareStats.add(getStatItem(Hardware.DEVICE))
94 | hardwareStats.add(getStatItem(Hardware.BRAND))
95 | hardwareStats.add(getStatItem(Hardware.BOARD))
96 | hardwareStats.add(getStatItem(Hardware.HOST))
97 | hardwareStats.add(getStatItem(Hardware.PRODUCT))
98 | hardwareStats.add(getStatItem(Hardware.MEMORY_CLASS))
99 | hardwareStats.add(getStatItem(Hardware.LARGE_MEMORY_CLASS))
100 | hardwareStats.add(getStatItem(Hardware.MAX_MEMORY))
101 | hardwareStats.add(getStatItem(Hardware.FREE_SPACE))
102 | hardwareStats.add(getStatItem(Hardware.TELEPHONY))
103 | hardwareStats.add(getStatItem(Hardware.SD_CARD))
104 | hardwareStats.add(getStatItem(Hardware.ARCHITECTURE))
105 | hardwareStats.add(getStatItem(Hardware.PROCESSORS))
106 | return hardwareStats
107 | }
108 |
109 | fun getStatItem(hardware: Hardware): StatItem {
110 | var stat = StatItem()
111 | val am = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
112 | when (hardware) {
113 | Hardware.MODEL -> {
114 | stat.title = context.getString(R.string.device_model)
115 | stat.info = Build.MODEL
116 | }
117 |
118 | Hardware.DEVICE -> {
119 | stat.title = context.getString(R.string.device)
120 | stat.info = Build.DEVICE
121 | }
122 |
123 | Hardware.BRAND -> {
124 | stat.title = context.getString(R.string.brand)
125 | stat.info = Build.BRAND
126 | }
127 |
128 | Hardware.BOARD -> {
129 | stat.title = context.getString(R.string.board)
130 | stat.info = Build.BOARD
131 | }
132 |
133 | Hardware.HOST -> {
134 | stat.title = context.getString(R.string.host)
135 | stat.info = Build.HOST
136 | }
137 |
138 | Hardware.MANUFACTURER -> {
139 | stat.title = context.getString(R.string.manufacturer)
140 | stat.info = Build.MANUFACTURER
141 | }
142 |
143 | Hardware.PRODUCT -> {
144 | stat.title = context.getString(R.string.product)
145 | stat.info = Build.PRODUCT
146 | }
147 |
148 | Hardware.MEMORY_CLASS -> {
149 | stat.title = context.getString(R.string.memory_class)
150 | val memoryClass = am.memoryClass
151 | stat.info = String.format(Locale.getDefault(), "%d MB", memoryClass)
152 | }
153 | Hardware.LARGE_MEMORY_CLASS -> {
154 | stat.title = context.getString(R.string.large_memory_class)
155 | val largeMemoryClass = am.largeMemoryClass
156 | stat.info = String.format(Locale.getDefault(), "%d MB", largeMemoryClass)
157 | }
158 | Hardware.MAX_MEMORY -> {
159 | stat = StatItem()
160 | stat.title = context.getString(R.string.max_memory)
161 | val rt = Runtime.getRuntime()
162 | val maxMemory = rt.maxMemory()
163 | stat.info = readableFileSize(maxMemory)
164 | }
165 | Hardware.FREE_SPACE -> {
166 | stat.title = context.getString(R.string.free_space)
167 | val available = Environment.getExternalStorageDirectory().freeSpace
168 | stat.info = readableFileSize(available)
169 | }
170 | Hardware.TELEPHONY -> {
171 | stat.title = context.getString(R.string.telephony)
172 | stat.info = if (isTelephonyEnabled) {
173 | context.getString(R.string.enabled)
174 | } else {
175 | context.getString(R.string.disabled)
176 | }
177 | }
178 |
179 | Hardware.SD_CARD -> {
180 | stat.title = context.getString(R.string.sd_card)
181 | val sdPresence = Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED
182 | val emulated = Environment.isExternalStorageEmulated()
183 | stat.info = context.getString(R.string.sd_presence_emulated, sdPresence.toString(), emulated.toString())
184 | }
185 | Hardware.ARCHITECTURE -> {
186 | stat.title = context.getString(R.string.architecture)
187 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
188 | stat.info = TextUtils.join(", ", Build.SUPPORTED_ABIS)
189 | } else {
190 | stat.info = TextUtils.join(", ", Arrays.asList(Build.CPU_ABI, Build.CPU_ABI2))
191 | }
192 | }
193 | Hardware.PROCESSORS -> {
194 | stat.title = context.getString(R.string.processors)
195 | stat.info = "" + Runtime.getRuntime().availableProcessors()
196 | }
197 | }
198 | return stat
199 | }
200 |
201 | val screenList: ArrayList
202 | get() {
203 | val screenStats = ArrayList()
204 | screenStats.add(getStatItem(Screen.WIDTH))
205 | screenStats.add(getStatItem(Screen.HEIGHT))
206 | screenStats.add(getStatItem(Screen.DISPLAY_DENSITY))
207 | screenStats.add(getStatItem(Screen.DRAWABLE_DENSITY))
208 | screenStats.add(getStatItem(Screen.SCREEN_SIZE))
209 | return screenStats
210 | }
211 |
212 | fun getStatItem(screen: Screen): StatItem {
213 | val metrics = context.resources.displayMetrics
214 |
215 | val stat = StatItem()
216 | when (screen) {
217 | Screen.WIDTH -> {
218 | stat.title = context.getString(R.string.screen_width)
219 | stat.info = String.format(Locale.getDefault(), "%d px", metrics.widthPixels)
220 | }
221 | Screen.HEIGHT -> {
222 | stat.title = context.getString(R.string.screen_height)
223 | stat.info = String.format(Locale.getDefault(), "%d px", metrics.heightPixels)
224 | }
225 | Screen.DISPLAY_DENSITY -> {
226 | stat.title = context.getString(R.string.display_density)
227 | stat.info = String.format(Locale.getDefault(), "%d dpi", metrics.densityDpi)
228 | }
229 | Screen.DRAWABLE_DENSITY -> {
230 | stat.title = context.getString(R.string.drawable_density)
231 | stat.info = getDensityInfo(metrics)
232 | }
233 | Screen.SCREEN_SIZE -> {
234 | stat.title = context.getString(R.string.screen_size)
235 | val screenSize = context.resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK
236 |
237 | when (screenSize) {
238 | Configuration.SCREENLAYOUT_SIZE_LARGE -> stat.info = context.getString(R.string.screen_size_large)
239 | Configuration.SCREENLAYOUT_SIZE_NORMAL -> stat.info = context.getString(R.string.screen_size_normal)
240 | Configuration.SCREENLAYOUT_SIZE_SMALL -> stat.info = context.getString(R.string.screen_size_small)
241 | Configuration.SCREENLAYOUT_SIZE_XLARGE -> stat.info = context.getString(R.string.screen_size_xlarge)
242 | else -> stat.info = context.getString(R.string.screen_size_undefined)
243 | }
244 | }
245 | }
246 | return stat
247 | }
248 |
249 | private fun getDensityInfo(metrics: DisplayMetrics): String {
250 | when (metrics.densityDpi) {
251 | DisplayMetrics.DENSITY_LOW -> return "ldpi (.75x)"
252 | DisplayMetrics.DENSITY_MEDIUM // === DENSITY_DEFAULT
253 | -> return "mdpi (1x)"
254 | DisplayMetrics.DENSITY_TV -> return "tvdpi (1.33x)"
255 | DisplayMetrics.DENSITY_HIGH -> return "hdpi (1.5x)"
256 | DisplayMetrics.DENSITY_XHIGH -> return "xhdpi (2x)"
257 | DisplayMetrics.DENSITY_280 -> return "xhdpi (System scaled down to suit)"
258 | DisplayMetrics.DENSITY_360 -> return "xxhdpi (System scaled down to suit)"
259 | DisplayMetrics.DENSITY_400, DisplayMetrics.DENSITY_420 -> return "xxhdpi (System scaled down to suit)"
260 | DisplayMetrics.DENSITY_XXHIGH -> return "xxhdpi (3x)"
261 | DisplayMetrics.DENSITY_560 -> return "xxxhdpi (System scaled down to suit)"
262 | DisplayMetrics.DENSITY_XXXHIGH -> return "xxxhdpi (4x)"
263 | }
264 | return "Unknown DPI: " + metrics.densityDpi
265 | }
266 |
267 | val featureList: ArrayList
268 | get() {
269 | val featureList = ArrayList()
270 | for (featureInfo in context.packageManager.systemAvailableFeatures) {
271 | val stat = StatItem()
272 | if (featureInfo.name != null) {
273 | val featureParts = featureInfo.name.toLowerCase(Locale.UK).split("[.]".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
274 | val featureName = featureParts[featureParts.size - 1].replace("_".toRegex(), " ")
275 | stat.title = featureName.substring(0, 1).toUpperCase(Locale.UK) + featureName.substring(1)
276 | stat.info = featureInfo.name
277 | } else {
278 | stat.title = context.getString(R.string.opengl_version)
279 | stat.info = featureInfo.glEsVersion
280 | }
281 | featureList.add(stat)
282 | }
283 | return featureList
284 | }
285 |
286 | private val isTelephonyEnabled: Boolean
287 | get() {
288 | val tm = context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
289 | return tm.simState == TelephonyManager.SIM_STATE_READY
290 | }
291 |
292 | internal val cryptoList: ArrayList
293 | get() {
294 | val cryptoList = ArrayList()
295 |
296 | for (provider in Security.getProviders()) {
297 | val item = StatItem()
298 | item.title = provider.name
299 | var info = ""
300 |
301 | val services = provider.services
302 | for (service in services) {
303 | info += service.algorithm + "\n"
304 | }
305 | info = info.substring(0, info.length - 2)
306 | item.info = info
307 | cryptoList.add(item)
308 | }
309 |
310 | return cryptoList
311 | }
312 |
313 | enum class Hardware {
314 | MANUFACTURER,
315 | MODEL,
316 | MEMORY_CLASS,
317 | LARGE_MEMORY_CLASS,
318 | MAX_MEMORY,
319 | FREE_SPACE,
320 | TELEPHONY,
321 | DEVICE,
322 | BRAND,
323 | BOARD,
324 | HOST,
325 | PRODUCT,
326 | SD_CARD,
327 | ARCHITECTURE,
328 | PROCESSORS
329 | }
330 |
331 | enum class Screen {
332 | WIDTH,
333 | HEIGHT,
334 | DISPLAY_DENSITY,
335 | DRAWABLE_DENSITY,
336 | SCREEN_SIZE
337 | }
338 |
339 | enum class Software {
340 | ANDROID_VERSION,
341 | SDK_INT,
342 | OPEN_GL_ES,
343 | GOOGLE_PLAY_SERVICES_VERSION,
344 | BUILD_NUMBER
345 | }
346 |
347 | }
348 |
--------------------------------------------------------------------------------
/app/src/main/java/uk/co/ianfield/devstat/StatItemAdapter.kt:
--------------------------------------------------------------------------------
1 | package uk.co.ianfield.devstat
2 |
3 | import android.content.Context
4 | import androidx.recyclerview.widget.RecyclerView
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import android.widget.TextView
9 | import uk.co.ianfield.devstat.model.StatItem
10 | import java.util.*
11 |
12 | /**
13 | * Created by Ian on 18/08/2015.
14 | */
15 | class StatItemAdapter(context: Context, private val dataSet: ArrayList,
16 | private val listener: (Int) -> Unit) :
17 | RecyclerView.Adapter() {
18 | private val inflater: LayoutInflater = LayoutInflater.from(context)
19 |
20 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
21 | val v = inflater.inflate(R.layout.stat_item, parent, false)
22 | return ViewHolder(v)
23 | }
24 |
25 | override fun onBindViewHolder(holder: ViewHolder, position: Int) {
26 | holder.title.text = dataSet[position].title
27 | holder.info.text = dataSet[position].info
28 |
29 | val viewListener: View.OnLongClickListener = View.OnLongClickListener {
30 | listener.invoke(holder.bindingAdapterPosition)
31 | true
32 | }
33 | holder.title.setOnLongClickListener(viewListener)
34 | holder.info.setOnLongClickListener(viewListener)
35 | }
36 |
37 | override fun getItemCount(): Int {
38 | return dataSet.size
39 | }
40 |
41 | class ViewHolder(container: View) : RecyclerView.ViewHolder(container) {
42 | val title: TextView = container.findViewById(R.id.txtTitle)
43 | val info: TextView = container.findViewById(R.id.txtInfo)
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/uk/co/ianfield/devstat/di/modules/AppModule.kt:
--------------------------------------------------------------------------------
1 | package uk.co.ianfield.devstat.di.modules
2 |
3 | import android.content.Context
4 | import dagger.Module
5 | import dagger.Provides
6 | import dagger.hilt.InstallIn
7 | import dagger.hilt.android.qualifiers.ApplicationContext
8 | import dagger.hilt.components.SingletonComponent
9 | import uk.co.ianfield.devstat.DevStatApplication
10 | import uk.co.ianfield.devstat.StatHelper
11 | import javax.inject.Qualifier
12 | import javax.inject.Singleton
13 |
14 | @InstallIn(SingletonComponent::class)
15 | @Module
16 | class AppModule {
17 |
18 | @Provides
19 | @Singleton
20 | fun provideStatHelper(@ApplicationContext context: Context): StatHelper {
21 | return StatHelper(context)
22 | }
23 |
24 | }
--------------------------------------------------------------------------------
/app/src/main/java/uk/co/ianfield/devstat/model/StatItem.kt:
--------------------------------------------------------------------------------
1 | package uk.co.ianfield.devstat.model
2 |
3 | /**
4 | * Created by Ian Field on 20/02/2014.
5 | */
6 | open class StatItem {
7 | lateinit var title: String
8 | lateinit var info: String
9 |
10 | override fun toString(): String {
11 | return "$title: $info"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/uk/co/ianfield/devstat/widget/InformationPageFragment.kt:
--------------------------------------------------------------------------------
1 | package uk.co.ianfield.devstat.widget
2 |
3 | import android.content.ClipData
4 | import android.content.ClipboardManager
5 | import android.content.Context
6 | import android.os.Bundle
7 | import com.google.android.material.snackbar.Snackbar
8 | import androidx.fragment.app.Fragment
9 | import androidx.recyclerview.widget.LinearLayoutManager
10 | import android.view.LayoutInflater
11 | import android.view.View
12 | import android.view.ViewGroup
13 | import uk.co.ianfield.devstat.R
14 | import uk.co.ianfield.devstat.StatItemAdapter
15 | import uk.co.ianfield.devstat.databinding.FragmentInformationPageBinding
16 | import uk.co.ianfield.devstat.model.StatItem
17 | import java.util.*
18 |
19 | class InformationPageFragment : Fragment() {
20 | private var _binding: FragmentInformationPageBinding? = null
21 | private val binding get() = _binding!!
22 |
23 | private lateinit var items: ArrayList
24 |
25 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
26 | _binding = FragmentInformationPageBinding.inflate(inflater, container, false)
27 | return binding.root
28 | }
29 |
30 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
31 | super.onViewCreated(view, savedInstanceState)
32 | binding.recyclerView.setHasFixedSize(true)
33 | val layoutManager = LinearLayoutManager(activity)
34 | binding.recyclerView.layoutManager = layoutManager
35 |
36 | val adapter = StatItemAdapter(requireContext(), items) { position: Int ->
37 | val clipboard = context?.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
38 | val clip = ClipData.newPlainText("text label", items[position].toString())
39 | clipboard.setPrimaryClip(clip)
40 | Snackbar.make(binding.recyclerView, R.string.copied_to_clipboard, Snackbar.LENGTH_SHORT).show()
41 | }
42 | binding.recyclerView.adapter = adapter
43 | }
44 |
45 | fun setItems(items: ArrayList) {
46 | this.items = items
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/uk/co/ianfield/devstat/widget/InformationPagerAdapter.kt:
--------------------------------------------------------------------------------
1 | package uk.co.ianfield.devstat.widget
2 |
3 | import android.content.Context
4 | import androidx.fragment.app.*
5 | import androidx.viewpager2.adapter.FragmentStateAdapter
6 | import uk.co.ianfield.devstat.model.StatItem
7 | import java.util.*
8 |
9 | /**
10 | * Created by Ian Field on 14/08/15.
11 | */
12 | class InformationPagerAdapter(fa: FragmentActivity,
13 | private val tabTitles: IntArray,
14 | private val statSets: ArrayList>)
15 | : FragmentStateAdapter(fa) {
16 |
17 | override fun createFragment(position: Int): Fragment {
18 | val fragment = InformationPageFragment()
19 | fragment.setItems(statSets[position])
20 | return fragment
21 | }
22 |
23 | override fun getItemCount(): Int {
24 | return tabTitles.size
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_share_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/res/drawable-hdpi/ic_share_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_share_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/res/drawable-mdpi/ic_share_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi-v25/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/res/drawable-xhdpi-v25/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_share_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/res/drawable-xhdpi/ic_share_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi-v25/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/res/drawable-xxhdpi-v25/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_share_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/res/drawable-xxhdpi/ic_share_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi-v25/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/res/drawable-xxxhdpi-v25/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/res/drawable-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/app/src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_shortcut_copy.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
13 |
14 |
20 |
21 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_information_page.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/stat_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
18 |
19 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #4527A0
4 | #311B92
5 | #00E676
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | DevStat
5 |
6 | Screen Metrics
7 | Software
8 | Hardware
9 | Features
10 | Crypto
11 |
12 | About
13 | Open developer options
14 | Send email…
15 | DevStat Information
16 |
17 |
18 | Display density
19 | Width
20 | Height
21 | Drawable density
22 | Screen size
23 |
24 | Small
25 | Normal
26 | Large
27 | Extra large
28 | Undefined
29 |
30 |
31 |
32 | Android version
33 | SDK Int
34 | OpenGL ES version
35 | Google Play Services version
36 | Unknown
37 |
38 |
39 | Memory class
40 | Large memory class
41 | Max memory
42 | Free space
43 |
44 | Telephony
45 | Enabled
46 | Disabled
47 |
48 | SD Card
49 |
50 | Unavailable
51 |
52 | Manufacturer
53 | Device model
54 | Product
55 | Host
56 | Board
57 | Brand
58 | Device
59 |
60 | Present: %1$s, Emulated: %2$s
61 | Present: %1$s
62 | ABIs
63 | Online Processors
64 |
65 | Copied to clipboard!
66 |
67 |
68 | Copy stats
69 | Copy stats to Clipboard
70 | Copy disabled
71 | Build Number
72 |
73 |
74 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/shortcuts.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
14 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/test/java/uk/co/ianfield/devstat/model/StatItemTest.kt:
--------------------------------------------------------------------------------
1 | package uk.co.ianfield.devstat.model
2 |
3 | import com.google.common.truth.Truth.assertThat
4 | import org.junit.Before
5 | import org.junit.Test
6 | import org.junit.runner.RunWith
7 | import org.junit.runners.JUnit4
8 | import org.mockito.Mock
9 | import org.mockito.MockitoAnnotations.initMocks
10 | import org.mockito.Mockito.`when` as whenMock
11 |
12 | /**
13 | * Created by Ian on 20/11/2015.
14 | */
15 | @RunWith(JUnit4::class)
16 | class StatItemTest {
17 | @Mock lateinit var statItem: StatItem
18 |
19 | @Before
20 | fun setUp() {
21 | initMocks(this)
22 | }
23 |
24 | @Test
25 | @Throws(Exception::class)
26 | fun testToString() {
27 | whenMock(statItem.title).thenReturn("a")
28 | whenMock(statItem.info).thenReturn("b")
29 | assertThat(statItem.title).isEqualTo("a")
30 |
31 | // Can't mock toString()
32 | statItem = StatItem()
33 | statItem.title = "a"
34 | statItem.info = "b"
35 | assertThat(statItem.toString()).isEqualTo("a: b")
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker:
--------------------------------------------------------------------------------
1 | mock-maker-inline
2 |
--------------------------------------------------------------------------------
/build.gradle.kts:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | }
6 | dependencies {
7 | classpath(libs.android.pluginGradle)
8 | classpath(libs.kotlin.pluginGradle)
9 | classpath(libs.hilt.pluginGradle)
10 | }
11 | }
12 |
13 | allprojects {
14 | repositories {
15 | google()
16 | mavenCentral()
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 | uk.co.ianfield.devstat.keystore.location=/your/path/to/keystore
20 | uk.co.ianfield.devstat.keystore.storepass=yourpassword
21 | uk.co.ianfield.devstat.keystore.keypass=yourkeypassword
22 | uk.co.ianfield.devstat.keystore.alias=yourkeyalias
23 |
24 | android.useAndroidX=true
25 |
26 | #android.enableR8.fullMode=true
27 | kapt.incremental.apt=true
28 |
29 | android.enableBuildConfigAsBytecode=true
--------------------------------------------------------------------------------
/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [versions]
2 | androidxJunit = "1.2.1"
3 | annotation = "1.9.1"
4 | appcompat = "1.7.0"
5 | coreKtx = "1.15.0"
6 | espressoCore = "3.6.1"
7 | hamcrestLibrary = "2.2"
8 | junit = "4.13.2"
9 | kotlin = "1.9.24"
10 | androidBuildTools = "8.8.1"
11 | hilt = "2.48"
12 | kotlinStdlibJdk8 = "2.0.21"
13 | material = "1.12.0"
14 | mockitoCore = "3.10.0"
15 | orchestrator = "1.5.1"
16 | recyclerview = "1.4.0"
17 | rules = "1.6.1"
18 | runner = "1.6.2"
19 | truth = "1.1.2"
20 |
21 | [libraries]
22 | androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "annotation" }
23 | androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
24 | androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }
25 | androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }
26 | androidx-espresso-intents = { module = "androidx.test.espresso:espresso-intents", version.ref = "espressoCore" }
27 | androidx-junit = { module = "androidx.test.ext:junit", version.ref = "androidxJunit" }
28 | androidx-orchestrator = { module = "androidx.test:orchestrator", version.ref = "orchestrator" }
29 | androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerview" }
30 | androidx-rules = { module = "androidx.test:rules", version.ref = "rules" }
31 | androidx-runner = { module = "androidx.test:runner", version.ref = "runner" }
32 | hamcrest-library = { module = "org.hamcrest:hamcrest-library", version.ref = "hamcrestLibrary" }
33 | hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
34 | hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" }
35 | hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" }
36 | junit = { module = "junit:junit", version.ref = "junit" }
37 | kotlin-pluginGradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
38 | android-pluginGradle = { module = "com.android.tools.build:gradle", version.ref = "androidBuildTools" }
39 |
40 | hilt-pluginGradle = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
41 | kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlinStdlibJdk8" }
42 | material = { module = "com.google.android.material:material", version.ref = "material" }
43 | mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockitoCore" }
44 | truth = { module = "com.google.truth:truth", version.ref = "truth" }
45 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IanField90/DevStat/3a4a4df0cb90c10b5128e5e05b3bd8b51b3c41cb/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Feb 21 16:18:45 GMT 2025
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | mavenCentral()
4 | gradlePluginPortal()
5 | }
6 | }
7 | include(":app")
8 |
--------------------------------------------------------------------------------