-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
SimpleImmersionFragment.java
65 lines (56 loc) · 1.93 KB
/
SimpleImmersionFragment.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.gyf.immersionbar.components;
import android.content.res.Configuration;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
/**
* 为了方便在Fragment使用沉浸式请继承ImmersionFragment,
* 请在immersionBarEnabled方法中实现你的沉浸式代码,
* ImmersionProxy已经做了ImmersionBar.with(mFragment).destroy()了,所以不需要在你的代码中做这个处理了
* 如果不能继承,请拷贝代码到你的项目中
*
* @author geyifeng
* @date 2017 /5/12
*/
@Deprecated
public abstract class SimpleImmersionFragment extends Fragment implements SimpleImmersionOwner {
/**
* ImmersionBar代理类
*/
private SimpleImmersionProxy mSimpleImmersionProxy = new SimpleImmersionProxy(this);
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
mSimpleImmersionProxy.setUserVisibleHint(isVisibleToUser);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mSimpleImmersionProxy.onActivityCreated(savedInstanceState);
}
@Override
public void onDestroy() {
super.onDestroy();
mSimpleImmersionProxy.onDestroy();
}
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
mSimpleImmersionProxy.onHiddenChanged(hidden);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mSimpleImmersionProxy.onConfigurationChanged(newConfig);
}
/**
* 是否可以实现沉浸式,当为true的时候才可以执行initImmersionBar方法
* Immersion bar enabled boolean.
*
* @return the boolean
*/
@Override
public boolean immersionBarEnabled() {
return true;
}
}