forked from iSoron/uhabits
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
514 additions
and
801 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 0 additions & 83 deletions
83
uhabits-android/src/main/java/org/isoron/uhabits/widgets/CheckmarkWidget.java
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
uhabits-android/src/main/java/org/isoron/uhabits/widgets/CheckmarkWidget.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (C) 2016 Álinson Santos Xavier <[email protected]> | ||
* | ||
* This file is part of Loop Habit Tracker. | ||
* | ||
* Loop Habit Tracker is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation, either version 3 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* Loop Habit Tracker is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.isoron.uhabits.widgets | ||
|
||
import android.content.* | ||
import android.view.* | ||
import org.isoron.uhabits.core.models.* | ||
import org.isoron.uhabits.utils.* | ||
import org.isoron.uhabits.widgets.views.* | ||
|
||
class CheckmarkWidget( | ||
context: Context, | ||
widgetId: Int, | ||
private val habit: Habit | ||
) : BaseWidget(context, widgetId) { | ||
|
||
override fun getOnClickPendingIntent(context: Context) = | ||
pendingIntentFactory.toggleCheckmark(habit, null) | ||
|
||
override fun refreshData(v: View) { | ||
(v as CheckmarkWidgetView).apply { | ||
setPercentage(habit.scores.todayValue.toFloat()) | ||
setActiveColor(PaletteUtils.getColor(context, habit.color)) | ||
setName(habit.name) | ||
setCheckmarkValue(habit.checkmarks.todayValue) | ||
refresh() | ||
} | ||
} | ||
|
||
override fun buildView() = CheckmarkWidgetView(context) | ||
override fun getDefaultHeight() = 125 | ||
override fun getDefaultWidth() = 125 | ||
} |
35 changes: 0 additions & 35 deletions
35
uhabits-android/src/main/java/org/isoron/uhabits/widgets/CheckmarkWidgetProvider.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 0 additions & 83 deletions
83
uhabits-android/src/main/java/org/isoron/uhabits/widgets/FrequencyWidget.java
This file was deleted.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
uhabits-android/src/main/java/org/isoron/uhabits/widgets/FrequencyWidget.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright (C) 2016 Álinson Santos Xavier <[email protected]> | ||
* | ||
* This file is part of Loop Habit Tracker. | ||
* | ||
* Loop Habit Tracker is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation, either version 3 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* Loop Habit Tracker is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.isoron.uhabits.widgets | ||
|
||
import android.content.* | ||
import android.view.* | ||
import org.isoron.uhabits.activities.common.views.* | ||
import org.isoron.uhabits.core.models.* | ||
import org.isoron.uhabits.utils.* | ||
import org.isoron.uhabits.widgets.views.* | ||
|
||
class FrequencyWidget( | ||
context: Context, | ||
widgetId: Int, | ||
private val habit: Habit | ||
) : BaseWidget(context, widgetId) { | ||
|
||
override fun getOnClickPendingIntent(context: Context) = | ||
pendingIntentFactory.showHabit(habit) | ||
|
||
override fun refreshData(v: View) { | ||
val widgetView = v as GraphWidgetView | ||
widgetView.setTitle(habit.name) | ||
(widgetView.dataView as FrequencyChart).apply { | ||
setColor(PaletteUtils.getColor(context, habit.color)) | ||
setFrequency(habit.repetitions.weekdayFrequency) | ||
} | ||
} | ||
|
||
override fun buildView() = | ||
GraphWidgetView(context, FrequencyChart(context)) | ||
|
||
override fun getDefaultHeight() = 200 | ||
override fun getDefaultWidth() = 200 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.