Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
grumoon committed Feb 3, 2015
2 parents 2a12958 + b3783cc commit 627c9ca
Show file tree
Hide file tree
Showing 448 changed files with 7,464 additions and 692 deletions.
6 changes: 0 additions & 6 deletions android-Ultra-Pull-To-Refresh-demo/.gitignore

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
14 changes: 14 additions & 0 deletions android-ultra-pull-to-refresh-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
UltraPTR Demo
================================
###1.Demo Download
[本地下载](./apk/UltraPTR-demo.apk?raw=true)

###2.Screenshot
####包含内容
![TextView](image/content_text_view.gif)![ImageView](image/content_image_view.gif)![ScrollView](image/content_scroll_view.gif)![ListView](image/content_list_view.gif)![GridView](image/content_grid_view.gif)![WebView](image/content_web_view.gif)![RecyclerView](image/content_recycler_view.gif)
####刷新类型
![ReleaseToRefresh](image/release_to_refresh.gif)![PullToRefresh](image/pull_to_refresh.gif)![AutoRefresh](image/auto_refresh.gif)
####头部
![StoreHouseHeader](image/store_house_header.gif)![MaterialHeader](image/material_header.gif)![CustomHeader](image/custom_header.gif)
####自定义加载更多
![GetMoreListView](image/get_more_list_view.gif)
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;

/**
* Created by Administrator on 2015/1/14.
* Created by grumoon on 2015/1/14.
*/
public class PTRApplication extends Application {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public GradViewAdapter(Context context, String[] imageUrls) {
this.imageUrls = imageUrls;

options = new DisplayImageOptions.Builder()
.showImageForEmptyUri(R.drawable.ic_empty)
.showImageOnLoading(R.drawable.ic_empty)
.showImageOnFail(R.drawable.ic_empty)
.showImageForEmptyUri(R.drawable.ic_empty_small)
.showImageOnLoading(R.drawable.ic_empty_small)
.showImageOnFail(R.drawable.ic_empty_small)
.cacheInMemory(true)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,28 @@
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;


/**
* Created by grumoon on 15/1/17.
*/
public class ListViewAdapter extends BaseAdapter {

private LayoutInflater layoutInflater;
private String[] imageUrls;
private List<String> imageUrls;

private DisplayImageOptions options;

public ListViewAdapter(Context context, String[] imageUrls) {
public ListViewAdapter(Context context, List<String> imageUrls) {

this.layoutInflater = LayoutInflater.from(context);
this.imageUrls = imageUrls;

options = new DisplayImageOptions.Builder()
.showImageForEmptyUri(R.drawable.ic_empty)
.showImageOnLoading(R.drawable.ic_empty)
.showImageOnFail(R.drawable.ic_empty)
.showImageForEmptyUri(R.drawable.ic_empty_small)
.showImageOnLoading(R.drawable.ic_empty_small)
.showImageOnFail(R.drawable.ic_empty_small)
.cacheInMemory(true)
.build();

Expand All @@ -42,15 +44,15 @@ public int getCount() {
if (imageUrls == null) {
return 0;
}
return imageUrls.length;
return imageUrls.size();
}

@Override
public Object getItem(int position) {
if (imageUrls == null || position > imageUrls.length - 1) {
if (imageUrls == null || position > imageUrls.size() - 1) {
return null;
}
return imageUrls[position];
return imageUrls.get(position);
}

@Override
Expand All @@ -72,7 +74,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
}


ImageLoader.getInstance().displayImage(imageUrls[position], viewHolder.ivCar, options);
ImageLoader.getInstance().displayImage(imageUrls.get(position), viewHolder.ivCar, options);

return convertView;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ public RecyclerViewAdapter(Context context, String[] imageUrls) {
this.imageUrls = imageUrls;

options = new DisplayImageOptions.Builder()
.showImageForEmptyUri(R.drawable.ic_empty)
.showImageOnLoading(R.drawable.ic_empty)
.showImageOnFail(R.drawable.ic_empty)
.cacheInMemory(true)
.showImageForEmptyUri(R.drawable.ic_empty_large)
.showImageOnLoading(R.drawable.ic_empty_large)
.showImageOnFail(R.drawable.ic_empty_large)
.build();

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
package com.grumoon.androidultrapulltorefreshdemo.header;


import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;

import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;

import com.grumoon.androidultrapulltorefreshdemo.R;


/**
* Created by grumoon on 2015/1/20.
*/
public class WindmillDrawable extends Drawable implements Animatable {

private static final String TAG = WindmillDrawable.class.getSimpleName();

private Resources resources;

private Bitmap windmill;

private Matrix matrix;

private View parent;


private Animation animation;

private boolean isFirstDraw = true;

private boolean isAnimating;

public WindmillDrawable(Context context, View parent) {
resources = context.getResources();
windmill = BitmapFactory.decodeResource(resources, R.drawable.windmill);

matrix = new Matrix();

this.parent = parent;


animation = new RotateAnimation(360, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
animation.setInterpolator(new LinearInterpolator());
animation.setDuration(800);
animation.setRepeatMode(Animation.RESTART);
animation.setRepeatCount(Animation.INFINITE);
animation.setFillAfter(true);

}


@Override
public void draw(Canvas canvas) {
if (isFirstDraw) {
isFirstDraw = false;
matrix.setTranslate((getBounds().width() - windmill.getWidth()) / 2, (getBounds().height() - windmill.getHeight()) / 2);
}

Paint p = new Paint();
canvas.drawBitmap(windmill, matrix, p);
}

@Override
public void setAlpha(int alpha) {

}

@Override
public void setColorFilter(ColorFilter cf) {

}

@Override
public int getOpacity() {
return 0;
}

public void postRotation(int degree) {

matrix.postRotate(degree, getBounds().exactCenterX(), getBounds().exactCenterY());
invalidateSelf();
}

@Override
public void start() {
parent.startAnimation(animation);
isAnimating = true;
}

@Override
public void stop() {
parent.clearAnimation();
isAnimating = false;
}

@Override
public boolean isRunning() {
return isAnimating;
}
}
Loading

0 comments on commit 627c9ca

Please sign in to comment.