Skip to content

Instantly share code, notes, and snippets.

View VladSumtsov's full-sized avatar

Vladyslav Sumtsov VladSumtsov

View GitHub Profile
@huewu
huewu / gist:ed8bf1485864e3ca1768740c740e19f6
Created April 17, 2019 07:24
Get a Widevine DEVICE UNIQUE ID by using MediaDrm API in Android (28+)
val WIDEVINE_UUID = UUID(-0x121074568629b532L, -0x5c37d8232ae2de13L)
val wvDrm = try {
MediaDrm(WIDEVINE_UUID)
} catch (e: UnsupportedSchemeException) {
//WIDEVINE is not available
null
}
wvDrm!!.apply {
@cunneen
cunneen / Readme.md
Last active January 23, 2024 11:17
Install Open GApps In Android Emulator

Introduction

This works to install Open GApps into the Android Emulator, working around the issue where the system partition is too small.

With it, I can get Google Play installing into the emulator. Tested on KitKat (API 19), Lollipop (API 21) and Oreo (API 27).

It's tested on MacOS.

Instructions

@VladSumtsov
VladSumtsov / ListByListFilter.java
Last active December 22, 2016 15:28
Rx list filter. Use this filter to filter list by other list or by internal list
package com.grasshopper.dialer.util;
import android.support.annotation.NonNull;
import java.util.List;
import rx.Observable;
import rx.functions.Func1;
/**
@arcadefire
arcadefire / RecyclerViewExtension.kt
Last active April 20, 2023 10:14
Add addOnItemClickListener easily to a RecyclerView using Kotlin
import android.support.v7.widget.RecyclerView
import android.view.View
interface OnItemClickListener {
fun onItemClicked(position: Int, view: View)
}
fun RecyclerView.addOnItemClickListener(onClickListener: OnItemClickListener) {
this.addOnChildAttachStateChangeListener(object: RecyclerView.OnChildAttachStateChangeListener {
override fun onChildViewDetachedFromWindow(view: View?) {
@VladSumtsov
VladSumtsov / ScreenPagerStateAdapter.java
Created July 20, 2016 19:06
Flow mortar ViewPager Adapter with save state. Logic of saving state took from FragmentStatePagerAdapter.
package com.ghm.ui.adapter;
import android.content.Context;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@oc2pcoj
oc2pcoj / Good IOS RTSP Player.md
Last active March 11, 2024 02:03
iOS RTSP player for IP video cameras
@VladSumtsov
VladSumtsov / CenterImageView.java
Last active September 17, 2015 08:06
Center image in the ImageView using matrix scheme.
package com.aliens.ui.widget;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.drawable.PictureDrawable;
import android.util.AttributeSet;
import android.widget.ImageView;
public class CenterImageView extends ImageView {
@gennad
gennad / BFSDFS.java
Created January 23, 2011 09:14
Breadth-first search and depth-first search Java implementation
Class Main {
public void bfs()
{
// BFS uses Queue data structure
Queue queue = new LinkedList();
queue.add(this.rootNode);
printNode(this.rootNode);
rootNode.visited = true;
while(!queue.isEmpty()) {
Node node = (Node)queue.remove();