Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
PhoneManager
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yang
PhoneManager
Commits
07f47302
Commit
07f47302
authored
May 13, 2025
by
CZ1004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】内部勾选框
parent
c877a173
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
309 additions
and
183 deletions
+309
-183
project.pbxproj
PhoneManager.xcodeproj/project.pbxproj
+0
-161
CompressSelectCell.swift
...Manager/Class/Page/Compress/Cell/CompressSelectCell.swift
+25
-2
CompressCompletedViewController.swift
...Compress/Controller/CompressCompletedViewController.swift
+16
-3
CompressController.swift
...r/Class/Page/Compress/Controller/CompressController.swift
+1
-0
VideoViewController.swift
...eManager/Class/Page/Home/Common/VideoViewController.swift
+57
-0
HomePhotosDetailViewController.swift
...Page/Home/Controller/HomePhotosDetailViewController.swift
+11
-1
HomeVideoDetailController.swift
...lass/Page/Home/Controller/HomeVideoDetailController.swift
+9
-1
HomeInfoView.swift
PhoneManager/Class/Page/Home/View/HomeInfoView.swift
+8
-2
HomeInfoTableViewCell.swift
...ger/Class/Page/Home/View/cell/HomeInfoTableViewCell.swift
+13
-0
ImageSeletedCollectionCell.swift
...lass/Page/Home/View/cell/ImageSeletedCollectionCell.swift
+3
-3
PMShowImgCell.swift
PhoneManager/Class/Page/Secret/Cell/PMShowImgCell.swift
+25
-0
PMShowVideoCell.swift
PhoneManager/Class/Page/Secret/Cell/PMShowVideoCell.swift
+64
-8
PMShowImgVideoController.swift
...eManager/Class/Page/Secret/PMShowImgVideoController.swift
+67
-2
SecretViewController.swift
PhoneManager/Class/Page/Secret/SecretViewController.swift
+10
-0
iOS压缩完成.json
...ss/Resource/Animation/CompressCompletedLight/iOS压缩完成.json
+0
-0
No files found.
PhoneManager.xcodeproj/project.pbxproj
View file @
07f47302
This diff is collapsed.
Click to expand it.
PhoneManager/Class/Page/Compress/Cell/CompressSelectCell.swift
View file @
07f47302
...
@@ -17,6 +17,8 @@ typealias CompressSelectCellCallback = (AssetModel,Bool)->Void
...
@@ -17,6 +17,8 @@ typealias CompressSelectCellCallback = (AssetModel,Bool)->Void
class
CompressSelectCell
:
UICollectionViewCell
{
class
CompressSelectCell
:
UICollectionViewCell
{
var
indexPath
:
IndexPath
?
var
callBack
:
CompressSelectCellCallback
=
{
model
,
choose
in
}
var
callBack
:
CompressSelectCellCallback
=
{
model
,
choose
in
}
var
currentMediaType
:
CompressType
=
.
compressPhoto
{
var
currentMediaType
:
CompressType
=
.
compressPhoto
{
...
@@ -235,13 +237,25 @@ class CompressSelectCell : UICollectionViewCell {
...
@@ -235,13 +237,25 @@ class CompressSelectCell : UICollectionViewCell {
let
vc
=
PMShowImgVideoController
()
let
vc
=
PMShowImgVideoController
()
vc
.
state
=
.
similarPhotos
vc
.
state
=
.
similarPhotos
vc
.
currentIdx
=
0
vc
.
currentIdx
=
0
vc
.
oldPageIndexPath
=
indexPath
let
dataSource
=
ImageSeletedCollectionItem
()
let
dataSource
=
ImageSeletedCollectionItem
()
dataSource
.
isSeleted
=
tru
e
dataSource
.
isSeleted
=
self
.
choos
e
dataSource
.
id
=
tempModel
dataSource
.
id
=
tempModel
// 获取image
// 获取image
dataSource
.
image
=
PhotoAndVideoMananger
.
mananger
.
getImageFromAssetID
(
id
:
tempModel
.
localIdentifier
)
dataSource
.
image
=
PhotoAndVideoMananger
.
mananger
.
getImageFromAssetID
(
id
:
tempModel
.
localIdentifier
)
vc
.
homeDataSource
=
[
dataSource
]
vc
.
homeDataSource
=
[
dataSource
]
vc
.
backOrgPageCallBack
=
{[
weak
self
]
index
,
data
in
guard
let
self
else
{
return
}
if
let
data
=
data
{
if
let
item
=
data
.
first
{
self
.
choose
=
item
.
isSeleted
??
false
}
}
}
self
.
responderViewController
()?
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
self
.
responderViewController
()?
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
}
else
{
}
else
{
...
@@ -253,12 +267,21 @@ class CompressSelectCell : UICollectionViewCell {
...
@@ -253,12 +267,21 @@ class CompressSelectCell : UICollectionViewCell {
let
vc
=
PMShowImgVideoController
()
let
vc
=
PMShowImgVideoController
()
vc
.
state
=
.
similarVideos
vc
.
state
=
.
similarVideos
vc
.
currentIdx
=
0
vc
.
currentIdx
=
0
vc
.
oldPageIndexPath
=
self
.
indexPath
let
dataSource
=
ImageSeletedCollectionItem
()
let
dataSource
=
ImageSeletedCollectionItem
()
dataSource
.
isSeleted
=
tru
e
dataSource
.
isSeleted
=
self
.
choos
e
dataSource
.
id
=
tempModel
dataSource
.
id
=
tempModel
dataSource
.
image
=
image
dataSource
.
image
=
image
// 表示这个是视频
// 表示这个是视频
vc
.
homeDataSource
=
[
dataSource
]
vc
.
homeDataSource
=
[
dataSource
]
vc
.
backOrgPageCallBack
=
{[
weak
self
]
index
,
data
in
guard
let
self
else
{
return
}
if
let
data
=
data
{
if
let
item
=
data
.
first
{
self
.
choose
=
item
.
isSeleted
??
false
}
}
}
vc
.
getVideoURLFromLocalIdentifier
(
localIdentifier
:
tempModel
.
localIdentifier
)
{
url
,
error
in
vc
.
getVideoURLFromLocalIdentifier
(
localIdentifier
:
tempModel
.
localIdentifier
)
{
url
,
error
in
if
url
!=
nil
{
if
url
!=
nil
{
DispatchQueue
.
main
.
async
{
DispatchQueue
.
main
.
async
{
...
...
PhoneManager/Class/Page/Compress/Controller/CompressCompletedViewController.swift
View file @
07f47302
...
@@ -19,8 +19,16 @@ class CompressCompletedViewController : BaseViewController{
...
@@ -19,8 +19,16 @@ class CompressCompletedViewController : BaseViewController{
var
currentMediaType
:
CompressType
=
.
compressPhoto
var
currentMediaType
:
CompressType
=
.
compressPhoto
lazy
var
bacView
:
UIView
=
{
let
view
=
UIView
()
view
.
layer
.
cornerRadius
=
115
view
.
backgroundColor
=
UIColor
(
red
:
0
,
green
:
0.51
,
blue
:
1
,
alpha
:
1
)
return
view
}()
lazy
var
animationView
:
LottieAnimationView
=
{
lazy
var
animationView
:
LottieAnimationView
=
{
let
animationView
=
LottieAnimationView
(
name
:
"
CompressCompletedLight
"
)
let
animationView
=
LottieAnimationView
(
name
:
"
iOS压缩完成
"
)
animationView
.
layer
.
cornerRadius
=
12
animationView
.
layer
.
cornerRadius
=
12
animationView
.
backgroundColor
=
.
clear
animationView
.
backgroundColor
=
.
clear
animationView
.
loopMode
=
.
loop
animationView
.
loopMode
=
.
loop
...
@@ -153,6 +161,7 @@ class CompressCompletedViewController : BaseViewController{
...
@@ -153,6 +161,7 @@ class CompressCompletedViewController : BaseViewController{
self
.
view
.
backgroundColor
=
UIColor
(
red
:
0.95
,
green
:
0.96
,
blue
:
0.99
,
alpha
:
1
)
self
.
view
.
backgroundColor
=
UIColor
(
red
:
0.95
,
green
:
0.96
,
blue
:
0.99
,
alpha
:
1
)
self
.
titleView
.
isHidden
=
true
self
.
titleView
.
isHidden
=
true
self
.
view
.
addSubview
(
self
.
bacView
)
self
.
view
.
addSubview
(
self
.
animationView
)
self
.
view
.
addSubview
(
self
.
animationView
)
self
.
view
.
addSubview
(
self
.
tipLabel
)
self
.
view
.
addSubview
(
self
.
tipLabel
)
self
.
view
.
addSubview
(
self
.
detailTiplabel
)
self
.
view
.
addSubview
(
self
.
detailTiplabel
)
...
@@ -168,7 +177,11 @@ class CompressCompletedViewController : BaseViewController{
...
@@ -168,7 +177,11 @@ class CompressCompletedViewController : BaseViewController{
self
.
infoView
.
addSubview
(
self
.
finalTipLabel
)
self
.
infoView
.
addSubview
(
self
.
finalTipLabel
)
self
.
view
.
addSubview
(
self
.
completedButton
)
self
.
view
.
addSubview
(
self
.
completedButton
)
self
.
bacView
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
statusBarHeight
+
60
)
make
.
width
.
height
.
equalTo
(
230
)
make
.
centerX
.
equalToSuperview
()
}
self
.
animationView
.
snp
.
makeConstraints
{
make
in
self
.
animationView
.
snp
.
makeConstraints
{
make
in
make
.
top
.
equalTo
(
statusBarHeight
+
60
)
make
.
top
.
equalTo
(
statusBarHeight
+
60
)
make
.
width
.
height
.
equalTo
(
230
)
make
.
width
.
height
.
equalTo
(
230
)
...
@@ -366,7 +379,7 @@ class CompressCompletedViewController : BaseViewController{
...
@@ -366,7 +379,7 @@ class CompressCompletedViewController : BaseViewController{
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
setUI
()
setUI
()
self
.
animationView
.
play
(
fromProgress
:
0
,
toProgress
:
1
,
loopMode
:
.
playOnce
)
self
.
animationView
.
play
(
fromProgress
:
0
,
toProgress
:
1
,
loopMode
:
.
loop
)
}
}
...
...
PhoneManager/Class/Page/Compress/Controller/CompressController.swift
View file @
07f47302
...
@@ -174,6 +174,7 @@ extension CompressController:WaterfallMutiSectionDelegate,UICollectionViewDataSo
...
@@ -174,6 +174,7 @@ extension CompressController:WaterfallMutiSectionDelegate,UICollectionViewDataSo
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"CompressSelectCell"
,
for
:
indexPath
)
as!
CompressSelectCell
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"CompressSelectCell"
,
for
:
indexPath
)
as!
CompressSelectCell
cell
.
currentMediaType
=
self
.
currentResourceType
cell
.
currentMediaType
=
self
.
currentResourceType
cell
.
model
=
self
.
resourceData
[
indexPath
.
row
]
cell
.
model
=
self
.
resourceData
[
indexPath
.
row
]
cell
.
indexPath
=
indexPath
if
self
.
selectedModel
.
count
==
0
{
if
self
.
selectedModel
.
count
==
0
{
cell
.
choose
=
false
cell
.
choose
=
false
}
}
...
...
PhoneManager/Class/Page/Home/Common/VideoViewController.swift
0 → 100644
View file @
07f47302
//
// VideoViewController.swift
// PhoneManager
//
// Created by edy on 2025/5/13.
//
import
Foundation
import
AVKit
import
MediaPlayer
class
VideoViewController
:
UIViewController
{
var
url
:
URL
?
// 系统播放器控制器
let
playerViewController
=
AVPlayerViewController
()
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
setupPlayer
()
}
func
setupPlayer
()
{
// 1. 创建播放器
if
let
url
=
self
.
url
{
let
player
=
AVPlayer
(
url
:
url
)
// 2. 配置播放器控制器
playerViewController
.
player
=
player
playerViewController
.
delegate
=
self
playerViewController
.
showsPlaybackControls
=
true
// 3. 添加到当前视图
addChild
(
playerViewController
)
view
.
addSubview
(
playerViewController
.
view
)
playerViewController
.
view
.
frame
=
view
.
bounds
playerViewController
.
didMove
(
toParent
:
self
)
// 4. 自动播放
player
.
play
()
}
}
}
// MARK: - AVPlayerViewControllerDelegate
extension
VideoViewController
:
AVPlayerViewControllerDelegate
{
// 处理全屏切换
func
playerViewController
(
_
playerViewController
:
AVPlayerViewController
,
willBeginFullScreenPresentationWithAnimationCoordinator
coordinator
:
UIViewControllerTransitionCoordinator
)
{
}
func
playerViewController
(
_
playerViewController
:
AVPlayerViewController
,
willEndFullScreenPresentationWithAnimationCoordinator
coordinator
:
UIViewControllerTransitionCoordinator
)
{
}
}
PhoneManager/Class/Page/Home/Controller/HomePhotosDetailViewController.swift
View file @
07f47302
...
@@ -313,12 +313,22 @@ extension HomePhotosDetailViewController:WaterfallMutiSectionDelegate,UICollecti
...
@@ -313,12 +313,22 @@ extension HomePhotosDetailViewController:WaterfallMutiSectionDelegate,UICollecti
let
vc
=
PMShowImgVideoController
()
let
vc
=
PMShowImgVideoController
()
vc
.
state
=
.
similarPhotos
vc
.
state
=
.
similarPhotos
vc
.
currentIdx
=
0
vc
.
currentIdx
=
0
vc
.
oldPageIndexPath
=
indexPath
let
dataSource
=
ImageSeletedCollectionItem
()
let
dataSource
=
ImageSeletedCollectionItem
()
dataSource
.
isSeleted
=
tru
e
dataSource
.
isSeleted
=
cell
.
choos
e
dataSource
.
id
=
ident
dataSource
.
id
=
ident
// 获取image
// 获取image
dataSource
.
image
=
PhotoAndVideoMananger
.
mananger
.
getImageFromAssetID
(
id
:
ident
.
localIdentifier
)
dataSource
.
image
=
PhotoAndVideoMananger
.
mananger
.
getImageFromAssetID
(
id
:
ident
.
localIdentifier
)
vc
.
homeDataSource
=
[
dataSource
]
vc
.
homeDataSource
=
[
dataSource
]
vc
.
backOrgPageCallBack
=
{[
weak
self
]
index
,
data
in
guard
let
self
else
{
return
}
if
let
data
=
data
{
if
let
item
=
data
.
first
{
cell
.
choose
=
item
.
isSeleted
??
false
}
}
}
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
...
...
PhoneManager/Class/Page/Home/Controller/HomeVideoDetailController.swift
View file @
07f47302
...
@@ -257,11 +257,19 @@ extension HomeVideoDetailController:WaterfallMutiSectionDelegate,UICollectionVie
...
@@ -257,11 +257,19 @@ extension HomeVideoDetailController:WaterfallMutiSectionDelegate,UICollectionVie
vc
.
state
=
.
similarVideos
vc
.
state
=
.
similarVideos
vc
.
currentIdx
=
0
vc
.
currentIdx
=
0
let
dataSource
=
ImageSeletedCollectionItem
()
let
dataSource
=
ImageSeletedCollectionItem
()
dataSource
.
isSeleted
=
tru
e
dataSource
.
isSeleted
=
cell
.
choos
e
dataSource
.
id
=
ident
dataSource
.
id
=
ident
dataSource
.
image
=
image
dataSource
.
image
=
image
// 表示这个是视频
// 表示这个是视频
vc
.
homeDataSource
=
[
dataSource
]
vc
.
homeDataSource
=
[
dataSource
]
vc
.
backOrgPageCallBack
=
{[
weak
self
]
index
,
data
in
guard
let
self
else
{
return
}
if
let
data
=
data
{
if
let
item
=
data
.
first
{
cell
.
choose
=
item
.
isSeleted
??
false
}
}
}
vc
.
getVideoURLFromLocalIdentifier
(
localIdentifier
:
ident
.
localIdentifier
)
{
url
,
error
in
vc
.
getVideoURLFromLocalIdentifier
(
localIdentifier
:
ident
.
localIdentifier
)
{
url
,
error
in
if
url
!=
nil
{
if
url
!=
nil
{
DispatchQueue
.
main
.
async
{
DispatchQueue
.
main
.
async
{
...
...
PhoneManager/Class/Page/Home/View/HomeInfoView.swift
View file @
07f47302
...
@@ -42,7 +42,7 @@ class HomeInfoView :UIView {
...
@@ -42,7 +42,7 @@ class HomeInfoView :UIView {
lazy
var
headerView
:
HomeInfoTitleView
=
{
lazy
var
headerView
:
HomeInfoTitleView
=
{
let
sview
:
HomeInfoTitleView
=
HomeInfoTitleView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
width
,
height
:
84
))
let
sview
:
HomeInfoTitleView
=
HomeInfoTitleView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
width
,
height
:
84
))
sview
.
titleLabel
.
text
=
self
.
titleText
sview
.
titleLabel
.
text
=
self
.
titleText
sview
.
filterButton
.
isHidden
=
self
.
type
!=
.
similar
sview
.
filterButton
.
isHidden
=
self
.
type
!=
.
similar
&&
self
.
type
!=
.
SimilarVideos
tableView
.
addSubview
(
sview
)
tableView
.
addSubview
(
sview
)
return
sview
return
sview
}()
}()
...
@@ -117,7 +117,13 @@ class HomeInfoView :UIView {
...
@@ -117,7 +117,13 @@ class HomeInfoView :UIView {
// 从源头获取相似数据
// 从源头获取相似数据
PhotoDataManager
.
manager
.
loadFromFileSystem
(
resultModel
:
{[
weak
self
]
model
in
PhotoDataManager
.
manager
.
loadFromFileSystem
(
resultModel
:
{[
weak
self
]
model
in
guard
let
self
else
{
return
}
guard
let
self
else
{
return
}
let
tempData
=
self
.
filterDataByDate
(
orgModels
:
model
.
titleModelArray
[
1
]
.
assets
,
startDate
:
filterModel
.
startDate
,
endDate
:
filterModel
.
endDate
)
var
dataS
:
[[
AssetModel
]]
=
[]
if
self
.
type
==
.
SimilarVideos
{
dataS
=
model
.
otherModelArray
[
3
]
.
assets
}
else
{
dataS
=
model
.
titleModelArray
[
1
]
.
assets
}
let
tempData
=
self
.
filterDataByDate
(
orgModels
:
dataS
,
startDate
:
filterModel
.
startDate
,
endDate
:
filterModel
.
endDate
)
// 重新更新下数据源
// 重新更新下数据源
self
.
ids
=
self
.
sortData
(
source
:
tempData
,
type
:
filterModel
.
sortType
)
self
.
ids
=
self
.
sortData
(
source
:
tempData
,
type
:
filterModel
.
sortType
)
var
tempModels
:
[
HomeInfoTableItem
]
=
[]
var
tempModels
:
[
HomeInfoTableItem
]
=
[]
...
...
PhoneManager/Class/Page/Home/View/cell/HomeInfoTableViewCell.swift
View file @
07f47302
...
@@ -253,9 +253,22 @@ extension HomeInfoTableViewCell:UICollectionViewDelegate,UICollectionViewDataSou
...
@@ -253,9 +253,22 @@ extension HomeInfoTableViewCell:UICollectionViewDelegate,UICollectionViewDataSou
}
else
{
}
else
{
vc
.
state
=
.
similarPhotos
vc
.
state
=
.
similarPhotos
}
}
vc
.
oldPageIndexPath
=
indexPath
vc
.
currentIdx
=
indexPath
.
row
vc
.
currentIdx
=
indexPath
.
row
vc
.
homeDataSource
=
self
.
model
?
.
smodels
vc
.
homeDataSource
=
self
.
model
?
.
smodels
self
.
responderViewController
()?
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
self
.
responderViewController
()?
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
vc
.
backOrgPageCallBack
=
{[
weak
self
]
index
,
data
in
guard
let
self
else
{
return
}
self
.
model
?
.
smodels
=
data
DispatchQueue
.
main
.
async
{
if
let
view
=
self
.
collectionView
{
UIView
.
transition
(
with
:
view
,
duration
:
0.3
,
options
:
.
transitionCrossDissolve
,
animations
:
{
view
.
reloadData
()
},
completion
:
nil
)
}
}
}
}
}
}
}
...
...
PhoneManager/Class/Page/Home/View/cell/ImageSeletedCollectionCell.swift
View file @
07f47302
...
@@ -37,8 +37,8 @@ class ImageSeletedCollectionCell:UICollectionViewCell {
...
@@ -37,8 +37,8 @@ class ImageSeletedCollectionCell:UICollectionViewCell {
let
button
=
UIButton
(
type
:
.
custom
)
let
button
=
UIButton
(
type
:
.
custom
)
button
.
layer
.
cornerRadius
=
8
button
.
layer
.
cornerRadius
=
8
button
.
clipsToBounds
=
true
button
.
clipsToBounds
=
true
button
.
backgroundColor
=
UIColor
(
red
:
0
,
green
:
0.51
,
blue
:
1
,
alpha
:
1
)
button
.
backgroundColor
=
UIColor
(
red
:
1
,
green
:
0.65
,
blue
:
0
,
alpha
:
1
)
button
.
setTitle
(
"Best
result
"
,
for
:
.
normal
)
button
.
setTitle
(
"Best"
,
for
:
.
normal
)
button
.
setImage
(
UIImage
(
named
:
"Frame"
),
for
:
.
normal
)
button
.
setImage
(
UIImage
(
named
:
"Frame"
),
for
:
.
normal
)
button
.
setTitleColor
(
.
white
,
for
:
.
normal
)
button
.
setTitleColor
(
.
white
,
for
:
.
normal
)
button
.
isHidden
=
true
button
.
isHidden
=
true
...
@@ -179,7 +179,7 @@ class ImageSeletedCollectionCell:UICollectionViewCell {
...
@@ -179,7 +179,7 @@ class ImageSeletedCollectionCell:UICollectionViewCell {
self
.
bestResultButton
.
snp
.
makeConstraints
{
make
in
self
.
bestResultButton
.
snp
.
makeConstraints
{
make
in
make
.
left
.
bottom
.
equalToSuperview
()
make
.
left
.
bottom
.
equalToSuperview
()
make
.
width
.
equalTo
(
81
)
make
.
width
.
equalTo
(
52
)
make
.
height
.
equalTo
(
16
)
make
.
height
.
equalTo
(
16
)
}
}
...
...
PhoneManager/Class/Page/Secret/Cell/PMShowImgCell.swift
View file @
07f47302
...
@@ -29,6 +29,21 @@ class PMShowImgCell: UICollectionViewCell {
...
@@ -29,6 +29,21 @@ class PMShowImgCell: UICollectionViewCell {
}
}
}
}
lazy
var
bestResultButton
:
UIButton
=
{
let
button
=
UIButton
(
type
:
.
custom
)
button
.
setImage
(
UIImage
(
named
:
"Frame"
),
for
:
.
normal
)
button
.
setTitle
(
"Best"
,
for
:
.
normal
)
button
.
setTitleColor
(
.
white
,
for
:
.
normal
)
button
.
titleLabel
?
.
font
=
UIFont
.
systemFont
(
ofSize
:
14
,
weight
:
.
semibold
)
button
.
layer
.
cornerRadius
=
10.5
button
.
clipsToBounds
=
true
button
.
backgroundColor
=
UIColor
(
red
:
1
,
green
:
0.65
,
blue
:
0
,
alpha
:
1
)
contentView
.
addSubview
(
button
)
return
button
}()
private
lazy
var
iconView
:
UIImageView
=
{
private
lazy
var
iconView
:
UIImageView
=
{
let
info
=
UIImageView
()
let
info
=
UIImageView
()
info
.
contentMode
=
.
scaleAspectFill
info
.
contentMode
=
.
scaleAspectFill
...
@@ -63,6 +78,14 @@ class PMShowImgCell: UICollectionViewCell {
...
@@ -63,6 +78,14 @@ class PMShowImgCell: UICollectionViewCell {
}
}
private
func
setup
()
->
Void
{
private
func
setup
()
->
Void
{
bestResultButton
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalToSuperview
()
.
offset
(
15
)
make
.
top
.
equalToSuperview
()
.
offset
(
34
)
make
.
width
.
equalTo
(
63
)
make
.
height
.
equalTo
(
21
)
}
iconView
.
snp
.
makeConstraints
{
make
in
iconView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
bottom
.
top
.
equalToSuperview
()
make
.
left
.
right
.
bottom
.
top
.
equalToSuperview
()
}
}
...
@@ -74,5 +97,7 @@ class PMShowImgCell: UICollectionViewCell {
...
@@ -74,5 +97,7 @@ class PMShowImgCell: UICollectionViewCell {
make
.
width
.
height
.
equalTo
(
iconWH
)
make
.
width
.
height
.
equalTo
(
iconWH
)
make
.
bottom
.
equalToSuperview
()
.
offset
(
-
10
)
make
.
bottom
.
equalToSuperview
()
.
offset
(
-
10
)
}
}
self
.
contentView
.
bringSubviewToFront
(
self
.
bestResultButton
)
}
}
}
}
PhoneManager/Class/Page/Secret/Cell/PMShowVideoCell.swift
View file @
07f47302
...
@@ -17,6 +17,8 @@ class PMShowVideoCell: UICollectionViewCell {
...
@@ -17,6 +17,8 @@ class PMShowVideoCell: UICollectionViewCell {
var
type
:
Int
=
0
var
type
:
Int
=
0
var
innerVideoController
:
VideoViewController
?
func
reload
()
->
Void
{
func
reload
()
->
Void
{
var
url
:
URL
?
var
url
:
URL
?
if
type
==
0
{
if
type
==
0
{
...
@@ -25,25 +27,39 @@ class PMShowVideoCell: UICollectionViewCell {
...
@@ -25,25 +27,39 @@ class PMShowVideoCell: UICollectionViewCell {
url
=
homeResouceUrl
url
=
homeResouceUrl
}
}
if
let
url
=
url
{
if
let
url
=
url
{
player
.
playVideo
(
from
:
url
)
self
.
innerVideoController
=
VideoViewController
()
if
let
vc
=
self
.
innerVideoController
{
vc
.
url
=
url
self
.
contentView
.
addSubview
(
vc
.
view
)
self
.
contentView
.
bringSubviewToFront
(
self
.
selectBtn
)
vc
.
view
.
snp
.
makeConstraints
{
make
in
make
.
left
.
top
.
bottom
.
right
.
equalToSuperview
()
}
}
}
}
}
}
override
init
(
frame
:
CGRect
)
{
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
super
.
init
(
frame
:
frame
)
setup
()
self
.
contentView
.
addSubview
(
self
.
selectBtn
)
selectBtn
.
snp
.
makeConstraints
{
make
in
make
.
right
.
equalToSuperview
()
make
.
width
.
height
.
equalTo
(
iconWH
)
make
.
bottom
.
equalToSuperview
()
.
offset
(
-
10
)
}
bestResultButton
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalToSuperview
()
.
offset
(
15
)
make
.
top
.
equalToSuperview
()
.
offset
(
34
)
make
.
width
.
equalTo
(
63
)
make
.
height
.
equalTo
(
21
)
}
self
.
contentView
.
bringSubviewToFront
(
self
.
bestResultButton
)
}
}
required
init
?(
coder
:
NSCoder
)
{
required
init
?(
coder
:
NSCoder
)
{
fatalError
(
"init(coder:) has not been implemented"
)
fatalError
(
"init(coder:) has not been implemented"
)
}
}
private
func
setup
()
->
Void
{
player
.
snp
.
makeConstraints
{
make
in
make
.
left
.
top
.
bottom
.
right
.
equalToSuperview
()
}
}
var
zPlayer
:
SecretVideoPlayer
{
var
zPlayer
:
SecretVideoPlayer
{
get
{
get
{
return
player
return
player
...
@@ -57,4 +73,44 @@ class PMShowVideoCell: UICollectionViewCell {
...
@@ -57,4 +73,44 @@ class PMShowVideoCell: UICollectionViewCell {
contentView
.
addSubview
(
p
)
contentView
.
addSubview
(
p
)
return
p
return
p
}()
}()
var
callblock
:(()
->
Void
)
=
{}
@objc
private
func
selectTap
()
->
Void
{
callblock
()
}
var
isCurrent
:
Bool
=
false
{
didSet
{
selectBtn
.
isSelected
=
isCurrent
}
}
lazy
var
selectBtn
:
UIButton
=
{
let
select
=
UIButton
(
type
:
.
custom
)
select
.
setImage
(
UIImage
(
named
:
"home_info_norl"
),
for
:
.
normal
)
select
.
setImage
(
UIImage
(
named
:
"home_info_seleted"
),
for
:
.
selected
)
select
.
addTarget
(
self
,
action
:
#selector(
selectTap
)
,
for
:
.
touchUpInside
)
contentView
.
addSubview
(
select
)
return
select
}()
lazy
var
bestResultButton
:
UIButton
=
{
let
button
=
UIButton
(
type
:
.
custom
)
button
.
setImage
(
UIImage
(
named
:
"Frame"
),
for
:
.
normal
)
button
.
setTitle
(
"Best"
,
for
:
.
normal
)
button
.
setTitleColor
(
.
white
,
for
:
.
normal
)
button
.
titleLabel
?
.
font
=
UIFont
.
systemFont
(
ofSize
:
14
,
weight
:
.
semibold
)
button
.
layer
.
cornerRadius
=
10.5
button
.
clipsToBounds
=
true
button
.
backgroundColor
=
UIColor
(
red
:
1
,
green
:
0.65
,
blue
:
0
,
alpha
:
1
)
contentView
.
addSubview
(
button
)
return
button
}()
}
}
PhoneManager/Class/Page/Secret/PMShowImgVideoController.swift
View file @
07f47302
...
@@ -21,16 +21,32 @@ class PMShowImgVideoController: BaseViewController {
...
@@ -21,16 +21,32 @@ class PMShowImgVideoController: BaseViewController {
// 资源类型 0-图片 1-视频
// 资源类型 0-图片 1-视频
var
homeMediaType
:
Int
=
0
var
homeMediaType
:
Int
=
0
// 记录原来进来的
var
oldPageIndexPath
:
IndexPath
?
var
state
:
ShowState
=
.
secret
var
state
:
ShowState
=
.
secret
var
imageVideoPath
:[
String
]
=
[]
var
imageVideoPath
:[
String
]
=
[]
// 首页过来的数据
// 首页过来的数据
var
homeDataSource
:
[
ImageSeletedCollectionItem
]?
var
homeDataSource
:
[
ImageSeletedCollectionItem
]?
{
didSet
{
if
let
data
=
homeDataSource
{
for
(
index
,
item
)
in
data
.
enumerated
()
{
if
item
.
isSeleted
==
true
{
selectSet
.
add
(
index
)
}
}
}
}
}
var
currentIdx
=
0
var
currentIdx
=
0
var
selectSet
=
NSMutableSet
()
var
selectSet
=
NSMutableSet
()
var
backOrgPageCallBack
:
(
IndexPath
?,[
ImageSeletedCollectionItem
]?)
->
Void
=
{
index
,
data
in
}
var
url
:
URL
?
var
url
:
URL
?
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
...
@@ -53,6 +69,19 @@ class PMShowImgVideoController: BaseViewController {
...
@@ -53,6 +69,19 @@ class PMShowImgVideoController: BaseViewController {
self
.
MaxCollection
.
scrollToItem
(
at
:
IndexPath
(
row
:
currentIdx
,
section
:
0
),
at
:
.
centeredHorizontally
,
animated
:
false
)
self
.
MaxCollection
.
scrollToItem
(
at
:
IndexPath
(
row
:
currentIdx
,
section
:
0
),
at
:
.
centeredHorizontally
,
animated
:
false
)
}
}
override
func
viewWillDisappear
(
_
animated
:
Bool
)
{
super
.
viewWillDisappear
(
animated
)
// 离开返回上一个把选择的数据带过去
for
item
in
self
.
selectSet
{
if
let
index
=
item
as?
Int
{
self
.
homeDataSource
?[
index
]
.
isSeleted
=
true
}
}
self
.
backOrgPageCallBack
(
self
.
oldPageIndexPath
,
self
.
homeDataSource
)
}
private
lazy
var
MaxCollection
:
UICollectionView
=
{
private
lazy
var
MaxCollection
:
UICollectionView
=
{
let
flowlayout
=
UICollectionViewFlowLayout
()
let
flowlayout
=
UICollectionViewFlowLayout
()
flowlayout
.
sectionInset
=
UIEdgeInsets
()
flowlayout
.
sectionInset
=
UIEdgeInsets
()
...
@@ -131,8 +160,10 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
...
@@ -131,8 +160,10 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
if
collectionView
==
bottItems
{
if
collectionView
==
bottItems
{
if
selectSet
.
contains
(
indexPath
.
row
)
{
if
selectSet
.
contains
(
indexPath
.
row
)
{
self
.
homeDataSource
?[
indexPath
.
row
]
.
isSeleted
=
false
selectSet
.
remove
(
indexPath
.
row
)
selectSet
.
remove
(
indexPath
.
row
)
}
else
{
}
else
{
self
.
homeDataSource
?[
indexPath
.
row
]
.
isSeleted
=
true
selectSet
.
add
(
indexPath
.
row
)
selectSet
.
add
(
indexPath
.
row
)
}
}
self
.
MaxCollection
.
reloadData
()
self
.
MaxCollection
.
reloadData
()
...
@@ -158,7 +189,7 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
...
@@ -158,7 +189,7 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
let
showName
=
imageVideoPath
[
indexPath
.
row
]
let
showName
=
imageVideoPath
[
indexPath
.
row
]
if
!
showName
.
hasSuffix
(
".png"
)
{
if
!
showName
.
hasSuffix
(
".png"
)
{
guard
let
zCell
:
PMShowVideoCell
=
cell
as?
PMShowVideoCell
else
{
return
}
guard
let
zCell
:
PMShowVideoCell
=
cell
as?
PMShowVideoCell
else
{
return
}
zCell
.
zPlayer
.
pause
()
zCell
.
innerVideoController
?
.
playerViewController
.
player
?
.
pause
()
}
}
}
}
}
}
...
@@ -172,12 +203,16 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
...
@@ -172,12 +203,16 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
showName
.
loadPhotoOrVideo
{
durs
,
icon
in
showName
.
loadPhotoOrVideo
{
durs
,
icon
in
cell
.
icon
=
icon
cell
.
icon
=
icon
}
}
cell
.
bestResultButton
.
isHidden
=
indexPath
.
row
!=
0
cell
.
isCurrent
=
selectSet
.
contains
(
indexPath
.
row
)
cell
.
isCurrent
=
selectSet
.
contains
(
indexPath
.
row
)
cell
.
callblock
=
{[
weak
self
]
in
cell
.
callblock
=
{[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
if
self
.
selectSet
.
contains
(
indexPath
.
row
){
if
self
.
selectSet
.
contains
(
indexPath
.
row
){
self
.
homeDataSource
?[
indexPath
.
row
]
.
isSeleted
=
false
self
.
selectSet
.
remove
(
indexPath
.
row
)
self
.
selectSet
.
remove
(
indexPath
.
row
)
}
else
{
}
else
{
self
.
homeDataSource
?[
indexPath
.
row
]
.
isSeleted
=
true
self
.
selectSet
.
add
(
indexPath
.
row
)
self
.
selectSet
.
add
(
indexPath
.
row
)
}
}
self
.
MaxCollection
.
reloadData
()
self
.
MaxCollection
.
reloadData
()
...
@@ -186,8 +221,21 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
...
@@ -186,8 +221,21 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
return
cell
return
cell
}
else
{
}
else
{
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
PMShowVideoCellID
,
for
:
indexPath
)
as!
PMShowVideoCell
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
PMShowVideoCellID
,
for
:
indexPath
)
as!
PMShowVideoCell
cell
.
isCurrent
=
selectSet
.
contains
(
indexPath
.
row
)
cell
.
playURL
=
showName
cell
.
playURL
=
showName
cell
.
reload
()
cell
.
reload
()
cell
.
callblock
=
{[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
if
self
.
selectSet
.
contains
(
indexPath
.
row
){
self
.
homeDataSource
?[
indexPath
.
row
]
.
isSeleted
=
false
self
.
selectSet
.
remove
(
indexPath
.
row
)
}
else
{
self
.
homeDataSource
?[
indexPath
.
row
]
.
isSeleted
=
true
self
.
selectSet
.
add
(
indexPath
.
row
)
}
self
.
MaxCollection
.
reloadData
()
self
.
bottItems
.
reloadData
()
}
return
cell
return
cell
}
}
}
else
{
}
else
{
...
@@ -208,11 +256,14 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
...
@@ -208,11 +256,14 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
PMShowImgCellID
,
for
:
indexPath
)
as!
PMShowImgCell
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
PMShowImgCellID
,
for
:
indexPath
)
as!
PMShowImgCell
cell
.
icon
=
self
.
homeDataSource
!
[
indexPath
.
row
]
.
image
??
UIImage
()
cell
.
icon
=
self
.
homeDataSource
!
[
indexPath
.
row
]
.
image
??
UIImage
()
cell
.
isCurrent
=
selectSet
.
contains
(
indexPath
.
row
)
cell
.
isCurrent
=
selectSet
.
contains
(
indexPath
.
row
)
cell
.
bestResultButton
.
isHidden
=
indexPath
.
row
!=
0
cell
.
callblock
=
{[
weak
self
]
in
cell
.
callblock
=
{[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
if
self
.
selectSet
.
contains
(
indexPath
.
row
){
if
self
.
selectSet
.
contains
(
indexPath
.
row
){
self
.
homeDataSource
?[
indexPath
.
row
]
.
isSeleted
=
false
self
.
selectSet
.
remove
(
indexPath
.
row
)
self
.
selectSet
.
remove
(
indexPath
.
row
)
}
else
{
}
else
{
self
.
homeDataSource
?[
indexPath
.
row
]
.
isSeleted
=
true
self
.
selectSet
.
add
(
indexPath
.
row
)
self
.
selectSet
.
add
(
indexPath
.
row
)
}
}
self
.
MaxCollection
.
reloadData
()
self
.
MaxCollection
.
reloadData
()
...
@@ -247,6 +298,20 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
...
@@ -247,6 +298,20 @@ extension PMShowImgVideoController : UICollectionViewDelegate,UICollectionViewDa
}
}
// 表示这个是视频
// 表示这个是视频
cell
.
type
=
1
cell
.
type
=
1
cell
.
isCurrent
=
selectSet
.
contains
(
indexPath
.
row
)
cell
.
bestResultButton
.
isHidden
=
indexPath
.
row
!=
0
cell
.
callblock
=
{[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
if
self
.
selectSet
.
contains
(
indexPath
.
row
){
self
.
homeDataSource
?[
indexPath
.
row
]
.
isSeleted
=
false
self
.
selectSet
.
remove
(
indexPath
.
row
)
}
else
{
self
.
homeDataSource
?[
indexPath
.
row
]
.
isSeleted
=
true
self
.
selectSet
.
add
(
indexPath
.
row
)
}
self
.
MaxCollection
.
reloadData
()
self
.
bottItems
.
reloadData
()
}
return
cell
return
cell
}
else
{
}
else
{
if
indexPath
.
row
<
self
.
homeDataSource
?
.
count
??
0
{
if
indexPath
.
row
<
self
.
homeDataSource
?
.
count
??
0
{
...
...
PhoneManager/Class/Page/Secret/SecretViewController.swift
View file @
07f47302
...
@@ -325,6 +325,16 @@ extension SecretViewController : UICollectionViewDelegate,UICollectionViewDataSo
...
@@ -325,6 +325,16 @@ extension SecretViewController : UICollectionViewDelegate,UICollectionViewDataSo
let
play
=
PMShowImgVideoController
()
let
play
=
PMShowImgVideoController
()
play
.
currentIdx
=
indexPath
.
row
play
.
currentIdx
=
indexPath
.
row
play
.
imageVideoPath
=
dataSource
play
.
imageVideoPath
=
dataSource
play
.
oldPageIndexPath
=
indexPath
play
.
backOrgPageCallBack
=
{[
weak
self
]
index
,
data
in
guard
let
self
else
{
return
}
self
.
selectArray
=
play
.
selectSet
DispatchQueue
.
main
.
async
{
UIView
.
transition
(
with
:
self
.
secretCollect
,
duration
:
0.3
,
options
:
.
transitionCrossDissolve
,
animations
:
{
self
.
secretCollect
.
reloadData
()
},
completion
:
nil
)
}
}
self
.
navigationController
?
.
pushViewController
(
play
,
animated
:
true
)
self
.
navigationController
?
.
pushViewController
(
play
,
animated
:
true
)
}
}
...
...
PhoneManager/Class/Resource/Animation/CompressCompletedLight/iOS压缩完成.json
0 → 100644
View file @
07f47302
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment