You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Adam Zielonka fd258e0fa8 Update README.md 3 years ago
.idea Updated the url & project 3 years ago
app Update version of app 3 years ago
file Write test with code, no in the end 3 years ago
gradle/wrapper Updated the url & project 3 years ago
img Update README.md 3 years ago
items Write test with code, no in the end 3 years ago
java Removed unnecessary code 4 years ago
verification Removed unnecessary code 4 years ago
.gitignore Update .gitignore 3 years ago
LICENSE Add LICENSE 3 years ago
README.md Update README.md 3 years ago
build.gradle Updated the url & project 3 years ago
gradle.properties Optimize editing activities, Part IV 5 years ago
gradlew Initiation of the project 5 years ago
gradlew.bat Initiation of the project 5 years ago
settings.gradle cleaning completed 4 years ago

README.md

Unit Converter

Get it on Google Play

Table of contents

Project structure

  • app - contain base code
  • file - android library for internal/external file operations
  • items - android library that contain ItemsView
  • java - java library that contain supporting code
  • verification - java library that support code to make interface to verify objects

Measure File Format

To add custom measures you can use editor build in app or you can prepare the json file:

{
  "name": {
    "en": "Area",
    "pl": "Powierzchnia"
  },
  "version": 1,
  "author": [
    "root"
  ],
  "global": "en",
  "units": [
    {
      "symbol": "m²",
      "descriptionPrefix": {
        "en": "square ",
        "pl": ""
      },
      "description": {
        "en": "meter",
        "pl": "metr kwadratowy"
      },
      "one": 1,
      "prefixes": [
        {
          "symbol": "k",
          "description": {
            "en": "kilo"
          },
          "exp": 6,
          "position": 3
        },
        {
          "symbol": "d",
          "description": {
            "en": "deci",
            "pl": "decy"
          },
          "exp": -2
        },
        {
          "symbol": "c",
          "description": {
            "en": "centi",
            "pl": "centy"
          },
          "": -4
        },
      ]
    },
    {
      "symbol": "in²",
      "description": {
        "en": "square inch",
        "pl": "cal kwadratowy"
      },
      "one": 0.00064516
    }
  ]
}

You can find more measures files on this folder: ./app/src/main/assets/converters

Properties

property value
file {name, version, author, global, units}
name {"country_code" : "measure name"}
version integer
author ["author name"]
global base country code name
units [{symbol, descriptionPrefix, description, one, shift, shift2, expBase, prefixes}]
symbol base unit symbol
descriptionPrefix {"country_code" : "description prefix"}
description {"country_code" : "description"}
one number of multiples of base unit, default is 1
shift number of shift to the basic unit, default is 0
shift2 number of shift to the basic unit, default is 0
expBase exponent base for prefixes, default is 10
prefixes [{symbol, description, exp}]
symbol prefix symbol
description {"country_code" : "prefix description"}
exp prefix exponent

Equations

In the file you define paramiters for the equation that caluclate target unit value from base unit:

y = \alpha*(x + \Delta_1) + \Delta_2

where:

  • $x$ - value of base unit
  • $y$ - value of target unit
  • $\alpha$ - one - multiply of base value
  • $\Delta_1$ - shift_1 - shift base value before multiply
  • $\Delta_2$ - shift_2 - shift base value after multiply

For calculate base unit value form target unit, the equation is:

x = \frac{1}{\alpha}*(y - \Delta_2) - \Delta_1

To calculate from one unit to another, it used this formula:

f(x) = \frac{1}{\alpha^T}*(\alpha^S*(x + \Delta_1^S) + \Delta_2^S - \Delta_2^T) - \Delta_1^T

where:

  • $x$ - value of source unit
  • $f(x)$ - value of target unit
  • $\alpha^S$ - one from source unit
  • $\Delta_1^S$ - shift_1 from source unit
  • $\Delta_2^S$ - shift_2 from source unit
  • $\alpha^T$ - one from target unit
  • $\Delta_1^T$ - shift_1 from target unit
  • $\Delta_2^T$ - shift_2 from target unit

Screens

License

MIT

Google Play and the Google Play logo are trademarks of Google LLC.