kopia lustrzana https://github.com/ryukoposting/Signal-Android
Go back to emoji selection on keyboard close in search.
rodzic
84e27e7bff
commit
c59006e06e
|
@ -167,7 +167,7 @@ public class MediaKeyboard extends FrameLayout implements InputView,
|
||||||
transaction.runOnCommit(() -> show(latestKeyboardHeight, false));
|
transaction.runOnCommit(() -> show(latestKeyboardHeight, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
transaction.commit();
|
transaction.commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onOpenEmojiSearch() {
|
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)
|
.add(R.id.media_keyboard_fragment_container, new EmojiSearchFragment(), EMOJI_SEARCH)
|
||||||
.runOnCommit(() -> show(latestKeyboardHeight, true))
|
.runOnCommit(() -> show(latestKeyboardHeight, true))
|
||||||
.setCustomAnimations(R.anim.fade_in, R.anim.fade_out)
|
.setCustomAnimations(R.anim.fade_in, R.anim.fade_out)
|
||||||
.commit();
|
.commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.thoughtcrime.securesms.keyboard.emoji.search
|
package org.thoughtcrime.securesms.keyboard.emoji.search
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.graphics.Rect
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
|
@ -10,6 +11,7 @@ import androidx.lifecycle.ViewModelProviders
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import org.thoughtcrime.securesms.R
|
import org.thoughtcrime.securesms.R
|
||||||
|
import org.thoughtcrime.securesms.components.KeyboardAwareLinearLayout
|
||||||
import org.thoughtcrime.securesms.components.emoji.EmojiKeyboardProvider
|
import org.thoughtcrime.securesms.components.emoji.EmojiKeyboardProvider
|
||||||
import org.thoughtcrime.securesms.components.emoji.EmojiPageView
|
import org.thoughtcrime.securesms.components.emoji.EmojiPageView
|
||||||
import org.thoughtcrime.securesms.components.emoji.EmojiPageViewGridAdapter
|
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]
|
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 eventListener: EmojiKeyboardProvider.EmojiEventListener = requireNotNull(findListener())
|
||||||
val searchBar: KeyboardPageSearchView = view.findViewById(R.id.emoji_search_view)
|
val searchBar: KeyboardPageSearchView = view.findViewById(R.id.emoji_search_view)
|
||||||
val resultsContainer: FrameLayout = view.findViewById(R.id.emoji_search_results_container)
|
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
|
noResults.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
view.post {
|
||||||
|
keyboardAwareLinearLayout.addOnKeyboardHiddenListener {
|
||||||
|
callback.closeEmojiSearch()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class SearchCallbacks : KeyboardPageSearchView.Callbacks {
|
private inner class SearchCallbacks : KeyboardPageSearchView.Callbacks {
|
||||||
override fun onNavigationClicked() {
|
override fun onNavigationClicked() {
|
||||||
ViewUtil.hideKeyboard(requireContext(), requireView())
|
ViewUtil.hideKeyboard(requireContext(), requireView())
|
||||||
callback.closeEmojiSearch()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onQueryChanged(query: String) {
|
override fun onQueryChanged(query: String) {
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="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
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/emoji_keyboard_search_appbar"
|
android:id="@+id/emoji_keyboard_search_appbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/signal_background_secondary"
|
android:background="@color/signal_background_tertiary"
|
||||||
app:elevation="0dp"
|
app:elevation="0dp"
|
||||||
app:expanded="false">
|
app:expanded="false">
|
||||||
|
|
||||||
|
|
|
@ -1,46 +1,53 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/kb_aware_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/signal_background_tertiary">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.keyboard.emoji.KeyboardPageSearchView
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/emoji_search_view"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="8dp"
|
android:background="@color/signal_background_tertiary">
|
||||||
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" />
|
|
||||||
|
|
||||||
<TextView
|
<org.thoughtcrime.securesms.keyboard.emoji.KeyboardPageSearchView
|
||||||
android:id="@+id/emoji_search_empty"
|
android:id="@+id/emoji_search_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:layout_marginTop="8dp"
|
||||||
android:text="@string/EmojiSearchFragment__no_results_found"
|
android:transitionName="emoji_search_transition"
|
||||||
android:visibility="gone"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/emoji_search_results_container"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/emoji_search_results_container"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:visibility="visible" />
|
app:search_hint="@string/KeyboardPagerFragment_search_emoji"
|
||||||
|
app:show_always="true" />
|
||||||
|
|
||||||
<FrameLayout
|
<TextView
|
||||||
android:id="@+id/emoji_search_results_container"
|
android:id="@+id/emoji_search_empty"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/emoji_drawer_item_width"
|
android:layout_height="0dp"
|
||||||
android:layout_marginStart="16dp"
|
android:gravity="center"
|
||||||
android:layout_marginTop="8dp"
|
android:text="@string/EmojiSearchFragment__no_results_found"
|
||||||
android:layout_marginEnd="16dp"
|
android:visibility="gone"
|
||||||
android:layout_marginBottom="8dp"
|
app:layout_constraintBottom_toBottomOf="@id/emoji_search_results_container"
|
||||||
android:orientation="horizontal"
|
app:layout_constraintTop_toTopOf="@id/emoji_search_results_container"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
tools:visibility="visible" />
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/emoji_search_view" />
|
|
||||||
|
|
||||||
</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>
|
Ładowanie…
Reference in New Issue