Make repeat/shuffle buttons instead of menu items
BIN
orig/random_active.svgz
Normal file
BIN
orig/repeat_active.svgz
Normal file
BIN
orig/repeat_current_active.svgz
Normal file
BIN
orig/repeat_inactive.svgz
Normal file
BIN
orig/shuffle_active.svgz
Normal file
BIN
orig/shuffle_album_active.svgz
Normal file
BIN
orig/shuffle_inactive.svgz
Normal file
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 4.0 KiB |
BIN
res/drawable-hdpi/random_active.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
res/drawable-hdpi/repeat_active.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
res/drawable-hdpi/repeat_current_active.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
res/drawable-hdpi/repeat_inactive.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
res/drawable-hdpi/shuffle_active.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
res/drawable-hdpi/shuffle_album_active.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
res/drawable-hdpi/shuffle_inactive.png
Normal file
After Width: | Height: | Size: 846 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.1 KiB |
BIN
res/drawable-mdpi/random_active.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/drawable-mdpi/repeat_active.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
res/drawable-mdpi/repeat_current_active.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
res/drawable-mdpi/repeat_inactive.png
Normal file
After Width: | Height: | Size: 861 B |
BIN
res/drawable-mdpi/shuffle_active.png
Normal file
After Width: | Height: | Size: 737 B |
BIN
res/drawable-mdpi/shuffle_album_active.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
res/drawable-mdpi/shuffle_inactive.png
Normal file
After Width: | Height: | Size: 588 B |
@ -63,6 +63,14 @@ THE SOFTWARE.
|
|||||||
android:layout_margin="0dip"
|
android:layout_margin="0dip"
|
||||||
android:background="#a000"
|
android:background="#a000"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/shuffle"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="0px"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@null"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/shuffle_inactive" />
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/previous"
|
android:id="@+id/previous"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -87,5 +95,13 @@ THE SOFTWARE.
|
|||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:src="@drawable/next" />
|
android:src="@drawable/next" />
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/end_action"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="0px"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@null"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/repeat_inactive" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</merge>
|
</merge>
|
||||||
|
@ -92,6 +92,14 @@ THE SOFTWARE.
|
|||||||
android:layout_margin="0dip"
|
android:layout_margin="0dip"
|
||||||
android:background="#a000"
|
android:background="#a000"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/shuffle"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="0px"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@null"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/shuffle_inactive" />
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/previous"
|
android:id="@+id/previous"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -116,5 +124,13 @@ THE SOFTWARE.
|
|||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:src="@drawable/next" />
|
android:src="@drawable/next" />
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/end_action"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="0px"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@null"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/repeat_inactive" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</merge>
|
</merge>
|
||||||
|
@ -29,22 +29,6 @@ THE SOFTWARE.
|
|||||||
<string name="settings">Settings</string>
|
<string name="settings">Settings</string>
|
||||||
<string name="library">Library</string>
|
<string name="library">Library</string>
|
||||||
<string name="display_mode">Display Mode</string>
|
<string name="display_mode">Display Mode</string>
|
||||||
<string name="shuffle_enable">Enable Shuffle</string>
|
|
||||||
<string name="shuffle_disable">Disable Shuffle</string>
|
|
||||||
<string name="shuffle_albums">Shuffle Albums</string>
|
|
||||||
<string name="shuffle_songs_enabled">Song shuffle enabled</string>
|
|
||||||
<string name="shuffle_albums_enabled">Album shuffle enabled</string>
|
|
||||||
<string name="shuffle_disabled">Shuffle disabled</string>
|
|
||||||
<string name="repeat_enable">Enable Repeat</string>
|
|
||||||
<string name="repeat_current">Repeat Song</string>
|
|
||||||
<string name="repeat_disable">Disable Repeat</string>
|
|
||||||
<string name="repeat_enabling">Repeating all songs</string>
|
|
||||||
<string name="repeat_current_enabling">Repeating current song</string>
|
|
||||||
<string name="repeat_disabling">Repeat disabled</string>
|
|
||||||
<string name="random_enable">Enable Random</string>
|
|
||||||
<string name="random_disable">Disable Random</string>
|
|
||||||
<string name="random_enabling">Random enabled</string>
|
|
||||||
<string name="random_disabling">Random disabled</string>
|
|
||||||
<string name="song_load_failed">Failed to load song %s. It may be corrupt or missing.</string>
|
<string name="song_load_failed">Failed to load song %s. It may be corrupt or missing.</string>
|
||||||
<string name="queue_cleared">Queue cleared.</string>
|
<string name="queue_cleared">Queue cleared.</string>
|
||||||
|
|
||||||
|
@ -64,6 +64,9 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
|||||||
private TextView mAlbum;
|
private TextView mAlbum;
|
||||||
private TextView mArtist;
|
private TextView mArtist;
|
||||||
|
|
||||||
|
private ImageButton mShuffleButton;
|
||||||
|
private ImageButton mEndButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if the controls are visible (play, next, seek bar, etc).
|
* True if the controls are visible (play, next, seek bar, etc).
|
||||||
*/
|
*/
|
||||||
@ -144,6 +147,11 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
|||||||
mSeekBar.setMax(1000);
|
mSeekBar.setMax(1000);
|
||||||
mSeekBar.setOnSeekBarChangeListener(this);
|
mSeekBar.setOnSeekBarChangeListener(this);
|
||||||
|
|
||||||
|
mShuffleButton = (ImageButton)findViewById(R.id.shuffle);
|
||||||
|
mShuffleButton.setOnClickListener(this);
|
||||||
|
mEndButton = (ImageButton)findViewById(R.id.end_action);
|
||||||
|
mEndButton.setOnClickListener(this);
|
||||||
|
|
||||||
setControlsVisible(settings.getBoolean("visible_controls", true));
|
setControlsVisible(settings.getBoolean("visible_controls", true));
|
||||||
setDuration(0);
|
setDuration(0);
|
||||||
}
|
}
|
||||||
@ -227,6 +235,31 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
|||||||
|
|
||||||
if ((state & PlaybackService.FLAG_PLAYING) != 0)
|
if ((state & PlaybackService.FLAG_PLAYING) != 0)
|
||||||
updateProgress();
|
updateProgress();
|
||||||
|
|
||||||
|
if ((toggled & (PlaybackService.FLAG_REPEAT|PlaybackService.FLAG_REPEAT_CURRENT|PlaybackService.FLAG_RANDOM)) != 0) {
|
||||||
|
if ((state & PlaybackService.FLAG_REPEAT) != 0)
|
||||||
|
mEndButton.setImageResource(R.drawable.repeat_active);
|
||||||
|
else if ((state & PlaybackService.FLAG_REPEAT_CURRENT) != 0)
|
||||||
|
mEndButton.setImageResource(R.drawable.repeat_current_active);
|
||||||
|
else if ((state & PlaybackService.FLAG_RANDOM) != 0)
|
||||||
|
mEndButton.setImageResource(R.drawable.random_active);
|
||||||
|
else
|
||||||
|
mEndButton.setImageResource(R.drawable.repeat_inactive);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((toggled & PlaybackService.MASK_SHUFFLE) != 0) {
|
||||||
|
switch (PlaybackService.shuffleMode(state)) {
|
||||||
|
case SongTimeline.SHUFFLE_NONE:
|
||||||
|
mShuffleButton.setImageResource(R.drawable.shuffle_inactive);
|
||||||
|
break;
|
||||||
|
case SongTimeline.SHUFFLE_SONGS:
|
||||||
|
mShuffleButton.setImageResource(R.drawable.shuffle_active);
|
||||||
|
break;
|
||||||
|
case SongTimeline.SHUFFLE_ALBUMS:
|
||||||
|
mShuffleButton.setImageResource(R.drawable.shuffle_album_active);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -416,4 +449,23 @@ public class FullPlaybackActivity extends PlaybackActivity implements SeekBar.On
|
|||||||
super.performAction(action);
|
super.performAction(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View view)
|
||||||
|
{
|
||||||
|
switch (view.getId()) {
|
||||||
|
case R.id.end_action:
|
||||||
|
if ((mState & (PlaybackService.FLAG_REPEAT_CURRENT|PlaybackService.FLAG_RANDOM)) != 0)
|
||||||
|
toggleRandom();
|
||||||
|
else
|
||||||
|
cycleRepeat();
|
||||||
|
break;
|
||||||
|
case R.id.shuffle:
|
||||||
|
cycleShuffle();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
super.onClick(view);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -310,54 +310,13 @@ public class PlaybackActivity extends Activity
|
|||||||
|
|
||||||
static final int MENU_PREFS = 2;
|
static final int MENU_PREFS = 2;
|
||||||
static final int MENU_LIBRARY = 3;
|
static final int MENU_LIBRARY = 3;
|
||||||
static final int MENU_SHUFFLE = 4;
|
|
||||||
static final int MENU_PLAYBACK = 5;
|
static final int MENU_PLAYBACK = 5;
|
||||||
static final int MENU_REPEAT = 6;
|
|
||||||
static final int MENU_SEARCH = 7;
|
static final int MENU_SEARCH = 7;
|
||||||
static final int MENU_RANDOM = 8;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu)
|
public boolean onCreateOptionsMenu(Menu menu)
|
||||||
{
|
{
|
||||||
menu.add(0, MENU_PREFS, 0, R.string.settings).setIcon(R.drawable.ic_menu_preferences);
|
menu.add(0, MENU_PREFS, 0, R.string.settings).setIcon(R.drawable.ic_menu_preferences);
|
||||||
menu.add(0, MENU_SHUFFLE, 0, R.string.shuffle_enable).setIcon(R.drawable.ic_menu_shuffle);
|
|
||||||
menu.add(0, MENU_REPEAT, 0, R.string.repeat_enable).setIcon(R.drawable.ic_menu_refresh);
|
|
||||||
menu.add(0, MENU_RANDOM, 0, R.string.random_enable).setIcon(R.drawable.ic_menu_random);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onPrepareOptionsMenu(Menu menu)
|
|
||||||
{
|
|
||||||
int state = mState;
|
|
||||||
|
|
||||||
int shuffleRes;
|
|
||||||
switch (PlaybackService.shuffleMode(state)) {
|
|
||||||
default:
|
|
||||||
case SongTimeline.SHUFFLE_NONE:
|
|
||||||
shuffleRes = R.string.shuffle_enable;
|
|
||||||
break;
|
|
||||||
case SongTimeline.SHUFFLE_SONGS:
|
|
||||||
shuffleRes = R.string.shuffle_albums;
|
|
||||||
break;
|
|
||||||
case SongTimeline.SHUFFLE_ALBUMS:
|
|
||||||
shuffleRes = R.string.shuffle_disable;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
menu.findItem(MENU_SHUFFLE).setTitle(shuffleRes);
|
|
||||||
|
|
||||||
int repeatRes;
|
|
||||||
if ((state & PlaybackService.FLAG_REPEAT) != 0)
|
|
||||||
repeatRes = R.string.repeat_current;
|
|
||||||
else if ((state & PlaybackService.FLAG_REPEAT_CURRENT) != 0)
|
|
||||||
repeatRes = R.string.repeat_disable;
|
|
||||||
else
|
|
||||||
repeatRes = R.string.repeat_enable;
|
|
||||||
menu.findItem(MENU_REPEAT).setTitle(repeatRes);
|
|
||||||
|
|
||||||
boolean isRandom = (state & PlaybackService.FLAG_RANDOM) != 0;
|
|
||||||
menu.findItem(MENU_RANDOM).setTitle(isRandom ? R.string.random_disable : R.string.random_enable);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,15 +324,6 @@ public class PlaybackActivity extends Activity
|
|||||||
public boolean onOptionsItemSelected(MenuItem item)
|
public boolean onOptionsItemSelected(MenuItem item)
|
||||||
{
|
{
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case MENU_SHUFFLE:
|
|
||||||
cycleShuffle();
|
|
||||||
return true;
|
|
||||||
case MENU_REPEAT:
|
|
||||||
cycleRepeat();
|
|
||||||
return true;
|
|
||||||
case MENU_RANDOM:
|
|
||||||
toggleRandom();
|
|
||||||
return true;
|
|
||||||
case MENU_PREFS:
|
case MENU_PREFS:
|
||||||
startActivity(new Intent(this, PreferencesActivity.class));
|
startActivity(new Intent(this, PreferencesActivity.class));
|
||||||
return true;
|
return true;
|
||||||
@ -389,26 +339,11 @@ public class PlaybackActivity extends Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle shuffle mode on/off
|
* Cycle shuffle mode.
|
||||||
*/
|
*/
|
||||||
public void cycleShuffle()
|
public void cycleShuffle()
|
||||||
{
|
{
|
||||||
int state = PlaybackService.get(this).cycleShuffle();
|
setState(PlaybackService.get(this).cycleShuffle());
|
||||||
int shuffleRes;
|
|
||||||
switch (PlaybackService.shuffleMode(state)) {
|
|
||||||
default:
|
|
||||||
case SongTimeline.SHUFFLE_NONE:
|
|
||||||
shuffleRes = R.string.shuffle_disabled;
|
|
||||||
break;
|
|
||||||
case SongTimeline.SHUFFLE_SONGS:
|
|
||||||
shuffleRes = R.string.shuffle_songs_enabled;
|
|
||||||
break;
|
|
||||||
case SongTimeline.SHUFFLE_ALBUMS:
|
|
||||||
shuffleRes = R.string.shuffle_albums_enabled;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Toast.makeText(this, shuffleRes, Toast.LENGTH_SHORT).show();
|
|
||||||
setState(state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -416,16 +351,7 @@ public class PlaybackActivity extends Activity
|
|||||||
*/
|
*/
|
||||||
public void cycleRepeat()
|
public void cycleRepeat()
|
||||||
{
|
{
|
||||||
int state = PlaybackService.get(this).cycleRepeat();
|
setState(PlaybackService.get(this).cycleRepeat());
|
||||||
int res;
|
|
||||||
if ((state & PlaybackService.FLAG_REPEAT) != 0)
|
|
||||||
res = R.string.repeat_enabling;
|
|
||||||
else if ((state & PlaybackService.FLAG_REPEAT_CURRENT) != 0)
|
|
||||||
res = R.string.repeat_current_enabling;
|
|
||||||
else
|
|
||||||
res = R.string.repeat_disabling;
|
|
||||||
Toast.makeText(this, res, Toast.LENGTH_SHORT).show();
|
|
||||||
setState(state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -433,10 +359,7 @@ public class PlaybackActivity extends Activity
|
|||||||
*/
|
*/
|
||||||
public void toggleRandom()
|
public void toggleRandom()
|
||||||
{
|
{
|
||||||
int state = PlaybackService.get(this).toggleRandom();
|
setState(PlaybackService.get(this).toggleRandom());
|
||||||
int res = (state & PlaybackService.FLAG_RANDOM) == 0 ? R.string.random_disabling : R.string.random_enabling;
|
|
||||||
Toast.makeText(this, res, Toast.LENGTH_SHORT).show();
|
|
||||||
setState(state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -674,7 +674,7 @@ public final class PlaybackService extends Service implements Handler.Callback,
|
|||||||
public int toggleRandom()
|
public int toggleRandom()
|
||||||
{
|
{
|
||||||
synchronized (mStateLock) {
|
synchronized (mStateLock) {
|
||||||
return updateState((mState ^ FLAG_RANDOM) & ~FLAG_REPEAT);
|
return updateState((mState ^ FLAG_RANDOM) & ~(FLAG_REPEAT|FLAG_REPEAT_CURRENT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|