No description or website provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Add examples Activities for conversion on background thread, Fix race… Jul 16, 2018
gradle/wrapper Update Git Ignore and add option to use background conversion Jul 15, 2018
mdetect Add examples Activities for conversion on background thread, Fix race… Jul 16, 2018
.gitignore Add examples Activities for conversion on background thread, Fix race… Jul 16, 2018
License.md Add examples Activities for conversion on background thread, Fix race… Jul 16, 2018
README.md Create README.md Jul 15, 2018
Screenshot_Unicode.png added screenshots Nov 23, 2016
Screenshot_Zawgyi.png added screenshots Nov 23, 2016
build.gradle
gradle.properties initial commit Nov 23, 2016
gradlew initial commit Nov 23, 2016
gradlew.bat initial commit Nov 23, 2016
settings.gradle initial commit Nov 23, 2016

README.md

MDetect

MDetect is yet another library for displaying Burmese texts for Android.

Zawgyi device and Unicode device

How it works

MDetect detects the device's font i.e. whether the user is using Unicode or Zawgyi by drawing က္က and compare the width with က. It doesnt embed any font and convert the text to Zawgyi if the user is using Zawgyi and it doesn't effect the performance of the app much.

Download

Gradle:

compile 'myatminsoe.mdetect.android:mdetect-android:3.2'

or Maven:

<dependency>
  <groupId>myatminsoe.mdetect.android</groupId>
  <artifactId>mdetect-android</artifactId>
  <version>3.2</version>
  <type>pom</type>
</dependency>

How to use

Kotlin

Initialize MDetect on your Application class onCreate.

override fun onCreate() {
    super.onCreate()
    MDetect.init(this)
}

MDetect can be used for deciding whether the user is using Unicode.

if (MDetect.isUnicode()){
  //user is using Unicode
} else {
  //user is using Zawgyi or showing squares
}

Java

Initialize MDetect on your Application class onCreate.

@Override
public void onCreate() {
    super.onCreate();
    MDetect.INSTANCE.init(this);
}

MDetect can be used for deciding whether the user is using Unicode.

if (MDetect.INSTANCE.isUnicode()){
  //user is using Unicode
} else {
  //user is using Zawgyi or showing squares
}

MDetect have custom views for TextView, EditText and Button

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    android:padding="16dp"
    >

  <me.myatminsoe.mdetect.MMTextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:padding="8dp"
      android:text="@string/myanmar_textview"
      android:textColor="@color/grey_900"
      />

  <me.myatminsoe.mdetect.MMEditText
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:hint="@string/myanmar_edittext"
      android:padding="8dp"
      />

  <me.myatminsoe.mdetect.MMButtonView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:onClick="showMyanmarToast"
      android:padding="8dp"
      android:text="@string/myanmar_button"
      />

</LinearLayout>

Setting and Getting Text for custom views

use setMMText() and getMMText() instead of setText() and getText() for custom views.

Getting Text

Kotlin

MDetect.getText("မင်္ဂလာပါ") //return မဂၤလာပါ is the device is using zawgyi

Java

MDetect.INSTANCE.getText("မင်္ဂလာပါ") //return မဂၤလာပါ is the device is using zawgyi

Toast

Kotlin

MMToast.showShortToast(this, "မင်္ဂလာပါ")
MMToast.showLongToast(this, "မင်္ဂလာပါ")

Java

MMToast.INSTANCE.showShortToast(this, "မင်္ဂလာပါ")
MMToast.INSTANCE.showLongToast(this, "မင်္ဂလာပါ")

Zawgyi <-> Unicode Converter

MDetect use Rabbit Converter for converting Zawgyi and Unicode and you can also use the features from Rabbit Converter.

Kotlin

val uniSt = Rabbit.zg2uni("ေနေကာင္းလား"); //နေကောင်းလား
val zgSt = Rabbit.uni2zg("နေကောင်းလား"); //ေနေကာင္းလား

Java

String uniSt = Rabbit.zg2uni("ေနေကာင္းလား"); //နေကောင်းလား
String zgSt = Rabbit.uni2zg("နေကောင်းလား"); //ေနေကာင္းလား

See the sample app for more detail.

License

MIT License

Copyright (c) 2016 Myat Min Soe

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.