Skip to content

Instantly share code, notes, and snippets.


Pedro Oliveira kanytu

Block or report user

Report or block kanytu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:2418876068187ae46454
ImageLoader.getInstance().loadImage("", new ImageLoadingListener() {
public void onLoadingStarted(String imageUri, View view) {
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
kanytu / PERMISSIONS m
Last active Nov 12, 2015 — forked from pocmo/gist:bc95238e890a185003c4
Android M-Preview 1 - Permissions + Groups + Protection Level
(android.permission-group.CONTACTS) android.permission.READ_CONTACTS dangerous
(android.permission-group.CONTACTS) android.permission.WRITE_CONTACTS dangerous
(android.permission-group.CONTACTS) android.permission.READ_PROFILE dangerous
(android.permission-group.CONTACTS) android.permission.WRITE_PROFILE dangerous
(android.permission-group.CALENDAR) android.permission.READ_CALENDAR dangerous
(android.permission-group.CALENDAR) android.permission.WRITE_CALENDAR dangerous
(android.permission-group.SMS) android.permission.SEND_SMS dangerous
(android.permission-group.SMS) android.permission.RECEIVE_SMS dangerous
View gist:c71501b16ebd9bec4b43
import android.content.Context;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.TextView;
import com.poliveira.parallaxrecycleradapter.ParallaxRecyclerAdapter;
View ValueAnimator for Colors
ValueAnimator animator = ValueAnimator.ofObject(new ArgbEvaluator(), 0x7fffffff, 0x00ffffff);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
wrapper.getImageView().setColorFilter((Integer) animation.getAnimatedValue());
View density conversion
private float pxFromDp(float dp)
return dp * getResources().getDisplayMetrics().density;
private float dpFromPx(float px)
return px / getResources().getDisplayMetrics().density;
View check_apk_signature
private static final int VALID = 0;
private static final int INVALID = 1;
public static int checkAppSignature(Context context) {
try {
PackageInfo packageInfo = context.getPackageManager()
View gist:2c80cff9b571f042b8f1
imgUsrClrId.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
//***********************Get the position of the screen on image***************************//
float eventX = event.getX();
float eventY = event.getY();
float[] eventXY = new float[] {eventX, eventY};
//***********************Get the position of the screen on image***************************//
//***********************Get the position of the image on image***************************//
View back button on toolbar
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if(shouldBack()) {
//call onbackpressed or something
return; //return after so you don't call syncState();
}else if (mNavigationDrawerFragment.isDrawerOpen())
View get_country_from_latlon
Geocoder geocoder = new Geocoder(context);
List<Address> addrs = geocoder.getFromLocation(myLatitude, myLongitude, 1);
if (!addrs.isEmpty())
String myCountry = addrs.get(0).getCountryName();
View textview_text_animation
public void animateTextView(int initialValue, int finalValue, final TextView textview) {
DecelerateInterpolator decelerateInterpolator = new DecelerateInterpolator(0.8f);
int start = Math.min(initialValue, finalValue);
int end = Math.max(initialValue, finalValue);
int difference = Math.abs(finalValue - initialValue);
Handler handler = new Handler();
for (int count = start; count <= end; count++) {
int time = Math.round(decelerateInterpolator.getInterpolation((((float) count) / difference)) * 100) * count;
final int finalCount = ((initialValue > finalValue) ? initialValue - count : count);
handler.postDelayed(new Runnable() {
You can’t perform that action at this time.