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