Skip to content

Commit 7becd46

Browse files
committed
修改可能出现的 IllegalArgumentException
1 parent 8088bc2 commit 7becd46

File tree

4 files changed

+24
-37
lines changed

4 files changed

+24
-37
lines changed

dragsloplayout/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ android {
1111
targetSdkVersion 23
1212
versionCode 5
1313
versionName "1.0.5"
14-
renderscriptTargetApi 23
15-
renderscriptSupportModeEnabled true
14+
// renderscriptTargetApi 23
15+
// renderscriptSupportModeEnabled true
1616
}
1717
buildTypes {
1818
release {

dragsloplayout/src/main/java/com/dl7/drag/DragSlopLayout.java

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,15 @@
22

33
import android.content.Context;
44
import android.content.res.TypedArray;
5-
import android.graphics.Bitmap;
6-
import android.graphics.Canvas;
7-
import android.graphics.Color;
8-
import android.graphics.drawable.BitmapDrawable;
9-
import android.graphics.drawable.ClipDrawable;
10-
import android.graphics.drawable.ColorDrawable;
11-
import android.graphics.drawable.Drawable;
12-
import android.os.Build;
135
import android.support.annotation.IntDef;
146
import android.support.v4.view.MotionEventCompat;
157
import android.support.v4.view.ViewCompat;
168
import android.support.v4.view.ViewPager;
179
import android.support.v4.widget.NestedScrollView;
1810
import android.support.v4.widget.ScrollerCompat;
1911
import android.support.v4.widget.ViewDragHelper;
20-
import android.support.v8.renderscript.Allocation;
21-
import android.support.v8.renderscript.Element;
22-
import android.support.v8.renderscript.RenderScript;
23-
import android.support.v8.renderscript.ScriptIntrinsicBlur;
2412
import android.util.AttributeSet;
2513
import android.view.GestureDetector;
26-
import android.view.Gravity;
2714
import android.view.MotionEvent;
2815
import android.view.View;
2916
import android.view.ViewConfiguration;
@@ -262,10 +249,10 @@ protected void onDetachedFromWindow() {
262249
if (mAnimPresenter != null) {
263250
mAnimPresenter.stopAllAnimator();
264251
}
265-
if (mBitmapToBlur != null) {
252+
/*if (mBitmapToBlur != null) {
266253
mBitmapToBlur.recycle();
267254
mBitmapToBlur = null;
268-
}
255+
}*/
269256
}
270257

271258
/***********************************
@@ -611,7 +598,7 @@ private void _dragPositionChanged(int visibleHeight, float percent) {
611598
mIsUp = (mDragViewTop < mLastDragViewTop);
612599
mLastDragViewTop = mDragViewTop;
613600
}
614-
if (mEnableBlur && mBlurDrawable != null) {
601+
/*if (mEnableBlur && mBlurDrawable != null) {
615602
if (visibleHeight < mFixHeight) {
616603
return;
617604
}
@@ -622,7 +609,7 @@ private void _dragPositionChanged(int visibleHeight, float percent) {
622609
mBlurDrawable.setLevel(blurLevel);
623610
}
624611
mBlurDrawable.setAlpha((int) (percent * 255));
625-
}
612+
}*/
626613
if (visibleHeight >= 0) {
627614
ViewCompat.setTranslationY(mMainView, -visibleHeight * (1 - mCollapseParallax));
628615
}
@@ -659,9 +646,9 @@ private boolean _isNeedIntercept(MotionEvent ev) {
659646
if (mDragHelper.isViewUnder(mAttachScrollView, (int) ev.getX(), y) && mMode != MODE_ANIMATE) {
660647
return true;
661648
}
662-
if (mEnableBlur && mDragStatus == STATUS_EXPANDED) {
649+
/*if (mEnableBlur && mDragStatus == STATUS_EXPANDED) {
663650
return true;
664-
}
651+
}*/
665652
return false;
666653
}
667654

@@ -983,7 +970,7 @@ public void setCustomAnimator(CustomViewAnimator inAnimator, CustomViewAnimator
983970
/*************************************
984971
* Blur
985972
********************************************/
986-
private final static int DEFAULT_SAMPLE_FACTOR = 4;
973+
/*private final static int DEFAULT_SAMPLE_FACTOR = 4;
987974
private final static int DEFAULT_BLUR_RADIUS = 5;
988975
989976
// 使能模糊
@@ -1027,11 +1014,11 @@ public void setBlurFull(boolean blurFull) {
10271014
mIsBlurFull = blurFull;
10281015
}
10291016
1030-
/**
1017+
*//**
10311018
* 设置使能模糊效果
10321019
*
10331020
* @param enableBlur
1034-
*/
1021+
*//*
10351022
public void setEnableBlur(boolean enableBlur) {
10361023
if (mEnableBlur == enableBlur) {
10371024
return;
@@ -1062,21 +1049,21 @@ public void run() {
10621049
}
10631050
}
10641051
1065-
/**
1052+
*//**
10661053
* 刷新模糊视图
1067-
*/
1054+
*//*
10681055
public void updateBlurView() {
10691056
if (mEnableBlur) {
10701057
mBlurDrawable = null;
10711058
_handleBlurInThread();
10721059
}
10731060
}
10741061
1075-
/**
1062+
*//**
10761063
* 模糊视图
10771064
*
10781065
* @param view
1079-
*/
1066+
*//*
10801067
private void _blurView(View view) {
10811068
final int width = view.getWidth();
10821069
final int height = view.getHeight();
@@ -1139,9 +1126,9 @@ private void _blurView(View view) {
11391126
}
11401127
}
11411128
1142-
/**
1129+
*//**
11431130
* 在线程处理图片模糊
1144-
*/
1131+
*//*
11451132
@SuppressWarnings("deprecation")
11461133
private void _handleBlurInThread() {
11471134
new Thread(new Runnable() {
@@ -1162,7 +1149,7 @@ public void run() {
11621149
}
11631150
}).start();
11641151
}
1165-
1152+
*/
11661153
/** ================================ 监听器 ================================ */
11671154

11681155
// 监听器

simple/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ android {
1111
targetSdkVersion 23
1212
versionCode 1
1313
versionName "1.0"
14-
renderscriptTargetApi 23
15-
renderscriptSupportModeEnabled true
14+
// renderscriptTargetApi 23
15+
// renderscriptSupportModeEnabled true
1616
}
1717
buildTypes {
1818
release {

simple/src/main/java/com/dl7/simple/drag/activity/DragBlurActivity.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected void onCreate(Bundle savedInstanceState) {
4646
setContentView(R.layout.activity_drag_blur);
4747
ButterKnife.bind(this);
4848
initToolBar(mToolBar, true, "");
49-
mDragLayout.setEnableBlur(true);
49+
// mDragLayout.setEnableBlur(true);
5050
}
5151

5252
@Override
@@ -60,10 +60,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
6060
item.setChecked(true);
6161
switch (item.getItemId()) {
6262
case R.id.blur_local:
63-
mDragLayout.setBlurFull(false);
63+
// mDragLayout.setBlurFull(false);
6464
return true;
6565
case R.id.blur_full:
66-
mDragLayout.setBlurFull(true);
66+
// mDragLayout.setBlurFull(true);
6767
return true;
6868
}
6969
return super.onOptionsItemSelected(item);
@@ -77,7 +77,7 @@ public void onClick(View view) {
7777
break;
7878
case R.id.ll_next:
7979
mIvPhoto.setImageResource(mImgRes[mIndex++ % mImgRes.length]);
80-
mDragLayout.updateBlurView();
80+
// mDragLayout.updateBlurView();
8181
break;
8282
case R.id.ll_download:
8383
Toast.makeText(this, "下载", Toast.LENGTH_SHORT).show();

0 commit comments

Comments
 (0)