Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

ShangjingZhu Assassinss

🎯
Focusing
View GitHub Profile
@Assassinss
Assassinss / code.kt
Last active Nov 30, 2018
判断是否弹出软键盘
View code.kt
val rootView = window.decorView.findViewById<View>(android.R.id.content)
rootView.viewTreeObserver.addOnGlobalLayoutListener {
val outLocation = IntArray(2)
login?.getLocationInWindow(outLocation)
val rect = Rect()
rootView.getWindowVisibleDisplayFrame(rect)
val screenHeight = rootView.rootView.height
@Assassinss
Assassinss / DrawInsetsFrameLayout.java
Created Jan 19, 2017 — forked from romannurik/DrawInsetsFrameLayout.java
DrawInsetsFrameLayout — adding additional background protection for system UI chrome when using KitKat’s translucent decor flags.
View DrawInsetsFrameLayout.java
/*
* Copyright 2014 Google Inc.
*
* 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
@Assassinss
Assassinss / ExpandingCircleAnimationDrawable.java
Created Nov 27, 2016 — forked from scottdweber/ExpandingCircleAnimationDrawable.java
An example showing how to create and use a Drawable that animates.
View ExpandingCircleAnimationDrawable.java
package com.example.manualanimation;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.view.animation.AnimationUtils;
@Assassinss
Assassinss / OkHttpProgressGlideModule.java
Created Oct 12, 2016 — forked from TWiStErRob/OkHttpProgressGlideModule.java
Full POC for showing progress of loading in Glide v3 via OkHttp v2
View OkHttpProgressGlideModule.java
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" />
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" />
// or not use 'okhttp@aar' in Gradle depdendencies
public class OkHttpProgressGlideModule implements GlideModule {
@Override public void applyOptions(Context context, GlideBuilder builder) { }
@Override public void registerComponents(Context context, Glide glide) {
OkHttpClient client = new OkHttpClient();
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener()));
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
}