Browse Source

1.上传图片暂时保存

huangxiaodong 2 years ago
parent
commit
f80008aa8a
29 changed files with 1220 additions and 5 deletions
  1. 48 0
      创维盒子/双子星云手机.xcodeproj/project.pbxproj
  2. 22 0
      创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_check.imageset/Contents.json
  3. BIN
      创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_check.imageset/upload_file_check@2x.png
  4. BIN
      创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_check.imageset/upload_file_check@3x.png
  5. 22 0
      创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_uncheck.imageset/Contents.json
  6. BIN
      创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_uncheck.imageset/upload_file_uncheck@2x.png
  7. BIN
      创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_uncheck.imageset/upload_file_uncheck@3x.png
  8. 22 0
      创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_uncheck2.imageset/Contents.json
  9. BIN
      创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_uncheck2.imageset/upload_file_uncheck2@2x.png
  10. BIN
      创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_uncheck2.imageset/upload_file_uncheck2@3x.png
  11. 22 0
      创维盒子/双子星云手机/Assets.xcassets/Set/upload_image_arrow.imageset/Contents.json
  12. BIN
      创维盒子/双子星云手机/Assets.xcassets/Set/upload_image_arrow.imageset/upload_image_arrow@2x.png
  13. BIN
      创维盒子/双子星云手机/Assets.xcassets/Set/upload_image_arrow.imageset/upload_image_arrow@3x.png
  14. 2 0
      创维盒子/双子星云手机/Class/Set/MySetViewController.m
  15. 18 0
      创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJGradientView.h
  16. 26 0
      创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJGradientView.m
  17. 25 0
      创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoGroupCell.h
  18. 88 0
      创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoGroupCell.m
  19. 43 0
      创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoGroupView.h
  20. 182 0
      创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoGroupView.m
  21. 36 0
      创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoListCell.h
  22. 124 0
      创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoListCell.m
  23. 16 0
      创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoListView.h
  24. 30 0
      创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoListView.m
  25. 16 0
      创维盒子/双子星云手机/Class/Set/uploadFile/photoView/uploadFileBottomView.h
  26. 29 0
      创维盒子/双子星云手机/Class/Set/uploadFile/photoView/uploadFileBottomView.m
  27. 39 0
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadImageOrVideoViewController.h
  28. 409 4
      创维盒子/双子星云手机/Class/Set/uploadFile/uploadImageOrVideoViewController.m
  29. 1 1
      创维盒子/双子星云手机/CloudPlayer/View/PlayerView.m

+ 48 - 0
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -141,6 +141,18 @@
 		6B05815C2AFC851E00D37290 /* mySetHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B05815A2AFC851E00D37290 /* mySetHeadView.m */; };
 		6B0581602AFCD0DF00D37290 /* uploadImageOrVideoViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B05815E2AFCD0DF00D37290 /* uploadImageOrVideoViewController.h */; };
 		6B0581612AFCD0DF00D37290 /* uploadImageOrVideoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B05815F2AFCD0DF00D37290 /* uploadImageOrVideoViewController.m */; };
+		6B05819E2AFCF4E800D37290 /* AJPhotoListView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B05819C2AFCF4E700D37290 /* AJPhotoListView.m */; };
+		6B05819F2AFCF4E800D37290 /* AJPhotoListView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B05819D2AFCF4E800D37290 /* AJPhotoListView.h */; };
+		6B0581A22AFCF50300D37290 /* AJPhotoListCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0581A02AFCF50300D37290 /* AJPhotoListCell.h */; };
+		6B0581A32AFCF50300D37290 /* AJPhotoListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0581A12AFCF50300D37290 /* AJPhotoListCell.m */; };
+		6B0581AA2AFCF57300D37290 /* AJGradientView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0581A42AFCF57200D37290 /* AJGradientView.h */; };
+		6B0581AB2AFCF57300D37290 /* AJGradientView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0581A52AFCF57200D37290 /* AJGradientView.m */; };
+		6B0581AC2AFCF57300D37290 /* AJPhotoGroupCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0581A62AFCF57200D37290 /* AJPhotoGroupCell.m */; };
+		6B0581AD2AFCF57300D37290 /* AJPhotoGroupView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0581A72AFCF57300D37290 /* AJPhotoGroupView.h */; };
+		6B0581AE2AFCF57300D37290 /* AJPhotoGroupView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0581A82AFCF57300D37290 /* AJPhotoGroupView.m */; };
+		6B0581AF2AFCF57300D37290 /* AJPhotoGroupCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0581A92AFCF57300D37290 /* AJPhotoGroupCell.h */; };
+		6B0581B22AFE02B100D37290 /* uploadFileBottomView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0581B02AFE02B100D37290 /* uploadFileBottomView.h */; };
+		6B0581B32AFE02B100D37290 /* uploadFileBottomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0581B12AFE02B100D37290 /* uploadFileBottomView.m */; };
 		6B3F96342AD2A15A008E349E /* netWorkManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3F96322AD2A15A008E349E /* netWorkManager.h */; };
 		6B3F96352AD2A15A008E349E /* netWorkManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B3F96332AD2A15A008E349E /* netWorkManager.m */; };
 		6B3F963A2AD2AD0B008E349E /* newWorkInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3F96392AD2AD0B008E349E /* newWorkInterface.h */; };
@@ -466,6 +478,18 @@
 		6B05815A2AFC851E00D37290 /* mySetHeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = mySetHeadView.m; sourceTree = "<group>"; };
 		6B05815E2AFCD0DF00D37290 /* uploadImageOrVideoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = uploadImageOrVideoViewController.h; sourceTree = "<group>"; };
 		6B05815F2AFCD0DF00D37290 /* uploadImageOrVideoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = uploadImageOrVideoViewController.m; sourceTree = "<group>"; };
+		6B05819C2AFCF4E700D37290 /* AJPhotoListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AJPhotoListView.m; sourceTree = "<group>"; };
+		6B05819D2AFCF4E800D37290 /* AJPhotoListView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJPhotoListView.h; sourceTree = "<group>"; };
+		6B0581A02AFCF50300D37290 /* AJPhotoListCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJPhotoListCell.h; sourceTree = "<group>"; };
+		6B0581A12AFCF50300D37290 /* AJPhotoListCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AJPhotoListCell.m; sourceTree = "<group>"; };
+		6B0581A42AFCF57200D37290 /* AJGradientView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJGradientView.h; sourceTree = "<group>"; };
+		6B0581A52AFCF57200D37290 /* AJGradientView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AJGradientView.m; sourceTree = "<group>"; };
+		6B0581A62AFCF57200D37290 /* AJPhotoGroupCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AJPhotoGroupCell.m; sourceTree = "<group>"; };
+		6B0581A72AFCF57300D37290 /* AJPhotoGroupView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJPhotoGroupView.h; sourceTree = "<group>"; };
+		6B0581A82AFCF57300D37290 /* AJPhotoGroupView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AJPhotoGroupView.m; sourceTree = "<group>"; };
+		6B0581A92AFCF57300D37290 /* AJPhotoGroupCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AJPhotoGroupCell.h; sourceTree = "<group>"; };
+		6B0581B02AFE02B100D37290 /* uploadFileBottomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = uploadFileBottomView.h; sourceTree = "<group>"; };
+		6B0581B12AFE02B100D37290 /* uploadFileBottomView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = uploadFileBottomView.m; sourceTree = "<group>"; };
 		6B3F96322AD2A15A008E349E /* netWorkManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = netWorkManager.h; sourceTree = "<group>"; };
 		6B3F96332AD2A15A008E349E /* netWorkManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = netWorkManager.m; sourceTree = "<group>"; };
 		6B3F96392AD2AD0B008E349E /* newWorkInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = newWorkInterface.h; sourceTree = "<group>"; };
@@ -1084,6 +1108,18 @@
 		6B0581622AFCDB4300D37290 /* photoView */ = {
 			isa = PBXGroup;
 			children = (
+				6B0581A42AFCF57200D37290 /* AJGradientView.h */,
+				6B0581A52AFCF57200D37290 /* AJGradientView.m */,
+				6B0581A92AFCF57300D37290 /* AJPhotoGroupCell.h */,
+				6B0581A62AFCF57200D37290 /* AJPhotoGroupCell.m */,
+				6B0581A72AFCF57300D37290 /* AJPhotoGroupView.h */,
+				6B0581A82AFCF57300D37290 /* AJPhotoGroupView.m */,
+				6B0581A02AFCF50300D37290 /* AJPhotoListCell.h */,
+				6B0581A12AFCF50300D37290 /* AJPhotoListCell.m */,
+				6B05819D2AFCF4E800D37290 /* AJPhotoListView.h */,
+				6B05819C2AFCF4E700D37290 /* AJPhotoListView.m */,
+				6B0581B02AFE02B100D37290 /* uploadFileBottomView.h */,
+				6B0581B12AFE02B100D37290 /* uploadFileBottomView.m */,
 			);
 			path = photoView;
 			sourceTree = "<group>";
@@ -1529,6 +1565,7 @@
 				181E85002A8F6B1800292B96 /* LogoSelectView.h in Headers */,
 				18BA24872AA5C57900BA01EE /* RSATool.h in Headers */,
 				6B3F963A2AD2AD0B008E349E /* newWorkInterface.h in Headers */,
+				6B0581B22AFE02B100D37290 /* uploadFileBottomView.h in Headers */,
 				18F9CAFC2ABD35C4003FF71A /* ModifyPWDFirstViewController.h in Headers */,
 				1810F9012AA1839C00322116 /* PhoneTimeInfoModel.h in Headers */,
 				6BBB35E22AE935C000E4A59B /* DDYLanguageTool.h in Headers */,
@@ -1553,18 +1590,23 @@
 				18FCE5482AD15E750020F623 /* PlayerViewController+AppDelegate.h in Headers */,
 				181E84F72A8F451D00292B96 /* MineViewCell.h in Headers */,
 				183AE6D42A8CAFAE00B11CB0 /* UIView+View.h in Headers */,
+				6B0581AF2AFCF57300D37290 /* AJPhotoGroupCell.h in Headers */,
 				184C8ACC2A94557200F26650 /* HidenMaskSetViewController.h in Headers */,
 				18EC79DC2ABC109F0084836A /* SetPWDSecondViewController.h in Headers */,
 				6BFF268C2AF8E1C600FCB4F7 /* forgetPwdViewController.h in Headers */,
 				6BF52C992AD5546500A617DB /* Reachability.h in Headers */,
 				18BB18412AC417CB00A36F63 /* RYShearDeviceUDPManager.h in Headers */,
 				184C8AD52A949D5900F26650 /* AboutViewController.h in Headers */,
+				6B0581A22AFCF50300D37290 /* AJPhotoListCell.h in Headers */,
 				187076772A9F400300F15F7F /* PlayerLoadingView.h in Headers */,
 				6B0581602AFCD0DF00D37290 /* uploadImageOrVideoViewController.h in Headers */,
 				18F9CB092ABD7835003FF71A /* TipsQRCodeForChangeDeviceViewController.h in Headers */,
+				6B05819F2AFCF4E800D37290 /* AJPhotoListView.h in Headers */,
 				18963B462AB84398006E7C50 /* GuideView.h in Headers */,
 				18A909982ABC4A3300E6D2BE /* ComontAlretViewController.h in Headers */,
 				186820192AB94877005702A6 /* GuideLastView.h in Headers */,
+				6B0581AA2AFCF57300D37290 /* AJGradientView.h in Headers */,
+				6B0581AD2AFCF57300D37290 /* AJPhotoGroupView.h in Headers */,
 				18F9CB072ABD7835003FF71A /* QRCodeScanForChangeDeviceViewController.h in Headers */,
 				18664FF62AC2B3A4008F8A61 /* ShearDeviceUDPManager.h in Headers */,
 				18F9CAFF2ABD3643003FF71A /* ModifyPWDSecondViewController.h in Headers */,
@@ -1866,6 +1908,7 @@
 				18664FF52AC2B3A4008F8A61 /* ShearDeviceUDPManager.m in Sources */,
 				6BF52CA22AD7C2F600A617DB /* inputPWDViewController.m in Sources */,
 				A003F6B627D841EE00715CBF /* UIColor+Colors.m in Sources */,
+				6B05819E2AFCF4E800D37290 /* AJPhotoListView.m in Sources */,
 				18E557292A3C60ED005CC84B /* PwdInPutView.m in Sources */,
 				18BB18422AC417CB00A36F63 /* RYShearDeviceUDPManager.m in Sources */,
 				18F9CB062ABD7835003FF71A /* TipsQRCodeForChangeDeviceViewController.m in Sources */,
@@ -1893,15 +1936,18 @@
 				18E557262A3C6088005CC84B /* SetUsePWDViewController.m in Sources */,
 				183AE6D52A8CAFAE00B11CB0 /* UIView+View.m in Sources */,
 				183AE64E2A8A2CF000B11CB0 /* AFNetworkActivityIndicatorManager.m in Sources */,
+				6B0581B32AFE02B100D37290 /* uploadFileBottomView.m in Sources */,
 				181E85012A8F6B1800292B96 /* LogoSelectView.m in Sources */,
 				A031DD6827EC195400909527 /* HWBookmarkViewController.m in Sources */,
 				183AE6572A8A2CF000B11CB0 /* AFURLRequestSerialization.m in Sources */,
+				6B0581AC2AFCF57300D37290 /* AJPhotoGroupCell.m in Sources */,
 				184C8AD92A949DAC00F26650 /* HaveNewVersionView.m in Sources */,
 				A003F6B527D841EE00715CBF /* UIView+HWCategory.m in Sources */,
 				A003F6E227D8428200715CBF /* Const.m in Sources */,
 				A08A94FE27E9A4E400C544BB /* BGTool.m in Sources */,
 				183AE6072A89CE3C00B11CB0 /* JSONModelClassProperty.m in Sources */,
 				18F9CB082ABD7835003FF71A /* QRCodeScanForChangeDeviceViewController.m in Sources */,
+				6B0581A32AFCF50300D37290 /* AJPhotoListCell.m in Sources */,
 				A08A950327E9A4E400C544BB /* FMDatabasePool.m in Sources */,
 				A003F6D327D8425C00715CBF /* iToast.m in Sources */,
 				A08A94E027E9837600C544BB /* HWPageListCell.m in Sources */,
@@ -1921,6 +1967,7 @@
 				18E557222A3C5D75005CC84B /* CalculatorViewController.m in Sources */,
 				6BFF269A2AFA16DA00FCB4F7 /* forgetSecretKeyViewController.m in Sources */,
 				18E5572F2A3C6141005CC84B /* UITextfield+NLLimit.m in Sources */,
+				6B0581AB2AFCF57300D37290 /* AJGradientView.m in Sources */,
 				183AE6B72A8CA0C100B11CB0 /* ShowImageView.m in Sources */,
 				186820262AB9B5BF005702A6 /* SetPWDFirstViewController.m in Sources */,
 				A003F6F827D8775A00715CBF /* HWSearchBar.m in Sources */,
@@ -1965,6 +2012,7 @@
 				1810F9002AA1839C00322116 /* PhoneTimeInfoModel.m in Sources */,
 				1823A8262A8601A500CE2913 /* GuideViewController.m in Sources */,
 				18A909992ABC4A3300E6D2BE /* ComontAlretViewController.m in Sources */,
+				6B0581AE2AFCF57300D37290 /* AJPhotoGroupView.m in Sources */,
 				18FCE5402AD136670020F623 /* PlayerViewController+TouchPointXD.m in Sources */,
 				6B0581612AFCD0DF00D37290 /* uploadImageOrVideoViewController.m in Sources */,
 				18E5572C2A3C6127005CC84B /* ForbidMenuTextField.m in Sources */,

+ 22 - 0
创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_check.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "upload_file_check@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "upload_file_check@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_check.imageset/upload_file_check@2x.png


BIN
创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_check.imageset/upload_file_check@3x.png


+ 22 - 0
创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_uncheck.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "upload_file_uncheck@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "upload_file_uncheck@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_uncheck.imageset/upload_file_uncheck@2x.png


BIN
创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_uncheck.imageset/upload_file_uncheck@3x.png


+ 22 - 0
创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_uncheck2.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "upload_file_uncheck2@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "upload_file_uncheck2@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_uncheck2.imageset/upload_file_uncheck2@2x.png


BIN
创维盒子/双子星云手机/Assets.xcassets/Set/upload_file_uncheck2.imageset/upload_file_uncheck2@3x.png


+ 22 - 0
创维盒子/双子星云手机/Assets.xcassets/Set/upload_image_arrow.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "upload_image_arrow@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "upload_image_arrow@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/双子星云手机/Assets.xcassets/Set/upload_image_arrow.imageset/upload_image_arrow@2x.png


BIN
创维盒子/双子星云手机/Assets.xcassets/Set/upload_image_arrow.imageset/upload_image_arrow@3x.png


+ 2 - 0
创维盒子/双子星云手机/Class/Set/MySetViewController.m

@@ -81,6 +81,8 @@
         
         if(tag ==2 || tag ==3){
             uploadImageOrVideoViewController *vc = [uploadImageOrVideoViewController new];
+            //vc.assetsFilter = [ALAssetsFilter allVideos];
+            vc.assetsFilter = [ALAssetsFilter allPhotos];
             [self.navigationController pushViewController:vc animated:YES];
         }
     };

+ 18 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJGradientView.h

@@ -0,0 +1,18 @@
+//
+//  AJGradientView.h
+//  AJPhotoPicker
+//
+//  Created by AlienJunX on 15/4/28.
+//  Copyright (c) 2015 AlienJunX
+//
+//  This source code is licensed under the MIT-style license found in the
+//  LICENSE file in the root directory of this source tree.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AJGradientView : UIView
+
+- (void)setupCAGradientLayer:(NSArray *)colors locations:(NSArray *)locations;
+
+@end

+ 26 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJGradientView.m

@@ -0,0 +1,26 @@
+//
+//  AJGradientView.m
+//  AJPhotoPicker
+//
+//  Created by AlienJunX on 15/4/28.
+//  Copyright (c) 2015 AlienJunX
+//
+//  This source code is licensed under the MIT-style license found in the
+//  LICENSE file in the root directory of this source tree.
+//
+
+#import "AJGradientView.h"
+
+@implementation AJGradientView
+
++ (Class)layerClass {
+    return [CAGradientLayer class];
+}
+
+- (void)setupCAGradientLayer:(NSArray *)colors locations:(NSArray *)locations {
+    CAGradientLayer *gradient=(CAGradientLayer*)self.layer;
+    gradient.colors = colors;
+    gradient.locations = locations;
+}
+
+@end

+ 25 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoGroupCell.h

@@ -0,0 +1,25 @@
+//
+//  AJPhotoGroupCell.h
+//  AJPhotoPicker
+//
+//  Created by AlienJunX on 15/11/2.
+//  Copyright (c) 2015 AlienJunX
+//
+//  This source code is licensed under the MIT-style license found in the
+//  LICENSE file in the root directory of this source tree.
+//
+
+#import <UIKit/UIKit.h>
+
+@class ALAssetsGroup;
+
+@interface AJPhotoGroupCell : UITableViewCell
+@property (nonatomic, strong) UIButton *selectButton;
+/**
+ *  显示相册信息
+ *
+ *  @param assetsGroup 相册
+ */
+- (void)bind:(ALAssetsGroup *)assetsGroup;
+
+@end

+ 88 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoGroupCell.m

@@ -0,0 +1,88 @@
+//
+//  AJPhotoGroupCell.m
+//  AJPhotoPicker
+//
+//  Created by AlienJunX on 15/11/2.
+//  Copyright (c) 2015 AlienJunX
+//
+//  This source code is licensed under the MIT-style license found in the
+//  LICENSE file in the root directory of this source tree.
+//
+
+#import "AJPhotoGroupCell.h"
+#import <AssetsLibrary/AssetsLibrary.h>
+
+@interface AJPhotoGroupCell()
+@property (nonatomic, strong) ALAssetsGroup *assetsGroup;
+@property (nonatomic, strong) UIImageView *groupImageView;
+@property (nonatomic, strong) UILabel *groupTextLabel;
+@end
+
+
+@implementation AJPhotoGroupCell
+
+- (void)bind:(ALAssetsGroup *)assetsGroup{
+    self.assetsGroup = assetsGroup;
+    self.backgroundColor = [UIColor whiteColor];
+    if (self.groupImageView == nil) {
+        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(14, 5, 50, 50)];
+        [self.contentView addSubview:imageView];
+        self.groupImageView = imageView;
+    }
+    
+    if (self.groupTextLabel == nil) {
+        UILabel *textLabel = [[UILabel alloc] initWithFrame:CGRectMake(70, 5, [UIScreen mainScreen].bounds.size.width-70, 50)];
+        textLabel.font = [UIFont boldSystemFontOfSize:16];
+        textLabel.backgroundColor = [UIColor clearColor];
+        textLabel.numberOfLines = 0;
+        [self.contentView addSubview:textLabel];
+        self.groupTextLabel = textLabel;
+    }
+    
+    CGImageRef posterImage = assetsGroup.posterImage;
+    size_t height = CGImageGetHeight(posterImage);
+    float scale = height / 78.0f;
+    
+    self.groupImageView.image = [UIImage imageWithCGImage:posterImage scale:scale orientation:UIImageOrientationUp];
+    
+    NSString *curStr1 = [NSString stringWithFormat:@"%@",[assetsGroup valueForProperty:ALAssetsGroupPropertyName]];
+    NSString *curStr2 = [NSString stringWithFormat:@"%ld",(long)[assetsGroup numberOfAssets]];
+    NSString *totalStr = [[NSString alloc] initWithFormat:@"%@\n%@",curStr1,curStr2];
+    
+    NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:totalStr];
+    
+    NSRange redRange = NSMakeRange([totalStr rangeOfString:curStr2].location, [totalStr rangeOfString:curStr2].length);
+    [noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor hwColor:@"#959799" alpha:1.0] range:redRange];
+    [noteStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14.0] range:redRange];
+    // 设置行间距
+    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+    [paragraphStyle setLineSpacing:5];        //设置行间距
+    
+    [noteStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [totalStr  length])];
+
+    
+    self.groupTextLabel.attributedText = noteStr;
+    //self.groupTextLabel.text = ;
+    
+    
+    if (self.selectButton == nil) {
+        UIButton *but = [[UIButton alloc] init];
+        [but setBackgroundImage:[UIImage imageNamed:@"upload_file_uncheck"] forState:UIControlStateNormal];
+        [but setBackgroundImage:[UIImage imageNamed:@"upload_file_check"] forState:UIControlStateSelected];
+        [self.contentView addSubview:but];
+        
+        but.frame = CGRectMake([UIScreen mainScreen].bounds.size.width- 15- 25, (60 - 25)/2.0, 25, 25);
+//        [but mas_makeConstraints:^(MASConstraintMaker *make) {
+//            make.width.mas_equalTo(20);
+//            make.height.mas_equalTo(20);
+//            make.right.mas_equalTo(-15);
+//            make.centerY.equalTo(self.contentView.mas_centerX).offset(0.f);
+//        }];
+        
+        self.selectButton = but;
+    }
+    
+    self.selectButton.selected = NO;
+}
+
+@end

+ 43 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoGroupView.h

@@ -0,0 +1,43 @@
+//
+//  AJPhotoGroupView.h
+//  AJPhotoPicker
+//
+//  Created by AlienJunX on 15/11/2.
+//  Copyright (c) 2015 AlienJunX
+//
+//  This source code is licensed under the MIT-style license found in the
+//  LICENSE file in the root directory of this source tree.
+//
+
+#import <UIKit/UIKit.h>
+@class ALAssetsGroup;
+@class ALAssetsFilter;
+
+@protocol AJPhotoGroupViewProtocol <NSObject>
+
+/**
+ *  选中相册
+ *
+ *  @param assetsGroup 相册
+ */
+- (void)didSelectGroup:(ALAssetsGroup *)assetsGroup;
+
+@end
+
+
+@interface AJPhotoGroupView : UITableView
+//委托
+@property (weak, nonatomic) id<AJPhotoGroupViewProtocol> my_delegate;
+//过滤掉不现实的信息
+@property (nonatomic, strong) ALAssetsFilter *assetsFilter;
+//选中相册的索引
+@property (nonatomic) NSInteger selectIndex;
+
+@property (nonatomic, strong) NSMutableArray *groups;
+
+/**
+ *  加载并显示相册
+ */
+- (void)setupGroup;
+
+@end

+ 182 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoGroupView.m

@@ -0,0 +1,182 @@
+//
+//  BoPhotoGroupView.m
+//  PhotoPicker
+//
+//  Created by AlienJunX on 15/11/2.
+//  Copyright © 2015年 com.alienjun.demo. All rights reserved.
+//
+
+#import "AJPhotoGroupView.h"
+#import "AJPhotoGroupCell.h"
+#import <AssetsLibrary/AssetsLibrary.h>
+
+@interface AJPhotoGroupView()<UITableViewDataSource,UITableViewDelegate>
+@property (nonatomic, strong) ALAssetsLibrary *assetsLibrary;
+
+@end
+
+@implementation AJPhotoGroupView
+
+#pragma mark - init
+- (instancetype)init {
+    self = [super init];
+    if (self) {
+        [self initCommon];
+    }
+    return self;
+}
+
+- (instancetype)initWithCoder:(NSCoder *)coder {
+    self = [super initWithCoder:coder];
+    if (self) {
+        [self initCommon];
+    }
+    return self;
+}
+
+- (id)initWithFrame:(CGRect)frame {
+    self = [super initWithFrame:frame];
+    if (self) {
+        [self initCommon];
+    }
+    return self;
+}
+
+- (void)initCommon {
+    self.delegate = self;
+    self.dataSource = self;
+    [self registerClass:[AJPhotoGroupCell class] forCellReuseIdentifier:@"cell"];
+    self.separatorStyle = UITableViewCellSeparatorStyleNone;
+    self.backgroundColor = [UIColor colorWithRed:235.0/255.0 green:235.0/255.0 blue:235.0/255.0 alpha:1.0];
+}
+
+- (void)setupGroup {
+    [self.groups removeAllObjects];
+    
+    __block BOOL isAddAllType = NO;
+    ALAssetsLibraryGroupsEnumerationResultsBlock resultsBlock = ^(ALAssetsGroup *group, BOOL *stop) {
+        if (group) {
+            [group setAssetsFilter:self.assetsFilter];
+            if (group.numberOfAssets > 0 ){
+                if ([[group valueForProperty:ALAssetsGroupPropertyType] intValue] == ALAssetsGroupSavedPhotos){
+                    //[self.groups insertObject:group atIndex:0];
+                } else if ([[group valueForProperty:ALAssetsGroupPropertyType] intValue] == ALAssetsGroupPhotoStream && self.groups.count > 0){
+                    //[self.groups insertObject:group atIndex:1];
+                } else {
+                    
+                    if([[group valueForProperty:ALAssetsGroupPropertyType] intValue] == ALAssetsGroupAlbum){
+                        [self.groups addObject:group];
+                    }
+                    else{
+                        if(!isAddAllType){
+                            [self.groups insertObject:group atIndex:0];
+                            isAddAllType = YES;
+                        }
+                        
+                    }
+                    
+                   
+                    //HLog(@"%@ === %ld",group,[[group valueForProperty:ALAssetsGroupPropertyType] intValue]);
+                }
+            }
+        } else {
+            [self dataReload];
+        }
+    };
+    
+    ALAssetsLibraryAccessFailureBlock failureBlock = ^(NSError *error) {
+        //没权限
+        [self showNotAllowed];
+    };
+    
+    //显示的相册
+    NSUInteger type = ALAssetsGroupSavedPhotos | ALAssetsGroupPhotoStream |
+    ALAssetsGroupLibrary | ALAssetsGroupAlbum | ALAssetsGroupEvent |
+    ALAssetsGroupFaces  ;
+    
+    [self.assetsLibrary enumerateGroupsWithTypes:type
+                                      usingBlock:resultsBlock
+                                    failureBlock:failureBlock];
+}
+
+#pragma mark - Reload Data
+- (void)dataReload {
+    if (self.groups.count == 0)
+        //没有图片
+        [self showNoAssets];
+    
+    if (self.groups.count >0 && [_my_delegate respondsToSelector:@selector(didSelectGroup:)]) {
+        [_my_delegate didSelectGroup:self.groups[0]];
+    }
+    [self reloadData];
+}
+
+#pragma mark - Not allowed / No assets
+- (void)showNotAllowed {
+    [[NSNotificationCenter defaultCenter] postNotificationName:@"NotAllowedPhoto" object:nil];
+    if ([_my_delegate respondsToSelector:@selector(didSelectGroup:)]) {
+        [_my_delegate didSelectGroup:nil];
+    }
+}
+
+- (void)showNoAssets {
+    NSLog(@"%s",__func__);
+}
+
+
+#pragma mark - uitableviewDelegate
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+    static NSString *cellIdentifer = @"cell";
+    AJPhotoGroupCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer forIndexPath:indexPath];
+    if(cell == nil){
+        cell = [[AJPhotoGroupCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifer];
+    }
+    
+    [cell bind:[self.groups objectAtIndex:indexPath.row]];
+    if (indexPath.row == self.selectIndex) {
+        cell.backgroundColor = [UIColor hwColor:@"#EEFBFF" alpha:1.0];
+        cell.selectButton.selected = YES;
+    }
+    return cell;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    return self.groups.count;
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+    return 60.0;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+    [tableView deselectRowAtIndexPath:indexPath animated:YES];
+    self.selectIndex = indexPath.row;
+    [self reloadData];
+    ALAssetsGroup *group = [self.groups objectAtIndex:indexPath.row];
+    if ([_my_delegate respondsToSelector:@selector(didSelectGroup:)]) {
+        [_my_delegate didSelectGroup:group];
+    }
+}
+
+#pragma mark - getter/setter
+- (NSMutableArray *)groups {
+    if (!_groups) {
+        _groups = [[NSMutableArray alloc] init];
+    }
+    return _groups;
+}
+
+#pragma mark - ALAssetsLibrary
+- (ALAssetsLibrary *)assetsLibrary {
+    if (!_assetsLibrary) {
+        static dispatch_once_t pred = 0;
+        static ALAssetsLibrary *library = nil;
+        dispatch_once(&pred, ^{
+            library = [[ALAssetsLibrary alloc] init];
+        });
+        _assetsLibrary = library;
+    }
+    return _assetsLibrary;
+}
+
+@end

+ 36 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoListCell.h

@@ -0,0 +1,36 @@
+//
+//  AJPhotoListCell.h
+//  AJPhotoPicker
+//
+//  Created by AlienJunX on 15/11/2.
+//  Copyright (c) 2015 AlienJunX
+//
+//  This source code is licensed under the MIT-style license found in the
+//  LICENSE file in the root directory of this source tree.
+//
+
+#import <UIKit/UIKit.h>
+@class ALAsset;
+
+@interface AJPhotoListCell : UICollectionViewCell
+@property (nonatomic, strong) UIButton *selectButton;
+/**
+ *  显示照片
+ *
+ *  @param asset           照片
+ *  @param selectionFilter 过滤器
+ *  @param isSelected YES选中,NO取消选中
+ */
+- (void)bind:(ALAsset *)asset selectionFilter:(NSPredicate*)selectionFilter isSelected:(BOOL)isSelected;
+
+
+/**
+ *  选中
+ *
+ *  @param isSelected YES选中,NO取消选中
+ */
+- (void)isSelected:(BOOL)isSelected;
+
+//点击按钮
+@property (nonatomic,copy) void (^didClckSelectBut)(BOOL isSelect);
+@end

+ 124 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoListCell.m

@@ -0,0 +1,124 @@
+//
+//  AJPhotoListCell.m
+//  AJPhotoPicker
+//
+//  Created by AlienJunX on 15/11/2.
+//  Copyright (c) 2015 AlienJunX
+//
+//  This source code is licensed under the MIT-style license found in the
+//  LICENSE file in the root directory of this source tree.
+//
+
+#import "AJPhotoListCell.h"
+#import <AssetsLibrary/AssetsLibrary.h>
+#import "AJGradientView.h"
+
+@interface AJPhotoListCell()
+@property (strong, nonatomic) UIImageView *imageView;
+@property (strong, nonatomic) ALAsset *asset;
+@property (strong, nonatomic) AJGradientView *gradientView;
+@end
+
+@implementation AJPhotoListCell
+
+- (void)bind:(ALAsset *)asset selectionFilter:(NSPredicate*)selectionFilter isSelected:(BOOL)isSelected {
+    self.asset = asset;
+    if (self.imageView == nil) {
+        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
+        [self.contentView addSubview:imageView];
+        self.imageView = imageView;
+        
+        [self.imageView setContentMode:UIViewContentModeScaleAspectFill];
+        self.imageView.layer.cornerRadius = 3;
+        self.imageView.clipsToBounds = YES;
+        self.backgroundColor = [UIColor whiteColor];
+    }
+    
+
+    
+    if ([asset isKindOfClass:[UIImage class]]) {
+        [self.imageView setImage:(UIImage *)asset];
+    } else {
+        [self.imageView setImage:[UIImage imageWithCGImage:asset.aspectRatioThumbnail]];
+        if ([asset valueForProperty:ALAssetPropertyType] == ALAssetTypeVideo) {
+            if (!self.gradientView) {
+                AJGradientView *gradientView = [[AJGradientView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
+                [self.contentView insertSubview:gradientView aboveSubview:self.imageView];
+                self.gradientView = gradientView;
+                [self.gradientView setupCAGradientLayer:@[(id)[[UIColor clearColor] colorWithAlphaComponent:0.0f].CGColor, (id)[[UIColor colorWithRed:23.0/255.0 green:22.0/255.0 blue:22.0/255.0 alpha:1.0] colorWithAlphaComponent:0.8f].CGColor] locations:@[@0.8f,@1.0f]];
+                
+                //icon
+                UIImageView *videoIcon = [[UIImageView alloc] initWithFrame:CGRectMake(5, self.bounds.size.height-15, 15, 8)];
+                videoIcon.image = [UIImage imageWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"BoPhotoPicker.bundle/images/AssetsPickerVideo@2x.png"]];
+                [self.gradientView addSubview:videoIcon];
+                
+                //duration
+                UILabel *duration = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(videoIcon.frame), self.bounds.size.height-17, self.bounds.size.width-CGRectGetMaxX(videoIcon.frame)-5, 12)];
+                duration.font = [UIFont systemFontOfSize:12];
+                duration.textColor = [UIColor whiteColor];
+                duration.textAlignment = NSTextAlignmentRight;
+                duration.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+                [self.gradientView addSubview:duration];
+                
+                double value = [[asset valueForProperty:ALAssetPropertyDuration] doubleValue];
+                duration.text = [self timeFormatted:value];
+            }
+        } else {
+            [self.gradientView removeFromSuperview];
+        }
+    }
+    
+    if (self.selectButton == nil) {
+        UIButton *but = [[UIButton alloc] init];
+        [but setImage:[UIImage imageNamed:@"upload_file_uncheck2"] forState:UIControlStateNormal];
+        [but setImage:[UIImage imageNamed:@"upload_file_check"] forState:UIControlStateSelected];
+        [self.contentView addSubview:but];
+        [but addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
+        
+        //but.backgroundColor = [UIColor greenColor];
+        //but.frame = CGRectMake([UIScreen mainScreen].bounds.size.width -10 - 25, 0, 25, 25);
+        [but mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.width.mas_equalTo(30);
+            make.height.mas_equalTo(30);
+            make.right.mas_equalTo(0);
+            make.top.mas_equalTo(0);
+        }];
+        
+        self.selectButton = but;
+    }
+    
+    self.selectButton.selected = NO;
+   
+}
+
+- (void)isSelected:(BOOL)isSelected {
+    //_tapAssetView.selected = isSelected;
+    self.selectButton.selected = isSelected;
+}
+
+#pragma mark - Utility
+//时间格式化
+- (NSString *)timeFormatted:(double)totalSeconds {
+    NSTimeInterval timeInterval = totalSeconds;
+    long seconds = lroundf(timeInterval); // Modulo (%) operator below needs int or long
+    int hour = 0;
+    int minute = seconds / 60.0f;
+    int second = seconds % 60;
+    if (minute > 59) {
+        hour = minute / 60;
+        minute = minute % 60;
+        return [NSString stringWithFormat:@"%02d:%02d:%02d", hour, minute, second];
+    } else {
+        return [NSString stringWithFormat:@"%02d:%02d", minute, second];
+    }
+}
+
+#pragma mark 选中按钮
+- (void)didClickButFun:(UIButton*)but
+{
+    //but.selected = !but.selected;
+    if(_didClckSelectBut){
+        _didClckSelectBut(but.selected);
+    }
+}
+@end

+ 16 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoListView.h

@@ -0,0 +1,16 @@
+//
+//  AJPhotoListView.h
+//  AJPhotoPicker
+//
+//  Created by AlienJunX on 15/11/2.
+//  Copyright (c) 2015 AlienJunX
+//
+//  This source code is licensed under the MIT-style license found in the
+//  LICENSE file in the root directory of this source tree.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AJPhotoListView : UICollectionView
+
+@end

+ 30 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/AJPhotoListView.m

@@ -0,0 +1,30 @@
+//
+//  AJPhotoListView.m
+//  AJPhotoPicker
+//
+//  Created by AlienJunX on 15/11/2.
+//  Copyright (c) 2015 AlienJunX
+//
+//  This source code is licensed under the MIT-style license found in the
+//  LICENSE file in the root directory of this source tree.
+//
+
+#import "AJPhotoListView.h"
+#import "AJPhotoListCell.h"
+
+@implementation AJPhotoListView
+
+#pragma mark - init
+- (instancetype)init {
+    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
+    [flowLayout setScrollDirection:UICollectionViewScrollDirectionVertical];
+    self = [[AJPhotoListView alloc] initWithFrame:CGRectMake(0, 64, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) collectionViewLayout:flowLayout];
+    if (self) {
+        [self registerClass:[AJPhotoListCell class] forCellWithReuseIdentifier:@"cell"];
+        self.backgroundColor = [UIColor whiteColor];
+        self.userInteractionEnabled = YES;
+    }
+    return self;
+}
+
+@end

+ 16 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/uploadFileBottomView.h

@@ -0,0 +1,16 @@
+//
+//  uploadFileBottomView.h
+//  隐私保护
+//
+//  Created by xd h on 2023/11/10.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface uploadFileBottomView : UIView
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 29 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/photoView/uploadFileBottomView.m

@@ -0,0 +1,29 @@
+//
+//  uploadFileBottomView.m
+//  隐私保护
+//
+//  Created by xd h on 2023/11/10.
+//
+
+#import "uploadFileBottomView.h"
+
+@interface uploadFileBottomView ()
+
+@end
+
+@implementation uploadFileBottomView
+
+- (id)initWithFrame:(CGRect)frame{
+    self = [super initWithFrame:frame];
+    
+    [self drawAnyView];
+    
+    return self;
+}
+
+- (void)drawAnyView{
+    [self setBackgroundColor:[UIColor whiteColor]];
+    
+}
+
+@end

+ 39 - 0
创维盒子/双子星云手机/Class/Set/uploadFile/uploadImageOrVideoViewController.h

@@ -6,11 +6,50 @@
 //
 
 #import "BaseViewController.h"
+#import <AssetsLibrary/AssetsLibrary.h>
 
 NS_ASSUME_NONNULL_BEGIN
 
+@class uploadImageOrVideoViewController;
+@protocol AJPhotoPickerProtocol <NSObject>
+@optional
+//选择完成
+- (void)photoPicker:(uploadImageOrVideoViewController *)picker didSelectAssets:(NSArray *)assets;
+
+//点击选中
+- (void)photoPicker:(uploadImageOrVideoViewController *)picker didSelectAsset:(ALAsset*)asset;
+
+//取消选中
+- (void)photoPicker:(uploadImageOrVideoViewController *)picker didDeselectAsset:(ALAsset*)asset;
+
+//点击相机按钮相关操作
+- (void)photoPickerTapCameraAction:(uploadImageOrVideoViewController *)picker;
+
+//取消
+- (void)photoPickerDidCancel:(uploadImageOrVideoViewController *)picker;
+
+//超过最大选择项时
+- (void)photoPickerDidMaximum:(uploadImageOrVideoViewController *)picker;
+
+//低于最低选择项时
+- (void)photoPickerDidMinimum:(uploadImageOrVideoViewController *)picker;
+
+//选择过滤
+- (void)photoPickerDidSelectionFilter:(uploadImageOrVideoViewController *)picker;
+
+@end
+
 @interface uploadImageOrVideoViewController : BaseViewController
 
+@property (weak, nonatomic) id <AJPhotoPickerProtocol> delegate;
+//选择过滤
+@property (nonatomic, strong) NSPredicate *selectionFilter;
+//资源过滤
+@property (nonatomic, strong) ALAssetsFilter *assetsFilter;
+
+//选中的项
+@property (nonatomic, strong) NSMutableArray *indexPathsForSelectedItems;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 409 - 4
创维盒子/双子星云手机/Class/Set/uploadFile/uploadImageOrVideoViewController.m

@@ -7,10 +7,32 @@
 
 #import "uploadImageOrVideoViewController.h"
 #import <AssetsLibrary/AssetsLibrary.h>
+#import <AVFoundation/AVFoundation.h>
+#import "AJPhotoListView.h"
+#import "AJPhotoGroupView.h"
+#import "AJPhotoListCell.h"
 
-@interface uploadImageOrVideoViewController ()
+@interface uploadImageOrVideoViewController ()<AJPhotoGroupViewProtocol,UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
+
+@property (strong, nonatomic) AJPhotoGroupView *photoGroupView;
+@property (strong, nonatomic) UILabel *MytitleLabel;
+@property (strong, nonatomic) UIImageView *selectTip;
+@property (nonatomic) BOOL isNotAllowed;
+@property (strong, nonatomic) UIView *bgMaskView;
+@property (strong, nonatomic) AJPhotoListView *photoListView;
+@property (strong, nonatomic) NSMutableArray *assets;
+@property (strong, nonatomic) NSIndexPath *lastAccessed;
+
+//最多选择项
+@property (nonatomic, assign) NSInteger maximumNumberOfSelection;
+
+//最少选择项
+@property (nonatomic, assign) NSInteger minimumNumberOfSelection;
+
+
+//是否开启多选
+@property (nonatomic, assign) BOOL multipleSelection;
 
-@property (weak, nonatomic) UILabel *titleLabel;
 @end
 
 @implementation uploadImageOrVideoViewController
@@ -26,18 +48,401 @@
     [self.navBarBGView setHidden:NO];
     
     [self initBaselUIFun];
+    
+    _isNotAllowed = YES;
+    _maximumNumberOfSelection = 3;
+    _minimumNumberOfSelection = 0;
+    _multipleSelection = YES;
+    
+    if(!_selectionFilter)
+    {
+        _selectionFilter = [NSPredicate predicateWithValue:YES];
+    }
+    [self checkVideoAccessFun];
+    
 }
 
 - (void)initBaselUIFun
 {
+    [self initNavHeadUIFun];
+    
+    //列表view
+    [self setupPhotoListView];
+    //相册分组
+    [self setupGroupView];
+}
+
+- (void)initNavHeadUIFun
+{
     //title
     UILabel *titleLabel = [[UILabel alloc] init];
     titleLabel.textAlignment = NSTextAlignmentCenter;
-    titleLabel.textColor = [UIColor whiteColor];
+    titleLabel.font = [UIFont boldSystemFontOfSize:18.0];
     titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
     [self.navBarBGView addSubview:titleLabel];
 
-    self.titleLabel = titleLabel;
+    self.MytitleLabel = titleLabel;
+    
+    //selectTipImageView
+    UIImageView *selectTip = [[UIImageView alloc] init];
+    selectTip.image = [UIImage imageNamed:@"upload_image_arrow"];
+    selectTip.translatesAutoresizingMaskIntoConstraints = NO;
+    [self.navBarBGView addSubview:selectTip];
+    self.selectTip = selectTip;
+    
+    UIButton *tapBtn = [UIButton buttonWithType:UIButtonTypeCustom];
+    tapBtn.backgroundColor = [UIColor clearColor];
+    tapBtn.translatesAutoresizingMaskIntoConstraints = NO;
+    [tapBtn addTarget:self action:@selector(selectGroupAction:) forControlEvents:UIControlEventTouchUpInside];
+    [self.navBarBGView addSubview:tapBtn];
+    
+    [tapBtn mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.centerX.mas_equalTo(self.navBarBGView.mas_centerX);
+        make.centerY.mas_equalTo(self.backBtn.mas_centerY);
+        make.width.mas_equalTo(100);
+        make.height.mas_equalTo(30);
+    }];
+    
+    [self setTitleLabelText:@"所有相片"];
+}
+
+#pragma mark 设置相册标题
+- (void)setTitleLabelText:(NSString*)title
+{
+    CGFloat curWidth = [title boundingRectWithSize:CGSizeMake(SCREEN_W, 30) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:18.f]} context:nil].size.width;
+    
+    self.MytitleLabel.text = title;
+    curWidth += 20;
+    //HLog(@"title w:%f",curWidth);
+    [self.MytitleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.centerX.mas_equalTo(self.navBarBGView.mas_centerX).offset(-10);
+        make.centerY.mas_equalTo(self.backBtn.mas_centerY);
+        make.width.mas_equalTo(curWidth);
+        make.height.mas_equalTo(30);
+    }];
+    //self.MytitleLabel.backgroundColor = [UIColor greenColor];
+    
+    [self.selectTip mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(self.MytitleLabel.mas_right).offset(2);
+        make.centerY.mas_equalTo(self.backBtn.mas_centerY);
+        make.width.mas_equalTo(15);
+        make.height.mas_equalTo(15);
+    }];
+}
+
+#pragma mark 判断手机相册权限
+- (void)checkVideoAccessFun
+{
+    AVAuthorizationStatus authStatus =[AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
+    //判断摄像头状态是否可用
+    if(authStatus==AVAuthorizationStatusAuthorized){
+        _isNotAllowed = NO;
+    }else{
+        NSLog(@"未开启相机权限,请前往设置中开启");
+        [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
+            if (granted){
+                self->_isNotAllowed = NO;
+//                mainBlock(^{
+//
+//                });
+            }
+        }];
+    }
+}
+
+/**
+ *  照片列表
+ */
+- (void)setupPhotoListView {
+    AJPhotoListView *collectionView = [[AJPhotoListView alloc] init];
+    collectionView.dataSource = self;
+    collectionView.delegate = self;
+    collectionView.translatesAutoresizingMaskIntoConstraints = NO;
+    [self.view insertSubview:collectionView atIndex:0];
+    self.photoListView = collectionView;
+    
+    [collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        make.bottom.mas_equalTo(0);
+        make.top.equalTo(self.navBarBGView.mas_bottom).offset(0.f);
+    }];
+}
+
+/**
+ *  相册
+ */
+- (void)setupGroupView {
+    AJPhotoGroupView *photoGroupView = [[AJPhotoGroupView alloc] init];
+    photoGroupView.assetsFilter = self.assetsFilter;
+    photoGroupView.my_delegate = self;
+    [self.view insertSubview:photoGroupView belowSubview:self.navBarBGView];
+    self.photoGroupView = photoGroupView;
+    photoGroupView.hidden = YES;
+    photoGroupView.translatesAutoresizingMaskIntoConstraints = NO;
+    
+    [self.photoGroupView setupGroup];
+    
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        [photoGroupView mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.left.mas_equalTo(0);
+            make.right.mas_equalTo(0);
+            make.height.mas_equalTo(60.0*self.photoGroupView.groups.count);
+            make.top.equalTo(self.navBarBGView.mas_bottom).offset(0.f);
+        }];
+    });
+    
+}
+
+#pragma mark - 相册切换
+- (void)selectGroupAction:(UIButton *)sender {
+    
+    //无权限
+    if (self.isNotAllowed) {
+        return;
+    }
+
+    if (self.photoGroupView.hidden) {
+        [self bgMaskView];
+        self.bgMaskView.hidden = NO;
+        self.photoGroupView.hidden = NO;
+        [UIView animateWithDuration:0.3 animations:^{
+            //self.photoGroupView.transform = CGAffineTransformMakeTranslation(0, 360);
+            self.selectTip.transform = CGAffineTransformMakeRotation(M_PI);
+        }];
+    } else {
+        [self hidenGroupView];
+    }
+}
+
+- (void)hidenGroupView {
+    //[self.bgMaskView removeFromSuperview];
+    self.bgMaskView.hidden = YES;
+    [UIView animateWithDuration:0.3 animations:^{
+        //self.photoGroupView.transform = CGAffineTransformIdentity;
+        self.selectTip.transform = CGAffineTransformIdentity;
+    }completion:^(BOOL finished) {
+        self.photoGroupView.hidden = YES;
+    }];
+}
+
+
+#pragma mark - 遮罩背景
+- (UIView *)bgMaskView {
+    if (_bgMaskView == nil) {
+        UIView *bgMaskView = [[UIView alloc] init];
+        bgMaskView.alpha = 0.5;
+        bgMaskView.translatesAutoresizingMaskIntoConstraints = NO;
+        bgMaskView.backgroundColor = [UIColor blackColor];
+        //[self.view insertSubview:bgMaskView aboveSubview:self.photoListView];
+        [self.view insertSubview:bgMaskView belowSubview:self.photoGroupView];
+        
+        bgMaskView.userInteractionEnabled = YES;
+        [bgMaskView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapBgMaskView:)]];
+        _bgMaskView = bgMaskView;
+        
+        [bgMaskView mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.left.mas_equalTo(0);
+            make.right.mas_equalTo(0);
+            make.bottom.mas_equalTo(0);
+            make.top.equalTo(self.navBarBGView.mas_bottom).offset(0.f);
+        }];
+    }
+   
+    return _bgMaskView;
+}
+
+- (void)tapBgMaskView:(UITapGestureRecognizer *)sender {
+    if (!self.photoGroupView.hidden) {
+        [self hidenGroupView];
+    }
+}
+
+
+#pragma mark - BoPhotoGroupViewProtocol
+- (void)didSelectGroup:(ALAssetsGroup *)assetsGroup {
+    [self loadAssets:assetsGroup];
+    [self setTitleLabelText:[assetsGroup valueForProperty:ALAssetsGroupPropertyName]];
+    [self hidenGroupView];
+}
+
+//加载图片
+- (void)loadAssets:(ALAssetsGroup *)assetsGroup {
+    [self.indexPathsForSelectedItems removeAllObjects];
+    [self.assets removeAllObjects];
+    
+    //相机cell
+    NSMutableArray *tempList = [[NSMutableArray alloc] init];
+    //默认第一个为相机按钮
+    //[tempList addObject:[UIImage imageWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"BoPhotoPicker.bundle/images/BoAssetsCamera@2x.png"]]];
+    
+    ALAssetsGroupEnumerationResultsBlock resultsBlock = ^(ALAsset *asset, NSUInteger index, BOOL *stop) {
+        if (asset) {
+            [tempList addObject:asset];
+        } else if (tempList.count > 0) {
+            //排序
+            NSArray *sortedList = [tempList sortedArrayUsingComparator:^NSComparisonResult(ALAsset *first, ALAsset *second) {
+                if ([first isKindOfClass:[UIImage class]]) {
+                    return NSOrderedAscending;
+                }
+                id firstData = [first valueForProperty:ALAssetPropertyDate];
+                id secondData = [second valueForProperty:ALAssetPropertyDate];
+                return [secondData compare:firstData];//降序
+            }];
+            [self.assets addObjectsFromArray:sortedList];
+            
+            [self.photoListView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];
+            [self.photoListView reloadData];
+        }
+    };
+    
+    [assetsGroup enumerateAssetsUsingBlock:resultsBlock];
+}
+
+#pragma mark - uicollectionDelegate
+- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
+    return self.assets.count;
+}
+
+- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
+    static NSString *cellIdentifer = @"cell";
+    AJPhotoListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifer forIndexPath:indexPath];
+    
+    BOOL isSelected = [self.indexPathsForSelectedItems containsObject:self.assets[indexPath.row]];
+    [cell bind:self.assets[indexPath.row] selectionFilter:self.selectionFilter isSelected:isSelected];
+    
+    KWeakSelf
+    cell.didClckSelectBut = ^(BOOL isSelect) {
+        [weakSelf handlCellSelectFunBy:indexPath];
+    };
+    
+    return cell;
+}
+
+- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
+    return UIEdgeInsetsMake(5, 5, 5, 5);
+}
+
+- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
+    CGFloat wh = (collectionView.bounds.size.width - 20)/3.0;
+    return CGSizeMake(wh, wh);
+}
+
+- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
+    return 5.0;
 }
 
+- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
+    return 5.0;
+}
+
+- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
+    AJPhotoListCell *cell = (AJPhotoListCell *)[self.photoListView cellForItemAtIndexPath:indexPath];
+    ALAsset *asset = self.assets[indexPath.row];
+    
+    //相机按钮处理
+//    if ([asset isKindOfClass:[UIImage class]] && _delegate && [_delegate respondsToSelector:@selector(photoPickerTapCameraAction:)]) {
+//        [_delegate photoPickerTapCameraAction:self];
+//        return;
+//    }
+    
+    //单选
+//    if (!self.multipleSelection && self.indexPathsForSelectedItems.count==1) {
+//        //取消上一个选中
+//        NSInteger index = [self.assets indexOfObject:self.indexPathsForSelectedItems[0]];
+//        NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0];
+//        AJPhotoListCell *previousCell = (AJPhotoListCell *)[self.photoListView cellForItemAtIndexPath:indexPath];
+//        [previousCell isSelected:NO];
+//        [self.indexPathsForSelectedItems removeAllObjects];
+//
+//        //选中当前的
+//        [self.indexPathsForSelectedItems addObject:asset];
+//        [cell isSelected:YES];
+//        if (_delegate && [_delegate respondsToSelector:@selector(photoPicker:didDeselectAsset:)])
+//            [_delegate photoPicker:self didDeselectAsset:asset];
+//        return;
+//    }
+    
+    //超出最大限制
+//    if (self.indexPathsForSelectedItems.count >= self.maximumNumberOfSelection && ![self.indexPathsForSelectedItems containsObject:asset]) {
+//        if (_delegate && [_delegate respondsToSelector:@selector(photoPickerDidMaximum:)])
+//            [_delegate photoPickerDidMaximum:self];
+//        return;
+//    }
+//
+//    //选择过滤
+//    BOOL selectable = [self.selectionFilter evaluateWithObject:asset];
+//    if (!selectable) {
+//        if (_delegate && [_delegate respondsToSelector:@selector(photoPickerDidSelectionFilter:)])
+//            [_delegate photoPickerDidSelectionFilter:self];
+//        return;
+//    }
+//
+//    //取消选中
+//    if ([self.indexPathsForSelectedItems containsObject:asset]) {
+//        [self.indexPathsForSelectedItems removeObject:asset];
+//        [cell isSelected:NO];
+//        if (_delegate && [_delegate respondsToSelector:@selector(photoPicker:didDeselectAsset:)])
+//            [_delegate photoPicker:self didDeselectAsset:asset];
+//        return;
+//    }
+//
+//    //选中
+//    [self.indexPathsForSelectedItems addObject:asset];
+//    [cell isSelected:YES];
+//    if (_delegate && [_delegate respondsToSelector:@selector(photoPicker:didSelectAsset:)])
+//        [_delegate photoPicker:self didSelectAsset:asset];
+}
+
+#pragma mark 处理点击选中相关
+- (void)handlCellSelectFunBy:(NSIndexPath *)indexPath
+{
+    AJPhotoListCell *cell = (AJPhotoListCell *)[self.photoListView cellForItemAtIndexPath:indexPath];
+    ALAsset *asset = self.assets[indexPath.row];
+    
+    //超出最大限制
+    if (self.indexPathsForSelectedItems.count >= self.maximumNumberOfSelection && ![self.indexPathsForSelectedItems containsObject:asset]) {
+        if (_delegate && [_delegate respondsToSelector:@selector(photoPickerDidMaximum:)])
+            [_delegate photoPickerDidMaximum:self];
+        return;
+    }
+    
+    //选择过滤
+    BOOL selectable = [self.selectionFilter evaluateWithObject:asset];
+    if (!selectable) {
+        if (_delegate && [_delegate respondsToSelector:@selector(photoPickerDidSelectionFilter:)])
+            [_delegate photoPickerDidSelectionFilter:self];
+        return;
+    }
+    
+    //取消选中
+    if ([self.indexPathsForSelectedItems containsObject:asset]) {
+        [self.indexPathsForSelectedItems removeObject:asset];
+        [cell isSelected:NO];
+        if (_delegate && [_delegate respondsToSelector:@selector(photoPicker:didDeselectAsset:)])
+            [_delegate photoPicker:self didDeselectAsset:asset];
+        return;
+    }
+    
+    //选中
+    [self.indexPathsForSelectedItems addObject:asset];
+    [cell isSelected:YES];
+    if (_delegate && [_delegate respondsToSelector:@selector(photoPicker:didSelectAsset:)])
+        [_delegate photoPicker:self didSelectAsset:asset];
+}
+
+#pragma mark - getter/setter
+- (NSMutableArray *)assets {
+    if (!_assets) {
+        _assets = [[NSMutableArray alloc] init];
+    }
+    return _assets;
+}
+
+- (NSMutableArray *)indexPathsForSelectedItems {
+    if (!_indexPathsForSelectedItems) {
+        _indexPathsForSelectedItems = [[NSMutableArray alloc] init];
+    }
+    return _indexPathsForSelectedItems;
+}
 @end

+ 1 - 1
创维盒子/双子星云手机/CloudPlayer/View/PlayerView.m

@@ -67,7 +67,7 @@ ShowImageViewDelegate>{
                   inRect:CGRectMake(0, 0, glkshowImageView.drawableWidth, glkshowImageView.drawableHeight)
                 fromRect:[ciImage extent]];
     
-    [self->glkshowImageView display];
+    //[self->glkshowImageView display];
 }
 
 - (void)showIMage