Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael krmao

View GitHub Profile
@krmao
krmao / IMMLeaks.java
Created Nov 20, 2017 — forked from pyricau/IMMLeaks.java
"Fix" for InputMethodManager leaking the last focused view: https://code.google.com/p/android/issues/detail?id=171190
View IMMLeaks.java
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.ContextWrapper;
import android.os.Bundle;
import android.os.Looper;
import android.os.MessageQueue;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
@krmao
krmao / colors.xml
Created Apr 24, 2018 — forked from hvkale/colors.xml
Material Design Color Palette Colors.xml Resource file for Android
View colors.xml
<?xml version="1.0" encoding="utf-8"?>
<!--
Google Material Design Color Palette for Android http://www.google.com/design/spec/style/color.html#color-ui-color-palette
Spreadsheet used to create this reosurce - http://bit.ly/mdcolor_spreadsheet
Link to this colors.xml resource file - http://bit.ly/mdcolorsxml
Harshad Kale
https://github.com/kalehv
-->
@krmao
krmao / ZipUnzip.groovy
Created Apr 8, 2020 — forked from bitsnaps/ZipUnzip.groovy
Zip and UnZip files using Groovy
View ZipUnzip.groovy
import java.util.zip.*
String zipFileName = "file.zip"
String inputDir = "logs"
def outputDir = "zip"
//Zip files
ZipOutputStream zipFile = new ZipOutputStream(new FileOutputStream(zipFileName))
new File(inputDir).eachFile() { file ->
@krmao
krmao / ZipUnzip.groovy
Created Apr 8, 2020 — forked from bitsnaps/ZipUnzip.groovy
Zip and UnZip files using Groovy
View ZipUnzip.groovy
import java.util.zip.*
String zipFileName = "file.zip"
String inputDir = "logs"
def outputDir = "zip"
//Zip files
ZipOutputStream zipFile = new ZipOutputStream(new FileOutputStream(zipFileName))
new File(inputDir).eachFile() { file ->
@krmao
krmao / learnDart.dart
Last active Apr 24, 2020
learn dart language
View learnDart.dart
import 'dart:io';
import 'dart:convert';
// Copyright 2015 the Dart project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file.
void main() {
// 1 var
print("\n变量----------------------\n");
@krmao
krmao / CompoundDrawableClickListener.java
Created Jan 13, 2021 — forked from amaksoft/CompoundDrawableClickListener.java
Handling TextView compound drawables touch and click events
View CompoundDrawableClickListener.java
/*
* Copyright 2017, Andrey Makeev
*
* 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