Skip to content

Instantly share code, notes, and snippets.

@yqritc
yqritc / TextThumbSeekBar.md
Last active April 17, 2024 08:26
SeekBar showing its progress as text on thumb

TextThumbSeekBar

Define a custom class extending SeekBar to show the progress text on thumb of SeekBar.

public class TextThumbSeekBar extends SeekBar {

    private int mThumbSize;
    private TextPaint mTextPaint;

    public TextThumbSeekBar(Context context) {
@SamRothCA
SamRothCA / calendar.sh
Created November 28, 2014 17:05
Calendar for current month
cal | grep --before-context 6 --after-context 6 --color -e " $(date +%e)" -e "^$(date +%e)"
@donnfelker
donnfelker / CircularTransformation.java
Last active December 2, 2020 20:47
Picasso and CircularTransform Example
import android.graphics.*;
import com.squareup.picasso.Transformation;
/**
* Transforms an image into a circle representation. Such as a avatar.
*/
public class CircularTransformation implements Transformation
{
int radius = 10;
@Zren
Zren / DarkSolarized.qss
Last active August 28, 2022 14:22
Dark Solarized - Quassel Theme (qss)
/**
** ______ _ _____ _ _ _
** | _ \ | | / ___| | | (_) | |
** | | | |__ _ _ __| | __ \ `--. ___ | | __ _ _ __ _ _______ __| |
** | | | / _` | '__| |/ / `--. \/ _ \| |/ _` | '__| |_ / _ \/ _` |
** | |/ / (_| | | | < /\__/ / (_) | | (_| | | | |/ / __/ (_| |
** |___/ \__,_|_| |_|\_\ \____/ \___/|_|\__,_|_| |_/___\___|\__,_|
**
** Quassel Theme
**
@dmarcato
dmarcato / strip_play_services.gradle
Last active December 21, 2022 10:10
Gradle task to strip unused packages on Google Play Services library
def toCamelCase(String string) {
String result = ""
string.findAll("[^\\W]+") { String word ->
result += word.capitalize()
}
return result
}
afterEvaluate { project ->
Configuration runtimeConfiguration = project.configurations.getByName('compile')
@butelo
butelo / crosswalkview.md
Created March 5, 2014 11:35
How to use CrossWalk runtime within an Android application

So, what is crosswalk and why do I care? Take a look at the website: https://crosswalk-project.org/

CrossWalk is a HTML5 runtime, you can use it to create HTML5 applications with 'native features' You can use CrossWalk to create HTML5-only applications for Android (x86 and arm architectures) and Tizen but you can also use CrossWalk as a View within an android project.

This means you can replace Android WebView with XWalkView and get some extra features like:

@brendanzagaeski
brendanzagaeski / gist:9337026
Last active April 18, 2020 10:27
Prevent the Xamarin.Android bindings generator from converting a get or set method to a property
# Prevent the Xamarin.Android bindings generator from converting a `get` or `set` method to a property
Xamarin.Android Java bindings projects will by default automatically bind any Java method that starts with "get" to be the getter of a C# property. To prevent this in specific cases, you can set the `propertyName` attribute of the method to the empty string. The same is true for methods that start with "set", except that they will only be converted to property setters if there is already a corresponding property getter. This requirement prevents the creation of set-only properties (see also http://msdn.microsoft.com/en-us/library/ms229006.aspx).
So for example, you would add something like the following to the Metadata.xml file:
```
<attr path="/api/package[@name='com.example.testandroidlib']/class[@name='MyClass']/method[@name='getNumberTen']" name="propertyName"></attr>
```
@chrisbanes
chrisbanes / ForegroundLinearLayout.java
Created February 19, 2014 13:16
ForegroundLinearLayout
/*
* Copyright (C) 2006 The Android Open Source Project
*
* 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
@ignasi
ignasi / db_getter.sh
Created January 30, 2014 11:43
Get database from an Android app (Android 4.3+)
#!/bin/bash
# Android 4.3+ changes app's internal directory permissions and you can not just pull your
# databases to your computer, so I did this as a workaround to extract my databases.
# I only use it for debug, use it under your responsability.
package=$1
db_name=$2
path="/data/data/$package/"
@cyrilmottier
cyrilmottier / ResourcesAdditions.java
Last active January 12, 2024 17:55
Lightweight key-value pairs resources for Android applications.
package com.cyrilmottier.android.resourcesadditions;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.os.Bundle;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
/**
* @author Cyril Mottier