Skip to content

Instantly share code, notes, and snippets.

View MaTriXy's full-sized avatar

Yossi Elkrief MaTriXy

View GitHub Profile
package com.mtsahakis.mediaprojectiondemo;
import android.app.Activity;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.hardware.display.DisplayManager;
@MaTriXy
MaTriXy / AndroidManifest.xml
Created November 25, 2017 22:03 — forked from bjoernQ/AndroidManifest.xml
Creating a System Overlay (Always on Top over all Apps) in Android
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.mobilej.overlay"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<application android:label="SystemOverlay" >
<activity
@MaTriXy
MaTriXy / code.kt
Created November 23, 2017 22:30 — forked from chrisbanes/code.kt
Night Mode inflater
/*
* Copyright 2017 Google, Inc.
*
* 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
@MaTriXy
MaTriXy / code.kt
Created November 23, 2017 22:30 — forked from chrisbanes/code.kt
Night Mode inflater
/*
* Copyright 2017 Google, Inc.
*
* 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
@MaTriXy
MaTriXy / NetUtils.kt
Created November 14, 2017 12:47
Get Local IP Address in kotlin
private fun getLocalIpAddress(): String? {
try {
val wifiManager: WifiManager = context?.getSystemService(WIFI_SERVICE) as WifiManager
return ipToString(wifiManager.connectionInfo.ipAddress)
} catch (ex: Exception) {
Log.e("IP Address", ex.toString())
}
@MaTriXy
MaTriXy / GifDecoder.java
Created August 10, 2017 17:39 — forked from devunwired/GifDecoder.java
An optimized implementation of GifDecoder for Android devices.
/**
* Copyright (c) 2013 Xcellent Creations, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@MaTriXy
MaTriXy / RepeatRule.java
Created July 14, 2017 11:20
Obeying the rules ? Challenge accepted. Blog post about using TestRules and Parameterized tests in Android
public class RepeatRule implements TestRule {
@Retention(RetentionPolicy.RUNTIME)
@Target({METHOD, ANNOTATION_TYPE})
public @interface Repeat {
int value() default 1;
}
private static class RepeatStatement extends Statement {
@MaTriXy
MaTriXy / build.gradle
Created July 11, 2017 04:36 — forked from koral--/build.gradle
testApt to testAnnotationProcessor migration, workaround for issue: https://code.google.com/p/android/issues/detail?id=224272
android.applicationVariants.all {
def aptOutputDir = new File(buildDir, "generated/source/apt/${it.unitTestVariant.dirName}")
it.unitTestVariant.addJavaSourceFoldersToModel(aptOutputDir)
}
@MaTriXy
MaTriXy / ResultHolder.java
Created June 26, 2017 03:46 — forked from 1zaman/ResultHolder.java
Loader for Retrofit 2.0 API. This uses the framework implementation, but it can be adapted to use the support library implementation without much modification.
package com.example.retrofit.loader;
import retrofit.Response;
/**
* A wrapper around the Retrofit {@link Response} that will
* throw any loading errors upon retrieval.
*
* @param <T> The data type that was loaded.
*/
@MaTriXy
MaTriXy / autojoin.user.js
Created June 15, 2017 06:26 — forked from ericcj/autojoin.user.js
G+ Hangouts Autojoin without setTimeout leak
// ==UserScript==
// @name G+ Hangouts Autojoin
// @description Automatically click the join button when loading a hangout
// @include https://plus.google.com/hangouts/_/*
// @match https://plus.google.com/hangouts/_/*
// @version 0.1.0
// ==/UserScript==
(function(){