Rummys Blog An world of endless Monday

Friday, 1 July, 2016

Code Resources, Iconography and imagery

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

Preferences

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.

Icons

Several of the icons I’m using come from https://materialdesignicons.com/, then minor edits to make them white.

dots-horizontal more horizontal (3 dots)

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

eye/show, eye-off/hidden

https://design.google.com/icons/
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:

http://stackoverflow.com/questions/32966069/how-implement-left-right-swipe-fling-on-layout-in-android
http://stackoverflow.com/questions/937313/fling-gesture-detection-on-grid-layout
which gives info about system standard values

handlepointermove has
this.requestParentDisallowInterceptTouchEvent(true);

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)
MyGridViewPager
FrameLayout
SwipeDismissLayout .. I know this gets events!#
PhoneWindow$DecorView
ViewRootImpl

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!

MyLocation

Can enable Maps blue dot without the mylocation button by
http://stackoverflow.com/questions/14376361/disable-center-button-in-mylocation-at-google-map-api-v2
map.setMyLocationEnabled(true);
map.getUiSettings().setMyLocationButtonEnabled(false);

 

Crash Reporting

http://stackoverflow.com/questions/601503/how-do-i-obtain-crash-data-from-my-android-application

ACRA?

Get document name from google drive downloaded document
http://stackoverflow.com/questions/23063691/how-to-get-file-name-and-real-path-of-google-drive-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).
also
http://stackoverflow.com/questions/5568874/how-to-extract-the-file-name-from-uri-returned-from-intent-action-get-content

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 {
cursor.close();
}
}
if (result == null) {
result = uri.getPath();
int cut = result.lastIndexOf('/');
if (cut != -1) {
result = result.substring(cut + 1);
}
}
return result;
}

and
getContentResolver().takePersistableUriPermission(originalUri, takeFlags);
and probably the best…
http://stackoverflow.com/questions/25171246/open-a-google-drive-file-content-uri-after-using-kitkat-storage-access-framework
https://developer.android.com/training/secure-file-sharing/retrieve-info.html

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress