Skip to content

Instantly share code, notes, and snippets.

View fiskurgit's full-sized avatar
🌑
...

öppenteknikstudio fiskurgit

🌑
...
View GitHub Profile
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
apply plugin: 'android'
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<polymer-element name="my-element">
<template>
<style>
@fiskurgit
fiskurgit / MainActivity.java
Last active August 29, 2015 14:03
How to change the global music volume on Android
package com.fiskur.wearvolume;
import android.app.Activity;
import android.content.Context;
import android.media.AudioManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
package com.fiskur.wearvolume;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.media.AudioManager;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
@fiskurgit
fiskurgit / screenshot.sh
Last active August 29, 2015 14:03
Bash script to take a screenshot from an attached Android device, and resize (maintaining aspect ratio) to a width of 270 pixels (OSX only).
#!/bin/sh
timestamp=$(date +%s)
filepath=/sdcard/$timestamp.png
echo $filepath
adb shell screencap -p $filepath
adb pull $filepath
adb shell rm $filepath
sips --resampleWidth 270 $timestamp.png
package com.degree53.percentbars;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.RectF;
import android.os.Bundle;
import android.os.Parcelable;
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/edit_background"
tools:context=".MainActivity" >
<TableLayout
android:id="@+id/url_table"
android:layout_width="fill_parent"
@fiskurgit
fiskurgit / gist:15c3dfe9f3c75a91a3e0
Created November 6, 2014 09:20
Android palette class
Palette.generateAsync(bitmap, new Palette.PaletteAsyncListener() {
public void onGenerated(Palette palette) {
//update your views
}
});
@fiskurgit
fiskurgit / Circle_001.java
Last active August 29, 2015 14:12
Processing.org - plot a circle.
//Plotting a circle
int cx, cy;
int segmentCount = 100;
int step = 0;
float plotDiameter, plotRadius;
void setup(){
size(500, 500);
cx = width/2;
package com.primer.accidentanimation;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Khronos {
private Date startDate;