Skip to content

Commit 8725f17

Browse files
committed
屏蔽模糊
1 parent f7c87a3 commit 8725f17

File tree

3 files changed

+22
-35
lines changed

3 files changed

+22
-35
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 4
1313
versionName "1.0.4"
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;
@@ -260,10 +247,10 @@ protected void onDetachedFromWindow() {
260247
if (mAnimPresenter != null) {
261248
mAnimPresenter.stopAllAnimator();
262249
}
263-
if (mBitmapToBlur != null) {
250+
/*if (mBitmapToBlur != null) {
264251
mBitmapToBlur.recycle();
265252
mBitmapToBlur = null;
266-
}
253+
}*/
267254
}
268255

269256
/***********************************
@@ -607,7 +594,7 @@ private void _dragPositionChanged(int visibleHeight, float percent) {
607594
mIsUp = (mDragViewTop < mLastDragViewTop);
608595
mLastDragViewTop = mDragViewTop;
609596
}
610-
if (mEnableBlur && mBlurDrawable != null) {
597+
/*if (mEnableBlur && mBlurDrawable != null) {
611598
if (visibleHeight < mFixHeight) {
612599
return;
613600
}
@@ -618,7 +605,7 @@ private void _dragPositionChanged(int visibleHeight, float percent) {
618605
mBlurDrawable.setLevel(blurLevel);
619606
}
620607
mBlurDrawable.setAlpha((int) (percent * 255));
621-
}
608+
}*/
622609
if (visibleHeight >= 0) {
623610
ViewCompat.setTranslationY(mMainView, -visibleHeight * (1 - mCollapseParallax));
624611
}
@@ -655,9 +642,9 @@ private boolean _isNeedIntercept(MotionEvent ev) {
655642
if (mDragHelper.isViewUnder(mAttachScrollView, (int) ev.getX(), y) && mMode != MODE_ANIMATE) {
656643
return true;
657644
}
658-
if (mEnableBlur && mDragStatus == STATUS_EXPANDED) {
645+
/*if (mEnableBlur && mDragStatus == STATUS_EXPANDED) {
659646
return true;
660-
}
647+
}*/
661648
return false;
662649
}
663650

@@ -894,7 +881,7 @@ public void setCustomAnimator(CustomViewAnimator inAnimator, CustomViewAnimator
894881
/*************************************
895882
* Blur
896883
********************************************/
897-
private final static int DEFAULT_SAMPLE_FACTOR = 4;
884+
/*private final static int DEFAULT_SAMPLE_FACTOR = 4;
898885
private final static int DEFAULT_BLUR_RADIUS = 5;
899886
900887
// 使能模糊
@@ -938,11 +925,11 @@ public void setBlurFull(boolean blurFull) {
938925
mIsBlurFull = blurFull;
939926
}
940927
941-
/**
928+
*//**
942929
* 设置使能模糊效果
943930
*
944931
* @param enableBlur
945-
*/
932+
*//*
946933
public void setEnableBlur(boolean enableBlur) {
947934
if (mEnableBlur == enableBlur) {
948935
return;
@@ -973,21 +960,21 @@ public void run() {
973960
}
974961
}
975962
976-
/**
963+
*//**
977964
* 刷新模糊视图
978-
*/
965+
*//*
979966
public void updateBlurView() {
980967
if (mEnableBlur) {
981968
mBlurDrawable = null;
982969
_handleBlurInThread();
983970
}
984971
}
985972
986-
/**
973+
*//**
987974
* 模糊视图
988975
*
989976
* @param view
990-
*/
977+
*//*
991978
private void _blurView(View view) {
992979
final int width = view.getWidth();
993980
final int height = view.getHeight();
@@ -1050,9 +1037,9 @@ private void _blurView(View view) {
10501037
}
10511038
}
10521039
1053-
/**
1040+
*//**
10541041
* 在线程处理图片模糊
1055-
*/
1042+
*//*
10561043
@SuppressWarnings("deprecation")
10571044
private void _handleBlurInThread() {
10581045
new Thread(new Runnable() {
@@ -1073,7 +1060,7 @@ public void run() {
10731060
}
10741061
}).start();
10751062
}
1076-
1063+
*/
10771064
/** ================================ 监听器 ================================ */
10781065

10791066
// 监听器

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)