Fix searchfab
This commit is contained in:
1 parent
7ce273ec67
commit
0effc0d181
4 files changed
+55
-22
No files matched your search
@@ -555,7 +555,7 @@ public final class GalleryListScene extends SearchBarScene
|
||||
FastScroller fastScroller = mContentLayout.getFastScroller();
|
||||
mSearchLayout = (SearchLayout) ViewUtils.$$(mainLayout, R.id.search_layout);
|
||||
mFabLayout = (FabLayout) ViewUtils.$$(mainLayout, R.id.fab_layout);
|
||||
mSearchFab = ViewUtils.$$(mainLayout, R.id.search_fab);
|
||||
mSearchFab = ViewUtils.$$(container, R.id.search_fab);
|
||||
ViewCompat.setWindowInsetsAnimationCallback(view, new WindowInsetsAnimationHelper(
|
||||
WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_STOP,
|
||||
mFabLayout,
|
||||
@@ -606,6 +606,12 @@ public final class GalleryListScene extends SearchBarScene
|
||||
int colorID = ResourcesKt.resolveColor(getTheme(), com.google.android.material.R.attr.colorOnSurface);
|
||||
mActionFabDrawable = new AddDeleteDrawable(context, colorID);
|
||||
mFabLayout.getPrimaryFab().setImageDrawable(mActionFabDrawable);
|
||||
mSearchFab.setOnClickListener( (v) -> {
|
||||
if (STATE_NORMAL != mState) {
|
||||
onApplySearch();
|
||||
hideSoftInput();
|
||||
}
|
||||
});
|
||||
|
||||
// Update list url builder
|
||||
onUpdateUrlBuilder();
|
||||
@@ -945,6 +951,18 @@ public final class GalleryListScene extends SearchBarScene
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSearchViewExpanded() {
|
||||
super.onSearchViewExpanded();
|
||||
selectSearchFab(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSearchViewHidden() {
|
||||
super.onSearchViewHidden();
|
||||
if (mState == STATE_NORMAL) selectActionFab(true);
|
||||
}
|
||||
|
||||
public boolean onItemLongClick(int position) {
|
||||
final Context context = getContext();
|
||||
final MainActivity activity = getMainActivity();
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.core.widget.addTextChangedListener
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@@ -55,14 +56,27 @@ abstract class SearchBarScene : ToolbarScene() {
|
||||
mRecyclerView?.adapter = mSuggestionAdapter
|
||||
val layoutManager = LinearLayoutManager(context)
|
||||
mRecyclerView?.layoutManager = layoutManager
|
||||
mSearchView?.addTransitionListener { _, _, _ ->
|
||||
(requireActivity() as StageActivity).updateBackPressCallBackStatus()
|
||||
updateSuggestions()
|
||||
mSearchView?.addTransitionListener { _, _, newState ->
|
||||
if (newState == SearchView.TransitionState.SHOWING)
|
||||
onSearchViewExpanded()
|
||||
else if (newState == SearchView.TransitionState.HIDING)
|
||||
onSearchViewHidden()
|
||||
}
|
||||
val contentView = onCreateViewWithToolbar(inflater, view, savedInstanceState)
|
||||
return view.apply { addView(contentView, 0) }
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
open fun onSearchViewExpanded() {
|
||||
(requireActivity() as StageActivity).updateBackPressCallBackStatus()
|
||||
updateSuggestions()
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
open fun onSearchViewHidden() {
|
||||
(requireActivity() as StageActivity).updateBackPressCallBackStatus()
|
||||
}
|
||||
|
||||
fun setSearchBarHint(hint: String?) {
|
||||
(mToolbar as? SearchBar)?.hint = hint
|
||||
}
|
||||
@@ -91,7 +105,7 @@ abstract class SearchBarScene : ToolbarScene() {
|
||||
onApplySearch = lambda
|
||||
}
|
||||
|
||||
private fun onApplySearch() {
|
||||
fun onApplySearch() {
|
||||
val query = mSearchView?.text.toString().trim()
|
||||
if (!mAllowEmptySearch && query.isEmpty()) {
|
||||
return
|
||||
|
||||
@@ -66,21 +66,4 @@
|
||||
|
||||
</com.hippo.widget.FabLayout>
|
||||
|
||||
<com.hippo.widget.FabLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingRight="@dimen/corner_fab_margin"
|
||||
android:paddingBottom="@dimen/corner_fab_margin"
|
||||
app:fitsSystemWindowsInsets="top|bottom">
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/search_fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleX="0"
|
||||
android:scaleY="0"
|
||||
android:visibility="invisible"
|
||||
app:srcCompat="@drawable/v_magnify_x24" />
|
||||
|
||||
</com.hippo.widget.FabLayout>
|
||||
</FrameLayout>
|
||||
@@ -46,4 +46,22 @@
|
||||
|
||||
</com.google.android.material.search.SearchView>
|
||||
|
||||
<com.hippo.widget.FabLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingRight="@dimen/corner_fab_margin"
|
||||
android:paddingBottom="@dimen/corner_fab_margin"
|
||||
app:fitsSystemWindowsInsets="top|bottom">
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/search_fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleX="0"
|
||||
android:scaleY="0"
|
||||
android:visibility="invisible"
|
||||
app:srcCompat="@drawable/v_magnify_x24" />
|
||||
|
||||
</com.hippo.widget.FabLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
Reference in new issue
Block a user