Skip to content

Instantly share code, notes, and snippets.

View tprochazka's full-sized avatar

Tomáš Procházka tprochazka

View GitHub Profile
package com.android.vending.expansion.zipfile;
/*
* Copyright (C) 2012 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
[INFO] trouble processing "javax/xml/bind/annotation/XmlAccessorType.class":
[INFO]
[INFO] Ill-advised or mistaken usage of a core class (java.* or javax.*)
[INFO] when not building a core library.
[INFO]
[INFO] This is often due to inadvertently including a core library file
[INFO] in your application's project, when using an IDE (such as
[INFO] Eclipse). If you are sure you're not intentionally defining a
[INFO] core class, then this is the most likely explanation of what's
[INFO] going on.
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.preference.Preference;
import android.preference.PreferenceGroup;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
@tprochazka
tprochazka / thermostat.ino
Created January 6, 2014 21:05
Arduino thermostat example project
#include <DHT.h>
#include <LCD5110_Basic.h>
const int COMFORT_TEMPERATURE = 21;
#define DHTPIN 3 // pin teplotního senzoru
#define DHTTYPE DHT11 // typ teplotního senzoru
#define RELAYPIN 2 // pin relé
LCD5110 myGLCD(8,9,10,11,12); // piny LCD displeje
@tprochazka
tprochazka / KnightRider.ino
Last active January 12, 2016 22:40
Simplistic Knight Rider (KIT) lights implementation
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 6
#define LEDS 9
#define SUBSTEPS 8
#define DELAY 75
@tprochazka
tprochazka / RemoteSignTask.groovy
Last active January 17, 2019 11:49
Custom sign task implementation for Android Build Plugin compatible with build plugin 3.3.0 (with app bundle support)
import com.android.annotations.NonNull
import com.android.build.api.artifact.BuildableArtifact
import com.android.build.gradle.api.ApkVariant
import com.android.build.gradle.api.ApkVariantOutput
import com.google.common.io.Files
import org.gradle.api.Action
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.Project
@tprochazka
tprochazka / build.gradle
Last active July 3, 2019 01:14
Smart versionName and versionCode for android Gradle build evaluation
/**
* Will return version from properties file and replace -SNAPSHOT by GIT commit hash
* to recognize origin commit for the every build.
*/
project.ext.evalVersionName = {
def ideBuild = project.properties['android.injected.invoked.from.ide']
if (ideBuild) {
logger.info("IDE build");
return "dev"
} else if (project.VERSION.toUpperCase().contains("SNAPSHOT")) {
@tprochazka
tprochazka / ScaleToFitLayout.kt
Created September 6, 2021 01:39
Layout manager that will simply render everything inside in requested size and then scale down it to fit the parent size.
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import androidx.core.view.children
import kotlin.math.roundToInt
/**
* Layout manager that will simply render everything inside in requested size
* and then scale down it to fit the parent size.
@tprochazka
tprochazka / ISettableView.java
Created February 27, 2016 23:36
Example of solution for universal RecyclerViewAdapter
/**
* View that can be used with this adapter must implement this interfaces.
*/
public interface ISettableView<T> {
void setData(T item);
void setEventListener(RecylerViewAdapter.ViewItemEventListener<T> listener);
}
@tprochazka
tprochazka / TypedArrayUtils.kt
Created May 30, 2021 21:42
Access to XML based textAppearance styles from Jetpack Compose
/*
* Copyright 2020 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software