mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Widgets: Show shadow if widget is completely opaque
This commit is contained in:
@@ -81,6 +81,7 @@ public abstract class BaseWidgetProvider extends AppWidgetProvider
|
||||
if (manager == null) throw new RuntimeException("manager is null");
|
||||
if (options == null) throw new RuntimeException("options is null");
|
||||
updateDependencies(context);
|
||||
|
||||
context.setTheme(R.style.WidgetTheme);
|
||||
|
||||
BaseWidget widget = getWidgetFromId(context, widgetId);
|
||||
|
||||
@@ -40,6 +40,7 @@ class FrequencyWidget(
|
||||
val widgetView = v as GraphWidgetView
|
||||
widgetView.setTitle(habit.name)
|
||||
widgetView.setBackgroundAlpha(preferedBackgroundAlpha)
|
||||
if (preferedBackgroundAlpha >= 255) widgetView.setShadowAlpha(0x4f)
|
||||
(widgetView.dataView as FrequencyChart).apply {
|
||||
setFirstWeekday(firstWeekday)
|
||||
setColor(PaletteUtils.getColor(context, habit.color))
|
||||
|
||||
@@ -41,6 +41,7 @@ class HistoryWidget(
|
||||
override fun refreshData(view: View) {
|
||||
val widgetView = view as GraphWidgetView
|
||||
widgetView.setBackgroundAlpha(preferedBackgroundAlpha)
|
||||
if (preferedBackgroundAlpha >= 255) widgetView.setShadowAlpha(0x4f)
|
||||
(widgetView.dataView as HistoryChart).apply {
|
||||
setFirstWeekday(firstWeekday)
|
||||
setColor(PaletteUtils.getColor(context, habit.color))
|
||||
|
||||
@@ -46,6 +46,7 @@ class ScoreWidget(
|
||||
|
||||
val widgetView = view as GraphWidgetView
|
||||
widgetView.setBackgroundAlpha(preferedBackgroundAlpha)
|
||||
if (preferedBackgroundAlpha >= 255) widgetView.setShadowAlpha(0x4f)
|
||||
(widgetView.dataView as ScoreChart).apply {
|
||||
setIsTransparencyEnabled(true)
|
||||
setBucketSize(size)
|
||||
|
||||
@@ -40,6 +40,7 @@ class StreakWidget(
|
||||
override fun refreshData(view: View) {
|
||||
val widgetView = view as GraphWidgetView
|
||||
widgetView.setBackgroundAlpha(preferedBackgroundAlpha)
|
||||
if (preferedBackgroundAlpha >= 255) widgetView.setShadowAlpha(0x4f)
|
||||
(widgetView.dataView as StreakChart).apply {
|
||||
setColor(PaletteUtils.getColor(context, habit.color))
|
||||
setStreaks(habit.streaks.getBest(maxStreakCount))
|
||||
|
||||
@@ -40,6 +40,7 @@ class TargetWidget(
|
||||
override fun refreshData(view: View) {
|
||||
val widgetView = view as GraphWidgetView
|
||||
widgetView.setBackgroundAlpha(preferedBackgroundAlpha)
|
||||
if (preferedBackgroundAlpha >= 255) widgetView.setShadowAlpha(0x4f)
|
||||
val chart = (widgetView.dataView as TargetChart)
|
||||
with(TargetCard.RefreshTask(context, habit, prefs.firstWeekday, chart, null)) {
|
||||
onPreExecute()
|
||||
|
||||
Reference in New Issue
Block a user