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.
Remove react-native; rewrite main screen in (native) swift
- Loading branch information
Showing
148 changed files
with
2,000 additions
and
8,892 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.49 KB
core/assets/test/components/old/common/BarChart/renderDifferentSize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.3 KB
core/assets/test/components/old/common/BarChart/renderTransparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.28 KB
core/assets/test/components/old/common/FrequencyChart/renderDataOffset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.1 KB
core/assets/test/components/old/common/FrequencyChart/renderDifferentSize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.97 KB
core/assets/test/components/old/common/FrequencyChart/renderTransparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+58.4 KB
core/assets/test/components/old/common/HistoryChart/renderDataOffset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31.4 KB
core/assets/test/components/old/common/HistoryChart/renderDifferentSize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+56.4 KB
core/assets/test/components/old/common/HistoryChart/renderTransparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20.2 KB
core/assets/test/components/old/common/ScoreChart/renderDataOffset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.2 KB
core/assets/test/components/old/common/ScoreChart/renderDifferentSize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.6 KB
core/assets/test/components/old/common/ScoreChart/renderTransparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+2.92 KB
core/assets/test/components/old/common/StreakChart/renderSmallSize.png
Oops, something went wrong.
Binary file added
BIN
+14.9 KB
core/assets/test/components/old/common/StreakChart/renderTransparent.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+8.59 KB
core/assets/test/components/old/widgets/CheckmarkWidgetView/checked.png
Oops, something went wrong.
Binary file added
BIN
+10.7 KB
core/assets/test/components/old/widgets/CheckmarkWidgetView/implicitly_checked.png
Oops, something went wrong.
Binary file added
BIN
+17.8 KB
core/assets/test/components/old/widgets/CheckmarkWidgetView/large_size.png
Oops, something went wrong.
Binary file added
BIN
+10.8 KB
core/assets/test/components/old/widgets/CheckmarkWidgetView/unchecked.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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
45 changes: 45 additions & 0 deletions
45
core/src/commonMain/kotlin/org/isoron/uhabits/gui/Canvas.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,45 @@ | ||
/* | ||
* Copyright (C) 2016-2019 Á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.gui | ||
|
||
enum class Font { | ||
REGULAR, | ||
BOLD, | ||
FONT_AWESOME | ||
} | ||
|
||
interface Canvas { | ||
fun setColor(color: Color) | ||
fun drawLine(x1: Double, y1: Double, x2: Double, y2: Double) | ||
fun drawText(text: String, x: Double, y: Double) | ||
fun fillRect(x: Double, y: Double, width: Double, height: Double) | ||
fun drawRect(x: Double, y: Double, width: Double, height: Double) | ||
fun getHeight(): Double | ||
fun getWidth(): Double | ||
fun setFont(font: Font) | ||
fun setTextSize(size: Double) | ||
fun setStrokeWidth(size: Double) | ||
fun fillArc(centerX: Double, | ||
centerY: Double, | ||
radius: Double, | ||
startAngle: Double, | ||
swipeAngle: Double) | ||
fun fillCircle(centerX: Double, centerY: Double, radius: Double) | ||
} |
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
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
68 changes: 68 additions & 0 deletions
68
core/src/commonMain/kotlin/org/isoron/uhabits/gui/Themes.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,68 @@ | ||
/* | ||
* Copyright (C) 2016-2019 Á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.gui | ||
|
||
abstract class Theme { | ||
val toolbarColor = Color(0xffffff) | ||
|
||
val lowContrastTextColor = Color(0xe0e0e0) | ||
val mediumContrastTextColor = Color(0x808080) | ||
val highContrastTextColor = Color(0x202020) | ||
|
||
val cardBackgroundColor = Color(0xFFFFFF) | ||
val appBackgroundColor = Color(0xf4f4f4) | ||
val toolbarBackgroundColor = Color(0xf4f4f4) | ||
val statusBarBackgroundColor = Color(0x333333) | ||
|
||
val headerBackgroundColor = Color(0xeeeeee) | ||
val headerBorderColor = Color(0xcccccc) | ||
val headerTextColor = mediumContrastTextColor | ||
|
||
val itemBackgroundColor = Color(0xffffff) | ||
|
||
fun color(paletteIndex: Int): Color { | ||
return when (paletteIndex) { | ||
0 -> Color(0xD32F2F) | ||
1 -> Color(0x512DA8) | ||
2 -> Color(0xF57C00) | ||
3 -> Color(0xFF8F00) | ||
4 -> Color(0xF9A825) | ||
5 -> Color(0xAFB42B) | ||
6 -> Color(0x7CB342) | ||
7 -> Color(0x388E3C) | ||
8 -> Color(0x00897B) | ||
9 -> Color(0x00ACC1) | ||
10 -> Color(0x039BE5) | ||
11 -> Color(0x1976D2) | ||
12 -> Color(0x303F9F) | ||
13 -> Color(0x5E35B1) | ||
14 -> Color(0x8E24AA) | ||
15 -> Color(0xD81B60) | ||
16 -> Color(0x5D4037) | ||
else -> Color(0x000000) | ||
} | ||
} | ||
|
||
val checkmarkButtonSize = 48.0 | ||
val smallTextSize = 12.0 | ||
val regularTextSize = 17.0 | ||
} | ||
|
||
class LightTheme : Theme() |
41 changes: 41 additions & 0 deletions
41
core/src/commonMain/kotlin/org/isoron/uhabits/gui/components/CheckmarkButton.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,41 @@ | ||
/* | ||
* Copyright (C) 2016-2019 Á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.gui.components.HabitList | ||
|
||
import org.isoron.uhabits.gui.* | ||
import org.isoron.uhabits.gui.components.* | ||
|
||
class CheckmarkButton(private val value: Int, | ||
private val color: Color, | ||
private val theme: Theme) : Component { | ||
override fun draw(canvas: Canvas) { | ||
canvas.setFont(Font.FONT_AWESOME) | ||
canvas.setTextSize(theme.smallTextSize * 1.5) | ||
canvas.setColor(when (value) { | ||
2 -> color | ||
else -> theme.lowContrastTextColor | ||
}) | ||
val text = when (value) { | ||
0 -> FontAwesome.TIMES | ||
else -> FontAwesome.CHECK | ||
} | ||
canvas.drawText(text, canvas.getWidth() / 2.0, canvas.getHeight() / 2.0) | ||
} | ||
} |
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
58 changes: 58 additions & 0 deletions
58
core/src/commonMain/kotlin/org/isoron/uhabits/gui/components/HabitListHeader.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,58 @@ | ||
/* | ||
* Copyright (C) 2016-2019 Á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.gui.components.HabitList | ||
|
||
import org.isoron.uhabits.gui.* | ||
import org.isoron.uhabits.gui.components.* | ||
import org.isoron.uhabits.utils.* | ||
|
||
class HabitListHeader(private val today: LocalDate, | ||
private val nButtons: Int, | ||
private val theme: Theme, | ||
private val fmt: LocalDateFormatter, | ||
private val calc: LocalDateCalculator) : Component { | ||
|
||
override fun draw(canvas: Canvas) { | ||
val width = canvas.getWidth() | ||
val height = canvas.getHeight() | ||
val buttonSize = theme.checkmarkButtonSize | ||
canvas.setColor(theme.headerBackgroundColor) | ||
canvas.fillRect(0.0, 0.0, width, height) | ||
|
||
canvas.setColor(theme.headerBorderColor) | ||
canvas.setStrokeWidth(0.5) | ||
canvas.drawLine(0.0, height - 0.5, width, height - 0.5) | ||
|
||
canvas.setColor(theme.headerTextColor) | ||
canvas.setFont(Font.BOLD) | ||
canvas.setTextSize(theme.smallTextSize) | ||
|
||
repeat(nButtons) { index -> | ||
val date = calc.minusDays(today, nButtons - index - 1) | ||
val name = fmt.shortWeekdayName(date).toUpperCase() | ||
val number = date.day.toString() | ||
|
||
val x = width - (index + 1) * buttonSize + buttonSize / 2 | ||
val y = height / 2 | ||
canvas.drawText(name, x, y - theme.smallTextSize * 0.6) | ||
canvas.drawText(number, x, y + theme.smallTextSize * 0.6) | ||
} | ||
} | ||
} |
Oops, something went wrong.