Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added handlebar to playerview #916

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,20 @@ public void onClick(DialogInterface dialog, int which) {
builder.create().show();
return true;
}

/**
* Override onBackPressed, so that the fileexplorer moves to the parent directory, until there is no parent. If there is no parent, close fileexplorer
*/
@Override
public void onBackPressed(){
File curPath = mListAdapter.getCurrentDir();
File newPath = curPath.getParentFile();

if (newPath != null){
setCurrentDir(newPath);
}else{
super.onBackPressed();
finish();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ protected void onFinishInflate() {

View handle = findViewById(mSliderHandleId);

//this is still needed because the libraryview handle is broken with the recursive one.
if (handle != null) {
if (handle instanceof ViewGroup) {
ViewGroup group = (ViewGroup)handle;
Expand All @@ -248,11 +249,30 @@ protected void onFinishInflate() {
handle.setOnTouchListener(this);
}
}

if (handle != null) {
attachListener(handle);
}
}


/**
* Attempts to stack all views orizontally in the available space
* Attaches the listener to any non-viewgroup element in a given view recursively
* @param view view to attach the listener to
*/
private void attachListener(View view){
if (view instanceof ViewGroup) {
ViewGroup group = (ViewGroup)view;
for (int i = 0; i < group.getChildCount(); i++) {
attachListener(((ViewGroup) view).getChildAt(i));
}
} else {
view.setOnTouchListener(this);
}
}

/**
* Attempts to stack all views horizontally in the available space
*/
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
Expand Down
Binary file added app/src/main/res/drawable-hdpi/grabberflat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/grabberflat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xhdpi/grabberflat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xxhdpi/grabberflat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions app/src/main/res/layout-v21/controls_handlebar.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2019 Felix Nüsse <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:vib="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:background="?overlay_background_color"
android:orientation="vertical"
android:elevation="2dp">

<!-- Only buttons are grabable, so we need an Imagebutton which is apropiately styled -->
<include
layout="@layout/controls"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<ImageButton
android:id="@+id/handlebar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:enabled="false"
android:paddingBottom="5dp"
android:src="@drawable/grabberflat" />

</LinearLayout>
122 changes: 64 additions & 58 deletions app/src/main/res/layout/controls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,66 +23,72 @@ THE SOFTWARE.

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:vib="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:background="?overlay_background_color"
android:orientation="horizontal"
android:elevation="2dp">
<ch.blinkenlights.android.vanilla.VanillaImageButton
android:id="@+id/shuffle"
android:paddingTop="@dimen/controls_padding"
android:paddingBottom="@dimen/controls_padding"
android:layout_height="fill_parent"
android:layout_width="0px"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/shuffle_inactive"
android:contentDescription="@string/cycle_shuffle_mode" />
<ch.blinkenlights.android.vanilla.VanillaImageButton
android:id="@+id/previous"
android:paddingTop="@dimen/controls_padding"
android:paddingBottom="@dimen/controls_padding"
android:layout_height="fill_parent"
android:layout_width="0px"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/previous"
android:contentDescription="@string/previous_song" />
<ch.blinkenlights.android.vanilla.VanillaImageButton
android:id="@+id/play_pause"
android:paddingTop="@dimen/controls_padding"
android:paddingBottom="@dimen/controls_padding"
android:layout_height="fill_parent"
android:layout_width="0px"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/play"
vib:backgroundCircleColor="?background_circle_color"
android:contentDescription="@string/play_pause" />
<ch.blinkenlights.android.vanilla.VanillaImageButton
android:id="@+id/next"
android:paddingTop="@dimen/controls_padding"
android:paddingBottom="@dimen/controls_padding"
android:layout_height="fill_parent"
android:layout_width="0px"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/next"
android:contentDescription="@string/next_song" />
<ch.blinkenlights.android.vanilla.VanillaImageButton
android:id="@+id/end_action"
android:paddingTop="@dimen/controls_padding"
android:paddingBottom="@dimen/controls_padding"
android:layout_height="fill_parent"
android:layout_width="0px"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:scaleType="fitCenter"
android:src="@drawable/repeat_inactive"
android:contentDescription="@string/cycle_repeat_mode" />
android:orientation="horizontal">


<ch.blinkenlights.android.vanilla.VanillaImageButton
android:id="@+id/shuffle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/cycle_shuffle_mode"
android:paddingTop="@dimen/controls_padding"
android:paddingBottom="@dimen/controls_padding"
android:scaleType="fitCenter"
android:src="@drawable/shuffle_inactive" />

<ch.blinkenlights.android.vanilla.VanillaImageButton
android:id="@+id/previous"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/previous_song"
android:paddingTop="@dimen/controls_padding"
android:paddingBottom="@dimen/controls_padding"
android:scaleType="fitCenter"
android:src="@drawable/previous" />

<ch.blinkenlights.android.vanilla.VanillaImageButton
android:id="@+id/play_pause"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/play_pause"
android:paddingTop="@dimen/controls_padding"
android:paddingBottom="@dimen/controls_padding"
android:scaleType="fitCenter"
android:src="@drawable/play"
vib:backgroundCircleColor="?background_circle_color" />

<ch.blinkenlights.android.vanilla.VanillaImageButton
android:id="@+id/next"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/next_song"
android:paddingTop="@dimen/controls_padding"
android:paddingBottom="@dimen/controls_padding"
android:scaleType="fitCenter"
android:src="@drawable/next" />

<ch.blinkenlights.android.vanilla.VanillaImageButton
android:id="@+id/end_action"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/cycle_repeat_mode"
android:paddingTop="@dimen/controls_padding"
android:paddingBottom="@dimen/controls_padding"
android:scaleType="fitCenter"
android:src="@drawable/repeat_inactive" />
</LinearLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/full_playback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ THE SOFTWARE.
android:elevation="2dp"
android:orientation="vertical">
<include layout="@layout/seek_bar" />
<include layout="@layout/controls" android:id="@+id/queue_slider" />
<include layout="@layout/controls_handlebar" android:id="@+id/queue_slider" />
</LinearLayout>


Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/full_playback_alt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ THE SOFTWARE.
android:elevation="2dp"
android:orientation="vertical">
<include layout="@layout/seek_bar" />
<include layout="@layout/controls" android:id="@+id/queue_slider" />
<include layout="@layout/controls_handlebar" android:id="@+id/queue_slider" />
</LinearLayout>

<fragment class="ch.blinkenlights.android.vanilla.ShowQueueFragment"
Expand Down
9 changes: 7 additions & 2 deletions app/src/main/res/layout/library_content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@ THE SOFTWARE.
</LinearLayout>

<include layout="@layout/seek_bar" />

<include layout="@layout/controls" />
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:background="?overlay_background_color"
android:elevation="2dp">
<include layout="@layout/controls" />
</LinearLayout>

<fragment class="ch.blinkenlights.android.vanilla.ShowQueueFragment"
android:id="@+id/queue"
Expand Down