Skip to content

Instantly share code, notes, and snippets.

View aenonGit's full-sized avatar

Vincenzo Esposito aenonGit

View GitHub Profile
@dlochrie
dlochrie / combineStyles.js
Created October 9, 2018 13:45
Utility that combines and merges multiple Material UI styles into on function for usage with the "withStyles" HOC.
/**
* Combines/merges Material UI styles so that they may be used on a single
* component with the "withStyles" HOC.
*
* @see {@link https://github.com/mui-org/material-ui/issues/11517#issuecomment-407509327}
* @see {@link https://material-ui.com/customization/css-in-js/}
*
* Usage:
*
* import { combineStyles } from '/path/to/thisFile';
@sheharyarn
sheharyarn / SimpleRVAdapter.java
Last active February 9, 2021 10:11
Simple Recycler View adapter (without XML layout)
/**
* SimpleRVAdapter to quickly get started with simple Lists in Recyclerview
*
* Usage:
*
* RecyclerView rv = (RecyclerView)findViewById(R.id.rv);
* rv.setLayoutManager(new LinearLayoutManager(getContext()));
* rv.setAdapter(new SimpleRVAdapter(new String[] {"1", "2", "3", "4", "5", "6", "7"}));
*
* @author Sheharyar Naseer
@ftvs
ftvs / PhonecallReceiver.java
Last active October 11, 2023 10:05
Detecting an incoming call coming to an Android device. Remember to set the appropriate permissions in AndroidManifest.xml as suggested in the Stackoverflow link. Usage example in comments. Source: Gabe Sechan http://stackoverflow.com/a/15564021/264619 Explanation: http://gabesechansoftware.com/is-the-phone-ringing/#more-8
package com.gabesechan.android.reusable.receivers;
import java.util.Date;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
public abstract class PhonecallReceiver extends BroadcastReceiver {
@elevenetc
elevenetc / gist:bf795f94aaf3e92169ef
Last active March 23, 2024 17:00
Android SuppressWarnings list
//src: http://kurrytran.blogspot.ru/2014/05/android-studio-list-of-suppress-warning.html
//https://android.googlesource.com/platform/tools/adt/idea/+/jb-mr2-dev/adt-branding/src/META-INF/AndroidIdePlugin.xml
//https://android.googlesource.com/platform/tools/adt/idea/+/jb-mr2-dev/android/src/META-INF/plugin.xml
//Most Common Annotations
@SuppressWarnings("all")
@SuppressWarnings("unchecked")
@SuppressWarnings({"JavaDoc"})
@SuppressWarnings({"UnusedDeclaration"})
@ishitcno1
ishitcno1 / MainActivity.java
Last active December 25, 2023 04:26
Detect android device screen on, screen off and user present, then to do something.
public class MainActivity extends Activity {
private ScreenStateReceiver mReceiver;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
IntentFilter intentFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
intentFilter.addAction(Intent.ACTION_SCREEN_OFF);