Skip to content

Instantly share code, notes, and snippets.

@jchernandez
jchernandez / Screenshot_20170210-151459.png
Last active February 10, 2017 21:16
Implementación del TopBarView para la aplicación de la Consar
Screenshot_20170210-151459.png
@jchernandez
jchernandez / touch_effect.xml
Last active May 19, 2022 05:05
Drawable for a touch hover effect pre lollipop and with ripple effect and an example usage
<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>
@jchernandez
jchernandez / TintedProgressBar.java
Last active September 30, 2016 18:42
Tinted Progress Bar
/***
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;
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 March 8, 2016 20:42
Json array of location, name of all the MetroBus from Mexico City, also has the encoded ploylines ot the 6 MB lines.
[{
"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 August 3, 2020 20:41
Simple Post Request with basic auth, using android Volley library
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
}
}) {