BanglaTextView | Bangla Utils
It’s a tribute to the Bangla Language. It can convert some certain types of English patterns into Bengali format, for now i.e. Any Numbers, Date, Ordinal Indicator, Month, Year, Distance, Weight, Amounts. and many more. It also has an Android TextView that can convert the supported patterns directly.
Preview
Dependencies
-
in your top level build.gradle file add the jitpack dependency
maven { url 'https://jitpack.io' }
-
in application level build.gradle add the BanglaTextView dependency
implementation 'com.github.noman404:BanglaTextView:1.0.6'
Usage
From .xml
<com.al.tobangla.views.BNTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="21.00"
toBangla:processType="amount" />
From Java
BNTextView bnTextView = new BNTextView(this);
bnTextView.setProcessType(ProcessType.AMOUNT);
bnTextView.setText("21.00");
Direct Process
You can use your own Textview
and use ToBN
converter to do your own conversion. ToBN.getInstance()
provide the direct access of it's underhood methods to achieve more complex processing/conversion. Example.
Supported Conversions
- Date
- Number
- Amount
- Time
- Ordinal Indicator (Date, Number, Today)
- Current Date, Time
- Distance, Weight units
Process Type | Flag | Method [ToBN.getInstance(): Return String Result] | Output |
---|---|---|---|
Date | DATE | String getDate(String date) | ২০১৮-০৫-০৭ |
Number | NUMBER | String getNumber(String anyNumber) | ৭৫ |
Time | TIME | String getNumber(String time) | ০৫:০৭ |
Amount | AMOUNT | String getAmount(String amount) | ৳ ৫৭ |
Today | TODAY | String getToday() | রবিবার |
Date Ordinal Indicator | ORDINAL_INDICATOR_FOR_DATE | String getOrdinalDate(String DDMMYYYY) | ১৬ই ডিসেম্বর, ১৯৭১ |
Number Ordinal Indicator | ORDINAL_INDICATOR_FOR_NUMERIC_ORDER | String getOrdinalIndicator(String theNumber, ProcessType.ORDINAL_INDICATOR_FOR_NUMERIC_ORDER) | ১৩ তম |
Today Ordinal Indicator | ORDINAL_INDICATOR_TODAY | String getTodayOrdinalDate() | ০৭/০৫/২০১৮ |
Current Time | TIME_NOW | String getCurrentTime() | ১২:০৯:২৫ |
Distance | DISTANCE | String getDistance(String distanceWithUnit) | ২১ কিলোমিটার |
Weight | WEIGHT | String getWeight(String weightWithUnit) | ২.৫ কেজি |