Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ dependencies {
}

android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
minSdkVersion 7
targetSdkVersion 19
targetSdkVersion 21
}
}
28 changes: 22 additions & 6 deletions library/src/main/java/me/imid/swipebacklayout/lib/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
package me.imid.swipebacklayout.lib;

import android.app.Activity;
import android.app.ActivityOptions;
import android.os.Build;

import java.lang.reflect.Method;

Expand Down Expand Up @@ -54,12 +56,26 @@ public static void convertActivityToTranslucent(Activity activity) {
translucentConversionListenerClazz = clazz;
}
}
Method method = Activity.class.getDeclaredMethod("convertToTranslucent",
translucentConversionListenerClazz);
method.setAccessible(true);
method.invoke(activity, new Object[] {
null
});
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
Method method = Activity.class.getDeclaredMethod(
"convertToTranslucent",
translucentConversionListenerClazz);
method.setAccessible(true);
method.invoke(activity, new Object[] {
null
});
} else {
Method method = Activity.class.getDeclaredMethod(
"convertToTranslucent",
translucentConversionListenerClazz,
ActivityOptions.class);
method.setAccessible(true);
method.invoke(activity, new Object[] {
null,
null
});
}

} catch (Throwable t) {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public void onActivityCreate() {
mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() {
@Override
public void onScrollStateChange(int state, float scrollPercent) {
if (state == SwipeBackLayout.STATE_IDLE && scrollPercent == 0) {
Utils.convertActivityFromTranslucent(mActivity);
}
}

@Override
Expand All @@ -46,6 +49,7 @@ public void onScrollOverThreshold() {

public void onPostCreate() {
mSwipeBackLayout.attachToActivity(mActivity);
Utils.convertActivityFromTranslucent(mActivity);
}

public View findViewById(int id) {
Expand Down