Skip to content

Instantly share code, notes, and snippets.

import android.graphics.*;
import com.squareup.picasso.Transformation;
/**
* Transforms an image into a circle representation. Such as a avatar.
*/
public class CircularTransformation implements Transformation
{
int radius = 10;
@dzwillpower
dzwillpower / blurBitmap.java
Created January 4, 2015 02:07
图片高斯模糊
/**
* Blur a bitmap by specified radius
* @param context
* @param src
* @param radius
* @return
*/
public static Bitmap blurBitmap(Context context, Bitmap src, float radius)
throws RSIllegalArgumentException {
if (radius <= 0f) {
@dzwillpower
dzwillpower / ProviderUtils.java
Last active August 29, 2015 14:14
SQLite 查询语句
public static List<Track> getLocalSongs(Context context, int pageIndex, int pageSize) {
long[] audioId;
Playlist playlist;
List<Track> trackList = new ArrayList<Track>();
String[] projection = new String[] { MediaStore.Audio.Media._ID, };
Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
.buildUpon()
.appendQueryParameter(QUERY_PARAMETER_LIMIT, String.valueOf(pageSize))
.appendQueryParameter(QUERY_PARAMETER_OFFSET,
String.valueOf((pageIndex - 1) * pageSize)).build();
@dzwillpower
dzwillpower / oppo_attrs.xml
Last active August 29, 2015 14:17
theme and style
<attr name="oppoPagerTabStripStyle" format="reference" />
<declare-styleable name="OppoPagerTabStrip">
<attr name="pagerTitle" format="reference" />
<attr name="pagerTitleSize" format="reference|dimension" />
<attr name="pagerTitleColor" format="reference|color" />
<attr name="pagerTitleColorHighlight" format="reference|color" />
<attr name="textPadding" format="reference|dimension" />
<attr name="bottomLine" format="reference|color" />
<attr name="focusLine" format="reference|color" />
public void apply(AlertController dialog) {
if (mCustomTitleView != null) {
dialog.setCustomTitle(mCustomTitleView);
} else {
if (mTitle != null) {
dialog.setTitle(mTitle);
}
if (mIcon != null) {
dialog.setIcon(mIcon);
}
@dzwillpower
dzwillpower / TabLayout.java
Created March 25, 2016 04:55
TabLayout.java
/*
* Copyright (C) 2015 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
*
* Unless required by applicable law or agreed to in writing, software
@dzwillpower
dzwillpower / main_AndroidManifest.xml
Created May 20, 2016 06:42 — forked from hzqtc/main_AndroidManifest.xml
Android FlowLayout demo.
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="hzqtc.flowlayout"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19"/>
@dzwillpower
dzwillpower / webview destroy
Created June 8, 2016 06:29
destroy webbiew avoid memory leak
public void destroyAll() {
for (WebView webview : mWebViews) {
if (webview != null) {
webview.onPause();
webview.stopLoading();
webview.setWebViewClient(null);
webview.removeAllViews();
webview.clearHistory();
webview.clearCache(true);
webview.destroy();
@dzwillpower
dzwillpower / LogcatUtils.java
Created July 25, 2016 02:09
android log分割类 默认的log 打印不完全所有的log
package com.ipanel.join.cq.vod.utils;
import java.util.ArrayList;
import android.util.Log;
public class LogcatUtils {
/**
* Divides a string into chunks of a given character size.
*
/*
* Created by w4lle 2016 .
* Copyright (c) 2016 Boohee, Inc. All rights reserved.
*/
package com.boohee.myview;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;