Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kennydude committed Jul 19, 2012
0 parents commit fd6c8bc
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
*.zip

1 change: 1 addition & 0 deletions content/android.app.ActionBar/class-ov.txt
@@ -0,0 +1 @@
Want to keep back-compatability? <a href="http://actionbarsherlock.com/">ActionBarSherlock</a> is here to help
46 changes: 46 additions & 0 deletions content/android.app.AlarmManager/class-ov.js
@@ -0,0 +1,46 @@
$("#tool input").change(function(){ generate(); }).keyup(function(){ generate(); });;
generate();

function c(i){
if($(i + ":checked").length == 0)
return false;
return true;
}

function generate(){
code = "Calendar calendar = Calendar.getInstance();\n";
code += "calendar.setTimeInMillis(System.currentTimeMillis());\n";
if($("#hours").val() != ""){
code += "calendar.add(Calendar.HOUR, " + $("#hours").val() + ");\n";
} if($("#mins").val() != ""){
code += "calendar.add(Calendar.MINUTE, " + $("#mins").val() + ");\n";
} if($("#secs").val() != ""){
code += "calendar.add(Calendar.SECOND, " + $("#secs").val() + ");\n";
}
code += "alm.set";
if(c("#repeat")){
code += "Repeating";
} else if(c("#repeat_in")){
code += "InexactRepeating";
}
code += "(AlarmManager.RTC, getTimeInMillis()";
if(c("#once")){
$("#repeatopts").hide(200);
} else{
code += ", ";
if(c("#in_hour")){
code += "AlarmManager.INTERVAL_HOUR";
} else if(c("#in_hhour")){
code += "AlarmManager.INTERVAL_HALF_HOUR";
} else if(c("#in_15")){
code += "AlarmManager.INTERVAL_FIFTEEN_MINUTES";
} else if(c("#in_day")){
code += "AlarmManager.INTERVAL_DAY";
} else if(c("#in_hday")){
code += "AlarmManager.INTERVAL_HALF_DAY";
}
$("#repeatopts").show(200);
}
code += ", pendingIntent);";
$("#thecode").html(code);
}
22 changes: 22 additions & 0 deletions content/android.app.AlarmManager/class-ov.txt
@@ -0,0 +1,22 @@
<h2>Code Generator:</h2>
<div id="tool">
Okay, so I've called my <a href="http://developer.android.com/reference/android/app/AlarmManager.html">AlarmManager</a> <code>alm</code>.<br/>
I want an alarm which:<br/>
<input type="radio" checked id="repeat" name="repeat"/><label for="repeat">Repeats exactly</label><br/>
<input type="radio" id="repeat_in" name="repeat"/><label for="repeat_in">Repeats inexactly <span class="label success" title="Use this if you need to repeat operations and it is not absolutely crucial for those to run on time (for example, weather)">Good for battery life!</span></label><br/>
<input type="radio" id="once" name="repeat"/><label for="once">Exactly on time</label><br/>
And I want it to run first of all in <input placeholder="none" style="width:50px" id="hours"/> hours, <input id="mins" style="width:50px" placeholder="none"/> minuites and <input id="secs" value="5" placeholder="none" style="width:50px"/> seconds.<br/>
<div id="repeatopts">
It needs to repeat every (if you need a custom, just replace the final result with your interval in microseconds (seconds * 1000) ):<br/>
<input type="radio" checked id="in_hour" name="in"/><label for="in_hour">hour</label><br/>
<input type="radio" id="in_hhour" name="in"/><label for="in_hhour">half hour</label><br/>
<input type="radio" id="in_15" name="in"/><label for="in_15">15 mins</label><br/>
<input type="radio" id="in_day" name="in"/><label for="in_day">day</label><br/>
<input type="radio" id="in_hday" name="in"/><label for="in_hday">half a day</label><br/>
</div>
And the code is going to be roughly (updating whenever you do):
<pre id="thecode">
// Please set something
</pre>
</div>
</div>
2 changes: 2 additions & 0 deletions content/android.os.PowerManager.WakeLock/class-ov.txt
@@ -0,0 +1,2 @@
<strong>Tip from Android G+ Developers:</strong>
If you just want to keep the screen on, don't use a Wake Lock just use <a href="http://developer.android.com/reference/android/view/View.html#setKeepScreenOn(boolean)">View.setKeepScreenOn</a>
6 changes: 6 additions & 0 deletions content/android.widget.EdgeEffect/class-ov.txt
@@ -0,0 +1,6 @@
<p>
This is really useful for glowable edges. You can rotate the canvas before drawing, which allows you to move the glow. By default it glows from the top edge.
</p>
<p>
You can automate a glow by having a float value, increasing on <code>draw()</code>, and calling <code>onPull()</code> until a sepecified value, then <code>onRelease</code>.
</p>
4 changes: 4 additions & 0 deletions jquery.min.js

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions manifest.json
@@ -0,0 +1,17 @@
{
"name": "Android Developer Improvements",
"version": "1",
"description": "New stuff for Android Devs",
"permissions": [
"http://developer.android.com/"
],
"homepage_url": "http://kennydude.me",
"content_scripts": [
{
"matches": ["http://developer.android.com/*"],
"js": ["jquery.min.js","page.js"],
"all_frames": true
}
]
}

48 changes: 48 additions & 0 deletions page.js
@@ -0,0 +1,48 @@
// AndroidAdditions

function l(h, t, x_id){
// load item
$.get(chrome.extension.getURL("content/" + h + "/"+t+".txt"), function(d, x, e){
$("<div>").addClass("aa-class-op").html(d).appendTo(".add-id-" + x_id);
});
}

$(document).ready(function(){
p = document.location.pathname.substr(1);
p = p.split("/");
if(p[0] == "reference"){
// Reference guide
// Remove ref
p = jQuery.grep(p, function(k,value) {
return value != 0;
});

// Get rid of .html properly
x = p[p.length-1].split(".");
x = jQuery.grep(x, function(value) {
return value != "html";
});
p[p.length-1] = x.join(".");

h = p.join(".");

// Request Class Overview
$.get(chrome.extension.getURL("content/" + h + "/class-ov.txt"), function(d){
$("<div>").addClass("aa-class-ov").html("<h1>Android Additions Notes</h1>" + d).insertAfter(".jd-descr:first");
}, "text");
$.get(chrome.extension.getURL("content/" + h + "/class-ov.js"), function(){}, "script");

// Get all the detail extras
var id = 0;
$(".jd-details").each(function(){
t = $(".jd-details-title", this).clone();
$("span.normal", t).remove();
t = t.text().trim();
$(this).addClass("add-id-" + id);
x_id = id;
id = id+1;

l(h, t, x_id);
});
}
});

0 comments on commit fd6c8bc

Please sign in to comment.