Loading res/layout/widget_cell_content.xml +6 −5 Original line number Diff line number Diff line Loading @@ -18,10 +18,11 @@ android:layout_height="wrap_content"> <!-- The image of the widget. This view does not support padding. Any placement adjustment should be done using margins. --> should be done using margins. width & height are set at runtime after scaling the preview image. --> <com.android.launcher3.widget.WidgetImageView android:id="@+id/widget_preview" android:layout_width="wrap_content" android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" android:importantForAccessibility="no" Loading @@ -38,7 +39,7 @@ android:singleLine="true" android:maxLines="1" android:textColor="?android:attr/textColorPrimary" android:textSize="14sp" /> android:textSize="@dimen/widget_cell_font_size" /> <!-- The original dimensions of the widget (can't be the same text as above due to different style. --> Loading @@ -48,7 +49,7 @@ android:layout_height="wrap_content" android:gravity="center_horizontal" android:textColor="?android:attr/textColorTertiary" android:textSize="14sp" android:textSize="@dimen/widget_cell_font_size" android:alpha="0.8" /> <TextView Loading @@ -56,7 +57,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:textSize="14sp" android:textSize="@dimen/widget_cell_font_size" android:textColor="?android:attr/textColorTertiary" android:maxLines="2" android:ellipsize="end" Loading res/layout/widgets_full_sheet_search_and_recommendations.xml +11 −1 Original line number Diff line number Diff line Loading @@ -18,12 +18,15 @@ android:id="@+id/search_and_recommendations_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:paddingHorizontal="16dp" android:layout_marginBottom="16dp" android:orientation="vertical"> <View android:id="@+id/collapse_handle" android:layout_width="48dp" android:layout_height="2dp" android:layout_marginTop="16dp" android:elevation="2dp" android:layout_gravity="center_horizontal" android:background="?android:attr/textColorSecondary"/> <TextView Loading @@ -36,4 +39,11 @@ android:textColor="?android:attr/textColorSecondary" android:text="@string/widget_button_text"/> <include layout="@layout/widgets_search_bar"/> <com.android.launcher3.widget.picker.WidgetsRecommendationTableLayout android:id="@+id/recommended_widget_table" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:visibility="gone" /> </LinearLayout> res/layout/widgets_search_bar.xml +2 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,8 @@ android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginTop="16dp" android:background="@drawable/bg_widgets_searchbox"> android:background="@drawable/bg_widgets_searchbox" android:elevation="2dp"> <com.android.launcher3.ExtendedEditText android:id="@+id/widgets_search_bar_edit_text" Loading res/values/dimens.xml +1 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,7 @@ <!-- Widget tray --> <dimen name="widget_cell_vertical_padding">8dp</dimen> <dimen name="widget_cell_horizontal_padding">16dp</dimen> <dimen name="widget_cell_font_size">14sp</dimen> <dimen name="widget_list_top_bottom_corner_radius">28dp</dimen> Loading src/com/android/launcher3/widget/WidgetCell.java +9 −2 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { protected int mPreviewHeight; protected int mPresetPreviewSize; private int mCellSize; private float mPreviewScale = 1f; private WidgetImageView mWidgetImage; private TextView mWidgetName; Loading Loading @@ -254,8 +255,8 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { } if (drawable != null) { LayoutParams layoutParams = (LayoutParams) mWidgetImage.getLayoutParams(); layoutParams.width = drawable.getIntrinsicWidth(); layoutParams.height = drawable.getIntrinsicHeight(); layoutParams.width = (int) (drawable.getIntrinsicWidth() * mPreviewScale); layoutParams.height = (int) (drawable.getIntrinsicHeight() * mPreviewScale); mWidgetImage.setLayoutParams(layoutParams); mWidgetImage.setDrawable(drawable, mWidgetPreviewLoader.getBadgeForUser(mItem.user, Loading Loading @@ -305,10 +306,16 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { /** Sets the widget preview image size in number of cells. */ public void setPreviewSize(int spanX, int spanY) { setPreviewSize(spanX, spanY, 1f); } /** Sets the widget preview image size, in number of cells, and preview scale. */ public void setPreviewSize(int spanX, int spanY, float previewScale) { int padding = 2 * getResources() .getDimensionPixelSize(R.dimen.widget_preview_shortcut_padding); mPreviewWidth = mDeviceProfile.cellWidthPx * spanX + padding; mPreviewHeight = mDeviceProfile.cellHeightPx * spanY + padding; mPreviewScale = previewScale; } @Override Loading Loading
res/layout/widget_cell_content.xml +6 −5 Original line number Diff line number Diff line Loading @@ -18,10 +18,11 @@ android:layout_height="wrap_content"> <!-- The image of the widget. This view does not support padding. Any placement adjustment should be done using margins. --> should be done using margins. width & height are set at runtime after scaling the preview image. --> <com.android.launcher3.widget.WidgetImageView android:id="@+id/widget_preview" android:layout_width="wrap_content" android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" android:importantForAccessibility="no" Loading @@ -38,7 +39,7 @@ android:singleLine="true" android:maxLines="1" android:textColor="?android:attr/textColorPrimary" android:textSize="14sp" /> android:textSize="@dimen/widget_cell_font_size" /> <!-- The original dimensions of the widget (can't be the same text as above due to different style. --> Loading @@ -48,7 +49,7 @@ android:layout_height="wrap_content" android:gravity="center_horizontal" android:textColor="?android:attr/textColorTertiary" android:textSize="14sp" android:textSize="@dimen/widget_cell_font_size" android:alpha="0.8" /> <TextView Loading @@ -56,7 +57,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:textSize="14sp" android:textSize="@dimen/widget_cell_font_size" android:textColor="?android:attr/textColorTertiary" android:maxLines="2" android:ellipsize="end" Loading
res/layout/widgets_full_sheet_search_and_recommendations.xml +11 −1 Original line number Diff line number Diff line Loading @@ -18,12 +18,15 @@ android:id="@+id/search_and_recommendations_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:paddingHorizontal="16dp" android:layout_marginBottom="16dp" android:orientation="vertical"> <View android:id="@+id/collapse_handle" android:layout_width="48dp" android:layout_height="2dp" android:layout_marginTop="16dp" android:elevation="2dp" android:layout_gravity="center_horizontal" android:background="?android:attr/textColorSecondary"/> <TextView Loading @@ -36,4 +39,11 @@ android:textColor="?android:attr/textColorSecondary" android:text="@string/widget_button_text"/> <include layout="@layout/widgets_search_bar"/> <com.android.launcher3.widget.picker.WidgetsRecommendationTableLayout android:id="@+id/recommended_widget_table" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:visibility="gone" /> </LinearLayout>
res/layout/widgets_search_bar.xml +2 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,8 @@ android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginTop="16dp" android:background="@drawable/bg_widgets_searchbox"> android:background="@drawable/bg_widgets_searchbox" android:elevation="2dp"> <com.android.launcher3.ExtendedEditText android:id="@+id/widgets_search_bar_edit_text" Loading
res/values/dimens.xml +1 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,7 @@ <!-- Widget tray --> <dimen name="widget_cell_vertical_padding">8dp</dimen> <dimen name="widget_cell_horizontal_padding">16dp</dimen> <dimen name="widget_cell_font_size">14sp</dimen> <dimen name="widget_list_top_bottom_corner_radius">28dp</dimen> Loading
src/com/android/launcher3/widget/WidgetCell.java +9 −2 Original line number Diff line number Diff line Loading @@ -74,6 +74,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { protected int mPreviewHeight; protected int mPresetPreviewSize; private int mCellSize; private float mPreviewScale = 1f; private WidgetImageView mWidgetImage; private TextView mWidgetName; Loading Loading @@ -254,8 +255,8 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { } if (drawable != null) { LayoutParams layoutParams = (LayoutParams) mWidgetImage.getLayoutParams(); layoutParams.width = drawable.getIntrinsicWidth(); layoutParams.height = drawable.getIntrinsicHeight(); layoutParams.width = (int) (drawable.getIntrinsicWidth() * mPreviewScale); layoutParams.height = (int) (drawable.getIntrinsicHeight() * mPreviewScale); mWidgetImage.setLayoutParams(layoutParams); mWidgetImage.setDrawable(drawable, mWidgetPreviewLoader.getBadgeForUser(mItem.user, Loading Loading @@ -305,10 +306,16 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { /** Sets the widget preview image size in number of cells. */ public void setPreviewSize(int spanX, int spanY) { setPreviewSize(spanX, spanY, 1f); } /** Sets the widget preview image size, in number of cells, and preview scale. */ public void setPreviewSize(int spanX, int spanY, float previewScale) { int padding = 2 * getResources() .getDimensionPixelSize(R.dimen.widget_preview_shortcut_padding); mPreviewWidth = mDeviceProfile.cellWidthPx * spanX + padding; mPreviewHeight = mDeviceProfile.cellHeightPx * spanY + padding; mPreviewScale = previewScale; } @Override Loading