├── .gitignore ├── .idea ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml └── runConfigurations.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── app │ │ └── com │ │ └── pixelmeasrumenttool │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── app │ │ │ └── com │ │ │ └── pixelmeasrumenttool │ │ │ └── MainActivity.kt │ └── res │ │ ├── drawable │ │ └── background.png │ │ ├── layout │ │ ├── activity_main.xml │ │ └── content_main.xml │ │ ├── menu │ │ └── menu_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-v21 │ │ └── styles.xml │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── app │ └── com │ └── pixelmeasrumenttool │ └── ExampleUnitTest.java ├── art ├── pic-1.png ├── pic-2.png ├── pic-3.png ├── pic-all.png └── pixel_measure.gif ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── pixelmeasuringview ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── app │ │ └── com │ │ └── pixelmeasuringview │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── app │ │ │ └── com │ │ │ └── pixelmeasuringview │ │ │ ├── CircleDrawable.kt │ │ │ ├── PixelMeasuringCallback.kt │ │ │ ├── PixelMeasuringView.kt │ │ │ └── Ruler.kt │ └── res │ │ └── values │ │ ├── attrs.xml │ │ └── strings.xml │ └── test │ └── java │ └── app │ └── com │ └── pixelmeasuringview │ └── ExampleUnitTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Add any directories, files, or patterns you don't want to be tracked by version control 2 | .gradle 3 | reports 4 | local.properties 5 | .idea 6 | *.iml 7 | build 8 | .DS_Store 9 | app/*.apk 10 | app/*.iml 11 | fastlane/report.xml 12 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 36 | 37 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 78 | 79 | 80 | 93 | 103 | 104 | 105 | 106 | 107 | 108 | 110 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android-PixelMeasuringTool 2 | A tool to measure the pixel between items in the picture. 3 | 4 | I don't know what might be possible usage. 5 | I used it in a calculation of the actual distance of the balls in a game called lawn bowls. If you know the approximate height of the phone when the picture was taken (and getting a little bit of help from the gyroscope to be sure that the phone is parallel to the ground) you can get the actual distance between the two items in the picture. 6 | 7 | ![Alt Text](art/pixel_measure.gif) 8 | 9 | ## Download 10 | 11 | via Gradle: 12 | 13 | dependencies { 14 | implementation 'com.zekapp.library:pixelmeasuringview:1.0.10' 15 | } 16 | 17 | ## Usage 18 | 19 | 32 | 33 | ## Getting Pixel Programmatically 34 | 35 | @Override 36 | protected void onCreate(Bundle savedInstanceState) { 37 | super.onCreate(savedInstanceState); 38 | setContentView(R.layout.activity_main); 39 | 40 | PixelMeasuringView measure = (PixelMeasuringView)findViewById(R.id.image); 41 | measure.setCallback(new PixelMeasuringCallback() { 42 | @Override 43 | public void distanceBetweenCircles(float distance) { 44 | 45 | } 46 | }); 47 | } 48 | 49 | ![Check Diagram](art/pic-all.png) 50 | 51 | ## License 52 | 53 | Copyright (C) 2015 Zeki Guler 54 | Copyright (C) 2011 The Android Open Source Project 55 | 56 | Licensed under the Apache License, Version 2.0 (the "License"); 57 | you may not use this file except in compliance with the License. 58 | You may obtain a copy of the License at 59 | 60 | http://www.apache.org/licenses/LICENSE-2.0 61 | 62 | Unless required by applicable law or agreed to in writing, software 63 | distributed under the License is distributed on an "AS IS" BASIS, 64 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 65 | See the License for the specific language governing permissions and 66 | limitations under the License. 67 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | 4 | android { 5 | compileSdkVersion 27 6 | buildToolsVersion '27.0.3' 7 | 8 | defaultConfig { 9 | applicationId "app.com.pixelmeasrumenttool" 10 | minSdkVersion 21 11 | targetSdkVersion 27 12 | versionCode 1 13 | versionName "1.0.0" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | 25 | implementation fileTree(dir: 'libs', include: ['*.jar']) 26 | testImplementation 'junit:junit:4.12' 27 | implementation 'com.android.support:support-compat:27.1.1' 28 | implementation 'com.android.support:design:27.1.1' 29 | implementation project(':pixelmeasuringview') 30 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 31 | } 32 | 33 | repositories { 34 | mavenCentral() 35 | } 36 | -------------------------------------------------------------------------------- /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/appscoredev2/Library/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. 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 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/app/com/pixelmeasrumenttool/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package app.com.pixelmeasrumenttool; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/app/com/pixelmeasrumenttool/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package app.com.pixelmeasrumenttool 2 | 3 | import android.os.Bundle 4 | import android.support.design.widget.FloatingActionButton 5 | import android.support.design.widget.Snackbar 6 | import android.support.v7.app.AppCompatActivity 7 | import android.support.v7.widget.Toolbar 8 | import android.view.View 9 | import android.view.Menu 10 | import android.view.MenuItem 11 | 12 | import app.com.pixelmeasuringview.PixelMeasuringCallback 13 | import app.com.pixelmeasuringview.PixelMeasuringView 14 | 15 | class MainActivity : AppCompatActivity() { 16 | 17 | override fun onCreate(savedInstanceState: Bundle?) { 18 | super.onCreate(savedInstanceState) 19 | setContentView(R.layout.activity_main) 20 | val toolbar = findViewById(R.id.toolbar) 21 | setSupportActionBar(toolbar) 22 | 23 | val fab = findViewById(R.id.fab) 24 | fab.setOnClickListener { view -> 25 | Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) 26 | .setAction("Action", null).show() 27 | } 28 | 29 | val measure = findViewById(R.id.lawn_ball_layout) 30 | measure.setCallback(callback = object : PixelMeasuringCallback{ 31 | override fun distanceBetweenCircles(distance: Float) { 32 | 33 | } 34 | }) 35 | } 36 | 37 | override fun onCreateOptionsMenu(menu: Menu): Boolean { 38 | // Inflate the menu; this adds items to the action bar if it is present. 39 | menuInflater.inflate(R.menu.menu_main, menu) 40 | return true 41 | } 42 | 43 | override fun onOptionsItemSelected(item: MenuItem): Boolean { 44 | // Handle action bar item clicks here. The action bar will 45 | // automatically handle clicks on the Home/Up button, so long 46 | // as you specify a parent activity in AndroidManifest.xml. 47 | val id = item.itemId 48 | 49 | 50 | return if (id == R.id.action_settings) { 51 | true 52 | } else super.onOptionsItemSelected(item) 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zekapp/Android-PixelMeasuringTool/46211793e2531f966a37ee5256e13de84a372a0d/app/src/main/res/drawable/background.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 22 | 23 | 24 | 25 | 26 | 27 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/content_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zekapp/Android-PixelMeasuringTool/46211793e2531f966a37ee5256e13de84a372a0d/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zekapp/Android-PixelMeasuringTool/46211793e2531f966a37ee5256e13de84a372a0d/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zekapp/Android-PixelMeasuringTool/46211793e2531f966a37ee5256e13de84a372a0d/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zekapp/Android-PixelMeasuringTool/46211793e2531f966a37ee5256e13de84a372a0d/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zekapp/Android-PixelMeasuringTool/46211793e2531f966a37ee5256e13de84a372a0d/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #1B5E20 7 | #4A148C 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | PixelMeasrumentTool 3 | Settings 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 17 | 18 |