Coder Social home page Coder Social logo

Comments (2)

Invocatis avatar Invocatis commented on August 23, 2024

I'm having a similar issue. Here's my specifics

  • Phone: Pixel 5
  • OS: iode, version: 4.4-20230824-redfin
  • Build number: TQ3A.230805.001 dev-keys
  • App version: 3.10.1

Specific message
🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕🤍💕!!!!!!!!!!!!!!

from qksms.

rezaJpour avatar rezaJpour commented on August 23, 2024

Remove EMOJI_REGEX from MessagesAdapter:
Remove the declaration and usage of EMOJI_REGEX from your MessagesAdapter class. This means you no longer need the Regex pattern EMOJI_REGEX in your adapter.

Update emojiOnly variable:
Change the line
val emojiOnly = messageText.isNotBlank() && messageText.matches(EMOJI_REGEX)
to :
val emojiOnly = messageText.isNotBlank() && containsOnlyEmoji(messageText.toString())
This means you're now calling the containsOnlyEmoji function to check if the message contains only emojis.

Add containsOnlyEmoji function:
Add the following function to your code:

fun containsOnlyEmoji(text: String): Boolean {
    val regexPattern = Regex("^[\\p{So}]+$")
    return regexPattern.matches(text)
}

This function checks if the given text contains only emojis by using the Regex pattern ^[\p{So}]+$. If the text matches this pattern (i.e., contains only emojis), it returns true; otherwise, it returns false.

         // Update emojiOnly variable
        val emojiOnly = messageText.isNotBlank() && containsOnlyEmoji(messageText.toString())

By following these steps, you'll remove the EMOJI_REGEX, update the emojiOnly variable, and add the containsOnlyEmoji function to your MessagesAdapter class.

from qksms.

Related Issues (20)

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.