Skip to content

Instantly share code, notes, and snippets.

View carlonzo's full-sized avatar

Carlo Marinangeli carlonzo

View GitHub Profile
@carlonzo
carlonzo / setup_mitm_emulator.sh
Created April 4, 2023 17:19
Setup mitmproxy certificate on a new android emulator
# Following instructions in https://docs.mitmproxy.org/stable/howto-install-system-trusted-ca-android/#instructions-for-api-level--28-1
# Use and emulator with API level 28 or lower
# Start the emulator with: emulator -avd <avd name> -writable-system
set -x
set -e
root_result=$(adb root)
@carlonzo
carlonzo / PopupHighlightItems.java
Last active November 2, 2018 10:20
Centered Window Android. It will align the contentView at the center of the anchor. It has a addOnGlobalLayoutListener to refresh the position when the size of the contentview changes
public class PopupHighlightItems {
private WindowManager windowManager;
private final View contentView;
private WeakReference<View> anchor;
private int direction = Gravity.TOP;
private boolean isShowing = false;
private WindowManager.LayoutParams layoutParams;
@carlonzo
carlonzo / PopupHighlightItems.java
Created April 18, 2017 16:35
Centered Window Android
public class PopupHighlightItems {
private WindowManager windowManager;
private final View contentView;
private WeakReference<View> anchor;
private int direction = Gravity.TOP;
private boolean isShowing = false;
private WindowManager.LayoutParams layoutParams;
@carlonzo
carlonzo / ParallaxScrollingImages.java
Created March 3, 2017 22:07
ParallaxScrollingImages yahoo weather like
package it.carlom.bubutranslater;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@carlonzo
carlonzo / CacheFragmentStatePagerAdapter.java
Created August 2, 2015 17:08
FragmentStatePagerAdapter that caches each pages.
/*
* Copyright 2014 Soichiro Kashima
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software