Skip to content

Instantly share code, notes, and snippets.

@markushi
markushi / ViewWidthHeight.java
Last active December 19, 2015 13:58
Elegant solution to determine view width and height after the view has been measured.
@Override
public void onCreate(Bundle savedInstanceState) {
final View view = findViewById(...)
view.post(new Runnable() {
@Override
public void run() {
int width = view.getWidth();
int height = view.getHeight();
@markushi
markushi / MyActivity.java
Last active May 3, 2020 22:50
Reveal Color View Demo
package at.markushi.reveal;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.Point;
import android.os.Bundle;
import android.view.View;
import at.markushi.ui.RevealColorView;
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red_500_primary">#f44336</color>
<color name="red_50">#ffebee</color>
<color name="red_100">#ffcdd2</color>
<color name="red_200">#ef9a9a</color>
<color name="red_300">#e57373</color>
<color name="red_400">#ef5350</color>
<color name="red_600">#e53935</color>
<color name="red_700">#d32f2f</color>
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-item/core-item.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@markushi
markushi / designer.html
Last active August 29, 2015 14:24
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<polymer-element name="my-element">
<template>
<style>
:host {
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;

Keybase proof

I hereby claim:

  • I am markushi on github.
  • I am markushi1 (https://keybase.io/markushi1) on keybase.
  • I have a public key ASDGCbmmJeWKrjiSgLokyVpqFlMhSsw1lsbNM3wrYQQz1wo

To claim this, I am signing this object:

@markushi
markushi / gen_random_view_hierarchy.py
Created November 8, 2022 14:07
Random View Hierarchy Generator
import random
import json
widgets = [
"com.google.android.material.appbar.AppBarLayout",
"androidx.appcompat.widget.Toolbar",
"Button",
"androidx.coordinatorlayout.widget.CoordinatorLayout",
"FrameLayout",
"io.sentry.example.ExampleRadioButton"