diff --git a/CHANGES.md b/CHANGES.md index 7904834e62..a4aa0b7a0f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,7 +4,8 @@ Changes in Element 1.0.12 (2020-XX-XX) Features ✨: - Add room aliases management, and room directory visibility management in a dedicated screen (#1579, #2428) - Room setting: update join rules and guest access (#2442) - - Store encrypted file in cache and cleanup decrypted file at each app start + - Store encrypted file in cache and cleanup decrypted file at each app start (#2512) + - Emoji Keyboard (#2520) Improvements 🙌: - Add Setting Item to Change PIN (#2462) diff --git a/vector/build.gradle b/vector/build.gradle index 62ff3951af..28d8fe5c1b 100644 --- a/vector/build.gradle +++ b/vector/build.gradle @@ -440,6 +440,10 @@ dependencies { implementation 'com.google.zxing:core:3.3.3' implementation 'me.dm7.barcodescanner:zxing:1.9.13' + // Emoji Keyboard + implementation 'com.vanniktech:emoji-material:0.7.0' + implementation 'com.vanniktech:emoji-google:0.7.0' + // TESTS testImplementation 'junit:junit:4.13' testImplementation "org.amshove.kluent:kluent-android:$kluent_version" diff --git a/vector/src/main/assets/open_source_licenses.html b/vector/src/main/assets/open_source_licenses.html index ac80b0d691..acf0bec14f 100755 --- a/vector/src/main/assets/open_source_licenses.html +++ b/vector/src/main/assets/open_source_licenses.html @@ -347,11 +347,6 @@ SOFTWARE.
Copyright 2017 Gabriel Ittner. -
  • - Android-multipicker-library -
    - Copyright 2018 Kumar Bibek -
  • htmlcompressor
    @@ -390,6 +385,11 @@ SOFTWARE.
    Copyright 2018, Aleksandr Nikiforov
  • +
  • + Emoji +
    + Copyright (C) 2016 - Niklas Baudy, Ruben Gees, Mario Đanić and contributors +
  •  Apache License
    diff --git a/vector/src/main/java/im/vector/app/VectorApplication.kt b/vector/src/main/java/im/vector/app/VectorApplication.kt
    index 5be313d719..921e8c0780 100644
    --- a/vector/src/main/java/im/vector/app/VectorApplication.kt
    +++ b/vector/src/main/java/im/vector/app/VectorApplication.kt
    @@ -36,6 +36,8 @@ import com.airbnb.epoxy.EpoxyAsyncUtil
     import com.airbnb.epoxy.EpoxyController
     import com.facebook.stetho.Stetho
     import com.gabrielittner.threetenbp.LazyThreeTen
    +import com.vanniktech.emoji.EmojiManager
    +import com.vanniktech.emoji.google.GoogleEmojiProvider
     import im.vector.app.core.di.ActiveSessionHolder
     import im.vector.app.core.di.DaggerVectorComponent
     import im.vector.app.core.di.HasVectorInjector
    @@ -184,6 +186,8 @@ class VectorApplication :
                 addAction(Intent.ACTION_SCREEN_OFF)
                 addAction(Intent.ACTION_SCREEN_ON)
             })
    +
    +        EmojiManager.install(GoogleEmojiProvider())
         }
     
         private fun enableStrictModeIfNeeded() {
    diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt
    index f1ae79a0aa..93b2b69ba5 100644
    --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt
    +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailFragment.kt
    @@ -53,7 +53,6 @@ import androidx.lifecycle.Observer
     import androidx.recyclerview.widget.ItemTouchHelper
     import androidx.recyclerview.widget.LinearLayoutManager
     import androidx.recyclerview.widget.RecyclerView
    -import butterknife.BindView
     import com.airbnb.epoxy.EpoxyModel
     import com.airbnb.epoxy.OnModelBuildFinishedListener
     import com.airbnb.epoxy.addGlidePreloader
    @@ -69,6 +68,7 @@ import com.airbnb.mvrx.withState
     import com.google.android.material.snackbar.Snackbar
     import com.google.android.material.textfield.TextInputEditText
     import com.jakewharton.rxbinding3.widget.textChanges
    +import com.vanniktech.emoji.EmojiPopup
     import im.vector.app.R
     import im.vector.app.core.dialogs.ConfirmationDialogBuilder
     import im.vector.app.core.dialogs.GalleryOrCameraDialogHelper
    @@ -286,8 +286,6 @@ class RoomDetailFragment @Inject constructor(
         private lateinit var attachmentsHelper: AttachmentsHelper
         private lateinit var keyboardStateUtils: KeyboardStateUtils
     
    -    @BindView(R.id.composerLayout)
    -    lateinit var composerLayout: TextComposerView
         private lateinit var attachmentTypeSelector: AttachmentTypeSelectorView
     
         private var lockSendButton = false
    @@ -308,6 +306,7 @@ class RoomDetailFragment @Inject constructor(
             setupActiveCallView()
             setupJumpToBottomView()
             setupConfBannerView()
    +        setupEmojiPopup()
     
             roomToolbarContentView.debouncedClicks {
                 navigator.openRoomProfile(requireActivity(), roomDetailArgs.roomId)
    @@ -475,6 +474,20 @@ class RoomDetailFragment @Inject constructor(
             }
         }
     
    +    private fun setupEmojiPopup() {
    +        val emojiPopup = EmojiPopup
    +                .Builder
    +                .fromRootView(rootConstraintLayout)
    +                .setKeyboardAnimationStyle(R.style.emoji_fade_animation_style)
    +                .setOnEmojiPopupShownListener { composerLayout?.composerEmojiButton?.setImageResource(R.drawable.ic_keyboard) }
    +                .setOnEmojiPopupDismissListener { composerLayout?.composerEmojiButton?.setImageResource(R.drawable.ic_insert_emoji) }
    +                .build(composerLayout.composerEditText)
    +
    +        composerLayout.composerEmojiButton.debouncedClicks {
    +            emojiPopup.toggle()
    +        }
    +    }
    +
         private fun joinJitsiRoom(jitsiWidget: Widget, enableVideo: Boolean) {
             navigator.openRoomWidget(requireContext(), roomDetailArgs.roomId, jitsiWidget, mapOf(JitsiCallViewModel.ENABLE_VIDEO_OPTION to enableVideo))
         }
    @@ -1208,9 +1221,6 @@ class RoomDetailFragment @Inject constructor(
                 scrollOnHighlightedEventCallback.timeline = roomDetailViewModel.timeline
                 timelineEventController.update(state)
                 inviteView.visibility = View.GONE
    -            val uid = session.myUserId
    -            val meMember = state.myRoomMember()
    -            avatarRenderer.render(MatrixItem.UserItem(uid, meMember?.displayName, meMember?.avatarUrl), composerLayout.composerAvatarImageView)
                 if (state.tombstoneEvent == null) {
                     if (state.canSendMessage) {
                         composerLayout.visibility = View.VISIBLE
    diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/ComposerEditText.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/ComposerEditText.kt
    index 353ab783db..2257e5ee81 100644
    --- a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/ComposerEditText.kt
    +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/ComposerEditText.kt
    @@ -24,16 +24,16 @@ import android.text.Editable
     import android.util.AttributeSet
     import android.view.inputmethod.EditorInfo
     import android.view.inputmethod.InputConnection
    -import androidx.appcompat.widget.AppCompatEditText
     import androidx.core.view.inputmethod.EditorInfoCompat
     import androidx.core.view.inputmethod.InputConnectionCompat
    +import com.vanniktech.emoji.EmojiEditText
     import im.vector.app.core.extensions.ooi
     import im.vector.app.core.platform.SimpleTextWatcher
     import im.vector.app.features.html.PillImageSpan
     import timber.log.Timber
     
     class ComposerEditText @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = android.R.attr.editTextStyle)
    -    : AppCompatEditText(context, attrs, defStyleAttr) {
    +    : EmojiEditText(context, attrs, defStyleAttr) {
     
         interface Callback {
             fun onRichContentSelected(contentUri: Uri): Boolean
    diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/TextComposerView.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/TextComposerView.kt
    index f4b14571c0..af0e1a91f0 100644
    --- a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/TextComposerView.kt
    +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/TextComposerView.kt
    @@ -72,8 +72,8 @@ class TextComposerView @JvmOverloads constructor(context: Context, attrs: Attrib
         @BindView(R.id.composerEditText)
         lateinit var composerEditText: ComposerEditText
     
    -    @BindView(R.id.composer_avatar_view)
    -    lateinit var composerAvatarImageView: ImageView
    +    @BindView(R.id.composer_emoji)
    +    lateinit var composerEmojiButton: ImageButton
     
         @BindView(R.id.composer_shield)
         lateinit var composerShieldImageView: ImageView
    diff --git a/vector/src/main/res/drawable/bg_send.xml b/vector/src/main/res/drawable/bg_send.xml
    new file mode 100644
    index 0000000000..4b357d7ab1
    --- /dev/null
    +++ b/vector/src/main/res/drawable/bg_send.xml
    @@ -0,0 +1,9 @@
    +
    +
    +    
    +        
    +            
    +        
    +    
    +    
    +
    \ No newline at end of file
    diff --git a/vector/src/main/res/drawable/ic_attachment.xml b/vector/src/main/res/drawable/ic_attachment.xml
    index 944998c1cd..ea01e94372 100644
    --- a/vector/src/main/res/drawable/ic_attachment.xml
    +++ b/vector/src/main/res/drawable/ic_attachment.xml
    @@ -1,7 +1,21 @@
    -
    -    
    +
    +  
    +  
    +  
     
    diff --git a/vector/src/main/res/drawable/ic_insert_emoji.xml b/vector/src/main/res/drawable/ic_insert_emoji.xml
    new file mode 100644
    index 0000000000..c35000342b
    --- /dev/null
    +++ b/vector/src/main/res/drawable/ic_insert_emoji.xml
    @@ -0,0 +1,21 @@
    +
    +  
    +  
    +  
    +  
    +
    diff --git a/vector/src/main/res/drawable/ic_keyboard.xml b/vector/src/main/res/drawable/ic_keyboard.xml
    new file mode 100644
    index 0000000000..5e5d431abb
    --- /dev/null
    +++ b/vector/src/main/res/drawable/ic_keyboard.xml
    @@ -0,0 +1,4 @@
    +
    +    
    +
    diff --git a/vector/src/main/res/layout/constraint_set_composer_layout_compact.xml b/vector/src/main/res/layout/constraint_set_composer_layout_compact.xml
    index ac67db6a64..6b9fbd4885 100644
    --- a/vector/src/main/res/layout/constraint_set_composer_layout_compact.xml
    +++ b/vector/src/main/res/layout/constraint_set_composer_layout_compact.xml
    @@ -77,9 +77,9 @@
             android:alpha="0"
             app:layout_constraintEnd_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="parent"
    +        app:tint="?riotx_text_primary"
             tools:ignore="MissingConstraints,MissingPrefix"
    -        tools:src="@drawable/ic_edit"
    -        app:tint="?riotx_text_primary" />
    +        tools:src="@drawable/ic_edit" />
     
     
         
    +        app:tint="@color/riotx_notice"
    +        tools:ignore="MissingPrefix"
    +        tools:visibility="visible" />
     
    -    
    -
    +        tools:ignore="MissingPrefix" />
     
         
    -
    +        tools:visibility="visible" />
     
         
    +        app:layout_constraintTop_toTopOf="@id/sendButton"
    +        app:layout_goneMarginEnd="8dp" />
     
         
     
         
    diff --git a/vector/src/main/res/layout/constraint_set_composer_layout_expanded.xml b/vector/src/main/res/layout/constraint_set_composer_layout_expanded.xml
    index dba996309e..f52b072ece 100644
    --- a/vector/src/main/res/layout/constraint_set_composer_layout_expanded.xml
    +++ b/vector/src/main/res/layout/constraint_set_composer_layout_expanded.xml
    @@ -83,9 +83,9 @@
             app:layout_constraintEnd_toEndOf="@id/composer_related_message_avatar_view"
             app:layout_constraintStart_toStartOf="@id/composer_related_message_avatar_view"
             app:layout_constraintTop_toBottomOf="@id/composer_related_message_avatar_view"
    -        tools:src="@drawable/ic_edit"
             app:tint="?riotx_text_primary"
    -        tools:ignore="MissingPrefix" />
    +        tools:ignore="MissingPrefix"
    +        tools:src="@drawable/ic_edit" />
     
     
         
     
    -
    -    
    -
    -
    -    
    -
    -
    -
         
     
    +    
    +
    +    
    +
         
     
    diff --git a/vector/src/main/res/layout/merge_composer_layout.xml b/vector/src/main/res/layout/merge_composer_layout.xml
    index 908b3f009b..ea2bc1bf30 100644
    --- a/vector/src/main/res/layout/merge_composer_layout.xml
    +++ b/vector/src/main/res/layout/merge_composer_layout.xml
    @@ -70,8 +70,8 @@
             android:id="@+id/composer_related_message_action_image"
             android:layout_width="0dp"
             android:layout_height="0dp"
    -        tools:ignore="MissingConstraints,MissingPrefix"
    -        app:tint="?riotx_text_primary" />
    +        app:tint="?riotx_text_primary"
    +        tools:ignore="MissingConstraints,MissingPrefix" />
     
         
     
    -
    -    
    +        android:background="?android:attr/selectableItemBackground"
    +        android:src="@drawable/ic_insert_emoji"
    +        tools:ignore="MissingConstraints" />