Added big app widget.

This commit is contained in:
Karim Abou Zeid 2016-04-04 15:35:12 +02:00
commit 14204d1789
14 changed files with 381 additions and 18 deletions

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/ripple_material_dark" />

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="#88000000"
android:startColor="#00000000" />
</shape>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="270"
android:endColor="#88000000"
android:startColor="#00000000" />
</shape>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/ripple_material_dark" android:state_activated="true" android:state_pressed="true" />
<item android:drawable="@color/ripple_material_dark" android:state_activated="true" />
<item android:drawable="@color/ripple_material_dark" android:state_pressed="true" />
<item android:drawable="@android:color/transparent" />
</selector>

View file

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:ignore="ContentDescription"
tools:src="@drawable/default_album_art" />
<LinearLayout
android:id="@+id/media_actions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/shadow_up_strong"
android:orientation="horizontal"
android:padding="16dp">
<ImageButton
android:id="@+id/button_prev"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/widget_selector"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_skip_previous_white_24dp"
tools:tint="@color/ate_primary_text_dark" />
<ImageButton
android:id="@+id/button_toggle_play_pause"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/widget_selector"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_play_arrow_white_24dp"
tools:tint="@color/ate_primary_text_dark" />
<ImageButton
android:id="@+id/button_next"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/widget_selector"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_skip_next_white_24dp"
tools:tint="@color/ate_primary_text_dark" />
</LinearLayout>
<FrameLayout
android:id="@+id/clickable_area"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/media_actions"
android:layout_alignParentTop="true" />
<LinearLayout
android:id="@+id/media_titles"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@drawable/shadow_down_strong"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:textColor="@color/ate_primary_text_dark"
tools:text="Title" />
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
android:textColor="@color/ate_secondary_text_dark"
tools:text="Text" />
</LinearLayout>
</RelativeLayout>

View file

@ -32,27 +32,27 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:background="@drawable/widget_selector"
tools:src="@drawable/ic_skip_previous_white_24dp"
tools:tint="#fff" />
tools:tint="@color/ate_secondary_text_dark" />
<ImageButton
android:id="@+id/button_toggle_play_pause"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:background="@drawable/widget_selector"
tools:src="@drawable/ic_play_arrow_white_24dp"
tools:tint="#fff" />
tools:tint="@color/ate_secondary_text_dark" />
<ImageButton
android:id="@+id/button_next"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:background="@drawable/widget_selector"
tools:src="@drawable/ic_skip_next_white_24dp"
tools:tint="#fff" />
tools:tint="@color/ate_secondary_text_dark" />
</LinearLayout>

View file

@ -27,30 +27,30 @@
android:layout_width="0dp"
android:layout_height="@dimen/app_widget_small_button_height"
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:background="@drawable/widget_selector"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_skip_previous_white_24dp"
tools:tint="#fff" />
tools:tint="@color/ate_secondary_text_dark" />
<ImageButton
android:id="@+id/button_toggle_play_pause"
android:layout_width="0dp"
android:layout_height="@dimen/app_widget_small_button_height"
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:background="@drawable/widget_selector"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_play_arrow_white_24dp"
tools:tint="#fff" />
tools:tint="@color/ate_secondary_text_dark" />
<ImageButton
android:id="@+id/button_next"
android:layout_width="0dp"
android:layout_height="@dimen/app_widget_small_button_height"
android:layout_weight="1"
android:background="@drawable/notification_selector"
android:background="@drawable/widget_selector"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_skip_next_white_24dp"
tools:tint="#fff" />
tools:tint="@color/ate_secondary_text_dark" />
</LinearLayout>

View file

@ -69,4 +69,7 @@ http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
<dimen name="app_widget_small_min_width">250dp</dimen>
<dimen name="app_widget_small_min_height">40dp</dimen>
<dimen name="app_widget_big_min_width">250dp</dimen>
<dimen name="app_widget_big_min_height">110dp</dimen>
</resources>

View file

@ -245,6 +245,7 @@
<string name="could_not_scan_files">Could not scan %d files.</string>
<string name="listing_files">Listing files</string>
<string name="new_start_directory">%s is the new start directory.</string>
<string name="app_widget_big_name">Phonograph - Big</string>
<string name="app_widget_classic_name">Phonograph - Classic</string>
<string name="app_widget_small_name">Phonograph - Small</string>
</resources>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:initialLayout="@layout/app_widget_big"
android:minHeight="@dimen/app_widget_big_min_height"
android:minWidth="@dimen/app_widget_big_min_width"
android:resizeMode="horizontal|vertical"
android:updatePeriodMillis="0"
android:widgetCategory="keyguard|home_screen"
tools:ignore="UnusedAttribute" />
<!--android:previewImage="@drawable/app_widget_classic"-->