Skip to content

Instantly share code, notes, and snippets.

Avatar

Dave Smith devunwired

View GitHub Profile
@devunwired
devunwired / background_dialog.xml
Created Nov 14, 2012
XML Shape Drawable for Dialog Backgrounds. Applies a fixed outer margin to keep background from fully stretching to screen edge, and allows for additional internal padding to apply to the dialog content.
View background_dialog.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Apply the margin value on the "item" element -->
<!-- This example creates a 15dp visible margin around the dialog -->
<item
android:top="15dp"
android:bottom="15dp"
android:left="15dp"
android:right="15dp">
<shape
@devunwired
devunwired / GifDecoder.java
Last active Aug 26, 2020
An optimized implementation of GifDecoder for Android devices.
View GifDecoder.java
/**
* Copyright (c) 2013 Xcellent Creations, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@devunwired
devunwired / CustomRowView.java
Created Jan 30, 2014
Custom View Example for drawing raw text and images
View CustomRowView.java
public class CustomRowView extends View {
private CharSequence mText;
private Layout mTextLayout;
private TextPaint mTextPaint;
private Drawable mImageDrawable;
public CustomRowView(Context context) {
this(context, null);
@devunwired
devunwired / ExampleFragment.java
Created May 15, 2014
Method for animating Android fragment positions during a add/replace/remove transition using custom properties. This method does not require subclassing target views with additional setter methods, but instead requires subclassing the fragment...something you are likely already doing.
View ExampleFragment.java
/**
* An example of adding these transitions to a Fragment. This simple
* version just applies opposite transitions to any Fragment whether it is
* entering or exiting view. You can also inspect the transit mode parameter
* (i.e. TRANSIT_FRAGMENT_OPEN, TRANSIT_FRAGMENT_CLOSE) in combination to do
* different animations for, say, adding a fragment versus popping the back stack.
*
* Transactions without an explicit transit mode set, in this example, will not
* animate. Allowing the initial fragment add, for example, to simply appear.
*/
View AndroidTool_BugReport_Emulator.crash
Process: AndroidTool [46967]
Path: /Applications/AndroidTool.app/Contents/MacOS/AndroidTool
Identifier: com.mortenjust.AndroidTool
Version: 1.1 (3)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: AndroidTool [46967]
User ID: 501
Date/Time: 2015-04-29 10:53:03.224 -0600
View AndroidTool_DeviceStart.crash
Process: AndroidTool [48235]
Path: /Applications/AndroidTool.app/Contents/MacOS/AndroidTool
Identifier: com.mortenjust.AndroidTool
Version: 1.1 (3)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: AndroidTool [48235]
User ID: 501
Date/Time: 2015-04-29 10:58:40.001 -0600
@devunwired
devunwired / FlickerActivity.java
Created Dec 22, 2016
Quick Android Things demo using ObjectAnimator to animate the brightness of a PWM output. This example uses a BounceInterpolator to create a flickering effect on an LED (like a candle).
View FlickerActivity.java
/*
* Copyright 2016 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
You can’t perform that action at this time.