Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
cranci1 committed Sep 15, 2024
1 parent e2af377 commit 0f2708a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 40 deletions.
Binary file not shown.
11 changes: 6 additions & 5 deletions Ryu/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@
</objects>
<point key="canvasLocation" x="-2695" y="1500"/>
</scene>
<!--Navigation Controller-->
<!--Saved-->
<scene sceneID="qIV-Ii-dhQ">
<objects>
<navigationController id="zUE-0l-pun" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" systemItem="favorites" id="bqb-dW-tII"/>
<tabBarItem key="tabBarItem" title="Saved" image="books.vertical.fill" catalog="system" id="bqb-dW-tII"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="nBH-n3-bIW">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
Expand All @@ -191,7 +191,7 @@
</objects>
<point key="canvasLocation" x="-4590" y="-18"/>
</scene>
<!--Favorites-->
<!--Saved-->
<scene sceneID="JNZ-TQ-x2k">
<objects>
<viewController id="IWM-mT-B3l" customClass="FavoritesViewController" customModule="Ryu" customModuleProvider="target" sceneMemberID="viewController">
Expand Down Expand Up @@ -224,7 +224,7 @@
<constraint firstItem="RC6-7K-ADf" firstAttribute="leading" secondItem="icT-SM-Cdp" secondAttribute="leading" id="owC-Er-z1o"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="Favorites" id="BBu-Lh-qnt">
<navigationItem key="navigationItem" title="Saved" id="BBu-Lh-qnt">
<barButtonItem key="leftBarButtonItem" id="2ET-QB-yVC">
<imageReference key="image" image="gearshape" catalog="system" symbolScale="large"/>
<color key="tintColor" name="AccentColor"/>
Expand Down Expand Up @@ -635,10 +635,11 @@
</scene>
</scenes>
<inferredMetricsTieBreakers>
<segue reference="X14-oT-TJn"/>
<segue reference="A4S-3U-V1x"/>
</inferredMetricsTieBreakers>
<resources>
<image name="arrow.down.circle.fill" catalog="system" width="128" height="121"/>
<image name="books.vertical.fill" catalog="system" width="128" height="109"/>
<image name="gearshape" catalog="system" width="128" height="121"/>
<image name="house.fill" catalog="system" width="128" height="106"/>
<namedColor name="AccentColor">
Expand Down
3 changes: 2 additions & 1 deletion Ryu/Sources/SourceMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class SourceMenu {
("Kuramanime", .kuramanime, "🇮🇩"),
("JKanime", .jkanime, "🇪🇸"),
("Anime3rb", .anime3rb, "🇸🇦"),
("HiAnime", .hianime, "🇺🇸")
("HiAnime", .hianime, "🇺🇸"),
("Hanashi", .hanashi, "🇩🇪")
]

let alertController = UIAlertController(title: "Select Source", message: "Choose your preferred source.", preferredStyle: .actionSheet)
Expand Down
59 changes: 25 additions & 34 deletions Ryu/Swift - Views/Anime Info/Anime Info View/AnimeHeaderCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AnimeHeaderCell: UITableViewCell {
private let animeImageView = UIImageView()
private let titleLabel = UILabel()
private let aliasLabel = UILabel()
private let favoriteButton = UIButton()
private let bookmarkButton = UIImageView()
private let optionsButton = UIImageView()
private let starLabel = UILabel()
private let airDateLabel = UILabel()
Expand All @@ -21,7 +21,6 @@ class AnimeHeaderCell: UITableViewCell {

var favoriteButtonTapped: (() -> Void)?
var showOptionsMenu: (() -> Void)?
var fetchAndNavigateToAnime: ((String) -> Void)?

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
Expand All @@ -38,22 +37,16 @@ class AnimeHeaderCell: UITableViewCell {
contentView.addSubview(animeImageView)
contentView.addSubview(titleLabel)
contentView.addSubview(aliasLabel)
contentView.addSubview(favoriteButton)
contentView.addSubview(bookmarkButton)
contentView.addSubview(optionsButton)
contentView.addSubview(starLabel)
contentView.addSubview(airDateLabel)
contentView.addSubview(starIconImageView)
contentView.addSubview(calendarIconImageView)

animeImageView.translatesAutoresizingMaskIntoConstraints = false
titleLabel.translatesAutoresizingMaskIntoConstraints = false
aliasLabel.translatesAutoresizingMaskIntoConstraints = false
favoriteButton.translatesAutoresizingMaskIntoConstraints = false
optionsButton.translatesAutoresizingMaskIntoConstraints = false
starLabel.translatesAutoresizingMaskIntoConstraints = false
airDateLabel.translatesAutoresizingMaskIntoConstraints = false
starIconImageView.translatesAutoresizingMaskIntoConstraints = false
calendarIconImageView.translatesAutoresizingMaskIntoConstraints = false
[animeImageView, titleLabel, aliasLabel, bookmarkButton, optionsButton, starLabel, airDateLabel, starIconImageView, calendarIconImageView].forEach {
$0.translatesAutoresizingMaskIntoConstraints = false
}

animeImageView.contentMode = .scaleAspectFill
animeImageView.layer.cornerRadius = 8
Expand All @@ -62,16 +55,15 @@ class AnimeHeaderCell: UITableViewCell {
titleLabel.font = UIFont.boldSystemFont(ofSize: 21)
titleLabel.textColor = .label
titleLabel.numberOfLines = 4

aliasLabel.font = UIFont.systemFont(ofSize: 13)
aliasLabel.textColor = .secondaryLabel
aliasLabel.numberOfLines = 2

favoriteButton.setTitle("FAVORITE", for: .normal)
favoriteButton.setTitleColor(.black, for: .normal)
favoriteButton.backgroundColor = .systemTeal
favoriteButton.layer.cornerRadius = 14
favoriteButton.addTarget(self, action: #selector(favoriteButtonPressed), for: .touchUpInside)

bookmarkButton.image = UIImage(systemName: "bookmark.circle")
bookmarkButton.tintColor = .systemTeal
let apGesture = UITapGestureRecognizer(target: self, action: #selector(favoriteButtonPressed))
bookmarkButton.addGestureRecognizer(apGesture)

optionsButton.image = UIImage(systemName: "ellipsis.circle.fill")
optionsButton.tintColor = .systemTeal
Expand Down Expand Up @@ -105,41 +97,40 @@ class AnimeHeaderCell: UITableViewCell {
aliasLabel.leadingAnchor.constraint(equalTo: titleLabel.leadingAnchor),
aliasLabel.trailingAnchor.constraint(equalTo: titleLabel.trailingAnchor),

favoriteButton.bottomAnchor.constraint(equalTo: animeImageView.bottomAnchor),
favoriteButton.leadingAnchor.constraint(equalTo: titleLabel.leadingAnchor),
favoriteButton.heightAnchor.constraint(equalToConstant: 30),
favoriteButton.widthAnchor.constraint(equalToConstant: 100),
bookmarkButton.bottomAnchor.constraint(equalTo: animeImageView.bottomAnchor),
bookmarkButton.trailingAnchor.constraint(equalTo: optionsButton.leadingAnchor, constant: -15),
bookmarkButton.widthAnchor.constraint(equalToConstant: 30),
bookmarkButton.heightAnchor.constraint(equalToConstant: 30),

optionsButton.centerYAnchor.constraint(equalTo: favoriteButton.centerYAnchor),
optionsButton.leadingAnchor.constraint(equalTo: favoriteButton.trailingAnchor, constant: 10),
optionsButton.bottomAnchor.constraint(equalTo: animeImageView.bottomAnchor),
optionsButton.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -15),
optionsButton.widthAnchor.constraint(equalToConstant: 30),
optionsButton.heightAnchor.constraint(equalToConstant: 30),

starIconImageView.topAnchor.constraint(equalTo: animeImageView.bottomAnchor, constant: 16),
starIconImageView.leadingAnchor.constraint(equalTo: animeImageView.leadingAnchor),
starIconImageView.widthAnchor.constraint(equalToConstant: 20),
starIconImageView.heightAnchor.constraint(equalToConstant: 20),

starLabel.bottomAnchor.constraint(equalTo: starIconImageView.bottomAnchor),
starLabel.leadingAnchor.constraint(equalTo: starIconImageView.trailingAnchor),

calendarIconImageView.topAnchor.constraint(equalTo: animeImageView.bottomAnchor, constant: 16),
calendarIconImageView.trailingAnchor.constraint(equalTo: airDateLabel.leadingAnchor),
calendarIconImageView.widthAnchor.constraint(equalToConstant: 20),
calendarIconImageView.heightAnchor.constraint(equalToConstant: 20),

airDateLabel.bottomAnchor.constraint(equalTo: calendarIconImageView.bottomAnchor),
airDateLabel.trailingAnchor.constraint(equalTo: titleLabel.trailingAnchor),

contentView.bottomAnchor.constraint(equalTo: calendarIconImageView.bottomAnchor, constant: 10)
])
}


@objc private func favoriteButtonPressed() {
favoriteButtonTapped?()
}

@objc private func optionsButtonTapped() {
showOptionsMenu?()
}
Expand Down Expand Up @@ -171,8 +162,8 @@ class AnimeHeaderCell: UITableViewCell {
}

private func updateFavoriteButtonState(isFavorite: Bool) {
let title = isFavorite ? "REMOVE" : "FAVORITE"
favoriteButton.setTitle(title, for: .normal)
favoriteButton.backgroundColor = isFavorite ? .systemGray : .systemTeal
let imageName = isFavorite ? "bookmark.circle.fill" : "bookmark.circle"
bookmarkButton.image = UIImage(systemName: imageName)
bookmarkButton.tintColor = isFavorite ? .systemYellow : .systemTeal
}
}

0 comments on commit 0f2708a

Please sign in to comment.