Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不能只用Fragment吗?我不想Activity滑动返回,只想Fragment才这样不行吗,异常Activity也要继承 #14

Open
TracyYing1993 opened this issue May 18, 2017 · 5 comments

Comments

@TracyYing1993
Copy link

TracyYing1993 commented May 18, 2017

不能只用Fragment吗?我不想Activity滑动返回,只想Fragment才这样不行吗,异常Activity也要继承

@YoKeyword
Copy link
Owner

Activity不需要滑动返回的话, Activity不继承SwipeBackActivity即可

@TracyYing1993
Copy link
Author

但是我的fragment需要滑动,它的父activity不继承swipeBaceActivity直接异常了

@YoKeyword
Copy link
Owner

不继承会异常, 报的什么异常呢? 印象中是独立互不影响的

@TracyYing1993
Copy link
Author

SwipeBackFragment 里面的这段代码
@OverRide
public void onAttach(Activity activity) {
super.onAttach(activity);
if (activity instanceof SwipeBackActivity) {
_mActivity = (SwipeBackActivity) activity;
} else {
throw new RuntimeException(activity.toString() + " must extends SwipeBackActivity");
}
}
如果fragment的父activity没继承的话就报这个异常

@YoKeyword
Copy link
Owner

😓 是的,这个是上版本加的特性,导致耦合了.

刚新push了 0.3.0版本, 可以独立互不影响了 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants