Make smartspace shadow consistent with workspace icons
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.android.launcher3.views.DoubleShadowBubbleTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
style="@style/SmartspaceTextHeadline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
@@ -21,17 +21,14 @@
|
||||
<dimen name="dynamic_grid_hotseat_bottom_padding">62dp</dimen>
|
||||
<dimen name="dynamic_grid_hotseat_bottom_non_tall_padding">15dp</dimen>
|
||||
<dimen name="dynamic_grid_hotseat_extra_vertical_size">24dp</dimen>
|
||||
|
||||
<dimen name="noqsb_hotseat_top_padding">8dp</dimen>
|
||||
<dimen name="noqsb_hotseat_bottom_padding">2dp</dimen>
|
||||
<dimen name="noqsb_hotseat_bottom_non_tall_padding">0dp</dimen>
|
||||
<dimen name="noqsb_hotseat_extra_vertical_size">34dp</dimen>
|
||||
|
||||
<dimen name="search_widget_top_shift">16dp</dimen>
|
||||
<dimen name="search_widget_hotseat_height">56dp</dimen>
|
||||
|
||||
<dimen name="lawnchair_dialog_corner_radius">24dp</dimen>
|
||||
|
||||
<!-- qsb -->
|
||||
<dimen name="all_apps_search_bar_bottom_padding">36dp</dimen>
|
||||
<dimen name="all_apps_search_vertical_offset">30dp</dimen>
|
||||
<dimen name="qsb_g_icon_marginStart">16dp</dimen>
|
||||
@@ -41,7 +38,10 @@
|
||||
<dimen name="qsb_shadow_margin">6dp</dimen>
|
||||
<dimen name="qsb_widget_height">64dp</dimen>
|
||||
<dimen name="qsb_icon_width">56dp</dimen>
|
||||
<dimen name="search_widget_top_shift">16dp</dimen>
|
||||
<dimen name="search_widget_hotseat_height">56dp</dimen>
|
||||
|
||||
<!-- search -->
|
||||
<dimen name="search_box_container_height">60dp</dimen>
|
||||
<dimen name="search_box_height">52dp</dimen>
|
||||
<dimen name="search_decoration_padding">1dp</dimen>
|
||||
@@ -53,4 +53,10 @@
|
||||
<dimen name="search_result_padding">16dp</dimen>
|
||||
<dimen name="search_result_radius">4dp</dimen>
|
||||
<dimen name="search_result_row_height">88dp</dimen>
|
||||
|
||||
<!-- smartspace -->
|
||||
<dimen name="smartspaceAmbientShadowBlur">1.5dp</dimen>
|
||||
<dimen name="smartspaceKeyShadowBlur">2dp</dimen>
|
||||
<dimen name="smartspaceKeyShadowOffset">0.5dp</dimen>
|
||||
<dimen name="smartspaceLetterSpacing">0.02</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -166,4 +166,15 @@
|
||||
<style name="TextAppearance.Lawnchair" parent="@android:style/TextAppearance.Material">
|
||||
<item name="customFontType">@id/font_body</item>
|
||||
</style>
|
||||
|
||||
<style name="SmartspaceTextHeadline">
|
||||
<item name="android:textColor">?attr/workspaceTextColor</item>
|
||||
<item name="android:letterSpacing">@dimen/smartspaceLetterSpacing</item>
|
||||
<item name="ambientShadowBlur">@dimen/smartspaceAmbientShadowBlur</item>
|
||||
<item name="ambientShadowColor">?attr/workspaceAmbientShadowColor</item>
|
||||
<item name="keyShadowBlur">@dimen/smartspaceKeyShadowBlur</item>
|
||||
<item name="keyShadowColor">?attr/workspaceKeyShadowColor</item>
|
||||
<item name="keyShadowOffsetX">@dimen/smartspaceKeyShadowOffset</item>
|
||||
<item name="keyShadowOffsetY">@dimen/smartspaceKeyShadowOffset</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.ImageView
|
||||
import android.widget.RemoteViews
|
||||
import android.widget.TextView
|
||||
@@ -13,6 +14,7 @@ import com.android.launcher3.R
|
||||
import com.android.launcher3.ResourceUtils
|
||||
import com.android.launcher3.icons.ShadowGenerator
|
||||
import com.android.launcher3.util.Themes
|
||||
import com.android.launcher3.views.DoubleShadowBubbleTextView
|
||||
|
||||
class ThemedSmartSpaceHostView(context: Context) : SmartSpaceHostView(context) {
|
||||
|
||||
@@ -20,6 +22,9 @@ class ThemedSmartSpaceHostView(context: Context) : SmartSpaceHostView(context) {
|
||||
private val workspaceTextColor = Themes.getAttrColor(context, R.attr.workspaceTextColor)
|
||||
private val shadowGenerator = ShadowGenerator(ResourceUtils.pxFromDp(48f, resources.displayMetrics))
|
||||
|
||||
private val templateTextView = LayoutInflater.from(context)
|
||||
.inflate(R.layout.smartspace_text_template, this, false) as DoubleShadowBubbleTextView
|
||||
|
||||
override fun updateAppWidget(remoteViews: RemoteViews?) {
|
||||
super.updateAppWidget(remoteViews)
|
||||
val images = mutableListOf<ImageView>()
|
||||
@@ -41,6 +46,14 @@ class ThemedSmartSpaceHostView(context: Context) : SmartSpaceHostView(context) {
|
||||
private fun overrideTextView(tv: TextView) {
|
||||
if (isWorkspaceDarkText) {
|
||||
tv.paint.clearShadowLayer()
|
||||
} else {
|
||||
val shadowInfo = templateTextView.shadowInfo
|
||||
tv.paint.setShadowLayer(
|
||||
shadowInfo.ambientShadowBlur,
|
||||
shadowInfo.keyShadowOffsetX,
|
||||
shadowInfo.keyShadowOffsetY,
|
||||
shadowInfo.ambientShadowColor
|
||||
)
|
||||
}
|
||||
tv.setTextColor(workspaceTextColor)
|
||||
FontManager.INSTANCE.get(context).setCustomFont(tv, R.id.font_heading)
|
||||
|
||||
@@ -133,4 +133,8 @@ public class DoubleShadowBubbleTextView extends BubbleTextView {
|
||||
return setColorAlphaBound(shadowColor,
|
||||
Math.round(Color.alpha(shadowColor) * textAlpha / 255f));
|
||||
}
|
||||
|
||||
public ShadowInfo getShadowInfo() {
|
||||
return mShadowInfo;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user