Skip to content

Commit

Permalink
improved detection
Browse files Browse the repository at this point in the history
  • Loading branch information
cinkhangin committed Nov 30, 2022
1 parent 214d37f commit a0df2dd
Show file tree
Hide file tree
Showing 36 changed files with 105 additions and 83 deletions.
6 changes: 1 addition & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,9 @@ dependencies {

implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':zawni')
}
Binary file added app/src/debug/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions app/src/debug/res/drawable/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#222222">
<group android:scaleX="1.7748"
android:scaleY="1.7748"
android:translateX="32.7024"
android:translateY="32.7024">
<path
android:fillColor="@android:color/white"
android:pathData="M9.93,13.5h4.14L12,7.98 9.93,13.5zM20,2L4,2c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM15.71,17.88l-0.9,-2.38L9.17,15.5l-0.89,2.37c-0.14,0.38 -0.5,0.63 -0.91,0.63 -0.68,0 -1.15,-0.69 -0.9,-1.32l4.25,-10.81c0.22,-0.53 0.72,-0.87 1.28,-0.87s1.06,0.34 1.27,0.87l4.25,10.81c0.25,0.63 -0.22,1.32 -0.9,1.32 -0.4,0 -0.76,-0.25 -0.91,-0.62z"/>
</group>
</vector>
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions app/src/main/java/com/naulian/zawni/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ class MainActivity : AppCompatActivity() {
viewBinding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

val test = "ဆိုတဲ့စကားလုံး အဓိပ္ပါယ်ကဘာလဲ"
val unicode = "အပြည်ပြည်ဆိုင်ရာ လူ့အခွင့်အရေး ကြေညာစာတမ်း"
val zawgyi = "အျပည္ျပည္ဆိုင္ရာ လူ႔အခြင့္အေရး ေၾကညာစာတမ္း"

binding.apply {
txtOutput.text = test.zawnify()
edtInput.addTextChangedListener {
it?.let {
val text = it.toString().zawnify()
txtOutput.text = text
val text = it.toString()
txtOutput.text = text.zawnify()
}
}
}
Expand Down
30 changes: 0 additions & 30 deletions app/src/main/res/drawable-v24/ic_launcher_foreground.xml

This file was deleted.

15 changes: 15 additions & 0 deletions app/src/main/res/drawable/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108"
android:tint="#84FFBF">
<group android:scaleX="1.7748"
android:scaleY="1.7748"
android:translateX="32.7024"
android:translateY="32.7024">
<path
android:fillColor="@android:color/white"
android:pathData="M9.93,13.5h4.14L12,7.98 9.93,13.5zM20,2L4,2c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM15.71,17.88l-0.9,-2.38L9.17,15.5l-0.89,2.37c-0.14,0.38 -0.5,0.63 -0.91,0.63 -0.68,0 -1.15,-0.69 -0.9,-1.32l4.25,-10.81c0.22,-0.53 0.72,-0.87 1.28,-0.87s1.06,0.34 1.27,0.87l4.25,10.81c0.25,0.63 -0.22,1.32 -0.9,1.32 -0.4,0 -0.76,-0.25 -0.91,-0.62z"/>
</group>
</vector>
Binary file added app/src/main/res/font/myanmar_regular.ttf
Binary file not shown.
60 changes: 43 additions & 17 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,57 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
tools:context=".MainActivity">

<com.google.android.material.chip.ChipGroup
android:id="@+id/chipGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:singleSelection="true">

<com.google.android.material.chip.Chip
android:id="@+id/chpA2R"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/any_to_readable" />

<com.google.android.material.chip.Chip
android:id="@+id/chpZ2U"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/zawgyi_to_unicode" />

<com.google.android.material.chip.Chip
android:id="@+id/chpU2Z"
style="@style/Widget.Material3.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/unicode_to_zawgyi" />
</com.google.android.material.chip.ChipGroup>

<com.google.android.material.card.MaterialCardView
android:id="@+id/crdInput"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_width="match_parent"
android:layout_height="0dp"
app:cardCornerRadius="12dp"
app:cardElevation="6dp"
app:strokeWidth="0dp"
app:layout_constraintBottom_toTopOf="@+id/spc"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toBottomOf="@+id/chipGroup">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edtInput"
android:layout_width="match_parent"
android:hint="@string/app_name"
android:gravity="top"
android:padding="12dp"
android:layout_height="match_parent"
android:background="@color/white"
android:layout_height="match_parent"/>
android:gravity="top"
android:hint="@string/app_name"
android:padding="12dp" />
</com.google.android.material.card.MaterialCardView>

<Space
Expand All @@ -37,13 +66,10 @@

<com.google.android.material.card.MaterialCardView
android:id="@+id/crdOutput"
app:cardElevation="6dp"
app:cardCornerRadius="12dp"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_width="match_parent"
android:layout_height="0dp"
app:cardCornerRadius="12dp"
app:strokeWidth="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/spc">

Expand All @@ -53,10 +79,10 @@

<TextView
android:id="@+id/txtOutput"
android:padding="12dp"
android:gravity="top"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:gravity="top"
android:padding="12dp" />

</ScrollView>
</com.google.android.material.card.MaterialCardView>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
4 changes: 2 additions & 2 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Binary file added app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher.webp
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Binary file not shown.
Binary file added app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher.webp
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Binary file not shown.
Binary file added app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Binary file not shown.
Binary file added app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
16 changes: 0 additions & 16 deletions app/src/main/res/values-night/themes.xml

This file was deleted.

4 changes: 4 additions & 0 deletions app/src/main/res/values/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<resources>
<string name="app_name">Zawni</string>
<string name="zawgyi2unicode">Zawgyi2Unicode</string>
<string name="unicode_to_zawgyi">Unicode to Zawgyi</string>
<string name="zawgyi_to_unicode">Zawgyi to Unicode</string>
<string name="any_to_readable">Any to Readable</string>
</resources>
13 changes: 7 additions & 6 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<resources>
<!-- Base application theme. -->
<style name="Theme.Zawni" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<style name="Theme.Zawni" parent="Theme.Material3.DayNight">

<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->

<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->

<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->

<item name="fontFamily">@font/myanmar_regular</item>
</style>
</resources>
8 changes: 5 additions & 3 deletions zawni/src/main/java/com/naulian/zawni/Zawni.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
package com.naulian.zawni

import android.content.Context
import android.util.Log
import com.google.myanmartools.TransliterateU2Z
import com.google.myanmartools.TransliterateZ2U
import com.google.myanmartools.ZawgyiDetector


private const val TAG = "Zawni"
//change unicode into device encoding
fun String.zawnify(): String {
val z2U = TransliterateZ2U("Zawgyi to Unicode")
Expand All @@ -21,8 +22,9 @@ fun String.zawnify(): String {
}

fun String.isZawgyi(): Boolean {
val score = ZawgyiDetector().getZawgyiProbability(this)
return score > 0.8
val score = ZawgyiDetector().getZawgyiProbability(this , true)
Log.i(TAG, "isZawgyi: ZawgyiProbability : $score")
return score == 1.0
}

object Zawni {
Expand Down

0 comments on commit a0df2dd

Please sign in to comment.