Skip to content

Commit

Permalink
Formatting and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsPriyesh committed Feb 25, 2016
1 parent ded69f1 commit e61b605
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015 500px Inc.
Copyright (c) 2015 500px, Inc.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
14 changes: 6 additions & 8 deletions app/src/main/java/com/fivehundredpx/blurdemo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.animation.OvershootInterpolator;
import android.widget.ImageView;
Expand All @@ -17,7 +17,7 @@
/**
* Demonstrates the use of the blurring view.
*/
public class MainActivity extends ActionBarActivity {
public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -45,13 +45,13 @@ public void shuffle(View view) {
// Randomly pick a different start in the array of available images.
int newStartIndex;
do {
newStartIndex = mImageIds[mRandom.nextInt(mImageIds.length)];
newStartIndex = IMAGE_IDS[mRandom.nextInt(IMAGE_IDS.length)];
} while (newStartIndex == mStartIndex);
mStartIndex = newStartIndex;

// Update the images for the image views contained in the blurred view.
for (int i = 0; i < mImageViews.length; i++) {
int drawableId = mImageIds[(mStartIndex + i) % mImageIds.length];
int drawableId = IMAGE_IDS[(mStartIndex + i) % IMAGE_IDS.length];
mImageViews[i].setImageDrawable(getResources().getDrawable(drawableId));
}

Expand Down Expand Up @@ -100,7 +100,7 @@ public void shift(View view) {

private BlurringView mBlurringView;

private int[] mImageIds = {
private static final int[] IMAGE_IDS = {
R.drawable.p0, R.drawable.p1, R.drawable.p2, R.drawable.p3, R.drawable.p4,
R.drawable.p5, R.drawable.p6, R.drawable.p7, R.drawable.p8, R.drawable.p9
};
Expand Down Expand Up @@ -136,8 +136,6 @@ public void onAnimationCancel(Animator animation) {
}

@Override
public void onAnimationRepeat(Animator animation) {

}
public void onAnimationRepeat(Animator animation) {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ protected void onDraw(Canvas canvas) {
// If the background of the blurred view is a color drawable, we use it to clear
// the blurring canvas, which ensures that edges of the child views are blurred
// as well; otherwise we clear the blurring canvas with a transparent color.
if (mBlurredView.getBackground() != null && mBlurredView.getBackground() instanceof ColorDrawable){
if (mBlurredView.getBackground() != null && mBlurredView.getBackground() instanceof ColorDrawable) {
mBitmapToBlur.eraseColor(((ColorDrawable) mBlurredView.getBackground()).getColor());
}else {
} else {
mBitmapToBlur.eraseColor(Color.TRANSPARENT);
}

Expand Down Expand Up @@ -152,7 +152,7 @@ protected void blur() {
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (mRenderScript != null){
if (mRenderScript != null) {
mRenderScript.destroy();
}
}
Expand Down
6 changes: 3 additions & 3 deletions blurringview/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="PxBlurringView">
<attr name="blurRadius" format="integer" />
<attr name="downsampleFactor" format="integer" />
<attr name="overlayColor" format="color" />
<attr name="blurRadius" format="integer"/>
<attr name="downsampleFactor" format="integer"/>
<attr name="overlayColor" format="color"/>
</declare-styleable>
</resources>

0 comments on commit e61b605

Please sign in to comment.