Skip to content

Commit

Permalink
Merge pull request #484 from Chaphasilor/better-queue
Browse files Browse the repository at this point in the history
[Redesign] Brand New Queuing System ✨
  • Loading branch information
jmshrv authored Nov 21, 2023
2 parents 35a2301 + ce6ed6b commit 5d275a2
Show file tree
Hide file tree
Showing 51 changed files with 6,731 additions and 1,126 deletions.
1 change: 1 addition & 0 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
</manifest>
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
Expand Down
1 change: 1 addition & 0 deletions android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
</manifest>
26 changes: 13 additions & 13 deletions lib/at_contrast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,33 @@ extension AtContrast on Color {

double minLightness = 0.0;
double maxLightness = 1.0;
double diff = contrast - targetContrast;
double diff = contrast.abs() - targetContrast.abs();
int steps = 0;
int maxSteps = 25;

while (diff.abs() > _tolerance) {
// If diff is negative, we need more contrast.
while (diff < -_tolerance && steps < maxSteps) {
steps++;
print("$steps $diff");
// If diff is negative, we need more contrast. Otherwise, we need less
print("contrast: $steps $diff");
if (diff.isNegative) {
minLightness = hslColor.lightness;
if (lighter) {
minLightness = hslColor.lightness;
} else {
maxLightness = hslColor.lightness;
}

final lightDiff = maxLightness - hslColor.lightness;
final lightDiff =
lighter ? maxLightness - minLightness : minLightness - maxLightness;

hslColor = hslColor.withLightness(hslColor.lightness + lightDiff / 2);
} else {
maxLightness = hslColor.lightness;

final lightDiff = hslColor.lightness - minLightness;

hslColor = hslColor.withLightness(hslColor.lightness - lightDiff / 2);
}

contrast = contrastRatio(
hslColor.toColor().computeLuminance(),
backgroundLuminance,
);

diff = (contrast - targetContrast);
diff = (contrast.abs() - targetContrast.abs());
}

_atContrastLogger.info("Calculated contrast in $steps steps");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class _AddToPlaylistListState extends State<AddToPlaylistList> {
return AlbumItem(
album: snapshot.data![index],
parentType: snapshot.data![index].type,
isPlaylist: true,
onTap: () async {
try {
await jellyfinApiHelper.addItemstoPlaylist(
Expand Down
8 changes: 5 additions & 3 deletions lib/components/AlbumScreen/album_screen_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,15 @@ class _AlbumScreenContentState extends State<AlbumScreenContent> {
SliverAppBar(
title: Text(widget.parent.name ??
AppLocalizations.of(context)!.unknownName),
// 125 + 64 is the total height of the widget we use as a
// 125 + 186 is the total height of the widget we use as a
// FlexibleSpaceBar. We add the toolbar height since the widget
// should appear below the appbar.
// TODO: This height is affected by platform density.
expandedHeight: kToolbarHeight + 125 + 64,
expandedHeight: kToolbarHeight + 125 + 186,
pinned: true,
flexibleSpace: AlbumScreenContentFlexibleSpaceBar(
album: widget.parent,
parentItem: widget.parent,
isPlaylist: widget.parent.type == "Playlist",
items: widget.children,
),
actions: [
Expand Down Expand Up @@ -172,6 +173,7 @@ class _SongsSliverListState extends State<SongsSliverList> {
children: widget.childrenForQueue,
index: index + indexOffset,
parentId: widget.parent.id,
parentName: widget.parent.name,
onDelete: () {
final item = removeItem();
if (widget.onDelete != null) {
Expand Down
Loading

0 comments on commit 5d275a2

Please sign in to comment.