Skip to content

Instantly share code, notes, and snippets.

View Y-E-P's full-sized avatar
🏠
Working from home

Yurii Poudanien Y-E-P

🏠
Working from home
  • NoName Ltd.
  • Vinnytsia
View GitHub Profile
@paulocaldeira17
paulocaldeira17 / AppBarStateChangeListener.java
Last active August 22, 2024 06:23
Android AppBarLayout collapsed/expanded state listener
import android.support.design.widget.AppBarLayout;
/**
* App bar collapsing state
* @author Paulo Caldeira <[email protected]>.
*/
public abstract class AppBarStateChangeListener implements AppBarLayout.OnOffsetChangedListener {
// State
public enum State {
EXPANDED,
@Mariovc
Mariovc / ShareUtils.java
Last active June 9, 2023 17:24
Utility to share text and url on Facebook, Twitter and Whatsapp
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
@lopspower
lopspower / README.md
Last active February 24, 2021 23:51
Configuration of proguard-rules.pro

Proguard Configuration

Twitter

1) Enable Proguard in your build.gradle module :

android {
    //...
 buildTypes {
@bjconlan
bjconlan / coffee.kt
Created November 22, 2015 04:06
Kotlin Dagger Example
import dagger.Component
import dagger.Module
import dagger.Provides
import javax.inject.Inject
import javax.inject.Singleton
interface Heater {
fun on()
fun off()
}
@cesarferreira
cesarferreira / RxJava.md
Last active March 30, 2025 00:28
Party tricks with RxJava, RxAndroid & Retrolambda

View Click

Instead of the verbose setOnClickListener:

RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));

Filter even numbers

Observable
    .just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
@gabrielemariotti
gabrielemariotti / README.md
Last active February 24, 2021 10:52
How to manage the support libraries in a multi-module projects. Thanks to Fernando Cejas (http://fernandocejas.com/)

Centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:

root
  --gradleScript
 ----dependencies.gradle
@rafayali
rafayali / custom_intent_chooser.java
Created March 31, 2015 07:27
Creating a chooser with custom intent resolvers
public void onShareClick(View v) {
Resources resources = getResources();
Intent emailIntent = new Intent();
emailIntent.setAction(Intent.ACTION_SEND);
// Native email client doesn't currently support HTML, but it doesn't hurt to try in case they fix it
emailIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(resources.getString(R.string.share_email_native)));
emailIntent.putExtra(Intent.EXTRA_SUBJECT, resources.getString(R.string.share_email_subject));
emailIntent.setType("message/rfc822");
@Laimiux
Laimiux / ViewStatePagerAdapter.java
Created January 9, 2015 23:03
PagerAdapter for views instead of Fragments.
package com.laimiux.dayahead.ui.util;
import android.content.Context;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.util.Log;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
@koocbor
koocbor / CreateDialog.java
Last active June 20, 2022 15:50
Full Screen Dialog in Android
FullScreenDialog dialog = new FullScreenDialog();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
dialog.show(ft, FullScreenDialog.TAG);
@slightfoot
slightfoot / MainActivity.java
Last active April 4, 2025 14:03
Example of using a SurfaceView to render potential 2d game content.
package com.your.package;
import java.util.Random;
import android.app.Activity;
import android.content.Context;
import android.graphics.BitmapFactory;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;