Skip to content

Instantly share code, notes, and snippets.

@dlew
dlew / themes-debug.xml
Last active March 1, 2024 15:46
With the new theming in AppCompat, a lot of assets are tinted automatically for you via theme attributes. That has often led me to wonder "where the hell did this color come from?" You can replace your normal theme with this debug theme to help figure out the source of that color.
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:windowBackground">@color/__debugWindowBackground</item>
<item name="android:colorPressedHighlight">#FF4400</item>
<item name="android:colorLongPressedHighlight">#FF0044</item>
<item name="android:colorFocusedHighlight">#44FF00</item>
<item name="android:colorActivatedHighlight">#00FF44</item>
@bouchard
bouchard / download.rb
Created December 31, 2014 23:51
Download Private but Embedded Vimeo Videos
#!/usr/bin/env ruby
require 'nokogiri'
require 'net/http'
require 'shellwords'
require 'json'
source = Net::HTTP.get('www.domain.com', '/thepagethathasthevideos/')
doc = Nokogiri::HTML(source)
ids = doc.css('a').map{ |a| a.attr('data-vimeoid') }.compact.uniq
@nickbutcher
nickbutcher / 1 search_bar.xml
Last active September 4, 2024 05:58
Demonstrating morphing a search icon into a search field. To do this we use an AnimatedVectorDrawable (https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable.html) made up of two paths. The first is the search icon (as a single line) the second is the horizontal bar. We then animate the 'trimPathStart' property …
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 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
public class PagerLayoutManager extends LinearLayoutManager {
private static final int SETTLE_DURATION = 600;
private static final float DEFAULT_FLING_THRESHOLD_DP = 10f;
private final int flingThreshold;
private int scrollState;
public PagerLayoutManager(Context context) {
public class Temp {
public View showFloatingView(View contentView)
{
final View floatingView = ((LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE)).inflate(R.layout.view_floating, null);
final WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
final WindowManager.LayoutParams mLayoutParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
@cherehapa
cherehapa / quote.md
Last active December 6, 2017 23:01
Поля ответа метода /v2/quote

Общая структура ответа

{
  "data": [...],
  "productPerCompany": [..],
  "assistances": [...],
  "preCalc": {...},
  "request": {...},
  "status": 200
}