Skip to content

Instantly share code, notes, and snippets.

Avatar

Afzal Najam AfzalivE

View GitHub Profile
View ForegroundServiceLauncher.kt
class ForegroundServiceLauncher(private val serviceClass: Class<out Service>) {
private var isStarting = false
private var shouldStop = false
private var isCreated = false
@Synchronized
fun startService(context: Context, block: Intent.() -> Unit = {}) {
if (!isCreated) {
isStarting = true
@AfzalivE
AfzalivE / debug_from_qr.py
Created Oct 29, 2020 — forked from benigumocom/debug_from_qr.py
Connect Wireless Debug from Terminal on Android11
View debug_from_qr.py
#!/usr/bin/env python3
"""
Android11
Pair and connect devices for wireless debug on terminal
python-zeroconf: A pure python implementation of multicast DNS service discovery
https://github.com/jstasiak/python-zeroconf
"""
@AfzalivE
AfzalivE / quotes.json
Last active Dec 15, 2016 — forked from signed0/quotes.json
json formatted quotes
View quotes.json
[
{
"quote": "Life isn’t about getting and having, it’s about giving and being.",
"author": "Kevin Kruse"
},
{
"quote": "Whatever the mind of man can conceive and believe, it can achieve.",
"author": "Napoleon Hill"
},
{
View Android CI
#Android and CI and Gradle (A How-To)
There are tech stacks in this world that make it dead simple to integrate a <abbr title="Continuous Integration">CI</abbr> build system. <br>
The Android platform is not one of them.
Although Gradle is getting better, it's still a bit non-deterministic, and some of the fixes you'll need will start to feel more like black magic than any sort of programming.
But fear not! It can be done!
Before we embark on our journey, you'll need a few things to run locally:
@AfzalivE
AfzalivE / idea
Last active Jan 15, 2020 — forked from chrisdarroch/idea
Open/Import a gradle or idea project in Android Studio from your command line!
View idea
#!/bin/sh
# check for where the latest version of IDEA is installed
IDEA=`ls -1d /Applications/Android\ Studio.app | tail -n1`
wd=`pwd`
# were we given a directory?
if [ -d "$1" ]; then
# echo "checking for things in the working dir given"
wd=`ls -1d "$1" | head -n1`
View gist:8ae077720a3a1e3e9ac6
/**
* A module for dependencies which require a {@link android.content.Context} or
* {@link android.app.Application} to create.
*/
@Module(
library = true
)
public class ContextModule {
private Context appContext;
@AfzalivE
AfzalivE / gist:eea5918ac0c61eb08343
Last active Aug 29, 2015 — forked from ljubisa987/gist:e33cd5597da07172c55d
TextInputLayout with fixed "hints not showing"
View gist:eea5918ac0c61eb08343
package com.centralway.numbrs.numbrsapp.views;
import android.content.Context;
import android.graphics.Canvas;
import android.support.design.widget.TextInputLayout;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
@AfzalivE
AfzalivE / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@AfzalivE
AfzalivE / gist:e26d4b10efdd7239031e
Created May 23, 2014 — forked from anonymous/gist:11010752
Inspiration for openGL stuff
View gist:e26d4b10efdd7239031e
URL: http://beesandbombs.tumblr.com/page/6
void setup(){
size(500,500,P3D);
smooth(8);
}
float f(int i, int j, float q){
return(q*(noise(.2*(i+400-.05*frameCount),.2*(j+90))-.5));
}