14
14
* limitations under the License.
15
15
*/
16
16
17
- package com .dylanc .loadinghelper .sample .base ;
17
+ package com .dylanc .loadingstateview .sample .base ;
18
18
19
19
import androidx .annotation .IdRes ;
20
20
import androidx .appcompat .app .AppCompatActivity ;
21
21
22
- import com .dylanc .loadinghelper . LoadingHelper ;
23
- import com .dylanc .loadinghelper .sample .adapter .NavIconType ;
24
- import com .dylanc .loadinghelper .sample .adapter . ToolbarAdapter ;
22
+ import com .dylanc .loadingstateview . LoadingStateView ;
23
+ import com .dylanc .loadingstateview .sample .delegate .NavIconType ;
24
+ import com .dylanc .loadingstateview .sample .delegate . ToolbarViewDelegate ;
25
25
26
26
/**
27
27
* 这是耦合度较低的封装方式,没有任何抽象方法,可以很方便地将基类里的代码拷贝到其它项目的基类里使用。
35
35
@ SuppressWarnings ("unused" )
36
36
public class BaseActivity extends AppCompatActivity {
37
37
38
- private LoadingHelper loadingHelper ;
38
+ private LoadingStateView loadingStateView ;
39
39
40
40
@ Override
41
41
public void setContentView (int layoutResID ) {
@@ -45,11 +45,11 @@ public void setContentView(int layoutResID) {
45
45
public void setContentView (int layoutResID , @ IdRes int contentViewId ) {
46
46
super .setContentView (layoutResID );
47
47
if (contentViewId == 0 ) {
48
- loadingHelper = new LoadingHelper (this );
48
+ loadingStateView = new LoadingStateView (this );
49
49
} else {
50
- loadingHelper = new LoadingHelper (findViewById (contentViewId ));
50
+ loadingStateView = new LoadingStateView (findViewById (contentViewId ));
51
51
}
52
- loadingHelper .setOnReloadListener (this ::onReload );
52
+ loadingStateView .setOnReloadListener (this ::onReload );
53
53
}
54
54
55
55
/**
@@ -64,27 +64,27 @@ public void setToolbar(String title, NavIconType type) {
64
64
}
65
65
66
66
public void setToolbar (String title , NavIconType type , int menuId ) {
67
- loadingHelper .setDecorHeader (new ToolbarAdapter (title , type , menuId , this ::onOptionsItemSelected ));
67
+ loadingStateView .setDecorHeader (new ToolbarViewDelegate (title , type , menuId , this ::onOptionsItemSelected ));
68
68
}
69
69
70
70
public void showLoadingView () {
71
- loadingHelper .showLoadingView ();
71
+ loadingStateView .showLoadingView ();
72
72
}
73
73
74
74
public void showContentView () {
75
- loadingHelper .showContentView ();
75
+ loadingStateView .showContentView ();
76
76
}
77
77
78
78
public void showErrorView () {
79
- loadingHelper .showErrorView ();
79
+ loadingStateView .showErrorView ();
80
80
}
81
81
82
82
public void showEmptyView () {
83
- loadingHelper .showEmptyView ();
83
+ loadingStateView .showEmptyView ();
84
84
}
85
85
86
86
public void showCustomView (Object viewType ) {
87
- loadingHelper .showView (viewType );
87
+ loadingStateView .showView (viewType );
88
88
}
89
89
90
90
protected void onReload () {
0 commit comments