This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ViewCopy extends View { | |
private Bitmap viewCopy; | |
public ViewCopy(View view) { | |
super(view.getContext()); | |
copyView(view); | |
measure(MeasureSpec.makeMeasureSpec(view.getWidth(), MeasureSpec.EXACTLY), | |
MeasureSpec.makeMeasureSpec(view.getHeight(), MeasureSpec.EXACTLY)); | |
layout(view.getLeft(), view.getTop(), view.getRight(), view.getBottom()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class RoundedDrawable extends Drawable { | |
protected final float cornerRadius; | |
protected final int margin; | |
protected final RectF mRect = new RectF(), | |
mBitmapRect; | |
protected final BitmapShader bitmapShader; | |
protected final Paint paint; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected InputStream getStreamFromNetwork(String imageUri, Object extra) throws IOException { | |
HttpGet httpRequest = new HttpGet(imageUri); | |
HttpResponse response = httpClient.execute(httpRequest); | |
HttpEntity entity = response.getEntity(); | |
BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity); | |
return bufHttpEntity.getContent(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2014 Gabriele Mariotti | |
* | |
* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//使用Service实现文件下载 | |
public class NewDownloadService extends IntentService { | |
public static final int UPDATE_PROGRESS = 8344; | |
public static final String DOWNLOAD_DIR=Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath()+"/"; | |
public NewDownloadService() { | |
super("NewDownloadService"); | |
} | |
@Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String getRealPathFromURI(Uri contentUri) { | |
String[] proj = { MediaStore.Audio.Media.DATA }; | |
Cursor cursor = managedQuery(contentUri, proj, null, null, null); | |
int column_index = cursor | |
.getColumnIndexOrThrow(MediaStore.Audio.Media.DATA); | |
cursor.moveToFirst(); | |
return cursor.getString(column_index); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PInfo { | |
private String appname = ""; | |
private String pname = ""; | |
private String versionName = ""; | |
private int versionCode = 0; | |
private Drawable icon; | |
private void prettyPrint() { | |
Log.v(appname + "\t" + pname + "\t" + versionName + "\t" + versionCode); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ResetAnimimation extends Animation { | |
int targetHeight; | |
int originalHeight; | |
int extraHeight; | |
View mView; | |
protected ResetAnimimation(View view, int targetHeight) { | |
this.mView = view; | |
this.targetHeight = targetHeight; | |
originalHeight = view.getHeight(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* thread-safe | |
* | |
*/ | |
public class Singleton { | |
private static final Singleton INSTANCE = new Singleton(); | |
private Singleton() { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.yscs.android.square_progressbar_example.dialogs; | |
import net.yscs.android.square_progressbar_example.R; | |
import android.app.Dialog; | |
import android.content.Context; | |
import android.graphics.Color; | |
import android.graphics.drawable.ColorDrawable; | |
import android.view.View; | |
import android.view.Window; | |
import android.widget.Button; |