-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update progress/recording indicator for Live TV and Radio
Update the indicators for progress and recording to a progress bar. The progress bar is located on the left side, uses dark gray background and Kodi blue for the progress. Total runtime is located right aligned and under the bar. The recording indicator is located in a reserved area left of the runtime. In the EPG the highlighting is done by changing the cell background and letting the start time label use a bigger font size and label color.
- Loading branch information
Showing
4 changed files
with
147 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// ProgressBarView.h | ||
// Kodi Remote | ||
// | ||
// Created by Buschmann on 27.12.24. | ||
// Copyright © 2024 Team Kodi. All rights reserved. | ||
// | ||
|
||
#ifndef ProgressBarView_h | ||
#define ProgressBarView_h | ||
|
||
@interface ProgressBarView : UIView { | ||
UIView *progressBarMask; | ||
UIView *progressBar; | ||
} | ||
|
||
- (void)setProgressBarFrame:(CGRect)frame; | ||
- (void)setProgressBarPercentage:(CGFloat)progressPercentage; | ||
|
||
@property (nonatomic, readonly) UILabel *barLabel; | ||
@property (nonatomic, readonly) UIView *reservedArea; | ||
|
||
@end | ||
|
||
#endif /* ProgressBarView_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// ProgressBarView.m | ||
// Kodi Remote | ||
// | ||
// Created by Buschmann on 27.12.24. | ||
// Copyright © 2024 Team Kodi. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "ProgressBarView.h" | ||
#import "Utilities.h" | ||
|
||
#define RESERVED_WIDTH 14 | ||
#define PROGRESSBAR_HEIGHT 8 | ||
#define PROGRESSBAR_RADIUS 2 | ||
#define FONT_SIZE 10 | ||
|
||
@implementation ProgressBarView | ||
|
||
@synthesize barLabel; | ||
@synthesize reservedArea; | ||
|
||
- (id)initWithFrame:(CGRect)frame { | ||
self = [super initWithFrame:frame]; | ||
if (self) { | ||
[self createProgressBar]; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)createProgressBar { | ||
progressBarMask = [UIView new]; | ||
progressBarMask.backgroundColor = UIColor.darkGrayColor; | ||
progressBarMask.layer.cornerRadius = PROGRESSBAR_RADIUS; | ||
progressBarMask.clipsToBounds = YES; | ||
[self addSubview:progressBarMask]; | ||
|
||
progressBar = [UIView new]; | ||
progressBar.backgroundColor = KODI_BLUE_COLOR; | ||
[progressBarMask addSubview:progressBar]; | ||
|
||
reservedArea = [UILabel new]; | ||
[self addSubview:reservedArea]; | ||
|
||
barLabel = [UILabel new]; | ||
barLabel.font = [UIFont systemFontOfSize:FONT_SIZE]; | ||
barLabel.adjustsFontSizeToFitWidth = YES; | ||
barLabel.minimumScaleFactor = FONT_SCALING_MIN; | ||
barLabel.textAlignment = NSTextAlignmentRight; | ||
barLabel.textColor = [Utilities get1stLabelColor]; | ||
[self addSubview:barLabel]; | ||
} | ||
|
||
- (void)setProgressBarFrame:(CGRect)frame { | ||
self.frame = frame; | ||
CGFloat labelHeight = CGRectGetHeight(frame) - PROGRESSBAR_HEIGHT; | ||
CGFloat labelWidth = CGRectGetWidth(frame) - RESERVED_WIDTH; | ||
barLabel.frame = CGRectMake(RESERVED_WIDTH, PROGRESSBAR_HEIGHT, labelWidth, labelHeight); | ||
reservedArea.frame = CGRectMake(0, PROGRESSBAR_HEIGHT, RESERVED_WIDTH, labelHeight); | ||
progressBarMask.frame = CGRectMake(0, 0, CGRectGetWidth(frame), PROGRESSBAR_HEIGHT); | ||
progressBar.frame = CGRectMake(0, 0, 0, PROGRESSBAR_HEIGHT); | ||
} | ||
|
||
- (void)setProgressBarPercentage:(CGFloat)progressPercentage { | ||
CGRect frame = progressBar.frame; | ||
frame.size.width = ceil(progressPercentage / 100.0 * CGRectGetWidth(self.frame)); | ||
progressBar.frame = frame; | ||
} | ||
|
||
@end |