-
Notifications
You must be signed in to change notification settings - Fork 6
/
notes.txt
112 lines (84 loc) · 5.69 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
* CalWatch / CalWatch2
* Copyright © 2014-2019 by Dan S. Wallach
* Home page: http://www.cs.rice.edu/~dwallach/calwatch/
* Licensing: http://www.cs.rice.edu/~dwallach/calwatch/licensing.html
*/
If you look at the full Git history of this file, you'll see it grew quite large at some points and
shrank down at others. Mostly it's served as the ongoing to-do list as well as notes for features in
progress.
==================================================================================================
Android Wear command-line things I can never remember:
-- How to set up the emulator: http://www.tech-recipes.com/rx/49586/how-do-i-connect-an-android-wear-emulator-to-a-real-phone/
adb -d forward tcp:5601 tcp:5601
This seems to be no longer necessary on newer Android Studio versions; there's a "pair wearable"
selection from the vertical-dots menu.
-- How to connect to Bluetooth debugging: http://blog.timmattison.com/archives/2014/07/16/common-android-wear-tasks-for-developers/
adb forward tcp:4444 localabstract:/adb-hub; adb connect 127.0.0.1:4444
-- The newer WiFi debugging is easier and faster, though.
-- How to get a dump from the watch into a file and see it while it's going
(-d == USB device, -e == TCP device)
adb -e logcat -v time | & tee logdumps/whatever.txt
-- How to enable verbose logging from the command-line
adb -d shell
(then)
setprop log.tag.ClockFace VERBOSE
setprop log.tag.ClockState VERBOSE
setprop log.tag.ClockStateHelper VERBOSE
setprop log.tag.MyViewAnim VERBOSE
setprop log.tag.PhoneActivity VERBOSE
setprop log.tag.CalendarFetcher VERBOSE
setprop log.tag.CalendarPermission VERBOSE
setprop log.tag.AnalogComplicationConfi VERBOSE
setprop log.tag.PreviewAndComplications VERBOSE
setprop log.tag.BackgroundComplicationV VERBOSE
setprop log.tag.ViewRootImpl VERBOSE
setprop log.tag.ComplicationWrapper VERBOSE
setprop log.tag.CalWatchFaceService VERBOSE
Deal with multiday events that aren't "all day" events
TODO update the slides
Now a standard lecture in Comp215, so some updates in there already, but should it change
from an "evolution of CalWatch" into a "how to code for Android" talk? Or not? Also, worth
adding Kotlin material.
Keeping up with newish Android features
TODO: Adopt newer Android LiveData/coroutine scoping idioms:
- https://developer.android.com/topic/libraries/architecture/livedata
- https://developer.android.com/topic/libraries/architecture/lifecycle
- https://developer.android.com/topic/libraries/architecture/coroutines
Hypothetically, we could keep the calendar as a LiveData object and could use these lifecycleScope
things rather than GlobalScope for doing the computation. Unclear whether we'd get any benefit from these changes.
General code refactoring and improvement ideas
TODO: bucketing events by size, so >6 hr, 3-6hr, etc. This might allow small events to coalesce with fewer levels,
keep really long events to the center of the dial. Experimentation will be necessary to make sure it still looks good.
Also, maybe for the really long events, maybe make them thinner.
TODO not noticing when the calendar is updating?
- All the code examples online seem to be really old
- We can't just move this into an <intent-filter> or something in the manifest, it has to be in the main code body
(because power savings instituted in Android Oreo, two APIs ago)
TODO preferences for day/date thing
- managed to switch to the new "rounded" style, but can't move the toggle to the left of the text
TODO code refactoring
TODO simplify / kill PreferencesHelper
TODO too much .toFloat() and .toDouble() in ClockFace -- cleanup?!
- We could try to standardize everything with Float, but many of the trig function in Math require Double
- Twice I've tried standardizing on Float and things break: loss of the second-hand (!), and misalignment of the stipple pattern,
so the thing to try next is standardizing on Double.
- There's something really subtle and weird about how Kotlin does floating point that I'm clearly missing.
TODO Merge in Kotlin Android synthetic properties where appropriate
https://kotlinlang.org/docs/tutorials/android-plugin.html
Background support
TODO Rethink the "stippling" support, such that we get a cleaner layering from background to foreground
Tentative approach: render the wedges to a bitmap (only needs to be done once per hour), cut a hole in that bitmap
- http://www.techrepublic.com/article/punch-a-hole-in-a-bitmap-by-using-androids-porter-duff-xfer/
- https://stackoverflow.com/questions/18387814/drawing-on-canvas-porterduff-mode-clear-draws-black-why
- https://medium.com/@rgomez/android-how-to-draw-an-overlay-with-a-transparent-hole-471af6cf3953
- This means that, at 60Hz, we'll be compositing bitmap images, but not doing anywhere near as much drawing.
When we draw the stippling, all we have to do is set paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
First link has code to create a new Canvas wrapping a Bitmap, draw into the Canvas, return the Bitmap.
Depending on how we did it, we'd also be able to supply a complication background to other watchfaces
Distant future
TODO replace left/right/top/bottom with arbitrary numbers of complications at arbitrary points on the watchface
TODO support LONG_TEXT in addition to SHORT_TEXT
TODO lots of other linear constraint solvers out there these days, including some with nice Kotlin frontends
https://github.com/ytheohar/koptim
https://github.com/optimatika/okAlgo