Skip to content

Instantly share code, notes, and snippets.

View moizest89's full-sized avatar
🎯
Focusing

Moises Portillo moizest89

🎯
Focusing
View GitHub Profile
@moizest89
moizest89 / gist:7009635
Last active December 25, 2015 16:59
Simple class to determinate if your device is tablet or phone from your size. If size > 5 is tablet
import android.content.Context;
import android.util.DisplayMetrics;
public class isTablet {
double size_device;
public double tabletSize(Context context) {
double size = 0;
try {
// Compute screen size
package models;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
package models;
import android.os.Parcel;
import android.os.Parcelable;
public class ArticlesPhotosModel implements Parcelable {
public static final String CN_PHOTOS = "photos";
public static final String CN_RETINA3X = "retina3x";
package models;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by @moizest89 in SV on 8/14/15.
*/
public class ArticlesVideosModel implements Parcelable{
//Data methods
private void getValuesUrl(){
Log.e("fragment", URL_CONNECTION);
JsonObjectRequest request = new JsonObjectRequest(this.URL_CONNECTION, null,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
//System.out.print("response: "+response);
setValuesUrl(response);
}
private AQuery aq;
private Bitmap preset;
@Override
protected void onCreate(Bundle savedInstanceState) {
this.aq= new AQuery(this.context);
this.preset= aq.getCachedImage(R.drawable.placeholder_slider); //Holder para que cargen las imagenes
}
var menu_responsive = {
evaluate_menu:function(){
console.log("evaluate_menu")
if(state_menu_responsive == 0){
this.open_menu();
}else if(state_menu_responsive == 1){
this.close_menu();
}
},
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import android.app.AlertDialog;
import android.app.Service;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.Address;
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@moizest89
moizest89 / Activity.java
Created November 30, 2016 01:20
Easy OnItemClickListener implementation into RecyclerView
Adapter mAdapter = new Adapter();
mAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClickListener(View view, int position) {
//To-do something
}
});