Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Waypoints widget #381

Closed
wants to merge 2 commits into from
Closed

Conversation

nma83
Copy link
Contributor

@nma83 nma83 commented Jul 31, 2016

Owntracks Waypoint widget is an Android home-screen widget. It uses 2 pieces of information from each user who has shared his/her location:

  • their current location
  • their shared waypoints

The widget compares the location with all possible pairs of waypoints and (possibly) comes up with a pair that bounds the current location best. The waypoints from this pair are shown on the ends of a linear scale and the current location is placed on the scale based on distance from each end.
More details at: http://narenma.net/2016/07/30/owntracks-waypoints-widget/

I will try to walk-through the code changes file-by-file (most critical first):

  • App.java
    • added a HashMap to store (FusedContact, WaypointCollection) for all contacts
    • hooks to update the widget on location updates
  • ServiceMessage.java
    • process a waypoints message and update list of waypoints for a contact
  • NEW ServiceWidget.java
    • service added to provide data to the widget views
    • most the widget logic is contained in this service
  • NEW WaypointPair.java
    • helper class to compute bounds and select waypoint pairs to display
  • NEW LClocWidgetProvider.java
    • class added to manage the widget
  • ContactImageProvider.java
    • had to change the visibility of a few helper static methods to public to access them from outside for the widget views
  • ServiceApplication.java
    • added a method to request other users' waypoint using a MessageCmd, but it is not working as intended due to the way processMessage is coded in ServiceBroker (but can look at it later)
  • Preferences are updated to add a new Widget item under Notifications
  • All required resources are added into the appropriate res sub-directories
  • Had to change gradle version to get past a dependency fetch error I ran into

Please let me know if any more details are required.

Thanks!
Narendra

@binarybucks
Copy link

Thank you for your contribution and the great documentation.
As I'm currently working on Android 7 support on a master branch, I'll leave this pull-request open and merge the changes afterwards, as the Android 7 branch probably contains some breaking changes.

@binarybucks
Copy link

One thing that occured to me though: You're loading the waypoints on the main thread when the app starts. In the Andorid 7 branch I moved the service initialization to a backround thread to increase the app startup speed. I think we should do this here too.

It's probably an easy fix by moving the loading code to a runnable.

@nma83
Copy link
Contributor Author

nma83 commented Aug 1, 2016

Sure, will change the waypoint loading and add the commit to this pull request.

@nma83
Copy link
Contributor Author

nma83 commented Aug 4, 2016

When you say waypoint loading, do you mean requestWaypoints()? Or is it updateWidget()?
requestWaypoints() is already run in a Runnable.

@nma83
Copy link
Contributor Author

nma83 commented Aug 27, 2016

@binarybucks do I need to rebase and resolve for this PR?
EDIT: Just did a rebase and realised what had happened on master :).
Close to done with merging all my changes into latest master.

Refactored launcher activity for setup

Refactored wizzard activity

Added Play Services checks

general fixes

Improved map follow behavior (owntracks#352), fixed crt import for some content
providers (owntracks#339), fixed missing actionbar on lower APIs (owntracks#350), fixed
Google Play services check on startup

Fixed region action mode colors and behavior

Fixed bottom sheet

Gradle fixes (owntracks#360)

* Fix error running ./gradlew from command-line.

These changes were generated automatically by running:

    .../android-studio/gradle/gradle-2.10/bin/gradle wrapper

Previously. gradle-wrapper.jar was missing from the repo, so running
"./gradlew" would produce an error:

    Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

* Use secure connection to access gradle repositories (HTTPS).

ignore backups

new versions

sample code to get a widget created

got location into widget textview

refactored widget logic into ServiceWidget

Store list of waypoints per contact and crude distance computation

logs

Added StackView and moving to adaptor based updates

basic setup for the StackView in widget

restructuring progress rendering

first cut working version of widget

added better resources and widget preview

widget UI tweaks

cleaned up log prints

Tweaked widget UI to show geo-coded location

Adding support for incremental waypoint updates

Setting the right topic for remote command requesting other user's waypoints
@nma83
Copy link
Contributor Author

nma83 commented Sep 2, 2016

I am having a really tough time trying to rebase my changes on top of master. Have to try manual merging :(.

@@ -14,7 +14,7 @@
import com.google.android.gms.gcm.OneoffTask;
import com.google.android.gms.gcm.Task;

import org.antlr.v4.runtime.misc.NotNull;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package was flagged as non-existing in my build, even with just the baseline upstream/master repo without my changes.

@nma83
Copy link
Contributor Author

nma83 commented Sep 3, 2016

Finally managed to rebase properly (I hope). @binarybucks, is it possible to get some feedback on the changes? There is a build issue with antlr that I have noted in the line comments.

@nma83
Copy link
Contributor Author

nma83 commented Sep 14, 2016

@binarybucks is there any feedback on this PR?

@nma83
Copy link
Contributor Author

nma83 commented Jan 1, 2017

I am creating a new branch in my repo to rebase changes, get it building and running. Will open a new PR with the latest changes. Closing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants