Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Added support for 6 band resistors.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktprograms committed Mar 22, 2021
1 parent 7afcca6 commit 8c02f9d
Show file tree
Hide file tree
Showing 29 changed files with 709 additions and 233 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelogs

### V 0.1.5 Beta
- Added support for 6 band resistors.

>MD5: 6397213d8512015a98e86bc3f4cce077
>
>SHA1: 025936325afb16697f5177aba48e16e1c8d51ed1
### V 0.1.4 Beta
- BUGFIX: Fixed extra band being visible even in 4 band mode when the app starts.

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ You can swipe left/right to go to the previous/next E series value.

<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/4.png" width="214" height="419" />
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/5.png" width="214" height="419" />

When in 5 band mode, tapping the '6' icon in the top right will enter into 6 band mode. Tapping the icon (which will have changed to a '5' icon) again will go back to 5 band mode.

<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/6.png" width="214" height="419" />
<hr />

## Download
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ android {
applicationId "com.ktprograms.ohmsnow"
minSdkVersion 16
targetSdkVersion 30
versionCode 5
versionName "v0.1.4-beta"
versionCode 6
versionName "v0.1.5-beta"

vectorDrawables.useSupportLibrary true
}
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/java/com/ktprograms/ohmsnow/Colors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,16 @@ enum class ToleranceBandColors(val argb: Int) {
enum class BodyColors(val argb: Int) {
BEIGE(0xFFFAD6A5.toInt()),
BLUE(0xFF00BFFF.toInt())
}

enum class TempCoefBandColors(val argb: Int) {
BLACK(0xFF000000.toInt()),
BROWN(0xFF964B00.toInt()),
RED(0xFFFF0000.toInt()),
ORANGE(0xFFFF7F50.toInt()),
YELLOW(0xFFFFFF00.toInt()),
GREEN(0xFF32CD32.toInt()),
BLUE(0xFF0000FF.toInt()),
VIOLET(0xFF9400D3.toInt()),
GREY(0xFF808080.toInt())
}
22 changes: 22 additions & 0 deletions app/src/main/java/com/ktprograms/ohmsnow/ESeries.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/*
* GNU General Public License v3.0
*
* Copyright (c) 2021 Toh Jeen Gie Keith
*
*
* This file is part of Ohms Now!.
*
* Ohms Now! is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Ohms Now! is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Ohms Now!. If not, see <https://www.gnu.org/licenses/>.
*/

package com.ktprograms.ohmsnow

val e6 = listOf(
Expand Down
383 changes: 271 additions & 112 deletions app/src/main/java/com/ktprograms/ohmsnow/MainActivity.kt

Large diffs are not rendered by default.

9 changes: 2 additions & 7 deletions app/src/main/res/drawable/band_1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,8 @@
android:viewportWidth="200.0"
android:viewportHeight="110.0">

<!--<path android:fillColor="#FF0000FF"
<path android:fillColor="@color/blue"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:pathData="M30,22.7 Q37,23 45,27.9 L45,82 Q37,87 30,87.3 Z" />-->

<path android:fillColor="#FF0000FF"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:strokeColor="@android:color/transparent"
android:pathData="M25,23 Q32,21.5 40,25.5 L40,84.5 Q32,88.5 25,87 Z" />
</vector>
9 changes: 2 additions & 7 deletions app/src/main/res/drawable/band_2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,8 @@
android:viewportWidth="200.0"
android:viewportHeight="110.0">

<!--<path android:fillColor="#FF808080"
<path android:fillColor="@color/grey"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:pathData="M55,31 L70,31 L70,79 L55,79 Z" />-->

<path android:fillColor="#FF808080"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:strokeColor="@android:color/transparent"
android:pathData="M50,31 L65,31 L65,79 L50,79 Z" />
</vector>
9 changes: 2 additions & 7 deletions app/src/main/res/drawable/band_3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,8 @@
android:viewportWidth="200.0"
android:viewportHeight="110.0">

<!--<path android:fillColor="#FFFF0000"
<path android:fillColor="@color/red"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:pathData="M80,31 L95,31 L95,79 L80,79 Z" />-->

<path android:fillColor="#FFFF0000"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:strokeColor="@android:color/transparent"
android:pathData="M75,31 L90,31 L90,79 L75,79 Z" />
</vector>
9 changes: 2 additions & 7 deletions app/src/main/res/drawable/band_4.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,8 @@
android:viewportWidth="200.0"
android:viewportHeight="110.0">

<!--<path android:fillColor="#FFFF0000"
<path android:fillColor="@color/red"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:pathData="M105,31 L120,31 L120,79 L105,79 Z" />-->

<path android:fillColor="#FFFF0000"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:strokeColor="@android:color/transparent"
android:pathData="M100,31 L115,31 L115,79 L100,79 Z" />
</vector>
11 changes: 3 additions & 8 deletions app/src/main/res/drawable/band_5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,8 @@
android:viewportWidth="200.0"
android:viewportHeight="110.0">

<!--<path android:fillColor="#FFD4AF37"
<path android:fillColor="@color/gold"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:pathData="M170,22.7 Q163,23 155,27.9 L155,82 Q163,87 170,87.3 Z" />-->

<path android:fillColor="#FFD4AF37"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:pathData="M175,23 Q168,21.5 160,25.5 L160,84.5 Q168,88.5 175,87 Z" />
android:strokeColor="@android:color/transparent"
android:pathData="M135,31 L150,31 L150,79 L135,79 Z" />
</vector>
38 changes: 38 additions & 0 deletions app/src/main/res/drawable/icon_5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!--
~ GNU General Public License v3.0
~
~ Copyright (c) 2021 Toh Jeen Gie Keith
~
~
~ This file is part of Ohms Now!.
~
~ Ohms Now! is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ Ohms Now! is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with Ohms Now!. If not, see <https://www.gnu.org/licenses/>.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">

<path
android:fillColor="@android:color/black"
android:strokeWidth="0"
android:strokeColor="@android:color/transparent"
android:pathData="M5,5 L19,5 L19,19 L5,19 Z"/>

<path
android:fillColor="@android:color/white"
android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM15,9h-4v2h2c1.1,0 2,0.89 2,2v2c0,1.11 -0.9,2 -2,2L9,17v-2h4v-2L9,13L9,7h6v2z"/>
</vector>
38 changes: 38 additions & 0 deletions app/src/main/res/drawable/icon_6.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!--
~ GNU General Public License v3.0
~
~ Copyright (c) 2021 Toh Jeen Gie Keith
~
~
~ This file is part of Ohms Now!.
~
~ Ohms Now! is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ Ohms Now! is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with Ohms Now!. If not, see <https://www.gnu.org/licenses/>.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">

<path
android:fillColor="@android:color/black"
android:strokeWidth="0"
android:strokeColor="@android:color/transparent"
android:pathData="M5,5 L19,5 L19,19 L5,19 Z"/>

<path
android:fillColor="@android:color/white"
android:pathData="M11,15h2v-2h-2v2zM19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM15,9h-4v2h2c1.1,0 2,0.89 2,2v2c0,1.11 -0.9,2 -2,2h-2c-1.1,0 -2,-0.89 -2,-2L9,9c0,-1.11 0.9,-2 2,-2h4v2z"/>
</vector>
44 changes: 2 additions & 42 deletions app/src/main/res/drawable/resistor_body.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,48 +27,8 @@
android:viewportWidth="200.0"
android:viewportHeight="110.0">

<!--<path android:fillColor="#33FFFFFF"
<path android:fillColor="@color/colorPrimary"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:pathData="M0,0 L200,0 L200,200 L0,200 Z" />-->

<path android:fillColor="#FFFAD6A5"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:strokeColor="@android:color/transparent"
android:pathData="M50,30 H150 C180,10 190,30 190,50 V60 C190,80 180,100 150,80 H50 C20,100 10,80 10,60 V50 C10,30 20,10 50,30 Z" />

<!--<path android:fillColor="#FF0000FF"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:pathData="M30,22.7 Q37,23 45,27.9 L45,82 Q37,87 30,87.3 Z" />
<path android:fillColor="#FFC0C0C0"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:pathData="M55,31 L70,31 L70,79 L55,79 Z" />
<path android:fillColor="#FFFF0000"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:pathData="M80,31 L95,31 L95,79 L80,79 Z" />
<path android:fillColor="#FF9400D3"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:pathData="M105,31 L120,31 L120,79 L105,79 Z" />
<path android:fillColor="#FFD4AF37"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:pathData="M170,22.7 Q163,23 155,27.9 L155,82 Q163,87 170,87.3 Z" />
<path android:fillColor="#FF000000"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:pathData="M0,45 L10,45 L10,65 L0,65 Z" />
<path android:fillColor="#FF000000"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:pathData="M190,45 L200,45 L200,65 L190,65 Z" />-->
</vector>
12 changes: 6 additions & 6 deletions app/src/main/res/drawable/resistor_outline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
android:viewportWidth="200.0"
android:viewportHeight="110.0">

<path android:fillColor="#FFC0C0C0"
<path android:fillColor="@color/silver"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:strokeColor="@android:color/transparent"
android:pathData="M0,45 L10,45 L10,65 L0,65 Z" />

<path android:fillColor="#FFC0C0C0"
<path android:fillColor="@color/silver"
android:strokeWidth="0"
android:strokeColor="#00000000"
android:strokeColor="@android:color/transparent"
android:pathData="M190,45 L200,45 L200,65 L190,65 Z" />

<path android:fillColor="#00000000"
<path android:fillColor="@android:color/transparent"
android:strokeWidth="2"
android:strokeColor="#FF000000"
android:strokeColor="@android:color/black"
android:pathData="M50,30 H150 C180,10 190,30 190,50 V60 C190,80 180,100 150,80 H50 C20,100 10,80 10,60 V50 C10,30 20,10 50,30 Z" />
</vector>
15 changes: 15 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,31 @@
android:adjustViewBounds="true"
android:background="@null"
android:scaleType="fitCenter"
android:visibility="invisible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/band_5" />

<ImageButton
android:id="@+id/band_6"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:background="@null"
android:scaleType="fitCenter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/band_6" />

<TextView
android:id="@+id/ohms_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="6.8 KΩ ±5%"
android:textColor="?android:attr/textColorPrimary"
android:textSize="50sp"
Expand Down
32 changes: 32 additions & 0 deletions app/src/main/res/menu/app_bar_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ GNU General Public License v3.0
~
~ Copyright (c) 2021 Toh Jeen Gie Keith
~
~
~ This file is part of Ohms Now!.
~
~ Ohms Now! is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ Ohms Now! is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with Ohms Now!. If not, see <https://www.gnu.org/licenses/>.
-->

<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">

<item
android:id="@+id/num_bands"
android:icon="@drawable/icon_6"
android:title="Number of Bands"
app:showAsAction="always" />
</menu>
Loading

0 comments on commit 8c02f9d

Please sign in to comment.