Coder Social home page Coder Social logo

emojiconverter's Introduction

Build Quality Gate Status

EmojiConverter

This is a HMOS library used to convert text to Emoji's from a textfield or from other sources.

Source

The code in this repository was inspired from AnkitKiet/EmojiConverter - Release 1.15. We are very thankful to AnkitKiet.

Demo

EmojiConverter library converts text to it's corresponding emoji .

finaldemo

Dependency

  1. For using EmojiConverter module in sample app, include the source code and add the below dependencies in entry/build.gradle to generate hap/support.har.
	dependencies {
		implementation project(':emojiconverter')
        	implementation fileTree(dir: 'libs', include: ['*.har'])
        	testImplementation 'junit:junit:4.13'
	}
  1. For using EmojiConverter in separate application using har file, add the har file in the entry/libs folder and add the dependencies in entry/build.gradle file.
	dependencies {
		implementation fileTree(dir: 'libs', include: ['*.har'])
		testImplementation 'junit:junit:4.13'
	}

  1. For using EmojiConverter from a remote repository in separate application, add the below dependencies in entry/build.gradle file.
    dependencies {
	    implementation 'dev.applibgroup:emojiconverter:1.0.0'
	    testCompile 'junit:junit:4.13'
    }

Usage

Declare in XML (see xml attributes below for customization):

<TextField
        ohos:id="$+id:textfield"
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:hint="Enter your text"
        ohos:text_size="70px"
        ohos:layout_alignment="center"
        ohos:top_margin="70px"
        ohos:bottom_margin="50px"
        />

    <Text
        ohos:id="$+id:text"
        ohos:height="match_content"
        ohos:width="match_content"
        ohos:background_element="$graphic:background_ability_main"
        ohos:layout_alignment="horizontal_center"
        ohos:text=" "
        ohos:text_size="50px"
        />

Include following code in your activity :

TextField textField = (TextField) findComponentById(ResourceTable.Id_textfield);
Text text = (Text) findComponentById(ResourceTable.Id_text);
EmojiConverter emojiConverter = new EmojiConverter(this);

//don't add a textobserver on the same textfield it will cause a stackoverflow error.
textField.addTextObserver((s, i, i1, i2) -> {
            String mod = emojiConverter.convertToEmoji(s);
            text.setText(mod);
        });
     

Future works

Since the retrofit library is unavailable in hmos , emojis.json file was parsed from a local directory using zsonArray and zsonObject . Once retrofit library is available in hmos , emoji.json can be parsed using it.

License

Copyright 2017 Ankit Maurya

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

emojiconverter's People

Contributors

applibengineering avatar muhammed-fazil-k avatar samuel-abhishek avatar sharathks84 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.