Skip to content

Commit faeb287

Browse files
author
Issac
committed
Not to invoke convertActivityFromTranslucent when starting to scroll.
1 parent 3aab752 commit faeb287

File tree

2 files changed

+21
-27
lines changed

2 files changed

+21
-27
lines changed

library/src/main/java/me/imid/swipebacklayout/lib/SwipeBackLayout.java

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
package me.imid.swipebacklayout.lib;
32

43
import android.app.Activity;
@@ -161,18 +160,18 @@ public SwipeBackLayout(Context context, AttributeSet attrs, int defStyle) {
161160

162161
/**
163162
* Sets the sensitivity of the NavigationLayout.
164-
*
165-
* @param context The application context.
163+
*
164+
* @param context The application context.
166165
* @param sensitivity value between 0 and 1, the final value for touchSlop =
167-
* ViewConfiguration.getScaledTouchSlop * (1 / s);
166+
* ViewConfiguration.getScaledTouchSlop * (1 / s);
168167
*/
169168
public void setSensitivity(Context context, float sensitivity) {
170169
mDragHelper.setSensitivity(context, sensitivity);
171170
}
172171

173172
/**
174173
* Set up contentView which will be moved by user gesture
175-
*
174+
*
176175
* @param view
177176
*/
178177
private void setContentView(View view) {
@@ -191,7 +190,7 @@ public void setEnableGesture(boolean enable) {
191190
* {@link me.imid.swipebacklayout.lib.ViewDragHelper.Callback#onEdgeDragStarted(int, int)}
192191
* methods will only be invoked for edges for which edge tracking has been
193192
* enabled.
194-
*
193+
*
195194
* @param edgeFlags Combination of edge flags describing the edges to watch
196195
* @see #EDGE_LEFT
197196
* @see #EDGE_RIGHT
@@ -205,7 +204,7 @@ public void setEdgeTrackingEnabled(int edgeFlags) {
205204
/**
206205
* Set a color to use for the scrim that obscures primary content while a
207206
* drawer is open.
208-
*
207+
*
209208
* @param color Color to use in 0xAARRGGBB format.
210209
*/
211210
public void setScrimColor(int color) {
@@ -217,7 +216,7 @@ public void setScrimColor(int color) {
217216
* Set the size of an edge. This is the range in pixels along the edges of
218217
* this view that will actively detect edge touches or drags if edge
219218
* tracking is enabled.
220-
*
219+
*
221220
* @param size The size of an edge in pixels
222221
*/
223222
public void setEdgeSize(int size) {
@@ -227,7 +226,7 @@ public void setEdgeSize(int size) {
227226
/**
228227
* Register a callback to be invoked when a swipe event is sent to this
229228
* view.
230-
*
229+
*
231230
* @param listener the swipe listener to attach to this view
232231
* @deprecated use {@link #addSwipeListener} instead
233232
*/
@@ -238,7 +237,7 @@ public void setSwipeListener(SwipeListener listener) {
238237

239238
/**
240239
* Add a callback to be invoked when a swipe event is sent to this view.
241-
*
240+
*
242241
* @param listener the swipe listener to attach to this view
243242
*/
244243
public void addSwipeListener(SwipeListener listener) {
@@ -250,7 +249,7 @@ public void addSwipeListener(SwipeListener listener) {
250249

251250
/**
252251
* Removes a listener from the set of listeners
253-
*
252+
*
254253
* @param listener
255254
*/
256255
public void removeSwipeListener(SwipeListener listener) {
@@ -263,18 +262,18 @@ public void removeSwipeListener(SwipeListener listener) {
263262
public static interface SwipeListener {
264263
/**
265264
* Invoke when state change
266-
*
267-
* @param state flag to describe scroll state
265+
*
266+
* @param state flag to describe scroll state
267+
* @param scrollPercent scroll percent of this view
268268
* @see #STATE_IDLE
269269
* @see #STATE_DRAGGING
270270
* @see #STATE_SETTLING
271-
* @param scrollPercent scroll percent of this view
272271
*/
273272
public void onScrollStateChange(int state, float scrollPercent);
274273

275274
/**
276275
* Invoke when edge touched
277-
*
276+
*
278277
* @param edgeFlag edge flag describing the edge being touched
279278
* @see #EDGE_LEFT
280279
* @see #EDGE_RIGHT
@@ -291,7 +290,7 @@ public static interface SwipeListener {
291290
/**
292291
* Set scroll threshold, we will close the activity, when scrollPercent over
293292
* this value
294-
*
293+
*
295294
* @param threshold
296295
*/
297296
public void setScrollThresHold(float threshold) {
@@ -303,8 +302,8 @@ public void setScrollThresHold(float threshold) {
303302

304303
/**
305304
* Set a drawable used for edge shadow.
306-
*
307-
* @param shadow Drawable to use
305+
*
306+
* @param shadow Drawable to use
308307
* @param edgeFlags Combination of edge flags describing the edge to set
309308
* @see #EDGE_LEFT
310309
* @see #EDGE_RIGHT
@@ -323,8 +322,8 @@ public void setShadow(Drawable shadow, int edgeFlag) {
323322

324323
/**
325324
* Set a drawable used for edge shadow.
326-
*
327-
* @param resId Resource of drawable to use
325+
*
326+
* @param resId Resource of drawable to use
328327
* @param edgeFlags Combination of edge flags describing the edge to set
329328
* @see #EDGE_LEFT
330329
* @see #EDGE_RIGHT
@@ -453,8 +452,8 @@ private void drawShadow(Canvas canvas, View child) {
453452

454453
public void attachToActivity(Activity activity) {
455454
mActivity = activity;
456-
TypedArray a = activity.getTheme().obtainStyledAttributes(new int[] {
457-
android.R.attr.windowBackground
455+
TypedArray a = activity.getTheme().obtainStyledAttributes(new int[]{
456+
android.R.attr.windowBackground
458457
});
459458
int background = a.getResourceId(0, 0);
460459
a.recycle();

library/src/main/java/me/imid/swipebacklayout/lib/app/SwipeBackActivityHelper.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
package me.imid.swipebacklayout.lib.app;
32

43
import android.app.Activity;
@@ -31,9 +30,6 @@ public void onActivityCreate() {
3130
mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() {
3231
@Override
3332
public void onScrollStateChange(int state, float scrollPercent) {
34-
if (state == SwipeBackLayout.STATE_IDLE && scrollPercent == 0) {
35-
Utils.convertActivityFromTranslucent(mActivity);
36-
}
3733
}
3834

3935
@Override
@@ -50,7 +46,6 @@ public void onScrollOverThreshold() {
5046

5147
public void onPostCreate() {
5248
mSwipeBackLayout.attachToActivity(mActivity);
53-
Utils.convertActivityFromTranslucent(mActivity);
5449
}
5550

5651
public View findViewById(int id) {

0 commit comments

Comments
 (0)