Skip to content

Commit

Permalink
1.0.5
Browse files Browse the repository at this point in the history
updated to jdk11
updated android gradle plugin
code refactoring
comments added
decimal number bug that converted numbers like 12.1 to 12.09999999999999999 fixed
etc
  • Loading branch information
yamin8000 committed Aug 10, 2021
1 parent 6495684 commit 8c74c22
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 135 deletions.
11 changes: 6 additions & 5 deletions Persian_Numbers/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 31
versionCode 2
versionName "1.0.4"
versionCode 3
versionName "1.0.5"
consumerProguardFiles "consumer-rules.pro"
}

Expand All @@ -27,11 +27,12 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '11'
useIR = true
}
}

Expand Down
246 changes: 159 additions & 87 deletions Persian_Numbers/src/main/java/ir/yamin/digits/Digits.kt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ internal object PersianNumber {
internal const val RADIX = "ممیز"
internal const val ZERO = "صفر"
internal const val ONE = "یک"
internal const val AND = "و"
private const val TWO = "دو"
private const val THREE = "سه"
private const val FOUR = "چهار"
Expand Down Expand Up @@ -48,43 +49,51 @@ internal object PersianNumber {
/**
* Single digits numbers representation
*/
val singleDigits = mutableMapOf(0L to ZERO, 1L to ONE, 2L to TWO, 3L to THREE, 4L to FOUR, 5L to FIVE,
6L to SIX, 7L to SEVEN, 8L to EIGHT, 9L to NINE)
val singleDigits = mapOf(
0L to ZERO, 1L to ONE, 2L to TWO, 3L to THREE, 4L to FOUR, 5L to FIVE, 6L to SIX,
7L to SEVEN, 8L to EIGHT, 9L to NINE,
)

/**
* Two digits numbers representation
*/
val twoDigits = mutableMapOf(10L to TEN, 11L to "یاز$TEN", 12L to "دواز$TEN", 13L to "سیز$TEN",
14L to "$FOUR$TEN", 15L to "پانز$TEN", 16L to "شانز$TEN", 17L to "هف$TEN",
18L to "هج$TEN", 19L to "نوز$TEN", 20L to "بیست", 30L to "سی", 40L to "چهل",
50L to "پنجاه", 60L to "شصت", 70L to "هفتاد", 80L to "هشتاد", 90L to "نود")
val twoDigits = mapOf(
10L to TEN, 11L to "یاز$TEN", 12L to "دواز$TEN", 13L to "سیز$TEN",
14L to "$FOUR$TEN", 15L to "پانز$TEN", 16L to "شانز$TEN", 17L to "هف$TEN",
18L to "هج$TEN", 19L to "نوز$TEN", 20L to "بیست", 30L to "سی", 40L to "چهل",
50L to "پنجاه", 60L to "شصت", 70L to "هفتاد", 80L to "هشتاد", 90L to "نود",
)

/**
* Three digits numbers representation
*/
val threeDigits = mutableMapOf(100L to "یک$HUNDRED", 200L to "دویست", 300L to "سی$HUNDRED",
400L to "$FOUR$HUNDRED", 500L to "پان$HUNDRED", 600L to "$SIX$HUNDRED",
700L to "$SEVEN$HUNDRED", 800L to "$EIGHT$HUNDRED",
900L to "$NINE$HUNDRED")
val threeDigits = mapOf(
100L to "یک$HUNDRED", 200L to "دویست", 300L to "سی$HUNDRED",
400L to "$FOUR$HUNDRED", 500L to "پان$HUNDRED", 600L to "$SIX$HUNDRED",
700L to "$SEVEN$HUNDRED", 800L to "$EIGHT$HUNDRED", 900L to "$NINE$HUNDRED",
)

/**
* Ten multipliers representation
*/
val tenMultipliers = mutableMapOf(1_000L to THOUSAND, 1_000_000L to MILLION, 1_000_000_000L to MILLIARD,
1_000_000_000_000L to TRILLION, 1_000_000_000_000_000L to QUADRILLION,
1_000_000_000_000_000_000L to QUINTILLION)
val tenMultipliers = mapOf(
1_000L to THOUSAND, 1_000_000L to MILLION, 1_000_000_000L to MILLIARD,
1_000_000_000_000L to TRILLION, 1_000_000_000_000_000L to QUADRILLION,
1_000_000_000_000_000_000L to QUINTILLION,
)

/**
* Big integer multipliers representation
*/
private val bigTen = BigInteger("10")
val bigIntegerMultipliers = mutableMapOf(bigTen.pow(21) to SEXTILLION, bigTen.pow(24) to SEPTILLION,
bigTen.pow(27) to OCTILLION, bigTen.pow(30) to NONILLION,
bigTen.pow(33) to DECILLION, bigTen.pow(36) to UNDECILLION,
bigTen.pow(39) to DUODECILLION, bigTen.pow(42) to TREDECILLION,
bigTen.pow(45) to QUATTUORDECILLION,
bigTen.pow(48) to QUINDECILLION, bigTen.pow(51) to SEXDECILLION,
bigTen.pow(54) to SEPTENDECILLION,
bigTen.pow(57) to OCTODECILLION,
bigTen.pow(60) to NOVEMDECILLION, bigTen.pow(63) to VIGINTILLION)
internal val bigTen = BigInteger("10")
val bigIntegerMultipliers = mapOf(
bigTen.pow(21) to SEXTILLION, bigTen.pow(24) to SEPTILLION,
bigTen.pow(27) to OCTILLION, bigTen.pow(30) to NONILLION,
bigTen.pow(33) to DECILLION, bigTen.pow(36) to UNDECILLION,
bigTen.pow(39) to DUODECILLION, bigTen.pow(42) to TREDECILLION,
bigTen.pow(45) to QUATTUORDECILLION, bigTen.pow(48) to QUINDECILLION,
bigTen.pow(51) to SEXDECILLION, bigTen.pow(54) to SEPTENDECILLION,
bigTen.pow(57) to OCTODECILLION, bigTen.pow(60) to NOVEMDECILLION,
bigTen.pow(63) to VIGINTILLION,
)
}
21 changes: 11 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ plugins {
}

android {
compileSdkVersion 30
compileSdkVersion 31
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "ir.yamin.digitstest"
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 31
versionCode 1
versionName "1.0"
}
Expand All @@ -23,20 +23,21 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '11'
useIR = true
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation project(path: ':Persian_Numbers')
//implementation 'com.github.yamin8000:PrettyPersianNumbers:1.0.0'
//implementation 'com.github.yamin8000:PrettyPersianNumbers:1.0.4'
}
16 changes: 9 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,23 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Digitstest">
<activity android:name=".MainActivity2">
<activity
android:name=".MainActivity2"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<!-- <activity android:name=".MainActivity">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <activity android:name=".MainActivity">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->

<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
<!-- </activity>-->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
<!-- </activity>-->
</application>

</manifest>
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.android.tools.build:gradle:7.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

classpath 'com.vanniktech:gradle-maven-publish-plugin:0.14.2'
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.4.32'
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip

0 comments on commit 8c74c22

Please sign in to comment.