From 69aad81933fe0657fdf39d36103adef76a37d837 Mon Sep 17 00:00:00 2001 From: fkloft Date: Fri, 13 Dec 2013 00:12:18 +0100 Subject: [PATCH 1/3] mobile: show portal counts in nav drawer --- .../drawable-hdpi/ic_action_data_usage.png | Bin 0 -> 633 bytes .../drawable-mdpi/ic_action_data_usage.png | Bin 0 -> 464 bytes .../drawable-xhdpi/ic_action_data_usage.png | Bin 0 -> 848 bytes .../drawable-xxhdpi/ic_action_data_usage.png | Bin 0 -> 1293 bytes plugins/portal-counts.user.js | 55 +++++++++++++----- 5 files changed, 39 insertions(+), 16 deletions(-) create mode 100644 mobile/res/drawable-hdpi/ic_action_data_usage.png create mode 100644 mobile/res/drawable-mdpi/ic_action_data_usage.png create mode 100644 mobile/res/drawable-xhdpi/ic_action_data_usage.png create mode 100644 mobile/res/drawable-xxhdpi/ic_action_data_usage.png diff --git a/mobile/res/drawable-hdpi/ic_action_data_usage.png b/mobile/res/drawable-hdpi/ic_action_data_usage.png new file mode 100644 index 0000000000000000000000000000000000000000..f0f83a027be2d4b1fd1a607a8980af3cb2c1d08e GIT binary patch literal 633 zcmV-<0*3vGP)k7X-j?Giuy?y)0RL7eGto{e!I+L%5d;S|1axwb3>jL%`=)HI%O z95^k`wWGPGC14nj+rRG_TQTMhY3}I=kk9KbvF`OxzS4xWhCBgM8x^n^bSe5SJbw|E z_Jr0F-+_$^SaciodGvh>U}biS~3lOc#{O|czVD!KbdZKl9dl0eLqMUh>Q zBoJx`&Rhs338(|6nUO#sNkHL%=>fE4%&9pA#+<~cI^T@(#gqh|nB!O6gbT(OB#G-= z?m){4tPT=e=uXVfT1f&*eWKBM`!5NOiq(&mYFTKE9GN2YO}V-pVRl?F`VLM0WbcEP)C7PrOwd-!1D~VD@&$Xiu*F^sp5KKywez5z1X(1Hfc`49TZ{EF23;!*J!RWx}8-fbS{P-$4<&IRs^g8KD$oo#DIA1 z=LE)UXxTqMILENI{EG`o%W=``c=0YIzkMZ3k|fDRfB^tyQ`X?bm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ge-Bl)uPto4nJ@xe+~2 zBh9oNz#(8&Ve{rvTG{aPm_vZqqY4^(Sclw?OH%%xA`wM`epmSmh29VA@L86!_k@W- zeenBNk1P+1ge6((=D!;h2}6?jU5WnBGkzkXz-s|nlMifKsP~uVj0Y}d4gee' + counts + '', - title: 'Portal counts: ' + total + ' ' + (total == 1 ? 'portal' : 'portals'), - }); + var title = total + ' ' + (total == 1 ? 'portal' : 'portals'); + + if(typeof android !== 'undefined' && android && android.addPane) { + $('
' + + '
' + title + '
' + + counts + + '
').appendTo(document.body); + } else { + dialog({ + html: '
' + counts + '
', + title: 'Portal counts: ' + title, + }); + } } +window.plugin.portalcounts.onPaneChanged = function(pane) { + if(pane == "plugin-portalcounts") + window.plugin.portalcounts.getPortals(); + else + $("#portalcounts").remove() +}; + var setup = function() { - $('#toolbox').append(' Portal counts'); + if(typeof android !== 'undefined' && android && android.addPane) { + android.addPane("plugin-portalcounts", "Portal counts", "ic_action_data_usage"); + addHook("paneChanged", window.plugin.portalcounts.onPaneChanged); + } else { + $('#toolbox').append(' Portal counts'); + } + $('head').append(''); From 508a892341eff41f600ae3aef39393aebd8cb719 Mon Sep 17 00:00:00 2001 From: fkloft Date: Sun, 15 Dec 2013 16:36:38 +0100 Subject: [PATCH 3/3] portal-counts: Some fixes for mobile --- plugins/portal-counts.user.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/plugins/portal-counts.user.js b/plugins/portal-counts.user.js index 47fb7ae6..60a41ec9 100644 --- a/plugins/portal-counts.user.js +++ b/plugins/portal-counts.user.js @@ -44,7 +44,7 @@ window.plugin.portalcounts = { }; //count portals for each level available on the map -window.plugin.portalcounts.getPortals = function(){ +window.plugin.portalcounts.getPortals = function (){ //console.log('** getPortals'); var self = window.plugin.portalcounts; var displayBounds = map.getBounds(); @@ -104,7 +104,7 @@ window.plugin.portalcounts.getPortals = function(){ counts += self.neuP; counts += ''; - var svg = $('').css("padding-top", 10); + var svg = $('').css("margin-top", 10); var all = self.PortalsRes.map(function(val,i){return val+self.PortalsEnl[i]}); all[0] = self.neuP; @@ -177,10 +177,9 @@ window.plugin.portalcounts.getPortals = function(){ .appendTo(g); } - counts += svg[0].outerHTML; + counts += $("
").append(svg).html(); } else counts += '

No Portals in range!

'; - counts += ''; var total = self.enlP + self.resP + self.neuP; var title = total + ' ' + (total == 1 ? 'portal' : 'portals'); @@ -248,6 +247,10 @@ window.plugin.portalcounts.makePie = function(startAngle, endAngle, color) { var p2x = Math.sin(endAngle * 2 * Math.PI) * self.RADIUS_INNER; var p2y = Math.cos(endAngle * 2 * Math.PI) * self.RADIUS_INNER; + // for a full circle, both coordinates would be identical, so no circle would be drawn + if(startAngle == 0.5 && endAngle == -0.5) + p2x -= 1E-5; + return $("") .attr({ fill: color, @@ -271,6 +274,12 @@ window.plugin.portalcounts.makeRing = function(startAngle, endAngle, color) { var p4x = Math.sin(startAngle * 2 * Math.PI) * self.RADIUS_INNER; var p4y = Math.cos(startAngle * 2 * Math.PI) * self.RADIUS_INNER; + // for a full circle, both coordinates would be identical, so no circle would be drawn + if(startAngle == 0.5 && endAngle == -0.5) { + p2x -= 1E-5; + p3x -= 1E-5; + } + return $("") .attr({ fill: color, @@ -306,7 +315,7 @@ var setup = function() { } $('head').append('