Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ccd7efa authored by Alina Zaidi's avatar Alina Zaidi
Browse files

Fix UI bugs for widget picker search.

- Mirror search icon in RTL (b/184162989)
- Fix spacing between edit text and cancel button, to make it consistent
with space between search icon and edit text. (b/183602001)
- Scroll to top on every search result. (b/183602001)
- Fix keyboard overlap on orientation change. This is fixed by clearing
text on edit text differently (b/184048899)

Test: Manually tested
Bug: 184162989
Bug: 183602001
Bug: 184048899
Change-Id: I72ed51e1968a55a3105bd8b389d1bbd74d50d8af
parent 5427fa7b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@
    android:width="24dp"
    android:height="24dp"
    android:viewportHeight="24.0"
    android:viewportWidth="24.0">
    android:viewportWidth="24.0"
    android:autoMirrored="true">
    <path
        android:fillColor="?android:attr/textColorTertiary"
        android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z" />
+7 −2
Original line number Diff line number Diff line
@@ -13,7 +13,9 @@
        android:id="@+id/widgets_search_bar_edit_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="12dp"
        android:paddingVertical="12dp"
        android:paddingStart="12dp"
        android:paddingEnd="0dp"
        android:drawablePadding="8dp"
        android:drawableStart="@drawable/ic_allapps_search"
        android:background="@null"
@@ -21,6 +23,7 @@
        android:maxLines="1"
        android:layout_weight="1"
        android:inputType="text"
        android:imeOptions="actionSearch"
        android:textColor="?android:attr/textColorSecondary"
        android:textColorHint="?android:attr/textColorTertiary"/>

@@ -28,7 +31,9 @@
        android:id="@+id/widgets_search_cancel_button"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:padding="8dp"
        android:paddingVertical="12dp"
        android:paddingStart="8dp"
        android:paddingEnd="12dp"
        android:src="@drawable/ic_gm_close_24"
        android:background="?android:selectableItemBackground"
        android:layout_gravity="center"
+1 −0
Original line number Diff line number Diff line
@@ -392,6 +392,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
        mAdapters.get(AdapterHolder.SEARCH).mWidgetsListAdapter.setWidgetsOnSearch(entries);
        updateNoSearchResultsView(
                mAdapters.get(AdapterHolder.SEARCH).mWidgetsListAdapter.getItemCount() == 0);
        mAdapters.get(AdapterHolder.SEARCH).mWidgetsRecyclerView.scrollToTop();
    }

    private void setViewVisibilityBasedOnSearch(boolean isInSearchMode) {
+15 −0
Original line number Diff line number Diff line
@@ -243,4 +243,19 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch
         */
        int getHeaderViewHeight();
    }

    @Override
    public void scrollToTop() {
        if (mScrollbar != null) {
            mScrollbar.reattachThumbToScroll();
        }

        if (getLayoutManager() instanceof LinearLayoutManager) {
            if (getCurrentScrollY() == 0) {
                // We are at the top, so don't scrollToPosition (would cause unnecessary relayout).
                return;
            }
        }
        scrollToPosition(0);
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ public class WidgetsSearchBarController implements TextWatcher,
    @Override
    public void clearSearchResult() {
        mSearchAlgorithm.cancel(/* interruptActiveRequests= */ true);
        mInput.getText().clear();
        mInput.setText("");
        clearFocus();
        mSearchModeListener.exitSearchMode();
    }