Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
260f76fe
Commit
260f76fe
authored
Jul 03, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor package and visibility refactors
parent
7d31fefb
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
36 deletions
+25
-36
Text.kt
...src/main/java/chat/rocket/android/util/extensions/Text.kt
+0
-23
EmojiKeyboardPopup.kt
...main/java/chat/rocket/android/emoji/EmojiKeyboardPopup.kt
+3
-4
EmojiPickerPopup.kt
...c/main/java/chat/rocket/android/emoji/EmojiPickerPopup.kt
+2
-0
EmojiRepository.kt
...rc/main/java/chat/rocket/android/emoji/EmojiRepository.kt
+7
-5
Fitzpatrick.kt
emoji/src/main/java/chat/rocket/android/emoji/Fitzpatrick.kt
+1
-1
EmojiCategory.kt
.../java/chat/rocket/android/emoji/internal/EmojiCategory.kt
+5
-2
EmojiPagerAdapter.kt
...a/chat/rocket/android/emoji/internal/EmojiPagerAdapter.kt
+7
-1
No files found.
app/src/main/java/chat/rocket/android/util/extensions/Text.kt
View file @
260f76fe
...
...
@@ -5,10 +5,8 @@ import android.text.Spanned
import
android.text.TextUtils
import
android.util.Base64
import
android.util.Patterns
import
android.widget.EditText
import
android.widget.TextView
import
chat.rocket.android.emoji.EmojiParser
import
chat.rocket.android.emoji.EmojiTypefaceSpan
import
org.json.JSONObject
import
ru.noties.markwon.Markwon
import
java.net.URLDecoder
...
...
@@ -21,21 +19,6 @@ fun String.ifEmpty(value: String): String {
return
this
}
fun
CharSequence
.
ifEmpty
(
value
:
String
):
CharSequence
{
if
(
isEmpty
())
{
return
value
}
return
this
}
fun
EditText
.
erase
()
{
this
.
text
.
clear
()
val
spans
=
this
.
text
.
getSpans
(
0
,
text
.
length
,
EmojiTypefaceSpan
::
class
.
java
)
spans
.
forEach
{
text
.
removeSpan
(
it
)
}
}
fun
String
.
isEmail
():
Boolean
=
Patterns
.
EMAIL_ADDRESS
.
matcher
(
this
).
matches
()
fun
String
.
encodeToBase64
():
String
{
...
...
@@ -94,9 +77,3 @@ var TextView.content: CharSequence?
Markwon
.
scheduleDrawables
(
this
)
Markwon
.
scheduleTableRows
(
this
)
}
var
TextView
.
spanned
:
CharSequence
?
get
()
=
text
set
(
value
)
{
text
=
spanned
}
\ No newline at end of file
emoji/src/main/java/chat/rocket/android/emoji/EmojiKeyboardPopup.kt
View file @
260f76fe
...
...
@@ -16,13 +16,12 @@ import androidx.appcompat.app.AppCompatActivity
import
androidx.core.content.ContextCompat
import
androidx.core.graphics.drawable.DrawableCompat
import
androidx.viewpager.widget.ViewPager
import
chat.rocket.android.emoji.internal.EmojiCategory
import
chat.rocket.android.emoji.internal.EmojiPagerAdapter
import
com.google.android.material.tabs.TabLayout
class
EmojiKeyboardPopup
(
context
:
Context
,
view
:
View
)
:
OverKeyboardPopupWindow
(
context
,
view
)
{
class
EmojiKeyboardPopup
(
context
:
Context
,
view
:
View
)
:
OverKeyboardPopupWindow
(
context
,
view
)
{
private
lateinit
var
viewPager
:
ViewPager
private
lateinit
var
tabLayout
:
TabLayout
...
...
emoji/src/main/java/chat/rocket/android/emoji/EmojiPickerPopup.kt
View file @
260f76fe
...
...
@@ -7,6 +7,8 @@ import android.view.LayoutInflater
import
android.view.Window
import
android.view.WindowManager
import
android.widget.ImageView
import
chat.rocket.android.emoji.internal.EmojiCategory
import
chat.rocket.android.emoji.internal.EmojiPagerAdapter
import
kotlinx.android.synthetic.main.emoji_picker.*
...
...
emoji/src/main/java/chat/rocket/android/emoji/EmojiRepository.kt
View file @
260f76fe
...
...
@@ -3,6 +3,7 @@ package chat.rocket.android.emoji
import
android.content.Context
import
android.content.SharedPreferences
import
android.graphics.Typeface
import
chat.rocket.android.emoji.internal.EmojiCategory
import
org.json.JSONArray
import
org.json.JSONObject
import
java.io.BufferedReader
...
...
@@ -12,6 +13,7 @@ import java.util.*
import
java.util.regex.Pattern
object
EmojiRepository
{
private
val
FITZPATRICK_REGEX
=
"(.*)_(tone[0-9]):"
.
toRegex
(
RegexOption
.
IGNORE_CASE
)
private
val
shortNameToUnicode
=
HashMap
<
String
,
String
>()
private
val
SHORTNAME_PATTERN
=
Pattern
.
compile
(
":([-+\\w]+):"
)
...
...
@@ -83,7 +85,7 @@ object EmojiRepository {
*
* @return All emojis for all categories.
*/
fun
getAll
()
=
ALL_EMOJIS
internal
fun
getAll
()
=
ALL_EMOJIS
/**
* Get all emojis for a given category.
...
...
@@ -92,7 +94,7 @@ object EmojiRepository {
*
* @return All emoji from specified category
*/
fun
getEmojisByCategory
(
category
:
EmojiCategory
):
List
<
Emoji
>
{
internal
fun
getEmojisByCategory
(
category
:
EmojiCategory
):
List
<
Emoji
>
{
return
ALL_EMOJIS
.
filter
{
it
.
category
.
toLowerCase
()
==
category
.
name
.
toLowerCase
()
}
}
...
...
@@ -103,12 +105,12 @@ object EmojiRepository {
*
* @return Emoji given by shortname or null
*/
fun
getEmojiByShortname
(
shortname
:
String
)
=
ALL_EMOJIS
.
firstOrNull
{
it
.
shortname
==
shortname
}
internal
fun
getEmojiByShortname
(
shortname
:
String
)
=
ALL_EMOJIS
.
firstOrNull
{
it
.
shortname
==
shortname
}
/**
* Add an emoji to the Recents category.
*/
fun
addToRecents
(
emoji
:
Emoji
)
{
internal
fun
addToRecents
(
emoji
:
Emoji
)
{
val
emojiShortname
=
emoji
.
shortname
val
recentsJson
=
JSONObject
(
preferences
.
getString
(
EmojiKeyboardPopup
.
PREF_EMOJI_RECENTS
,
"{}"
))
if
(
recentsJson
.
has
(
emojiShortname
))
{
...
...
@@ -125,7 +127,7 @@ object EmojiRepository {
*
* @return All recent emojis ordered by usage.
*/
fun
getRecents
():
List
<
Emoji
>
{
internal
fun
getRecents
():
List
<
Emoji
>
{
val
list
=
mutableListOf
<
Emoji
>()
val
recentsJson
=
JSONObject
(
preferences
.
getString
(
EmojiKeyboardPopup
.
PREF_EMOJI_RECENTS
,
"{}"
))
for
(
shortname
in
recentsJson
.
keys
())
{
...
...
emoji/src/main/java/chat/rocket/android/emoji/Fitzpatrick.kt
View file @
260f76fe
package
chat.rocket.android.emoji
/**
* Taken the Fitzpatrick scale as reference adapted to be used with emojione.
* Taken the Fitzpatrick scale as reference a
nd a
dapted to be used with emojione.
*
* @see <a href="https://en.wikipedia.org/wiki/Fitzpatrick_scale">https://en.wikipedia.org/wiki/Fitzpatrick_scale</a>
*/
...
...
emoji/src/main/java/chat/rocket/android/emoji/EmojiCategory.kt
→
emoji/src/main/java/chat/rocket/android/emoji/
internal/
EmojiCategory.kt
View file @
260f76fe
package
chat.rocket.android.emoji
package
chat.rocket.android.emoji
.internal
import
android.text.SpannableString
import
android.text.Spanned
import
androidx.annotation.DrawableRes
import
chat.rocket.android.emoji.EmojiRepository
import
chat.rocket.android.emoji.EmojiTypefaceSpan
import
chat.rocket.android.emoji.R
enum
class
EmojiCategory
{
internal
enum
class
EmojiCategory
{
RECENTS
{
override
fun
resourceIcon
()
=
R
.
drawable
.
ic_emoji_recents
...
...
emoji/src/main/java/chat/rocket/android/emoji/EmojiPagerAdapter.kt
→
emoji/src/main/java/chat/rocket/android/emoji/
internal/
EmojiPagerAdapter.kt
View file @
260f76fe
package
chat.rocket.android.emoji
package
chat.rocket.android.emoji
.internal
import
android.view.LayoutInflater
import
android.view.View
...
...
@@ -9,6 +9,12 @@ import androidx.recyclerview.widget.DefaultItemAnimator
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
androidx.viewpager.widget.PagerAdapter
import
chat.rocket.android.emoji.Emoji
import
chat.rocket.android.emoji.EmojiKeyboardListener
import
chat.rocket.android.emoji.EmojiParser
import
chat.rocket.android.emoji.EmojiRepository
import
chat.rocket.android.emoji.Fitzpatrick
import
chat.rocket.android.emoji.R
import
kotlinx.android.synthetic.main.emoji_category_layout.view.*
import
java.util.*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment