|
@@ -11,7 +11,7 @@ import Foundation
|
|
|
class MJRefreshManager: NSObject {
|
|
|
|
|
|
//MARK: - tableView
|
|
|
- class func hiddenHeaderWithFooter(tableView : UITableView?) {
|
|
|
+ class func mjRefreshManager(tableView : UITableView?) {
|
|
|
if tableView?.mj_footer != nil {
|
|
|
tableView?.endFooterRefresh()
|
|
|
}
|
|
@@ -21,7 +21,7 @@ class MJRefreshManager: NSObject {
|
|
|
tableView?.ly_endLoading()
|
|
|
}
|
|
|
|
|
|
- class func hiddenHeaderWithFooterNONetWork(tableView : UITableView?) {
|
|
|
+ class func mjRefreshManagerNONetWork(tableView : UITableView?) {
|
|
|
DIYEmptyView.emptyNoDataActionTableView(tableView: tableView, btnClickBlock: {
|
|
|
[weak tableView] in
|
|
|
tableView?.mj_header.beginRefreshing()
|
|
@@ -36,7 +36,7 @@ class MJRefreshManager: NSObject {
|
|
|
tableView?.ly_endLoading()
|
|
|
}
|
|
|
|
|
|
- class func hiddenHeaderWithFooterNOData(tableView : UITableView?) {
|
|
|
+ class func mjRefreshManagerNOData(tableView : UITableView?) {
|
|
|
DIYEmptyView.emptyNoDataTableView(tableView: tableView,imageStr: .one,detailStr: .one)
|
|
|
if tableView?.mj_footer != nil {
|
|
|
tableView?.endFooterRefresh()
|
|
@@ -47,26 +47,34 @@ class MJRefreshManager: NSObject {
|
|
|
tableView?.ly_endLoading()
|
|
|
}
|
|
|
|
|
|
- class func hiddenHeaderWithFooter(tableView:UITableView?,loadingStatus:SwiftMoyaNetWorkManagerLoadingStatus) {
|
|
|
+ class func mjRefreshManagerLoadingStatus(tableView:UITableView?,loadingStatus:SwiftMoyaNetWorkManagerLoadingStatus) {
|
|
|
if tableView?.mj_footer != nil {
|
|
|
tableView?.isHiddenFooter(true)
|
|
|
}
|
|
|
if loadingStatus == .noData {
|
|
|
- MJRefreshManager.hiddenHeaderWithFooterNOData(tableView: tableView)
|
|
|
+ mjRefreshManagerNOData(tableView: tableView)
|
|
|
}else if loadingStatus == .noNetwork {
|
|
|
- MJRefreshManager.hiddenHeaderWithFooterNONetWork(tableView: tableView)
|
|
|
+ mjRefreshManagerNONetWork(tableView: tableView)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ class func mjRefreshManagerPaginationNoHiddenFooter(tableView : UITableView?,pagination : PaginationModel?) {
|
|
|
+ mjRefreshManagerIsHiddenFooter(isHidden: false, tableView: tableView, pagination: pagination)
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- class func hiddenHeaderWithFooter(tableView : UITableView?,pagination : PaginationModel?) {
|
|
|
-
|
|
|
+ class func mjRefreshManagerPaginationHiddenFooter(tableView : UITableView?,pagination : PaginationModel?) {
|
|
|
+ mjRefreshManagerIsHiddenFooter(isHidden: true, tableView: tableView, pagination: pagination)
|
|
|
+ }
|
|
|
+
|
|
|
+ private class func mjRefreshManagerIsHiddenFooter(isHidden:Bool,tableView : UITableView?,pagination : PaginationModel?) {
|
|
|
if tableView?.mj_header != nil {
|
|
|
tableView?.endHeaderRefresh()
|
|
|
}
|
|
|
if tableView?.mj_footer != nil {
|
|
|
tableView?.endFooterRefresh()
|
|
|
}
|
|
|
+
|
|
|
if pagination?.total == 0 {
|
|
|
if tableView?.mj_footer != nil {
|
|
|
tableView?.isHiddenFooter(true)
|
|
@@ -76,16 +84,22 @@ class MJRefreshManager: NSObject {
|
|
|
tableView?.mj_footer.isHidden = false
|
|
|
if tableView?.mj_footer != nil {
|
|
|
tableView?.endFooterNoMoreData()
|
|
|
- tableView?.mj_footer.pullingPercent = 1
|
|
|
+ if isHidden {
|
|
|
+ tableView?.isHiddenFooter(true)
|
|
|
+ }else {
|
|
|
+ tableView?.mj_footer.pullingPercent = 1
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
tableView?.ly_endLoading()
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
//MARK: - collectionView
|
|
|
- class func hiddenHeaderWithFooter(collectionView : UICollectionView?) {
|
|
|
+ class func mjRefreshManager(collectionView : UICollectionView?) {
|
|
|
|
|
|
if collectionView?.mj_header != nil {
|
|
|
collectionView?.endHeaderRefresh()
|
|
@@ -96,7 +110,7 @@ class MJRefreshManager: NSObject {
|
|
|
collectionView?.ly_endLoading()
|
|
|
}
|
|
|
|
|
|
- class func hiddenHeaderWithFooterNONetWork(collectionView : UICollectionView?) {
|
|
|
+ class func mjRefreshManagerNONetWork(collectionView : UICollectionView?) {
|
|
|
DIYEmptyView.emptyNoDataActionCollectionView(collectionView: collectionView, btnClickBlock: {
|
|
|
[weak collectionView] in
|
|
|
collectionView?.mj_header.beginRefreshing()
|
|
@@ -110,7 +124,7 @@ class MJRefreshManager: NSObject {
|
|
|
collectionView?.ly_endLoading()
|
|
|
}
|
|
|
|
|
|
- class func hiddenHeaderWithFooterNOData(collectionView : UICollectionView?) {
|
|
|
+ class func mjRefreshManagerNOData(collectionView : UICollectionView?) {
|
|
|
DIYEmptyView.emptyNoDataCollectionView(collectionView: collectionView)
|
|
|
if collectionView?.mj_header != nil {
|
|
|
collectionView?.endHeaderRefresh()
|
|
@@ -121,18 +135,26 @@ class MJRefreshManager: NSObject {
|
|
|
collectionView?.ly_endLoading()
|
|
|
}
|
|
|
|
|
|
- class func hiddenHeaderWithFooter(collectionView:UICollectionView?,loadingStatus:SwiftMoyaNetWorkManagerLoadingStatus) {
|
|
|
+ class func mjRefreshManagerLoadingStatus(collectionView:UICollectionView?,loadingStatus:SwiftMoyaNetWorkManagerLoadingStatus) {
|
|
|
if collectionView?.mj_footer != nil {
|
|
|
collectionView?.isHiddenFooter(true)
|
|
|
}
|
|
|
if loadingStatus == .noData {
|
|
|
- MJRefreshManager.hiddenHeaderWithFooterNOData(collectionView: collectionView)
|
|
|
+ MJRefreshManager.mjRefreshManagerNOData(collectionView: collectionView)
|
|
|
}else if loadingStatus == .noNetwork {
|
|
|
- MJRefreshManager.hiddenHeaderWithFooterNONetWork(collectionView: collectionView)
|
|
|
+ MJRefreshManager.mjRefreshManagerNONetWork(collectionView: collectionView)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- class func hiddenHeaderWithFooter(collectionView : UICollectionView?,pagination : PaginationModel?) {
|
|
|
+ class func mjRefreshManagerNoHiddenFooter(collectionView : UICollectionView?,pagination : PaginationModel?) {
|
|
|
+ mjRefreshManagerIsHiddenFooter(isHidden: false, collectionView: collectionView, pagination: pagination)
|
|
|
+ }
|
|
|
+
|
|
|
+ class func mjRefreshManagerHiddenFooter(collectionView : UICollectionView?,pagination : PaginationModel?) {
|
|
|
+ mjRefreshManagerIsHiddenFooter(isHidden: true, collectionView: collectionView, pagination: pagination)
|
|
|
+ }
|
|
|
+
|
|
|
+ private class func mjRefreshManagerIsHiddenFooter(isHidden:Bool,collectionView : UICollectionView?,pagination : PaginationModel?) {
|
|
|
if collectionView?.mj_header != nil {
|
|
|
collectionView?.endHeaderRefresh()
|
|
|
}
|
|
@@ -149,11 +171,15 @@ class MJRefreshManager: NSObject {
|
|
|
collectionView?.mj_footer.isHidden = false
|
|
|
if collectionView?.mj_footer != nil {
|
|
|
collectionView?.endFooterNoMoreData()
|
|
|
- collectionView?.mj_footer.pullingPercent = 1
|
|
|
+ if isHidden {
|
|
|
+ collectionView?.isHiddenFooter(true)
|
|
|
+ }else {
|
|
|
+ collectionView?.mj_footer.pullingPercent = 1
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
collectionView?.ly_endLoading()
|
|
|
}
|
|
|
}
|