Skip to content

Instantly share code, notes, and snippets.

@jchernandez
jchernandez / Screenshot_20170210-151459.png
Last active Feb 10, 2017
Implementación del TopBarView para la aplicación de la Consar
@jchernandez
jchernandez / touch_effect.xml
Last active Feb 5, 2020
Drawable for a touch hover effect pre lollipop and with ripple effect and an example usage
View touch_effect.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<item android:state_pressed="false">
<color android:color="@android:color/transparent"/>
</item>
<item android:state_pressed="true">
<!--<color name="touch_hover">#44565656</color> -->
<color android:color="@color/touch_hover" />
</item>
View TintedProgressBar.java
/***
This progressbar is tinted with the accent color of an application
set a color filter to the progressbar drawable
so change the color of the progressbar in pre-lollipop versions
**/
package com.urbanity.wallet.ui.components;
import android.annotation.TargetApi;
View spiral.java
double t = 0;
Location temp = new Location("");
do {
double newLat = (uLocation.getLatitude() + (t * Math.cos(3 * t)));
double newLong = -(-uLocation.getLongitude() + (t * Math.sin(3 * t)));
LatLng latLng = new LatLng(newLat, newLong);
temp.setLatitude(newLat);
temp.setLongitude(newLong);
locations.add(latLng);
t = t + 0.00009;
@jchernandez
jchernandez / mb_cdmx.json
Last active Mar 8, 2016
Json array of location, name of all the MetroBus from Mexico City, also has the encoded ploylines ot the 6 MB lines.
View mb_cdmx.json
[{
"name": "Linea 1",
"color":"#B32018",
"lines":["upttB||g|Qo@U_AlB_AdE_GxQcBhEqBdCuBdAcE`AeC?{Dw@sYoIy@C{Av@m@tA_Tfp@yAvCw@pEi@tAkCjBcHv@mOp@cHn@_L^mr@zEgq@fEal@bDk^xC{G\\aHJwY`Bor@gR_`GcrAeoBuc@_L_Ces@iPk]qGmDeA@o@Mg@g@m@YM{@Km@Lg@`@U`@_c@eOqHyCay@wXsEwAoHiAaOwEySwBu_@oEqA]i@U_DeEwLyQaFwC_KgHw]uXgIaGqVmRua@c\\}IoGoh@aa@gH_GaTaP_Am@iGqBqIeBeKaByFyAy@AsFy@g@@[VO^ETHd@^b@lKvAc@[",
"}ppuBhxf|QEVITGLIJURYLWBO@S?OAOESKYUIIIOIYEWAW?ODO?C@EBG"],
"stations": [{
"name": "Metrobus Indios Verdes",
"latitude": "19.496586",
"longitude": "-99.119804"
}, {
@jchernandez
jchernandez / SimpleRequest.java
Last active Aug 3, 2020
Simple Post Request with basic auth, using android Volley library
View SimpleRequest.java
StringRequest request = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String s) {
///handle response from service
}, new ErrorResponse() {
@Override
public void onErrorResponse(VolleyError volleyError) {
//handle error response
}
}) {