Skip to content

Commit

Permalink
Audio Player Gestures (#329)
Browse files Browse the repository at this point in the history
* music player gestures
* resolved offline song issue
* gestures and prefetching of songs
* implemented suggested changes in repeat mode
* thumbnail aspect ratio fix
  • Loading branch information
ShresthPratapSingh authored Jul 30, 2020
1 parent decd0d3 commit 9313148
Show file tree
Hide file tree
Showing 20 changed files with 766 additions and 268 deletions.
16 changes: 16 additions & 0 deletions AmahiAnywhere/AmahiAnywhere.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,14 @@
46657183205085FC000E0D45 /* FilesPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46657182205085FC000E0D45 /* FilesPresenter.swift */; };
46CB896B204FB0FC0031151F /* SharesPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46CB896A204FB0FC0031151F /* SharesPresenter.swift */; };
46F87397204CC69500F1AF37 /* Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46F87396204CC69500F1AF37 /* Server.swift */; };
7253F21824BDA89F0094C385 /* AudioThumbnailCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7253F21624BDA89F0094C385 /* AudioThumbnailCollectionCell.swift */; };
7253F21924BDA89F0094C385 /* AudioThumbnailCollectionCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7253F21724BDA89F0094C385 /* AudioThumbnailCollectionCell.xib */; };
7253F21B24BDAF890094C385 /* AudioPlayerViewController+CollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7253F21A24BDAF890094C385 /* AudioPlayerViewController+CollectionView.swift */; };
725871912496BCEB00AF0A61 /* QueueContainerHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 725871902496BCEB00AF0A61 /* QueueContainerHeaderView.swift */; };
725871932496C65300AF0A61 /* PlayerQueueContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 725871922496C65300AF0A61 /* PlayerQueueContainerView.swift */; };
7270E663248D14A6001BE439 /* AudioPlayerQueueViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7270E662248D14A6001BE439 /* AudioPlayerQueueViewController.swift */; };
7270E665248D4490001BE439 /* AudioPlayerViewController + PlayerQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7270E664248D448F001BE439 /* AudioPlayerViewController + PlayerQueue.swift */; };
727A95E024D2DA350057C27C /* UIImageExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 727A95DF24D2DA350057C27C /* UIImageExtension.swift */; };
72BDA8B524A9ED6900B4469E /* QueueItemTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72BDA8B324A9ED6900B4469E /* QueueItemTableViewCell.swift */; };
72BDA8B624A9ED6900B4469E /* QueueItemTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 72BDA8B424A9ED6900B4469E /* QueueItemTableViewCell.xib */; };
72DAFE1C24B6276A00755E25 /* AudioPlayerDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72DAFE1B24B6276A00755E25 /* AudioPlayerDataModel.swift */; };
Expand Down Expand Up @@ -211,10 +215,14 @@
46F87396204CC69500F1AF37 /* Server.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Server.swift; sourceTree = "<group>"; };
499AAFCDBDAB4C05C7264992 /* Pods-AmahiAnywhere.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmahiAnywhere.release.xcconfig"; path = "Pods/Target Support Files/Pods-AmahiAnywhere/Pods-AmahiAnywhere.release.xcconfig"; sourceTree = "<group>"; };
665E1C7EF1F0DEBF3A9809B0 /* Pods-AmahiAnywhere.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AmahiAnywhere.debug.xcconfig"; path = "Pods/Target Support Files/Pods-AmahiAnywhere/Pods-AmahiAnywhere.debug.xcconfig"; sourceTree = "<group>"; };
7253F21624BDA89F0094C385 /* AudioThumbnailCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioThumbnailCollectionCell.swift; sourceTree = "<group>"; };
7253F21724BDA89F0094C385 /* AudioThumbnailCollectionCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AudioThumbnailCollectionCell.xib; sourceTree = "<group>"; };
7253F21A24BDAF890094C385 /* AudioPlayerViewController+CollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AudioPlayerViewController+CollectionView.swift"; sourceTree = "<group>"; };
725871902496BCEB00AF0A61 /* QueueContainerHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueueContainerHeaderView.swift; sourceTree = "<group>"; };
725871922496C65300AF0A61 /* PlayerQueueContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerQueueContainerView.swift; sourceTree = "<group>"; };
7270E662248D14A6001BE439 /* AudioPlayerQueueViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioPlayerQueueViewController.swift; sourceTree = "<group>"; };
7270E664248D448F001BE439 /* AudioPlayerViewController + PlayerQueue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AudioPlayerViewController + PlayerQueue.swift"; sourceTree = "<group>"; };
727A95DF24D2DA350057C27C /* UIImageExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIImageExtension.swift; sourceTree = "<group>"; };
72BDA8B324A9ED6900B4469E /* QueueItemTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueueItemTableViewCell.swift; sourceTree = "<group>"; };
72BDA8B424A9ED6900B4469E /* QueueItemTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = QueueItemTableViewCell.xib; sourceTree = "<group>"; };
72DAFE1B24B6276A00755E25 /* AudioPlayerDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioPlayerDataModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -343,6 +351,7 @@
3B3F43E422FED10100BB42B0 /* AudioPlayerViewController+Player.swift */,
3B3F43E622FED14900BB42B0 /* AudioPlayerViewController+Remote.swift */,
7270E664248D448F001BE439 /* AudioPlayerViewController + PlayerQueue.swift */,
7253F21A24BDAF890094C385 /* AudioPlayerViewController+CollectionView.swift */,
);
path = "Audio Player";
sourceTree = "<group>";
Expand Down Expand Up @@ -432,6 +441,7 @@
9938343C22CBAAA2002A8213 /* Toast.swift */,
3B37EBAE22ED11650065CB77 /* Units.swift */,
9935DAB32301FA21004816E1 /* RecentFiles.swift */,
727A95DF24D2DA350057C27C /* UIImageExtension.swift */,
);
path = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -654,6 +664,8 @@
3BB315D322E1143600A0FDAD /* SharesCollectionViewCell.swift */,
72BDA8B324A9ED6900B4469E /* QueueItemTableViewCell.swift */,
72BDA8B424A9ED6900B4469E /* QueueItemTableViewCell.xib */,
7253F21624BDA89F0094C385 /* AudioThumbnailCollectionCell.swift */,
7253F21724BDA89F0094C385 /* AudioThumbnailCollectionCell.xib */,
);
path = Cells;
sourceTree = "<group>";
Expand Down Expand Up @@ -783,6 +795,7 @@
3B24FE1822970B6B0044721D /* WalkthroughCell.xib in Resources */,
3B24FE162297086A0044721D /* WalkthroughAmahiCell.xib in Resources */,
FB71BE9D201CB2FC0005492C /* Main.storyboard in Resources */,
7253F21924BDA89F0094C385 /* AudioThumbnailCollectionCell.xib in Resources */,
C8490D1520C847F90052D636 /* VideoPlayer.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -868,6 +881,7 @@
3BCAFBA522C5385D0044057E /* DownloadsBaseCollectionCell.swift in Sources */,
9938343D22CBAAA2002A8213 /* Toast.swift in Sources */,
FB71BE9A201CB2FC0005492C /* LoginViewController.swift in Sources */,
7253F21824BDA89F0094C385 /* AudioThumbnailCollectionCell.swift in Sources */,
C86CA92920D3D26300C8EDCA /* OfflineFile+CoreData.swift in Sources */,
3B33325A22BAA40B00BC61EB /* FilesViewController+UICollectionViewDelegates.swift in Sources */,
4605964D204F3666004FA066 /* ServerShare.swift in Sources */,
Expand Down Expand Up @@ -908,6 +922,7 @@
C83C637320386DD90089B9D8 /* BaseContract.swift in Sources */,
C8DA5B2D20D7283400F5A527 /* DownloadService+URLSessionDelegate.swift in Sources */,
7270E663248D14A6001BE439 /* AudioPlayerQueueViewController.swift in Sources */,
727A95E024D2DA350057C27C /* UIImageExtension.swift in Sources */,
80F60700206BE1530098BC60 /* SettingsViewController.swift in Sources */,
3BEA683E2311899D0017779A /* RecentFilesViewController.swift in Sources */,
C83C63912038D5B30089B9D8 /* StringLiterals.swift in Sources */,
Expand Down Expand Up @@ -959,6 +974,7 @@
3B3F43E122FECF9300BB42B0 /* Interactor.swift in Sources */,
C8D86160209490230014D8AC /* WebViewController.swift in Sources */,
3BF1E81A22D0288700C531CD /* OfflineFileIndexes.swift in Sources */,
7253F21B24BDAF890094C385 /* AudioPlayerViewController+CollectionView.swift in Sources */,
3BCAFBA722C53E2A0044057E /* OfflineFilesViewController.swift in Sources */,
C83C63992038D5B30089B9D8 /* AuthResponses.swift in Sources */,
3B33324E22BAA17C00BC61EB /* FilteredServerFile.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// AudioThumbnailCollectionCell.swift
// AmahiAnywhere
//
// Created by Shresth Pratap Singh on 14/07/20.
// Copyright © 2020 Amahi. All rights reserved.
//

import UIKit

class AudioThumbnailCollectionCell: UICollectionViewCell {

@IBOutlet weak var imageView: UIImageView!

override func awakeFromNib() {
super.awakeFromNib()

self.imageView.layer.masksToBounds = false
self.imageView.clipsToBounds = true
self.imageView.layer.cornerRadius = UIScreen.main.bounds.width * 0.04
}

override func prepareForReuse() {
imageView.image = UIImage(named: "musicPlayerArtWork")
}

}
56 changes: 56 additions & 0 deletions AmahiAnywhere/AmahiAnywhere/Cells/AudioThumbnailCollectionCell.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="AudioThumbnailCollectionCell" customModule="AmahiAnywhere" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="561" height="574"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="561" height="574"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="c31-5C-Sqb" userLabel="containerView">
<rect key="frame" x="0.0" y="0.0" width="561" height="574"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" image="musicPlayerArtWork" translatesAutoresizingMaskIntoConstraints="NO" id="2Uy-7b-FSj">
<rect key="frame" x="10" y="5" width="541" height="564"/>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="2Uy-7b-FSj" firstAttribute="leading" secondItem="c31-5C-Sqb" secondAttribute="leading" constant="10" id="Prj-AY-Ufi"/>
<constraint firstItem="2Uy-7b-FSj" firstAttribute="top" secondItem="c31-5C-Sqb" secondAttribute="top" constant="5" id="Tz3-OD-Zsw"/>
<constraint firstAttribute="trailing" secondItem="2Uy-7b-FSj" secondAttribute="trailing" constant="10" id="cFn-n4-E6x"/>
<constraint firstAttribute="bottom" secondItem="2Uy-7b-FSj" secondAttribute="bottom" constant="5" id="eWu-pO-7Jm"/>
<constraint firstItem="2Uy-7b-FSj" firstAttribute="centerX" secondItem="c31-5C-Sqb" secondAttribute="centerX" id="kB5-Gr-W58"/>
<constraint firstItem="2Uy-7b-FSj" firstAttribute="centerY" secondItem="c31-5C-Sqb" secondAttribute="centerY" id="uSe-pq-8Nb"/>
</constraints>
</view>
</subviews>
</view>
<constraints>
<constraint firstAttribute="trailing" secondItem="c31-5C-Sqb" secondAttribute="trailing" id="5JH-08-IbN"/>
<constraint firstItem="c31-5C-Sqb" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="GeW-yd-5Ut"/>
<constraint firstItem="c31-5C-Sqb" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="L7Q-Ml-dpa"/>
<constraint firstAttribute="bottom" secondItem="c31-5C-Sqb" secondAttribute="bottom" id="mCj-dU-Xab"/>
</constraints>
<viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/>
<size key="customSize" width="561" height="574"/>
<connections>
<outlet property="imageView" destination="2Uy-7b-FSj" id="NTk-9z-FtD"/>
</connections>
<point key="canvasLocation" x="536.95652173913049" y="306.02678571428572"/>
</collectionViewCell>
</objects>
<resources>
<image name="musicPlayerArtWork" width="300" height="300"/>
</resources>
</document>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ class QueueItemTableViewCell:UITableViewCell{
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var artistLabel: UILabel!

override func awakeFromNib() {
super.awakeFromNib()
thumbnailView.layer.cornerRadius = 5
thumbnailView.clipsToBounds = true
selectionStyle = .none
shouldIndentWhileEditing = false
}
override func prepareForReuse() {
thumbnailView.image = UIImage(named:"musicPlayerArtWork")
titleLabel.text = "Title"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
Expand Down
Loading

0 comments on commit 9313148

Please sign in to comment.