This repository has been archived by the owner on May 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Functional phone app #23
Open
augustuen
wants to merge
42
commits into
LayoutXML:master
Choose a base branch
from
larshelo:Companion-app
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
Fixed wrong capitalization by calpilatizing the words in strings.xml and adding toLowerCase on capitalise2's output.
…h-10 # Conflicts: # build.gradle
-Fixed: capitalisation for suffixes with non-break spaces
…precated getAdapterPosition() - This seems to have fixed a bug with onItemClickSwitch not being fired in MainTextSettingsFragment Updated capitalisation of a key string.
Fixed a bug where invalidating the preview wouldn't update the prefixes and suffixes
…le adding options for other types of setting selection with only text. Refactored MainTextSettingsFragment.onActivityResult to be more readable. Started implementing handling for font and capitalization settings - Not yet functional.
…ins. Changed the text of some options to look better. Added helping text to replace integer options (e.g. date order, capitalization) Refactored TextSelectionActivity slightly to fit with TopSettingsFragment.onItemClick
…ixed broken imports in ComplicationConfigActivity
…eds implementing getting preferences from the wearable to handheld. Refactored MyWatchFace.Engine.onDataChanged to accept more than one incoming preference at a time. Changed how the wearable fetches preferences to send to handheld.
…e" capitalisation
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request represents a functional and presentable phone/companion/handheld app. There is still a lot of improvements to be made to the look and function of the app, but this version is functional and pretty enough.
Features
Some preferences have been temporarily removed from the phone app to fit with working features:
Communicator implementation
Loading preferences from watch to phone
Communicator.requestPreferences(Context context, WeakReference<WatchPreviewView> listenerActivity)
The phone initiates a transfer of preferences by sending a
DataRequest
with the boolean"rokas-twelveish-dr"
set to true. The watch app then loops through all preferences, adding each key and value to a string array, with each value directly following its key. The array is then returned to the phone in aDataRequest
with"rokas-twelveish-dr2"=true
.Upon reception of the array, the phone app loops through all entries and checks for a matching key in each
SettingsManager
hashmap, adding the value to the corresponding map. The entire SettingsManager is then converted to JSON and saved to a the filetest.json
. This is partially done because of a difficulty with sharing aSettingsManager
betweenHomeScreen
andCustomizationScreen
.Saving (all) preferences to watch from phone
Communicator.sendWatchFace(SettingsManager settingsManager, Context context)
Phone loops through each
SettingsManager
hashmap, adding every key/value pair to a string array, along with the value type. Every preference is added to the array in this format:The string array is sent in a
DataRequest
with booleanrokas-twelveish-dr2
set to true. The watch loops through the string array, converting the second string in each triplet to the appropriate variable type before adding it to preferences.Pinging
Communicator.ping()
After a connection to the watch has been established through
Communicator.initiateHandshake()
, a postDelayedHandler
is created, running every 5000 milliseconds. This handler callsping()
, sending aDataRequest
withrokas-twelveish-fire = true
. This request is answered withrokas-twelveish-ice=true
and a timestamp (the current system time in milliseconds on the watch) stored inrokas-twelveish-timestamp
. This timestamp is stored aslastPing
, which is then compared to the current system time of the phone.If the difference between the current time and the last received timestamp is greater than 15000 milliseconds (15 seconds), the watch is considered disconnected,
isWatchConnected
is set to false, and handshake initiation is restarted.Loading preferences
WatchPreviewView.WatchPreviewView(Context context, @Nullable AttributeSet attrs)
When created from the
HomeScreen
activity,WatchPreviewView
tells the communicator to request all preferences from the watch, as described inCommunicator.requestPreferences
. If the request was succesful, the preferences are saved to the local JSON file as a cache. This file is then loaded by theCustomizationScreen
activity. If no such file exists, a newSettingsManager
is initiated and saved to the file.This request includes the changes found in PR #22.