Skip to content

Instantly share code, notes, and snippets.

View TemMax's full-sized avatar
💥

Artsiom Komar TemMax

💥
View GitHub Profile
@jieyu
jieyu / AndroidViewInvalidation.md
Created March 9, 2013 21:24
Describe how View.invalidate() is processed in Android to refresh a widget.

How View.invalidate() is processed in Android

This document is based on the code of android-4.1.1_r6 (Jelly Bean).

First, the invalidate() call will be propagated back to the root of the view hierarchy. During the propagation, the system determines the dirty area that needs to be redrawn. The propagation will eventually reach ViewRootImpl.

frameworks/base/core/java/android/view/View.java

10219   void invalidate(boolean invalidateCache) {

... ...

@granoeste
granoeste / EachDirectoryPath.md
Last active July 23, 2024 09:11
[Android] How to get the each directory path.

System directories

Method Result
Environment.getDataDirectory() /data
Environment.getDownloadCacheDirectory() /cache
Environment.getRootDirectory() /system

External storage directories

@slightfoot
slightfoot / MainActivity.java
Created September 6, 2013 10:50
FadeyTextView example.. will animate text in like "H, He, Hel, Hell, Hello, etc"
package com.example.fadeytextthingy;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v4.view.ViewCompat;
@httnn
httnn / gist:b1d772caf76cdc0c11e2
Created April 9, 2015 16:23
Calculate brightness of Android Bitmap
/*
Calculates the estimated brightness of an Android Bitmap.
pixelSpacing tells how many pixels to skip each pixel. Higher values result in better performance, but a more rough estimate.
When pixelSpacing = 1, the method actually calculates the real average brightness, not an estimate.
This is what the calculateBrightness() shorthand is for.
Do not use values for pixelSpacing that are smaller than 1.
*/
public int calculateBrightnessEstimate(android.graphics.Bitmap bitmap, int pixelSpacing) {
int R = 0; int G = 0; int B = 0;
int height = bitmap.getHeight();
@KenVanHoeylandt
KenVanHoeylandt / build.gradle
Last active February 24, 2024 14:18
Gradle auto-installing pre-commit hook
apply from: rootProject.file('gradle/install-git-hooks.gradle')
@danielesegato
danielesegato / Maven-Publish.Android-Library.md
Last active March 30, 2023 11:44
Android Library Publishing Maven Artifacts via gradle

What is this

This gitst contains a script to push Android libraries as artifacts on a maven repository using the gradle build system.

It is somewhate a fork of Chris Banes gradle push script.

This was me while trying to understand how to setup maven publishing with gradle:

confused AF

Documentation is absent or very lacking and I found no script handling javadoc properly for Android.

@sagivo
sagivo / gist:3a4b2f2c7ac6e1b5267c2f1f59ac6c6b
Last active July 25, 2024 03:11
webRTC stun / turn server list
to check if the server works - https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice
stun:
stun.l.google.com:19302,
stun1.l.google.com:19302,
stun2.l.google.com:19302,
stun3.l.google.com:19302,
stun4.l.google.com:19302,
stun.ekiga.net,
stun.ideasip.com,
@AliYusuf95
AliYusuf95 / OnEventListener.java
Last active March 22, 2024 09:42
Websocket implementation using OkHttp3 with {event->data} message format to make your life easier.
public interface OnEventListener {
/**
* Invoked when new message received from websocket with {event, data} structure
*
* @param data Data string received
*/
void onMessage(String data);
}
@takahirom
takahirom / EventBus.kt
Last active June 8, 2024 14:09
EventBus by Kotlin coroutine
import kotlinx.coroutines.experimental.channels.BroadcastChannel
import kotlinx.coroutines.experimental.channels.ConflatedBroadcastChannel
import kotlinx.coroutines.experimental.channels.ReceiveChannel
import kotlinx.coroutines.experimental.channels.filter
import kotlinx.coroutines.experimental.channels.map
import kotlinx.coroutines.experimental.launch
import javax.inject.Inject
import javax.inject.Singleton
@xorik
xorik / MF.md
Last active July 8, 2024 10:06
Польские инкубаторы

Moja Firma

https://mojafirma.org/

Шаги

  1. Вы заключаете контракт со своим клиентом (клиентами) или через фриланс биржи, используя юридические данные нашего бизнес-инкубатора;
  2. Полученные средства поступают на ваш фирменный суб-счет (валюта PLN, EUR, USD), которые вы потом себе выплачиваете как заработную плату в рамках договора с нами;
  3. Предоставив польским государственным органом подтверждение того, что вы тведете деятельность и проводите доход легально, вы получаете ВНЖ в Польше.