Skip to content

Instantly share code, notes, and snippets.

@nickbutcher
nickbutcher / rainbow.xml
Last active January 25, 2023 17:09
Demonstrating using VectorDrawable gradients to create a rainbow effect. See https://twitter.com/crafty/status/1011922414983352320
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 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 distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.
@sabpprook
sabpprook / gist:26139f6690f694a6462c326d5f113280
Created December 31, 2016 20:39
ADB Change Android Language
adb shell content query --uri content://settings/system --where "name=\'system_locales\'"
adb shell content delete --uri content://settings/system --where "name=\'system_locales\'"
adb shell content insert --uri content://settings/system --bind name:s:system_locales --bind value:s:en-US
adb shell content insert --uri content://settings/system --bind name:s:system_locales --bind value:s:zh-Hant-TW
adb shell content insert --uri content://settings/system --bind name:s:system_locales --bind value:s:zh-Hant-TW,en-US,ja-JP
@Pkmmte
Pkmmte / WindowInsetsFrameLayout.java
Last active March 25, 2024 13:55
A FrameLayout subclass that dispatches WindowInsets to its children instead of adjusting its padding. Useful for Fragment containers.
package com.pkmmte.widget;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.WindowInsets;
import android.widget.FrameLayout;
/**
@yeoupooh
yeoupooh / ExampleStaticHandler.java
Last active August 28, 2018 06:26
Avoiding "This Handler class should be static or leaks might occur".
// This is OLD way of usnig Handler which shows an warning.
private Handler oldHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
// Handle a message as you want.
}
}
@dtmilano
dtmilano / android-select-device
Last active November 29, 2023 09:29
Script to select one connected device or emulator when running adb
#! /bin/bash
#=====================================================================
# Selects an android device
# Copyright (C) 2012-2022 Diego Torres Milano. All rights reserved.
#
# The simplest way to invoke this script is creating a function like
# this one in your shell startup file:
#
# ```
# adb ()