Merge branch 'searchbar'
This commit is contained in:
commit
5a26a09309
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:shape="rectangle">
|
|
||||||
<gradient
|
|
||||||
android:endColor="#ff555555"
|
|
||||||
android:startColor="#ff333333"
|
|
||||||
android:angle="90" />
|
|
||||||
</shape>
|
|
@ -41,32 +41,5 @@ THE SOFTWARE.
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="fill_parent" />
|
android:layout_height="fill_parent" />
|
||||||
</HorizontalScrollView>
|
</HorizontalScrollView>
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/search_box"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
android:paddingTop="4dip"
|
|
||||||
android:paddingLeft="4dip"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:background="@drawable/search_background">
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/filter_text"
|
|
||||||
android:layout_width="0px"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:inputType="textFilter" />
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/clear_button"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:paddingLeft="4dip"
|
|
||||||
android:paddingRight="4dip"
|
|
||||||
android:paddingBottom="4dip"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:src="@drawable/close"
|
|
||||||
android:contentDescription="@string/clear_search" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2012 Christopher Eby <kreed@kreed.org>
|
* Copyright (C) 2015 Adrian Ulrich <adrian@blinkenlights.ch>
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -24,14 +24,20 @@ package ch.blinkenlights.android.vanilla;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.View;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LinearLayout that contains some hacks for sizing inside an ActionBar.
|
* LinearLayout that contains some hacks for sizing inside an ActionBar.
|
||||||
*/
|
*/
|
||||||
public class ActionBarControls extends LinearLayout {
|
public class ActionBarControls extends LinearLayout {
|
||||||
|
|
||||||
|
private final int dpiMaxWidth = 350;
|
||||||
|
private final int dpiCompatMax = 200;
|
||||||
|
private final int dpiElement = 50;
|
||||||
|
private final int slackElements = 2;
|
||||||
|
|
||||||
public ActionBarControls(Context context, AttributeSet attrs)
|
public ActionBarControls(Context context, AttributeSet attrs)
|
||||||
{
|
{
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
@ -40,22 +46,40 @@ public class ActionBarControls extends LinearLayout {
|
|||||||
@Override
|
@Override
|
||||||
public void onMeasure(int ws, int hs)
|
public void onMeasure(int ws, int hs)
|
||||||
{
|
{
|
||||||
|
ViewGroup parent = (ViewGroup)this.getParent();
|
||||||
|
int pxUsed = 0; // pixels used by child elements, excluding us
|
||||||
|
int pxTotal = 0; // pixels we can actually use
|
||||||
|
|
||||||
|
// Measure how much space we got and how much is already used
|
||||||
|
// by other children
|
||||||
|
if (parent != null) {
|
||||||
|
// We are item 0, so we skip ourselfs
|
||||||
|
for (int i=1; i<parent.getChildCount(); i++) {
|
||||||
|
pxUsed += parent.getChildAt(i).getWidth();
|
||||||
|
}
|
||||||
|
View topParent = (View)parent.getParent();
|
||||||
|
if (topParent != null) {
|
||||||
|
pxTotal = topParent.getWidth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final float density = getResources().getDisplayMetrics().density;
|
||||||
|
int widthMode = MeasureSpec.getMode(ws);
|
||||||
|
|
||||||
super.onMeasure(ws, hs);
|
super.onMeasure(ws, hs);
|
||||||
|
|
||||||
float density = getResources().getDisplayMetrics().density;
|
if (widthMode != MeasureSpec.EXACTLY && pxTotal > 0) {
|
||||||
|
int pxAvailable = (pxTotal - (int)(density * dpiElement * slackElements));
|
||||||
|
int pxMaxWidth = (int)(dpiMaxWidth * density);
|
||||||
|
|
||||||
int width = MeasureSpec.getSize(ws);
|
if (pxAvailable <= 0 || pxAvailable > pxMaxWidth) {
|
||||||
int widthMode = MeasureSpec.getMode(ws);
|
pxAvailable = pxMaxWidth;
|
||||||
if (widthMode != MeasureSpec.EXACTLY)
|
}
|
||||||
width = (int)(200 * density);
|
if (android.os.Build.VERSION.SDK_INT < 21) {
|
||||||
|
pxAvailable = (int)(dpiCompatMax * density);
|
||||||
setMeasuredDimension(width, (int)(40 * density));
|
}
|
||||||
|
setMeasuredDimension( pxAvailable, (int)(dpiElement * density));
|
||||||
ViewGroup.LayoutParams lp = getLayoutParams();
|
|
||||||
try {
|
|
||||||
lp.getClass().getField("expandable").set(lp, true);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.d("VanillaMusic", "Failed to set controls expandable", e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ import android.provider.MediaStore;
|
|||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.TextWatcher;
|
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@ -60,6 +59,7 @@ import android.widget.ListView;
|
|||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
import android.widget.SearchView;
|
||||||
|
|
||||||
import com.viewpagerindicator.TabPageIndicator;
|
import com.viewpagerindicator.TabPageIndicator;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -70,9 +70,9 @@ import junit.framework.Assert;
|
|||||||
*/
|
*/
|
||||||
public class LibraryActivity
|
public class LibraryActivity
|
||||||
extends PlaybackActivity
|
extends PlaybackActivity
|
||||||
implements TextWatcher
|
implements DialogInterface.OnClickListener
|
||||||
, DialogInterface.OnClickListener
|
|
||||||
, DialogInterface.OnDismissListener
|
, DialogInterface.OnDismissListener
|
||||||
|
, SearchView.OnQueryTextListener
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@ -126,19 +126,10 @@ public class LibraryActivity
|
|||||||
SongTimeline.MODE_PLAY_ID_FIRST, SongTimeline.MODE_ENQUEUE_ID_FIRST,
|
SongTimeline.MODE_PLAY_ID_FIRST, SongTimeline.MODE_ENQUEUE_ID_FIRST,
|
||||||
-1, -1, -1, SongTimeline.MODE_ENQUEUE_AS_NEXT };
|
-1, -1, -1, SongTimeline.MODE_ENQUEUE_AS_NEXT };
|
||||||
|
|
||||||
private static final String SEARCH_BOX_VISIBLE = "search_box_visible";
|
|
||||||
|
|
||||||
public ViewPager mViewPager;
|
public ViewPager mViewPager;
|
||||||
private TabPageIndicator mTabs;
|
private TabPageIndicator mTabs;
|
||||||
|
|
||||||
private View mSearchBox;
|
|
||||||
private boolean mSearchBoxVisible;
|
|
||||||
|
|
||||||
private TextView mTextFilter;
|
|
||||||
private View mClearButton;
|
|
||||||
|
|
||||||
private View mActionControls;
|
private View mActionControls;
|
||||||
private View mControls;
|
|
||||||
private TextView mTitle;
|
private TextView mTitle;
|
||||||
private TextView mArtist;
|
private TextView mArtist;
|
||||||
private ImageView mCover;
|
private ImageView mCover;
|
||||||
@ -181,14 +172,6 @@ public class LibraryActivity
|
|||||||
|
|
||||||
setContentView(R.layout.library_content);
|
setContentView(R.layout.library_content);
|
||||||
|
|
||||||
mSearchBox = findViewById(R.id.search_box);
|
|
||||||
|
|
||||||
mTextFilter = (TextView)findViewById(R.id.filter_text);
|
|
||||||
mTextFilter.addTextChangedListener(this);
|
|
||||||
|
|
||||||
mClearButton = findViewById(R.id.clear_button);
|
|
||||||
mClearButton.setOnClickListener(this);
|
|
||||||
|
|
||||||
mLimiterScroller = (HorizontalScrollView)findViewById(R.id.limiter_scroller);
|
mLimiterScroller = (HorizontalScrollView)findViewById(R.id.limiter_scroller);
|
||||||
mLimiterViews = (ViewGroup)findViewById(R.id.limiter_layout);
|
mLimiterViews = (ViewGroup)findViewById(R.id.limiter_layout);
|
||||||
|
|
||||||
@ -231,10 +214,6 @@ public class LibraryActivity
|
|||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
SharedPreferences settings = PlaybackService.getSettings(this);
|
SharedPreferences settings = PlaybackService.getSettings(this);
|
||||||
if (settings.getBoolean(PrefKeys.CONTROLS_IN_SELECTOR, false) != (mControls != null)) {
|
|
||||||
finish();
|
|
||||||
startActivity(new Intent(this, LibraryActivity.class));
|
|
||||||
}
|
|
||||||
mDefaultAction = Integer.parseInt(settings.getString(PrefKeys.DEFAULT_ACTION_INT, "7"));
|
mDefaultAction = Integer.parseInt(settings.getString(PrefKeys.DEFAULT_ACTION_INT, "7"));
|
||||||
mLastActedId = LibraryAdapter.INVALID_ID;
|
mLastActedId = LibraryAdapter.INVALID_ID;
|
||||||
updateHeaders();
|
updateHeaders();
|
||||||
@ -292,68 +271,45 @@ public class LibraryActivity
|
|||||||
loadAlbumIntent(intent);
|
loadAlbumIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRestoreInstanceState(Bundle in)
|
|
||||||
{
|
|
||||||
if (in.getBoolean(SEARCH_BOX_VISIBLE))
|
|
||||||
setSearchBoxVisible(true);
|
|
||||||
super.onRestoreInstanceState(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSaveInstanceState(Bundle out)
|
|
||||||
{
|
|
||||||
super.onSaveInstanceState(out);
|
|
||||||
out.putBoolean(SEARCH_BOX_VISIBLE, mSearchBoxVisible);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyUp(int keyCode, KeyEvent event)
|
public boolean onKeyUp(int keyCode, KeyEvent event)
|
||||||
{
|
{
|
||||||
switch (keyCode) {
|
switch (keyCode) {
|
||||||
case KeyEvent.KEYCODE_BACK:
|
case KeyEvent.KEYCODE_BACK:
|
||||||
if (mSearchBoxVisible) {
|
Limiter limiter = mPagerAdapter.getCurrentLimiter();
|
||||||
mTextFilter.setText("");
|
if (limiter != null) {
|
||||||
setSearchBoxVisible(false);
|
int pos = -1;
|
||||||
} else {
|
switch (limiter.type) {
|
||||||
Limiter limiter = mPagerAdapter.getCurrentLimiter();
|
case MediaUtils.TYPE_ALBUM:
|
||||||
if (limiter != null) {
|
setLimiter(MediaUtils.TYPE_ARTIST, limiter.data.toString());
|
||||||
int pos = -1;
|
pos = mPagerAdapter.mAlbumsPosition;
|
||||||
switch (limiter.type) {
|
break;
|
||||||
case MediaUtils.TYPE_ALBUM:
|
case MediaUtils.TYPE_ARTIST:
|
||||||
setLimiter(MediaUtils.TYPE_ARTIST, limiter.data.toString());
|
mPagerAdapter.clearLimiter(MediaUtils.TYPE_ARTIST);
|
||||||
pos = mPagerAdapter.mAlbumsPosition;
|
pos = mPagerAdapter.mArtistsPosition;
|
||||||
break;
|
break;
|
||||||
case MediaUtils.TYPE_ARTIST:
|
case MediaUtils.TYPE_GENRE:
|
||||||
mPagerAdapter.clearLimiter(MediaUtils.TYPE_ARTIST);
|
mPagerAdapter.clearLimiter(MediaUtils.TYPE_GENRE);
|
||||||
pos = mPagerAdapter.mArtistsPosition;
|
pos = mPagerAdapter.mGenresPosition;
|
||||||
break;
|
break;
|
||||||
case MediaUtils.TYPE_GENRE:
|
case MediaUtils.TYPE_FILE:
|
||||||
mPagerAdapter.clearLimiter(MediaUtils.TYPE_GENRE);
|
if(limiter.names.length > 1) {
|
||||||
pos = mPagerAdapter.mGenresPosition;
|
File parentFile = ((File)limiter.data).getParentFile();
|
||||||
break;
|
mPagerAdapter.setLimiter(FileSystemAdapter.buildLimiter(parentFile));
|
||||||
case MediaUtils.TYPE_FILE:
|
|
||||||
if(limiter.names.length > 1) {
|
|
||||||
File parentFile = ((File)limiter.data).getParentFile();
|
|
||||||
mPagerAdapter.setLimiter(FileSystemAdapter.buildLimiter(parentFile));
|
|
||||||
} else {
|
|
||||||
mPagerAdapter.clearLimiter(MediaUtils.TYPE_FILE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (pos == -1) {
|
|
||||||
updateLimiterViews();
|
|
||||||
} else {
|
} else {
|
||||||
mViewPager.setCurrentItem(pos);
|
mPagerAdapter.clearLimiter(MediaUtils.TYPE_FILE);
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
|
if (pos == -1) {
|
||||||
|
updateLimiterViews();
|
||||||
|
} else {
|
||||||
|
mViewPager.setCurrentItem(pos);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KeyEvent.KEYCODE_SEARCH:
|
|
||||||
setSearchBoxVisible(!mSearchBoxVisible);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -373,14 +329,6 @@ public class LibraryActivity
|
|||||||
if (super.onKeyDown(keyCode, event))
|
if (super.onKeyDown(keyCode, event))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (mTextFilter.onKeyDown(keyCode, event)) {
|
|
||||||
if (!mSearchBoxVisible)
|
|
||||||
setSearchBoxVisible(true);
|
|
||||||
else
|
|
||||||
mTextFilter.requestFocus();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,22 +451,6 @@ public class LibraryActivity
|
|||||||
expand(rowData);
|
expand(rowData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable editable)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence text, int start, int before, int count)
|
|
||||||
{
|
|
||||||
mPagerAdapter.setFilter(text.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create or recreate the limiter breadcrumbs.
|
* Create or recreate the limiter breadcrumbs.
|
||||||
*/
|
*/
|
||||||
@ -558,12 +490,7 @@ public class LibraryActivity
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View view)
|
public void onClick(View view)
|
||||||
{
|
{
|
||||||
if (view == mClearButton) {
|
if (view == mCover || view == mActionControls) {
|
||||||
if (mTextFilter.getText().length() == 0)
|
|
||||||
setSearchBoxVisible(false);
|
|
||||||
else
|
|
||||||
mTextFilter.setText("");
|
|
||||||
} else if (view == mCover || view == mActionControls) {
|
|
||||||
openPlaybackActivity();
|
openPlaybackActivity();
|
||||||
} else if (view == mEmptyQueue) {
|
} else if (view == mEmptyQueue) {
|
||||||
setState(PlaybackService.get(this).setFinishAction(SongTimeline.FINISH_RANDOM));
|
setState(PlaybackService.get(this).setFinishAction(SongTimeline.FINISH_RANDOM));
|
||||||
@ -834,9 +761,14 @@ public class LibraryActivity
|
|||||||
{
|
{
|
||||||
MenuItem controls = menu.add(null);
|
MenuItem controls = menu.add(null);
|
||||||
controls.setActionView(mActionControls);
|
controls.setActionView(mActionControls);
|
||||||
controls.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
controls.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
|
|
||||||
MenuItem search = menu.add(0, MENU_SEARCH, 0, R.string.search).setIcon(R.drawable.ic_menu_search);
|
MenuItem search = menu.add(0, MENU_SEARCH, 0, R.string.search).setIcon(R.drawable.ic_menu_search);
|
||||||
search.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
search.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW | MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
|
SearchView mSearchView = new SearchView(getActionBar().getThemedContext());
|
||||||
|
mSearchView.setOnQueryTextListener(this);
|
||||||
|
search.setActionView(mSearchView);
|
||||||
|
|
||||||
menu.add(0, MENU_SORT, 0, R.string.sort_by).setIcon(R.drawable.ic_menu_sort_alphabetically);
|
menu.add(0, MENU_SORT, 0, R.string.sort_by).setIcon(R.drawable.ic_menu_sort_alphabetically);
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
@ -854,7 +786,7 @@ public class LibraryActivity
|
|||||||
{
|
{
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case MENU_SEARCH:
|
case MENU_SEARCH:
|
||||||
setSearchBoxVisible(!mSearchBoxVisible);
|
// this does nothing: expanding ishandled by mSearchView
|
||||||
return true;
|
return true;
|
||||||
case MENU_PLAYBACK:
|
case MENU_PLAYBACK:
|
||||||
openPlaybackActivity();
|
openPlaybackActivity();
|
||||||
@ -896,6 +828,24 @@ public class LibraryActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback of mSearchView while user types in text
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean onQueryTextChange (String newText) {
|
||||||
|
mPagerAdapter.setFilter(newText);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback of mSearchViews submit action
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean onQueryTextSubmit (String query) {
|
||||||
|
mPagerAdapter.setFilter(query);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the current page, passed in arg1, to SharedPreferences.
|
* Save the current page, passed in arg1, to SharedPreferences.
|
||||||
*/
|
*/
|
||||||
@ -924,40 +874,11 @@ public class LibraryActivity
|
|||||||
mPagerAdapter.invalidateData();
|
mPagerAdapter.invalidateData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSearchBoxVisible(boolean visible)
|
|
||||||
{
|
|
||||||
mSearchBoxVisible = visible;
|
|
||||||
mSearchBox.setVisibility(visible ? View.VISIBLE : View.GONE);
|
|
||||||
if (mControls != null) {
|
|
||||||
mControls.setVisibility(visible || (mState & PlaybackService.FLAG_NO_MEDIA) != 0 ? View.GONE : View.VISIBLE);
|
|
||||||
} else if (mActionControls != null) {
|
|
||||||
// try to hide the bottom action bar
|
|
||||||
ViewParent parent = mActionControls.getParent();
|
|
||||||
if (parent != null)
|
|
||||||
parent = parent.getParent();
|
|
||||||
if (parent != null && parent instanceof ViewGroup) {
|
|
||||||
ViewGroup ab = (ViewGroup)parent;
|
|
||||||
if (ab.getChildCount() == 1) {
|
|
||||||
ab.setVisibility(visible ? View.GONE : View.VISIBLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (visible) {
|
|
||||||
mTextFilter.requestFocus();
|
|
||||||
((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).showSoftInput(mTextFilter, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStateChange(int state, int toggled)
|
protected void onStateChange(int state, int toggled)
|
||||||
{
|
{
|
||||||
super.onStateChange(state, toggled);
|
super.onStateChange(state, toggled);
|
||||||
|
|
||||||
if ((toggled & PlaybackService.FLAG_NO_MEDIA) != 0) {
|
|
||||||
// update visibility of controls
|
|
||||||
setSearchBoxVisible(mSearchBoxVisible);
|
|
||||||
}
|
|
||||||
if ((toggled & PlaybackService.FLAG_EMPTY_QUEUE) != 0 && mEmptyQueue != null) {
|
if ((toggled & PlaybackService.FLAG_EMPTY_QUEUE) != 0 && mEmptyQueue != null) {
|
||||||
mEmptyQueue.setVisibility((state & PlaybackService.FLAG_EMPTY_QUEUE) == 0 ? View.GONE : View.VISIBLE);
|
mEmptyQueue.setVisibility((state & PlaybackService.FLAG_EMPTY_QUEUE) == 0 ? View.GONE : View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ package ch.blinkenlights.android.vanilla;
|
|||||||
* SharedPreference keys. Must be kept in sync with keys in res/xml/prefs_*.xml.
|
* SharedPreference keys. Must be kept in sync with keys in res/xml/prefs_*.xml.
|
||||||
*/
|
*/
|
||||||
public class PrefKeys {
|
public class PrefKeys {
|
||||||
public static final String CONTROLS_IN_SELECTOR = "controls_in_selector";
|
|
||||||
public static final String COVER_LONGPRESS_ACTION = "cover_longpress_action";
|
public static final String COVER_LONGPRESS_ACTION = "cover_longpress_action";
|
||||||
public static final String COVER_PRESS_ACTION = "cover_press_action";
|
public static final String COVER_PRESS_ACTION = "cover_press_action";
|
||||||
public static final String DEFAULT_ACTION_INT = "default_action_int";
|
public static final String DEFAULT_ACTION_INT = "default_action_int";
|
||||||
|
@ -180,8 +180,6 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
{
|
{
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
addPreferencesFromResource(R.xml.preference_library);
|
addPreferencesFromResource(R.xml.preference_library);
|
||||||
PreferenceGroup group = getPreferenceScreen();
|
|
||||||
group.removePreference(group.findPreference("controls_in_selector"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user