Change the appearance of the 1x4 widget

This commit is contained in:
Christopher Eby 2010-07-25 00:30:29 -05:00
parent 5f72dba0e4
commit a43baab770
12 changed files with 83 additions and 121 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2010 Christopher Eby <kreed@kreed.org>
This file is part of Vanilla Music Player.
Vanilla Music Player is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
Vanilla Music Player is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:drawable="@drawable/button_background_focused" />
<item
android:state_focused="true"
android:drawable="@drawable/button_background_focused" />
<item android:drawable="@android:color/transparent" />
</selector>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2010 Christopher Eby <kreed@kreed.org>
This file is part of Vanilla Music Player.
Vanilla Music Player is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
Vanilla Music Player is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:endColor="#A9D2E2"
android:startColor="#274162"
android:angle="90" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:drawable="@drawable/next_focused" />
<item
android:state_focused="true"
android:drawable="@drawable/next_focused" />
<item android:drawable="@drawable/next" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:drawable="@drawable/pause_focused" />
<item
android:state_focused="true"
android:drawable="@drawable/pause_focused" />
<item android:drawable="@drawable/pause" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:drawable="@drawable/play_focused" />
<item
android:state_focused="true"
android:drawable="@drawable/play_focused" />
<item android:drawable="@drawable/play" />
</selector>

View File

@ -21,80 +21,66 @@
android:layout_height="fill_parent"
android:orientation="horizontal"
android:clickable="true"
android:background="@drawable/appwidget_bg">
android:layout_marginTop="5dip"
android:layout_marginBottom="5dip"
android:background="#B2191919">
<ImageView
android:id="@+id/cover"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
android:padding="4dip"
android:padding="5dip"
android:scaleType="fitCenter" />
<LinearLayout
android:id="@+id/text"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:orientation="vertical"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1">
<LinearLayout
android:id="@+id/text"
android:paddingLeft="8dip"
android:paddingRight="8dip">
<TextView
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_height="wrap_content"
android:textColor="#fff"
android:textSize="24dip"
android:singleLine="true"
android:fadingEdge="horizontal"
android:fadingEdgeLength="10dip"
android:ellipsize="none" />
<TextView
android:id="@+id/artist"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#fff"
android:textSize="20dip"
android:singleLine="true"
android:fadingEdge="horizontal"
android:fadingEdgeLength="10dip"
android:ellipsize="none" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<ImageButton
android:id="@+id/play_pause"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="1"
android:layout_gravity="center"
android:orientation="vertical"
android:paddingLeft="8dip"
android:paddingRight="8dip">
<TextView
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#fff"
android:textStyle="bold"
android:textSize="13dip"
android:singleLine="true"
android:fadingEdge="horizontal"
android:fadingEdgeLength="10dip"
android:ellipsize="none" />
<TextView
android:id="@+id/artist"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#fff"
android:textSize="13dip"
android:singleLine="true"
android:fadingEdge="horizontal"
android:fadingEdgeLength="10dip"
android:ellipsize="none" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:src="@drawable/play_multi"
android:background="#0000"
android:scaleType="fitCenter" />
<ImageButton
android:id="@+id/next"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1">
<ImageButton
android:id="@+id/previous"
android:background="@drawable/button_background"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="fill_parent"
android:src="@drawable/previous"
android:scaleType="fitCenter" />
<ImageButton
android:id="@+id/play"
android:background="@drawable/button_background"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="fill_parent"
android:src="@drawable/play"
android:scaleType="fitCenter" />
<ImageButton
android:id="@+id/next"
android:background="@drawable/button_background"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="fill_parent"
android:src="@drawable/next"
android:scaleType="fitCenter" />
</LinearLayout>
android:layout_height="0px"
android:layout_weight="1"
android:src="@drawable/next_multi"
android:background="#0000"
android:scaleType="fitCenter" />
</LinearLayout>
</LinearLayout>

View File

@ -101,6 +101,8 @@ public class FourLongWidget extends AppWidgetProvider {
if (song == null) {
views.setViewVisibility(R.id.title, View.GONE);
views.setViewVisibility(R.id.next, View.GONE);
views.setViewVisibility(R.id.play_pause, View.GONE);
views.setTextViewText(R.id.artist, res.getText(R.string.no_songs));
} else {
views.setViewVisibility(R.id.title, View.VISIBLE);
@ -118,7 +120,7 @@ public class FourLongWidget extends AppWidgetProvider {
if (state != -1) {
boolean playing = (state & PlaybackService.FLAG_PLAYING) != 0;
views.setImageViewResource(R.id.play, playing ? R.drawable.pause : R.drawable.play);
views.setImageViewResource(R.id.play_pause, playing ? R.drawable.pause_multi : R.drawable.play_multi);
}
Intent intent;
@ -131,13 +133,9 @@ public class FourLongWidget extends AppWidgetProvider {
views.setOnClickPendingIntent(R.id.cover, pendingIntent);
views.setOnClickPendingIntent(R.id.text, pendingIntent);
intent = new Intent(PlaybackService.ACTION_PREVIOUS_SONG).setComponent(service);
pendingIntent = PendingIntent.getService(context, 0, intent, 0);
views.setOnClickPendingIntent(R.id.previous, pendingIntent);
intent = new Intent(PlaybackService.ACTION_TOGGLE_PLAYBACK).setComponent(service);
pendingIntent = PendingIntent.getService(context, 0, intent, 0);
views.setOnClickPendingIntent(R.id.play, pendingIntent);
views.setOnClickPendingIntent(R.id.play_pause, pendingIntent);
intent = new Intent(PlaybackService.ACTION_NEXT_SONG).setComponent(service);
pendingIntent = PendingIntent.getService(context, 0, intent, 0);