Skip to content

Instantly share code, notes, and snippets.

@pbednarz
pbednarz / style.xml
Last active November 4, 2015 20:36
buttton style
<style name="AppTheme.ButtonGrey" parent="Widget.AppCompat.Button.Borderless">
<item name="android:paddingLeft">14dp</item>
<item name="android:paddingRight">14dp</item>
<item name="android:textAllCaps">false</item>
<item name="android:textColor">@color/colorPrimaryDark</item>
<item name="android:background">@drawable/button_grey</item>
<item name="android:textStyle">bold</item>
</style>
<?xml version="1.0" encoding="utf-8"?>
https://github.com/hdodenhof/CircleImageView
https://github.com/MiguelCatalan/MaterialSearchView
http://stackoverflow.com/questions/11288475/custom-toast-in-android-a-simple-example
toolbar = change currency
selectable background = button (with bg color)
@pbednarz
pbednarz / FileProvider.java
Last active November 3, 2015 19:58
FileProvider
package com.example.storage;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.provider.MediaStore;
import java.util.Arrays;
/**
@pbednarz
pbednarz / FileUtils.java
Created November 3, 2015 19:54
FileUtils
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
@pbednarz
pbednarz / default.xml
Created October 6, 2015 19:54 — forked from alexras/default.xml
This file configures MAME to use four controllers (I use XBox 360 wireless controllers) as inputs
<?xml version="1.0"?>
<!-- This file configures MAME to use four controllers (I use XBox 360 wireless controllers) as inputs -->
<mameconfig version="10">
<system name="default">
<input>
<port type="P1_JOYSTICK_UP">
<newseq type="standard">
JOYCODE_1_YAXIS_UP_SWITCH
</newseq>
</port>
@Override
public Parcelable onSaveInstanceState() {
//begin boilerplate code that allows parent classes to save state
Parcelable superState = super.onSaveInstanceState();
SavedState ss = new SavedState(superState);
//end
ss.viewportOffset = this.viewportOffset;
ss.scaleFactor = this.scaleFactor;
@pbednarz
pbednarz / style.xml
Created September 16, 2015 12:21
Actionbar popup theme
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="actionBarPopupTheme">@style/AppTheme.PopupOverlay</item>
</style>
<html >
<head>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Directly accessing Street View data</title>
<style>
html, body, #map-canvas {
height: 100%;
public class BatteryActivity extends Activity {
//UI Elements
private TextView mTextViewLevel;
private TextView mTextViewTemperature;
private TextView mTextViewVoltage;
private TextView mTextViewHealth;
//Battery details
private int level;
package your.package;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.graphics.Palette;
import com.squareup.picasso.Picasso;
import your.package.PaletteTransformation;
import static your.package.PaletteTransformation.PaletteCallback;