Remove double tap ability in song selector in favor of a configurable single tap action
This commit is contained in:
parent
e86ca5dae5
commit
d9d78b0ea5
7
res/values/arrays.xml
Normal file
7
res/values/arrays.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="default_action_entries">
|
||||
<item>Play</item>
|
||||
<item>Enqueue</item>
|
||||
</string-array>
|
||||
</resources>
|
@ -41,7 +41,10 @@
|
||||
<string name="phone_input_summary">Enter filter text using buttons 1-9, where 1 matches 1, a, b or c, etc</string>
|
||||
|
||||
<string name="filter_suggestions_title">Use Suggestions in Filter Text</string>
|
||||
<string name="filter_suggestions_summary">Use text suggestions when editing the filter text</string>
|
||||
<string name="filter_suggestions_summary">Use text suggestions when editing the filter text</string>
|
||||
|
||||
<string name="default_action_title">Default Action</string>
|
||||
<string name="default_action_summary">What to do when an item is tapped</string>
|
||||
|
||||
<string name="scrobble_title">Use ScrobbleDroid API</string>
|
||||
<string name="scrobble_summary">Send song info to Last.FM scrobblers such as ScrobbleDroid and Simple Last.FM Scrobbler</string>
|
||||
|
@ -38,6 +38,13 @@
|
||||
android:title="@string/filter_suggestions_title"
|
||||
android:summary="@string/filter_suggestions_summary"
|
||||
android:defaultValue="false" />
|
||||
<ListPreference
|
||||
android:key="default_action"
|
||||
android:title="@string/default_action_title"
|
||||
android:summary="@string/default_action_summary"
|
||||
android:entries="@array/default_action_entries"
|
||||
android:entryValues="@array/default_action_entries"
|
||||
android:defaultValue="Play" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/pref_misc">
|
||||
<CheckBoxPreference
|
||||
|
@ -26,7 +26,6 @@ import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
@ -49,6 +48,8 @@ public class SongSelector extends TabActivity implements AdapterView.OnItemClick
|
||||
private View mClearButton;
|
||||
private AbstractAdapter[] mAdapters = new AbstractAdapter[3];
|
||||
|
||||
private int mDefaultAction;
|
||||
|
||||
private void initializeListView(int id, BaseAdapter adapter)
|
||||
{
|
||||
ListView view = (ListView)findViewById(id);
|
||||
@ -95,7 +96,9 @@ public class SongSelector extends TabActivity implements AdapterView.OnItemClick
|
||||
inputType = InputType.TYPE_CLASS_TEXT;
|
||||
mTextFilter.setInputType(inputType);
|
||||
|
||||
mHandler.post(new Runnable() {
|
||||
mDefaultAction = settings.getString("default_action", "Play").equals("Play") ? PlaybackService.ACTION_PLAY : PlaybackService.ACTION_ENQUEUE;
|
||||
|
||||
new Handler().post(new Runnable() {
|
||||
public void run()
|
||||
{
|
||||
mAdapters[1] = new AlbumAdapter(SongSelector.this, songs);
|
||||
@ -131,14 +134,7 @@ public class SongSelector extends TabActivity implements AdapterView.OnItemClick
|
||||
|
||||
public void onItemClick(AdapterView<?> list, View view, int pos, long id)
|
||||
{
|
||||
if (mHandler.hasMessages(MSG_ITEM_CLICK, list)) {
|
||||
mHandler.removeMessages(MSG_ITEM_CLICK, list);
|
||||
sendSongIntent(((AbstractAdapter)list.getAdapter()).buildSongIntent(PlaybackService.ACTION_ENQUEUE, pos));
|
||||
} else {
|
||||
Message message = mHandler.obtainMessage(MSG_ITEM_CLICK, list);
|
||||
message.arg1 = pos;
|
||||
mHandler.sendMessageDelayed(message, 333);
|
||||
}
|
||||
sendSongIntent(((AbstractAdapter)list.getAdapter()).buildSongIntent(mDefaultAction, pos));
|
||||
}
|
||||
|
||||
public void afterTextChanged(Editable editable)
|
||||
@ -167,21 +163,6 @@ public class SongSelector extends TabActivity implements AdapterView.OnItemClick
|
||||
}
|
||||
}
|
||||
|
||||
private static final int MSG_ITEM_CLICK = 0;
|
||||
|
||||
private Handler mHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message message)
|
||||
{
|
||||
switch (message.what) {
|
||||
case MSG_ITEM_CLICK:
|
||||
AbstractAdapter adapter = (AbstractAdapter)((ListView)message.obj).getAdapter();
|
||||
sendSongIntent(adapter.buildSongIntent(PlaybackService.ACTION_PLAY, message.arg1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private static final int MENU_PLAY = 0;
|
||||
private static final int MENU_ENQUEUE = 1;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user