Skip to content

Commit

Permalink
v1.10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
shadow5688 committed Aug 20, 2021
1 parent 724adb2 commit 1e715d0
Show file tree
Hide file tree
Showing 19 changed files with 528 additions and 422 deletions.
10 changes: 10 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: f4abaa0735eba4dfd8f33f73363911d63931fe03
channel: stable

project_type: app
76 changes: 0 additions & 76 deletions android/app/src/main/kotlin/com/shadow/blackhole/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,82 +1,6 @@
package com.shadow.blackhole

import android.graphics.Bitmap
import android.graphics.Color
import android.os.Handler
import android.view.PixelCopy
import android.view.View
import android.widget.FrameLayout
import android.widget.ImageView
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterSurfaceView
import io.flutter.embedding.android.TransparencyMode


class MainActivity : FlutterActivity() {
// hook into pause to create a screenshot of the UI
override fun onPause() {
val uiScreenshot = this.uiScreenshot ?: return
val uiSurfaceView = this.flutterSurfaceView ?: return

screenshotToken++

val uiBitmap = Bitmap.createBitmap(uiSurfaceView.width, uiSurfaceView.height, Bitmap.Config.ARGB_8888)
uiScreenshot.setImageBitmap(uiBitmap)
try {
PixelCopy.request(
uiSurfaceView, uiBitmap, {},
Handler()
)
} catch (e: IllegalArgumentException) {
}

super.onPause()
}

// hook into resume to remove the screenshot (free up resources)
override fun onResume() {
super.onResume()

val delay = 500L // give a bit of time for the Flutter UI to render the first frame
val screenshotToken = screenshotToken // don't increment token here!!!

Handler().postDelayed({
// ^ASYNC: still the same token?
if (screenshotToken == this.screenshotToken) {
uiScreenshot?.setImageDrawable(null)
}
}, delay)
}

// hook to place the container that contains the uiScreenshot layered below Flutter's UI view
override fun setContentView(view: View) {
uiScreenshot = ImageView(context)
container = FrameLayout(this).also {
it.setBackgroundColor(Color.WHITE)
it.addView(uiScreenshot)
it.addView(view, FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT))
super.setContentView(it)
}
}

// hook to remember the surface for taking screenshots
override fun onFlutterSurfaceViewCreated(flutterSurfaceView: FlutterSurfaceView) {
super.onFlutterSurfaceViewCreated(flutterSurfaceView)
this.flutterSurfaceView = flutterSurfaceView
}

// make the Flutter UI transparent to see the screenshot behind it
override fun getTransparencyMode(): TransparencyMode = TransparencyMode.transparent

// this container will wrap the uiScreenshot + Flutter's UI view
private var container: FrameLayout? = null

// UI screenshot taken in onPause
private var uiScreenshot: ImageView? = null

// token to guard against async race conditions
private var screenshotToken = 0

// the surface that Flutter uses to draw the UI
private var flutterSurfaceView: FlutterSurfaceView? = null
}
3 changes: 3 additions & 0 deletions lib/CustomWidgets/download_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class _DownloadButtonState extends State<DownloadButton> {
? Icons.download_rounded
: Icons.save_alt),
iconSize: 25.0,
color: Theme.of(context).iconTheme.color,
tooltip: 'Download',
onPressed: () {
down.prepareDownload(context, widget.data);
Expand Down Expand Up @@ -125,6 +126,7 @@ class _MultiDownloadButtonState extends State<MultiDownloadButton> {
Icons.save_alt_rounded,
),
iconSize: 25.0,
color: Theme.of(context).iconTheme.color,
tooltip: 'Download',
onPressed: () async {
for (final items in widget.data) {
Expand Down Expand Up @@ -230,6 +232,7 @@ class _AlbumDownloadButtonState extends State<AlbumDownloadButton> {
Icons.download_rounded,
),
iconSize: 25.0,
color: Theme.of(context).iconTheme.color,
tooltip: 'Download',
onPressed: () async {
ShowSnackBar().showSnackBar(
Expand Down
2 changes: 1 addition & 1 deletion lib/CustomWidgets/gradient_containers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class _GradientContainerState extends State<GradientContainer> {
? currentTheme.getTransBackGradient()
: currentTheme.getBackGradient())
: [
const Color(0xfff5f9ff),
Colors.white,
Theme.of(context).canvasColor,
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/CustomWidgets/like_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class _LikeButtonState extends State<LikeButton> {
return IconButton(
icon: Icon(
liked ? Icons.favorite_rounded : Icons.favorite_border_rounded,
color: liked ? Colors.redAccent : null,
color: liked ? Colors.redAccent : Theme.of(context).iconTheme.color,
),
iconSize: widget.size ?? 24.0,
tooltip: liked ? 'Unlike' : 'Like',
Expand Down
1 change: 1 addition & 0 deletions lib/Helpers/format.dart
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ class FormatResponse {
'charts',
'new_albums',
'top_playlists',
// 'radio',
// 'city_mod',
// 'artist_recos',
...promoList
Expand Down
15 changes: 11 additions & 4 deletions lib/Screens/About/about.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,17 @@ class _AboutScreenState extends State<AboutScreen> {
const SizedBox(
height: 20,
),
const SizedBox(
width: 150,
child:
Image(image: AssetImage('assets/ic_launcher.png'))),
Card(
elevation: 15,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100.0),
),
clipBehavior: Clip.antiAlias,
child: const SizedBox(
width: 150,
child: Image(
image: AssetImage('assets/ic_launcher.png'))),
),
const SizedBox(height: 20),
const Text(
'BlackHole',
Expand Down
54 changes: 26 additions & 28 deletions lib/Screens/Home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,9 @@ class _HomePageState extends State<HomePage> {
}

final ScrollController _scrollController = ScrollController();
ValueNotifier<double> _size = ValueNotifier<double>(0.0);

void _scrollListener() {
_size.value = _scrollController.offset.roundToDouble();
}

@override
void initState() {
_scrollController.addListener(_scrollListener);
super.initState();
}

Expand Down Expand Up @@ -313,9 +307,6 @@ class _HomePageState extends State<HomePage> {
physics: const CustomPhysics(),
onPageChanged: (indx) {
_selectedIndex.value = indx;
if (indx == 0) {
_size = ValueNotifier<double>(0.0);
}
},
controller: pageController,
children: [
Expand Down Expand Up @@ -440,22 +431,32 @@ class _HomePageState extends State<HomePage> {
toolbarHeight: 65,
title: Align(
alignment: Alignment.centerRight,
child: ValueListenableBuilder(
valueListenable: _size,
builder:
(context, double value, child) {
child: AnimatedBuilder(
animation: _scrollController,
builder: (context, child) {
return AnimatedContainer(
width: max(
MediaQuery.of(context)
.size
.width -
value,
MediaQuery.of(context)
.size
.width -
75),
width: (!_scrollController
.hasClients ||
_scrollController
// ignore: invalid_use_of_protected_member
.positions
.length >
1)
? MediaQuery.of(context)
.size
.width
: max(
MediaQuery.of(context)
.size
.width -
_scrollController.offset
.roundToDouble(),
MediaQuery.of(context)
.size
.width -
75),
duration: const Duration(
milliseconds: 300),
milliseconds: 150),
padding: const EdgeInsets.all(2.0),
// margin: EdgeInsets.zero,
decoration: BoxDecoration(
Expand All @@ -467,7 +468,7 @@ class _HomePageState extends State<HomePage> {
BoxShadow(
color: Colors.black26,
blurRadius: 5.0,
offset: Offset(0.0, 3.0),
offset: Offset(1.5, 1.5),
// shadow direction: bottom right
)
],
Expand Down Expand Up @@ -540,10 +541,7 @@ class _HomePageState extends State<HomePage> {
child: IconButton(
icon: const Icon(
Icons.horizontal_split_rounded),
color: Theme.of(context).brightness ==
Brightness.dark
? null
: Colors.grey[700],
color: Theme.of(context).iconTheme.color,
onPressed: () {
Scaffold.of(context).openDrawer();
},
Expand Down
5 changes: 4 additions & 1 deletion lib/Screens/Home/saavn.dart
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,10 @@ class _SaavnHomePageState extends State<SaavnHomePage> {
Card(
elevation: 5,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
borderRadius: BorderRadius.circular(
item['type'] == 'radio_station'
? 100.0
: 10.0),
),
clipBehavior: Clip.antiAlias,
child: CachedNetworkImage(
Expand Down
Loading

0 comments on commit 1e715d0

Please sign in to comment.