Go back to emoji selection on keyboard close in search.

fork-5.53.8
Alex Hart 2021-06-03 14:21:38 -03:00
rodzic 84e27e7bff
commit c59006e06e
4 zmienionych plików z 56 dodań i 41 usunięć

Wyświetl plik

@ -167,7 +167,7 @@ public class MediaKeyboard extends FrameLayout implements InputView,
transaction.runOnCommit(() -> show(latestKeyboardHeight, false));
}
transaction.commit();
transaction.commitAllowingStateLoss();
}
public void onOpenEmojiSearch() {
@ -182,7 +182,7 @@ public class MediaKeyboard extends FrameLayout implements InputView,
.add(R.id.media_keyboard_fragment_container, new EmojiSearchFragment(), EMOJI_SEARCH)
.runOnCommit(() -> show(latestKeyboardHeight, true))
.setCustomAnimations(R.anim.fade_in, R.anim.fade_out)
.commit();
.commitAllowingStateLoss();
}
private void initView() {

Wyświetl plik

@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.keyboard.emoji.search
import android.content.Context
import android.graphics.Rect
import android.os.Bundle
import android.view.View
import android.widget.FrameLayout
@ -10,6 +11,7 @@ import androidx.lifecycle.ViewModelProviders
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import org.thoughtcrime.securesms.R
import org.thoughtcrime.securesms.components.KeyboardAwareLinearLayout
import org.thoughtcrime.securesms.components.emoji.EmojiKeyboardProvider
import org.thoughtcrime.securesms.components.emoji.EmojiPageView
import org.thoughtcrime.securesms.components.emoji.EmojiPageViewGridAdapter
@ -34,6 +36,7 @@ class EmojiSearchFragment : Fragment(R.layout.emoji_search_fragment), EmojiPageV
viewModel = ViewModelProviders.of(this, factory)[EmojiSearchViewModel::class.java]
val keyboardAwareLinearLayout: KeyboardAwareLinearLayout = view.findViewById(R.id.kb_aware_layout)
val eventListener: EmojiKeyboardProvider.EmojiEventListener = requireNotNull(findListener())
val searchBar: KeyboardPageSearchView = view.findViewById(R.id.emoji_search_view)
val resultsContainer: FrameLayout = view.findViewById(R.id.emoji_search_results_container)
@ -56,12 +59,17 @@ class EmojiSearchFragment : Fragment(R.layout.emoji_search_fragment), EmojiPageV
noResults.visibility = View.VISIBLE
}
}
view.post {
keyboardAwareLinearLayout.addOnKeyboardHiddenListener {
callback.closeEmojiSearch()
}
}
}
private inner class SearchCallbacks : KeyboardPageSearchView.Callbacks {
override fun onNavigationClicked() {
ViewUtil.hideKeyboard(requireContext(), requireView())
callback.closeEmojiSearch()
}
override fun onQueryChanged(query: String) {

Wyświetl plik

@ -4,13 +4,13 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/signal_background_secondary">
android:background="@color/signal_background_tertiary">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/emoji_keyboard_search_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/signal_background_secondary"
android:background="@color/signal_background_tertiary"
app:elevation="0dp"
app:expanded="false">

Wyświetl plik

@ -1,46 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<org.thoughtcrime.securesms.components.KeyboardAwareLinearLayout 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/kb_aware_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/signal_background_tertiary">
android:orientation="vertical">
<org.thoughtcrime.securesms.keyboard.emoji.KeyboardPageSearchView
android:id="@+id/emoji_search_view"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:transitionName="emoji_search_transition"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:search_hint="@string/KeyboardPagerFragment_search_emoji"
app:show_always="true" />
android:layout_height="match_parent"
android:background="@color/signal_background_tertiary">
<TextView
android:id="@+id/emoji_search_empty"
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="center"
android:text="@string/EmojiSearchFragment__no_results_found"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/emoji_search_results_container"
app:layout_constraintTop_toTopOf="@id/emoji_search_results_container"
tools:visibility="visible" />
<org.thoughtcrime.securesms.keyboard.emoji.KeyboardPageSearchView
android:id="@+id/emoji_search_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:transitionName="emoji_search_transition"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:search_hint="@string/KeyboardPagerFragment_search_emoji"
app:show_always="true" />
<FrameLayout
android:id="@+id/emoji_search_results_container"
android:layout_width="match_parent"
android:layout_height="@dimen/emoji_drawer_item_width"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/emoji_search_view" />
<TextView
android:id="@+id/emoji_search_empty"
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="center"
android:text="@string/EmojiSearchFragment__no_results_found"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/emoji_search_results_container"
app:layout_constraintTop_toTopOf="@id/emoji_search_results_container"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:id="@+id/emoji_search_results_container"
android:layout_width="match_parent"
android:layout_height="@dimen/emoji_drawer_item_width"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/emoji_search_view" />
</androidx.constraintlayout.widget.ConstraintLayout>
</org.thoughtcrime.securesms.components.KeyboardAwareLinearLayout>