Skip to content

Instantly share code, notes, and snippets.

View shawnlinboy's full-sized avatar

Shen Lin shawnlinboy

View GitHub Profile
@InfiniteXyy
InfiniteXyy / powertoy.json
Last active December 6, 2023 16:36
Mac keyboard adaptive Powertoy setting
{"remapKeys":{"inProcess":[{"originalKeys":"91","newRemapKeys":"162"},{"originalKeys":"164","newRemapKeys":"91"},{"originalKeys":"162","newRemapKeys":"164"}]},"remapShortcuts":{"global":[{"originalKeys":"162;32","newRemapKeys":"162;164;32"},{"originalKeys":"91;8","newRemapKeys":"163;8"},{"originalKeys":"91;37","newRemapKeys":"163;37"},{"originalKeys":"91;39","newRemapKeys":"163;39"},{"originalKeys":"91;160;37","newRemapKeys":"162;160;37"},{"originalKeys":"91;160;39","newRemapKeys":"162;160;39"},{"originalKeys":"91;162;37","newRemapKeys":"164;37"},{"originalKeys":"91;162;39","newRemapKeys":"164;39"}],"appSpecific":[{"originalKeys":"164;32","newRemapKeys":"162;32","targetApp":"code"},{"originalKeys":"162;8","newRemapKeys":"162;89","targetApp":"code"},{"originalKeys":"91;13","newRemapKeys":"164;13","targetApp":"code"},{"originalKeys":"91;162;76","newRemapKeys":"162;164;76","targetApp":"code"}]}}
@shmehdi01
shmehdi01 / KotlinExtensionUtils.kt
Last active May 1, 2023 22:26
Kotlin Extension Utils
import android.animation.*
import android.app.Activity
import android.content.*
import android.content.Context.CLIPBOARD_SERVICE
import android.content.pm.PackageManager
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.Typeface
import android.net.Uri
import android.provider.Settings
@shawnlinboy
shawnlinboy / BlankItemDecoration.kt
Last active December 23, 2023 03:13
An ItemDecoration implementation which provides functionality that add extra blank space between list items.
/*
* Copyright (C) 2019 Shen Lin
*
* 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

ArrayMap ClassCastException Deep Analyze

preface

I'm a developer of 企鹅FM. Our app constantly report ClassCastException on ArrayMap, some stack trace looks like this.

Intent i = new Intent(ACTION);
i.putExtra(KEY, VALUE); // crashes here
public Bitmap blurBitmap(Bitmap bitmap){
//Let's create an empty bitmap with the same size of the bitmap we want to blur
Bitmap outBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
//Instantiate a new Renderscript
RenderScript rs = RenderScript.create(getApplicationContext());
//Create an Intrinsic Blur Script using the Renderscript
ScriptIntrinsicBlur blurScript = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
@devunwired
devunwired / ExampleFragment.java
Created May 15, 2014 17:03
Method for animating Android fragment positions during a add/replace/remove transition using custom properties. This method does not require subclassing target views with additional setter methods, but instead requires subclassing the fragment...something you are likely already doing.
/**
* An example of adding these transitions to a Fragment. This simple
* version just applies opposite transitions to any Fragment whether it is
* entering or exiting view. You can also inspect the transit mode parameter
* (i.e. TRANSIT_FRAGMENT_OPEN, TRANSIT_FRAGMENT_CLOSE) in combination to do
* different animations for, say, adding a fragment versus popping the back stack.
*
* Transactions without an explicit transit mode set, in this example, will not
* animate. Allowing the initial fragment add, for example, to simply appear.
*/
@ikew0ng
ikew0ng / ViewPagerUtils.java
Created October 1, 2013 14:20
获取ViewPager特定位置的Fragment
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
/**
* Created by Chaojun Wang on 5/6/14.
*/
public class ViewPagerUtils {
private ViewPagerUtils() {}