Aghajari / AXEmojiView

an advanced library which adds emoji,sticker,... support to your Android application.
Apache License 2.0
179 stars 45 forks source link

When the popupLayout is hidden, the keyboard pops out the edittext as if leaving room for the PopupLayout. #36

Closed Scorpionstvo closed 2 years ago

Scorpionstvo commented 2 years ago

Please, help me solve this problem

My layout:

` <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/cl_chat" android:layout_width="match_parent" android:layout_height="match_parent">

<androidx.constraintlayout.widget.ConstraintLayout
    android:id="@+id/input_layout"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:background="@color/white"
    android:elevation="6dp"
    app:layout_constraintBottom_toTopOf="@id/layout"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/standard_panel"
        android:layout_width="0dp"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/white"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent">

        <ImageButton
            android:id="@+id/button_send_message"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_gravity="center_vertical"
            android:layout_marginHorizontal="16dp"
            android:background="?attr/selectableItemBackgroundBorderless"
            android:src="@drawable/ic_material_send_24"
            android:visibility="gone"
            app:layout_constraintBottom_toBottomOf="@id/standard_panel"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="@id/standard_panel"
            app:tint="@color/blue_300" />

    </androidx.constraintlayout.widget.ConstraintLayout>

    <com.aghajari.emojiview.view.AXEmojiEditText
        android:id="@+id/chat_input"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="12dp"
        android:layout_marginEnd="12dp"
        android:background="@android:color/transparent"
        android:cursorVisible="true"
        android:fadingEdge="vertical"
        android:filterTouchesWhenObscured="false"
        android:hint="@string/chat_input_hint"
        android:imeOptions="actionSend|flagNoExtractUi"
        android:inputType="textAutoCorrect|textCapSentences|textMultiLine"
        android:maxLines="6"
        android:paddingTop="8dp"
        android:scrollbars="vertical"
        app:layout_constraintBottom_toBottomOf="@id/button_emoticon"
        app:layout_constraintEnd_toStartOf="@id/button_attach"
        app:layout_constraintStart_toEndOf="@id/button_emoticon"
        app:layout_goneMarginEnd="52dp" />

    <ImageButton
        android:id="@+id/button_emoticon"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:layout_gravity="center_vertical"
        android:layout_marginStart="16dp"
        android:background="@color/transparent"
        app:layout_constraintBottom_toBottomOf="@id/standard_panel"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@id/standard_panel"
        app:srcCompat="@drawable/ic_emoticon_outline"
        app:tint="@color/grey_500" />

    <ImageButton
        android:id="@+id/button_attach"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:layout_marginHorizontal="20dp"
        android:background="@color/transparent"
        android:src="@drawable/ic_attach"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@id/btn_record"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_goneMarginEnd="50dp"
        app:tint="@color/grey_500" />

    <ImageButton
        android:id="@+id/btn_record"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:clickable="false"
        android:layout_marginHorizontal="16dp"
        android:background="@color/transparent"
        android:filterTouchesWhenObscured="false"
        android:src="@drawable/ic_microphone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:tint="@color/grey_500" />

</androidx.constraintlayout.widget.ConstraintLayout>

<com.aghajari.emojiview.view.AXEmojiPopupLayout
    android:id="@+id/layout"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"/>

</androidx.constraintlayout.widget.ConstraintLayout>`

My code: ` AXEmojiManager.install(requireContext(), AXGoogleEmojiProvider(requireContext())) val emojiView = AXEmojiView(requireContext()) emojiView.editText = binding.chatInput binding.layout.initPopupView(emojiView)

    binding.buttonEmoticon.setOnClickListener {
        if (binding.layout.isShowing) binding.layout.hideAndOpenKeyboard() else
            binding.layout.toggle()
    }

``

1e53bec7-3010-448e-9df4-d80afcbc40a8

Aghajari commented 2 years ago

Hello @Scorpionstvo Add this line to your activity AndroidManifest.xml

android:windowSoftInputMode="adjustResize|adjustNothing"
Scorpionstvo commented 2 years ago

Привет@Scorpionstvo Добавьте эту строку в свою деятельностьAndroidManifest.xml

android:windowSoftInputMode="adjustResize|adjustNothing"

Unfortunately, it didn't help

Aghajari commented 2 years ago

Can you send a sample project of that? i'll fix it and send it back to you

Scorpionstvo commented 2 years ago

Can you send a sample project of that? i'll fix it and send it back to you

https://github.com/Scorpionstvo/Emoji.git - here is my sample. Is it possible, that I'm doing something wrong? Thank you very much for helping me!

Aghajari commented 2 years ago

Hello again, i just added android:windowSoftInputMode="adjustResize|adjustNothing" and it works fine!

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="garipolesya.com.example.emoji">

    <application
        android:allowBackup="true"
        android:windowSoftInputMode="adjustResize|adjustNothing"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Emoji"
        tools:targetApi="31">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:windowSoftInputMode="adjustResize|adjustNothing">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

app-debug.apk.zip

Scorpionstvo commented 2 years ago

Oh, I thought that adding the windowSoftInputMode attribute to the manifest on a application level applies this feature to all activities. Now it works. Thank you, your library is amazing!