Skip to content

Instantly share code, notes, and snippets.

View kenumir's full-sized avatar

Michał Szwarc kenumir

View GitHub Profile
@ianhanniballake
ianhanniballake / PlayerService.java
Created July 12, 2015 18:57
Minimal MediaSessionCompat needed to get RemoteControlClient to appear
package com.example.remotecontrolclient;
import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.media.AudioManager;
import android.os.IBinder;
import android.support.v4.media.MediaMetadataCompat;
@pyricau
pyricau / IMMLeaks.java
Last active June 5, 2022 22:46
"Fix" for InputMethodManager leaking the last focused view: https://code.google.com/p/android/issues/detail?id=171190
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.ContextWrapper;
import android.os.Bundle;
import android.os.Looper;
import android.os.MessageQueue;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
@mpost
mpost / colors.xml
Last active September 4, 2024 05:58
This gist demonstrates how to create an animated pause/resume media playback button for Android. It uses animated vector drawables and state transitions to orchestrate the effect. Some background: https://plus.google.com/u/0/+MoritzPost/posts/3EFF8uC7jXv
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="action_pause">#FF8F00</color>
<color name="action_resume">#43A047</color>
</resources>
@gabrielemariotti
gabrielemariotti / Readme.md
Last active March 2, 2024 23:10
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@Aracem
Aracem / OverrideTypefaceApplication.java
Last active May 31, 2018 23:19 — forked from artem-zinnatullin/MyApp.java
Example to override the default font of an Application.
public class OverrideTypefaceApplication extends Application {
@Override
public void onCreate() {
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/Roboto-Regular.ttf"); // font from assets: "assets/fonts/Roboto-Regular.ttf
}
}
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active November 2, 2024 08:30
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@b22n
b22n / AsyncQueryHandler.java
Created July 9, 2013 02:29
android.content.AsyncQueryHandler doesn't support the bulk insertion. I added a startBulkInsert method and onBulkInsertComplete callback pair.
package net.b22n.android.database;
import java.lang.ref.WeakReference;
import android.annotation.SuppressLint;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.Handler;
@javisantana
javisantana / license.txt
Last active August 30, 2023 07:07
NMEA parser in java which does not suck
this software is under the terms of MIT license: http://opensource.org/licenses/MIT