Rummys Blog An world of endless Monday

Friday, 1 July, 2016

Code Resources, Iconography and imagery

Filed under: — Andrew.Rowbottom @ 8:13 am


For the preferences on the watch I use code based on Deneley wear preferences, meningitis with amendments by LadyViktoria. And then some further modification to “fix” some scrolling issues.


Several of the icons I’m using come from, then minor edits to make them white.

dots-horizontal more horizontal (3 dots)

watch, watch-export, watch-import
routes — signpost, directions
check and close and window-close
crosshairs , crosshairs-gps
trending-up (looks a teensy bit like a route)
vpn (needs a little edit)

eye/show, eye-off/hidden
developer mode (Device)
gps fixed, off, not fixed (Device)
show chart .. zig zag line (Editor)
smartphone, watch, (Hardware)
directions (Maps)

Fling Detection

To reduce CPU and lag I’m using a single map in a “GridViewPager” with a user interaction of swipe left/right to zoom in and out. Code that helped me work on the swipe interaction came from StackOverflow:
which gives info about system standard values

handlepointermove has

interestingly scroll left doesn’t call onTouchEvent at all in gridviewpager
but scroll right DOES .. turns out
canScrollHorizontally in GridViewPager is called from SwipeDismissLayout!!!

No events at all seen by assorted listeners! – Doh, attaching to getView(), not myMapFragment, though not then either!
is not focusable
is not clickable
this could possibly be the problem

StackOverflow suggest I need to find the appropriate parent to attach to…

out of interest the heirachy – found in onViewCreated
MyMapFragment (actually the container for it aka emptyFragment)
SwipeDismissLayout .. I know this gets events!#

I think we could
a) intercept the canScrollHorizontally and say YES for the MAP specifically
b) check in the onScrolled for a float value of >0.05 this depends heavily on the GridViewPager internal configuraiton though.
Ideally we probably ought to just use similar logic to gridviewpager re fling detection (or roll our own)

// using built in gesture detector ..
// actually is a little aggresive as it pings in early .. not only when map is displayed
// also .. it is attached when previous row is shown
// gets DOWN .. MOVE .. UP to display the MAP
// when on MAP it then only gets MOVE and UP, but NO down events. I wonder where the down events go?
perhaps to the map?
// all guestures are disabled on the map!


Can enable Maps blue dot without the mylocation button by


Crash Reporting


Get document name from google drive downloaded document
You have to use the URI. Through the URI you can getContentResolver.query(theUriThatYouHave, null, null, null, null). Now that you have a cursor, you can check column names etc.

For Google drive there is a column name _display_name. This will give you the file name.

Now you want access to the file? You can open an InputStream to the URI via getContentResolver().openInputStream(theUriThatYouHave).

public String getFileName(Uri uri) {
String result = null;
if (uri.getScheme().equals("content")) {
Cursor cursor = getContentResolver().query(uri, null, null, null, null);
try {
if (cursor != null && cursor.moveToFirst()) {
result = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
} finally {
if (result == null) {
result = uri.getPath();
int cut = result.lastIndexOf('/');
if (cut != -1) {
result = result.substring(cut + 1);
return result;

getContentResolver().takePersistableUriPermission(originalUri, takeFlags);
and probably the best…

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress