Skip to content

Instantly share code, notes, and snippets.

files uploaded.
@thedoapps
thedoapps / RegularText.java
Last active March 29, 2016 19:49
Custom TextView Android with spacing between letters.
package pe.taxiapp.client.widget;
/**
* Created by doapps on 9/9/15.
*/
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.text.Spannable;
@thedoapps
thedoapps / VolleyExamplePOST.java
Last active March 6, 2016 13:36
How to implement Web services consumption POST using "x-www-form-urlencode"
RequestQueue requestQueue = Volley.newRequestQueue(this);
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(
Request.Method.POST,
"github.com/api/login",
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
Log.e("LOGIN", response.toString());
}
},
@thedoapps
thedoapps / layout_button.xml
Created January 13, 2015 22:11
Vista usando selector para customizar tu boton android
<Button
android:id="@+id/btn_ok"
android:layout_width="match_parent"
android:layout_height="45dp"
android:padding="10dp"
android:background="@drawable/selector_btn_red"
android:textColor="@color/white"
android:text="@string/ok"/>
@thedoapps
thedoapps / selector_btn_red.xml
Created January 13, 2015 22:08
Como customizar un boton en android, usando selector xml.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Estado Presionado -->
<item android:state_pressed="true">
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="10dp" />
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient android:angle="90" android:endColor="@color/white_5" android:startColor="@color/black_50" android:type="linear" />
</shape>
</item>
</selector>
@thedoapps
thedoapps / style.xml
Created December 4, 2014 00:29
Custom Action Bar - v21
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="android:Theme.Material.Light">
<item name="android:colorPrimary">@color/red_forte</item>
<item name="android:colorPrimaryDark">@color/red_light</item>
<item name="android:textColorPrimary">@color/white</item>
</style>
</resources>
@thedoapps
thedoapps / style.xml
Created December 4, 2014 00:28
Custom Action Bar - above v21
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
<!-- My Action Bar Style -->
@thedoapps
thedoapps / generate_key_fb.java
Last active August 29, 2015 14:07
Generate key hash for Facebook - Android
/**generate key hash facebook**/
EditText txt_key_fb = (EditText) findViewById(R.id.txt_fb);
try {
PackageInfo info = getPackageManager().getPackageInfo(
getPackageName(), PackageManager.GET_SIGNATURES);
for (android.content.pm.Signature signature : info.signatures) {
MessageDigest md;
md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
@thedoapps
thedoapps / RoundedTransformation.java
Created August 4, 2014 08:44
Convierte un ImageView a una Imagen Circular
public class RoundedTransformation implements com.squareup.picasso.Transformation {
private final int radius;
private final int margin; // dp
// radius is corner radii in dp
// margin is the board in dp
public RoundedTransformation(final int radius, final int margin) {
this.radius = radius;
this.margin = margin;
}