Merge "Fix bugs for Widgets picker Search UI." into sc-dev
This commit is contained in:
commit
7358069a91
|
@ -14,6 +14,6 @@
|
|||
limitations under the License.
|
||||
-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<solid android:color="#FFFFF7" />
|
||||
<solid android:color="?android:attr/textColorPrimaryInverse" />
|
||||
<corners android:radius="24dp" />
|
||||
</shape>
|
|
@ -19,12 +19,15 @@
|
|||
android:hint="@string/widgets_full_sheet_search_bar_hint"
|
||||
android:maxLines="1"
|
||||
android:layout_weight="1"
|
||||
android:inputType="text"/>
|
||||
android:inputType="text"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textColorHint="?android:attr/textColorTertiary"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/widgets_search_cancel_button"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:src="@drawable/ic_gm_close_24"
|
||||
android:background="?android:selectableItemBackground"
|
||||
android:layout_gravity="center"
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.animation.AnimatorListenerAdapter;
|
|||
import android.animation.PropertyValuesHolder;
|
||||
import android.content.Context;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
|
@ -232,6 +233,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
|||
mInsets.set(insets);
|
||||
|
||||
setBottomPadding(mAdapters.get(AdapterHolder.PRIMARY).mWidgetsRecyclerView, insets.bottom);
|
||||
setBottomPadding(mAdapters.get(AdapterHolder.SEARCH).mWidgetsRecyclerView, insets.bottom);
|
||||
if (mHasWorkProfile) {
|
||||
setBottomPadding(mAdapters.get(AdapterHolder.WORK).mWidgetsRecyclerView, insets.bottom);
|
||||
}
|
||||
|
@ -276,6 +278,8 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
|||
int maxSpansPerRow = getMeasuredWidth() / (deviceProfile.cellWidthPx + paddingPx);
|
||||
mAdapters.get(AdapterHolder.PRIMARY).mWidgetsListAdapter.setMaxHorizontalSpansPerRow(
|
||||
maxSpansPerRow);
|
||||
mAdapters.get(AdapterHolder.SEARCH).mWidgetsListAdapter.setMaxHorizontalSpansPerRow(
|
||||
maxSpansPerRow);
|
||||
if (mHasWorkProfile) {
|
||||
mAdapters.get(AdapterHolder.WORK).mWidgetsListAdapter.setMaxHorizontalSpansPerRow(
|
||||
maxSpansPerRow);
|
||||
|
@ -471,6 +475,23 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
|||
+ marginLayoutParams.topMargin;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
if (mIsInSearchMode) {
|
||||
mSearchAndRecommendationViewHolder.mSearchBar.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBackPressed() {
|
||||
if (mIsInSearchMode) {
|
||||
mSearchAndRecommendationViewHolder.mSearchBar.reset();
|
||||
return true;
|
||||
}
|
||||
return super.onBackPressed();
|
||||
}
|
||||
|
||||
/** A holder class for holding adapters & their corresponding recycler view. */
|
||||
private final class AdapterHolder {
|
||||
static final int PRIMARY = 0;
|
||||
|
|
|
@ -62,6 +62,11 @@ public class LauncherWidgetsSearchBar extends LinearLayout implements WidgetsSea
|
|||
algo, mEditText, mCancelButton, searchModeListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
mController.clearSearchResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
|
|
@ -29,6 +29,11 @@ public interface WidgetsSearchBar {
|
|||
*/
|
||||
void initialize(List<WidgetsListBaseEntry> allWidgets, SearchModeListener searchModeListener);
|
||||
|
||||
/**
|
||||
* Clears search bar.
|
||||
*/
|
||||
void reset();
|
||||
|
||||
/**
|
||||
* Sets the vertical location, in pixels, of this search bar relative to its top position.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue