Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC-Android
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
319
Issues
319
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
VLC-Android
Commits
c7cb4e81
Commit
c7cb4e81
authored
Feb 16, 2017
by
Geoffrey Métais
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TV: fill audioplayer background with blurred cover
parent
9f67ac48
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
171 additions
and
140 deletions
+171
-140
vlc-android/res/layout/tv_audio_player.xml
vlc-android/res/layout/tv_audio_player.xml
+138
-129
vlc-android/res/values/styles.xml
vlc-android/res/values/styles.xml
+1
-0
vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
+2
-0
vlc-android/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
.../videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
+30
-11
No files found.
vlc-android/res/layout/tv_audio_player.xml
View file @
c7cb4e81
<?xml version="1.0" encoding="utf-8"?>
<
Linear
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
Frame
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_margin=
"10dp"
android:orientation=
"horizontal"
>
<!-- Cover & HUD -->
android:layout_height=
"match_parent"
>
<ImageView
android:id=
"@+id/background"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:scaleType=
"centerCrop"
/>
<LinearLayout
android:layout_width=
"
0dp
"
android:layout_width=
"
match_parent
"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/album_cover"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"3"
android:scaleType=
"fitCenter"
android:src=
"@drawable/icon"
/>
<!-- Media HUD -->
android:layout_margin=
"10dp"
android:orientation=
"horizontal"
>
<!-- Cover & HUD -->
<LinearLayout
android:layout_width=
"
wrap_content
"
android:layout_height=
"
0dp
"
android:layout_width=
"
0dp
"
android:layout_height=
"
match_parent
"
android:layout_weight=
"1"
android:gravity=
"center"
android:orientation=
"vertical"
android:paddingBottom=
"5dip"
android:paddingLeft=
"30dip"
android:paddingRight=
"30dip"
android:layout_gravity=
"center_horizontal"
>
<TextView
android:id=
"@+id/media_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Title"
android:textAppearance=
"@style/TextAppearance.AppCompat.SearchResult.Title"
/>
<TextView
android:id=
"@+id/media_artist"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Artist"
android:textAppearance=
"@style/TextAppearance.AppCompat.SearchResult.Subtitle"
/>
<ProgressBar
android:id=
"@+id/media_progress"
style=
"?android:attr/progressBarStyleHorizontal"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/album_cover"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"@dimen/half_default_margin"
android:layout_marginTop=
"@dimen/half_default_margin"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:indeterminate=
"false"
android:nextFocusDown=
"@+id/button_play"
android:nextFocusUp=
"@+id/playlist"
android:background=
"@drawable/background_item"
android:progressDrawable=
"@drawable/tv_audioprogressbar"
/>
<!-- Media control buttons -->
android:layout_height=
"0dp"
android:layout_weight=
"3"
android:scaleType=
"fitCenter"
android:src=
"@drawable/icon"
/>
<!-- Media HUD -->
<LinearLayout
android:id=
"@+id/media_controls"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:gravity=
"center"
android:orientation=
"vertical"
android:paddingBottom=
"5dip"
android:paddingLeft=
"30dip"
android:paddingRight=
"30dip"
android:layout_gravity=
"center_horizontal"
>
<
Image
View
android:id=
"@+id/
button_repeat
"
<
Text
View
android:id=
"@+id/
media_title
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginRight=
"10dp"
android:clickable=
"true"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:nextFocusDown=
"@+id/playlist"
android:nextFocusUp=
"@+id/media_progress"
android:onClick=
"onClick"
android:src=
"@drawable/ic_repeat_w"
/>
android:text=
"Title"
android:textAppearance=
"@style/TextAppearance.AppCompat.SearchResult.Title"
/>
<
Image
View
android:id=
"@+id/
button_previous
"
<
Text
View
android:id=
"@+id/
media_artist
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:clickable=
"true"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:nextFocusDown=
"@+id/playlist"
android:nextFocusUp=
"@+id/media_progress"
android:onClick=
"onClick"
android:src=
"@drawable/ic_previous_w"
/>
android:text=
"Artist"
android:textAppearance=
"@style/TextAppearance.AppCompat.SearchResult.Subtitle"
/>
<ImageView
android:id=
"@+id/button_play"
android:layout_width=
"wrap_content"
<ProgressBar
android:id=
"@+id/media_progress"
style=
"?android:attr/progressBarStyleHorizontal"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
android:clickable=
"true"
android:layout_marginBottom=
"@dimen/half_default_margin"
android:layout_marginTop=
"@dimen/half_default_margin"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:nextFocusDown=
"@+id/playlist"
android:nextFocusUp=
"@+id/media_progress"
android:onClick=
"onClick"
android:src=
"@drawable/ic_play_w"
>
<requestFocus/>
</ImageView>
<ImageView
android:id=
"@+id/button_next"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:clickable=
"true"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:nextFocusDown=
"@+id/playlist"
android:nextFocusUp=
"@+id/media_progress"
android:onClick=
"onClick"
android:src=
"@drawable/ic_next_w"
/>
android:indeterminate=
"false"
android:nextFocusDown=
"@+id/button_play"
android:nextFocusUp=
"@+id/playlist"
android:background=
"@drawable/background_item"
android:progressDrawable=
"@drawable/tv_audioprogressbar"
/>
<ImageView
android:id=
"@+id/button_shuffle"
<!-- Media control buttons -->
<LinearLayout
android:id=
"@+id/media_controls"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginLeft=
"10dp"
android:clickable=
"true"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:nextFocusDown=
"@+id/playlist"
android:nextFocusRight=
"@id/playlist"
android:nextFocusUp=
"@+id/media_progress"
android:onClick=
"onClick"
android:src=
"@drawable/ic_shuffle_w"
/>
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/button_repeat"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginRight=
"10dp"
android:clickable=
"true"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:nextFocusDown=
"@+id/playlist"
android:nextFocusUp=
"@+id/media_progress"
android:onClick=
"onClick"
android:src=
"@drawable/ic_repeat_w"
/>
<ImageView
android:id=
"@+id/button_previous"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:clickable=
"true"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:nextFocusDown=
"@+id/playlist"
android:nextFocusUp=
"@+id/media_progress"
android:onClick=
"onClick"
android:src=
"@drawable/ic_previous_w"
/>
<ImageView
android:id=
"@+id/button_play"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
android:clickable=
"true"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:nextFocusDown=
"@+id/playlist"
android:nextFocusUp=
"@+id/media_progress"
android:onClick=
"onClick"
android:src=
"@drawable/ic_play_w"
>
<requestFocus/>
</ImageView>
<ImageView
android:id=
"@+id/button_next"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:clickable=
"true"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:nextFocusDown=
"@+id/playlist"
android:nextFocusUp=
"@+id/media_progress"
android:onClick=
"onClick"
android:src=
"@drawable/ic_next_w"
/>
<ImageView
android:id=
"@+id/button_shuffle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginLeft=
"10dp"
android:clickable=
"true"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:nextFocusDown=
"@+id/playlist"
android:nextFocusRight=
"@id/playlist"
android:nextFocusUp=
"@+id/media_progress"
android:onClick=
"onClick"
android:src=
"@drawable/ic_shuffle_w"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- Playlist -->
<android.support.v7.widget.RecyclerView
android:id=
"@+id/playlist"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:nextFocusUp=
"@+id/playlist"
android:nextFocusLeft=
"@+id/button_shuffle"
android:nextFocusRight=
"@+id/button_play"
android:nextFocusDown=
"@+id/playlist"
android:scrollbars=
"vertical"
/>
</LinearLayout>
\ No newline at end of file
<!-- Playlist -->
<android.support.v7.widget.RecyclerView
android:id=
"@+id/playlist"
android:layout_width=
"0dp"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:focusable=
"true"
android:focusableInTouchMode=
"true"
android:nextFocusUp=
"@+id/playlist"
android:nextFocusLeft=
"@+id/button_shuffle"
android:nextFocusRight=
"@+id/button_play"
android:nextFocusDown=
"@+id/playlist"
android:scrollbars=
"vertical"
/>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
vlc-android/res/values/styles.xml
View file @
c7cb4e81
...
...
@@ -179,6 +179,7 @@
<item
name=
"imageCardViewInfoAreaStyle"
>
@style/VLCardViewInfoStyle
</item>
<item
name=
"imageCardViewTitleStyle"
>
@style/VLCardViewTitleStyle
</item>
<item
name=
"imageCardViewStyle"
>
@style/VLCardView
</item>
<item
name=
"audio_player_background_tint"
>
@color/grey900transparent
</item>
</style>
<style
name=
"VLCardView"
parent=
"Widget.Leanback.ImageCardViewStyle"
>
<item
name=
"cardType"
>
infoUnderWithExtra
</item>
...
...
vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
View file @
c7cb4e81
...
...
@@ -274,6 +274,8 @@ public class UiTools {
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
public
static
Bitmap
blurBitmap
(
Bitmap
bitmap
){
if
(
bitmap
==
null
)
return
null
;
//Let's create an empty bitmap with the same size of the bitmap we want to blur
Bitmap
outBitmap
=
Bitmap
.
createBitmap
(
bitmap
.
getWidth
(),
bitmap
.
getHeight
(),
Bitmap
.
Config
.
ARGB_8888
);
...
...
vlc-android/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
View file @
c7cb4e81
...
...
@@ -23,6 +23,7 @@ package org.videolan.vlc.gui.tv.audioplayer;
import
android.annotation.TargetApi
;
import
android.content.SharedPreferences
;
import
android.graphics.Bitmap
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.preference.PreferenceManager
;
...
...
@@ -42,11 +43,14 @@ import org.videolan.libvlc.MediaPlayer;
import
org.videolan.medialibrary.media.MediaWrapper
;
import
org.videolan.vlc.PlaybackService
;
import
org.videolan.vlc.R
;
import
org.videolan.vlc.VLCApplication
;
import
org.videolan.vlc.gui.helpers.AudioUtil
;
import
org.videolan.vlc.gui.helpers.MediaComparators
;
import
org.videolan.vlc.gui.helpers.UiTools
;
import
org.videolan.vlc.gui.preferences.PreferencesActivity
;
import
org.videolan.vlc.gui.tv.browser.BaseTvActivity
;
import
org.videolan.vlc.util.AndroidDevices
;
import
org.videolan.vlc.util.Strings
;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -71,7 +75,7 @@ public class AudioPlayerActivity extends BaseTvActivity implements PlaybackServi
private
boolean
mShuffling
=
false
;
private
TextView
mTitleTv
,
mArtistTv
;
private
ImageView
mPlayPauseButton
,
mCover
,
mNext
,
mShuffle
,
mRepeat
;
private
ImageView
mPlayPauseButton
,
mCover
,
mNext
,
mShuffle
,
mRepeat
,
mBackground
;
private
ProgressBar
mProgressBar
;
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -100,6 +104,7 @@ public class AudioPlayerActivity extends BaseTvActivity implements PlaybackServi
mRepeat
=
(
ImageView
)
findViewById
(
R
.
id
.
button_repeat
);
mProgressBar
=
(
ProgressBar
)
findViewById
(
R
.
id
.
media_progress
);
mCover
=
(
ImageView
)
findViewById
(
R
.
id
.
album_cover
);
mBackground
=
(
ImageView
)
findViewById
(
R
.
id
.
background
);
}
...
...
@@ -131,6 +136,8 @@ public class AudioPlayerActivity extends BaseTvActivity implements PlaybackServi
mService
.
load
(
mMediaList
,
mCurrentlyPlaying
);
}
else
{
mMediaList
=
medias
;
if
(
mCurrentlyPlaying
!=
mService
.
getCurrentMediaPosition
())
mService
.
playIndex
(
mCurrentlyPlaying
);
update
();
mAdapter
=
new
PlaylistAdapter
(
this
,
mMediaList
);
mRecyclerView
.
setAdapter
(
mAdapter
);
...
...
@@ -165,17 +172,29 @@ public class AudioPlayerActivity extends BaseTvActivity implements PlaybackServi
mTitleTv
.
setText
(
mService
.
getTitle
());
mArtistTv
.
setText
(
mService
.
getArtist
());
mProgressBar
.
setMax
((
int
)
mService
.
getLength
());
MediaWrapper
mw
=
mService
.
getCurrentMediaWrapper
();
Bitmap
cover
=
AudioUtil
.
getCover
(
this
,
mw
,
mCover
.
getWidth
());
if
(
cover
==
null
)
cover
=
AudioUtil
.
getCover
(
this
,
mService
.
getCurrentMediaWrapper
(),
512
);
if
(
cover
==
null
)
mCover
.
setImageResource
(
R
.
drawable
.
ic_tv_icon_big
);
else
mCover
.
setImageBitmap
(
cover
);
mCurrentlyPlaying
=
mService
.
getCurrentMediaPosition
();
mCurrentlyPlaying
=
mService
.
getCurrentMediaPosition
();
selectItem
(
mCurrentlyPlaying
);
VLCApplication
.
runBackground
(
new
Runnable
()
{
@Override
public
void
run
()
{
final
Bitmap
cover
=
AudioUtil
.
readCoverBitmap
(
Strings
.
removeFileProtocole
(
Uri
.
decode
(
mService
.
getCurrentMediaWrapper
().
getArtworkMrl
())),
mCover
.
getWidth
());
final
Bitmap
blurredCover
=
UiTools
.
blurBitmap
(
cover
);
VLCApplication
.
runOnMainThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
cover
==
null
)
{
mCover
.
setImageResource
(
R
.
drawable
.
ic_tv_icon_big
);
mBackground
.
clearColorFilter
();
mBackground
.
setImageResource
(
0
);
}
else
{
mCover
.
setImageBitmap
(
cover
);
mBackground
.
setColorFilter
(
UiTools
.
getColorFromAttribute
(
mBackground
.
getContext
(),
R
.
attr
.
audio_player_background_tint
));
mBackground
.
setImageBitmap
(
blurredCover
);
}
}
});
}
});
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment