Skip to content

Commit

Permalink
Fix margins, styles, colors, etc.
Browse files Browse the repository at this point in the history
Bug: 19300873
Bug: 19300743

 - Second row of text in each list item is too far down, should have no extra
 padding between first and second rows (should just be two adjacent
 height=wrap_content TextViews)
 - For songs, icons should be offset from left at 16dp, text at 72dp
 - Set app:contentInsetStart=72dp for all Toolbars
 - Change the equalizer animation to an accent color like teal or dark cyan.
 - Music title aligned to toolbar
 - tablet: add more margin like inbox does.

Change-Id: Id28cea83a0380a4918aefc0a942fea98bb38e02d
  • Loading branch information
mangini committed Mar 10, 2015
1 parent bcfdd31 commit 39a49be
Show file tree
Hide file tree
Showing 25 changed files with 94 additions and 35 deletions.
8 changes: 4 additions & 4 deletions mobile/mobile.iml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.2" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" name="play-services-6.5.87" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="CastCompanionLibrary-debug-" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.2" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="mediarouter-v7-21.0.2" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-21.0.2" level="project" />
<orderEntry type="library" exported="" name="library-5.0.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.2" level="project" />
<orderEntry type="library" exported="" name="play-services-6.1.71" level="project" />
<orderEntry type="library" exported="" name="leanback-v17-21.0.2" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-21.0.2" level="project" />
</component>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
package com.example.android.uamp.ui;

import android.app.Activity;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.AnimationDrawable;
import android.media.MediaDescription;
import android.view.LayoutInflater;
Expand All @@ -34,12 +36,20 @@ public class MediaItemViewHolder {
static final int STATE_PAUSED = 2;
static final int STATE_PLAYING = 3;

private static ColorStateList sColorStatePlaying;
private static ColorStateList sColorStateNotPlaying;

ImageView mImageView;
TextView mTitleView;
TextView mDescriptionView;

static View setupView(Activity activity, View convertView, ViewGroup parent,
MediaDescription description, int state) {

if (sColorStateNotPlaying == null || sColorStatePlaying == null) {
initializeColorStateLists(activity);
}

MediaItemViewHolder holder;

Integer cachedState = STATE_INVALID;
Expand All @@ -66,19 +76,22 @@ static View setupView(Activity activity, View convertView, ViewGroup parent,
switch (state) {
case STATE_PLAYABLE:
holder.mImageView.setImageDrawable(
activity.getDrawable(R.drawable.ic_play_arrow_white_24dp));
activity.getDrawable(R.drawable.ic_play_arrow_black_36dp));
holder.mImageView.setImageTintList(sColorStateNotPlaying);
holder.mImageView.setVisibility(View.VISIBLE);
break;
case STATE_PLAYING:
AnimationDrawable animation = (AnimationDrawable)
activity.getDrawable(R.drawable.ic_equalizer_white_24dp);
activity.getDrawable(R.drawable.ic_equalizer_white_36dp);
holder.mImageView.setImageDrawable(animation);
holder.mImageView.setImageTintList(sColorStatePlaying);
holder.mImageView.setVisibility(View.VISIBLE);
animation.start();
break;
case STATE_PAUSED:
holder.mImageView.setImageDrawable(
activity.getDrawable(R.drawable.ic_equalizer1_white_24dp));
activity.getDrawable(R.drawable.ic_equalizer1_white_36dp));
holder.mImageView.setImageTintList(sColorStateNotPlaying);
holder.mImageView.setVisibility(View.VISIBLE);
break;
default:
Expand All @@ -90,4 +103,10 @@ static View setupView(Activity activity, View convertView, ViewGroup parent,
return convertView;
}

static private void initializeColorStateLists(Context ctx) {
sColorStateNotPlaying = ColorStateList.valueOf(ctx.getResources().getColor(
R.color.media_item_icon_not_playing));
sColorStatePlaying = ColorStateList.valueOf(ctx.getResources().getColor(
R.color.media_item_icon_playing));
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
limitations under the License.
-->
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:drawable="@drawable/ic_equalizer1_white_24dp" android:duration="200"/>
<item android:drawable="@drawable/ic_equalizer2_white_24dp" android:duration="200"/>
<item android:drawable="@drawable/ic_equalizer3_white_24dp" android:duration="200"/>
</animation-list>
<item android:drawable="@drawable/ic_equalizer1_white_36dp" android:duration="200"/>
<item android:drawable="@drawable/ic_equalizer2_white_36dp" android:duration="200"/>
<item android:drawable="@drawable/ic_equalizer3_white_36dp" android:duration="200"/>
</animation-list>
6 changes: 3 additions & 3 deletions mobile/src/main/res/layout/fragment_playback_controls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
<ImageView
android:id="@+id/album_art"
tools:src="@drawable/ic_launcher"
android:layout_width="@dimen/max_height_albumart"
android:layout_height="@dimen/max_height_albumart"
android:layout_width="@dimen/playback_controls_albumart_size"
android:layout_height="@dimen/playback_controls_albumart_size"
android:scaleType="centerCrop"
android:contentDescription="@string/currently_playing_song"
android:layout_alignParentStart="true"/>
<LinearLayout
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/horizontal_margin_around_albumart"
android:layout_marginStart="@dimen/playback_controls_albumart_horizontal_margin"
android:orientation="vertical"
android:layout_toEndOf="@id/album_art"
android:layout_toStartOf="@+id/play_pause"
Expand Down
1 change: 1 addition & 0 deletions mobile/src/main/res/layout/include_toolbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
android:layout_height="?attr/actionBarSize"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:contentInsetStart="@dimen/toolbar_inset_start"
android:background="?attr/colorPrimary"
android:popupTheme="@style/ThemeOverlay.AppCompat.Light"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
28 changes: 12 additions & 16 deletions mobile/src/main/res/layout/media_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,36 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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="wrap_content"
android:padding="@dimen/list_item_padding"
android:minHeight="?android:listPreferredItemHeight"
android:orientation="horizontal">
android:layout_height="@dimen/media_item_height">

<ImageView
android:id="@+id/play_eq"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/media_item_icon_margin_start"
android:tintMode="src_in"
android:tint="@android:color/darker_gray"
android:tint="@color/media_item_icon_not_playing"
android:contentDescription="@string/play_item"
android:src="@drawable/ic_play_arrow_white_24dp"/>
android:src="@drawable/ic_play_arrow_black_36dp"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:mode="twoLine"
android:padding="@dimen/list_item_padding"
android:layout_alignParentStart="true"
android:layout_marginStart="@dimen/media_item_text_margin_start"
android:layout_centerVertical="true"
android:orientation="vertical">

<TextView
android:id="@+id/title"
tools:text="The Best Music EVAH1111 FOREVER YOUNG I'M AWESOME!!!11^H^H"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_text_view"
android:layout_marginTop="@dimen/margin_text_view"
android:maxLines="1"
android:ellipsize="end"
android:textAppearance="?android:attr/textAppearanceMedium"
Expand All @@ -55,13 +53,11 @@
tools:text="John Doe, his brothers, his sisters, his pets and his more than amazing band"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_text_view"
android:layout_marginTop="@dimen/margin_text_view"
android:maxLines="1"
android:ellipsize="end"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorSecondary"/>

</LinearLayout>

</LinearLayout>
</RelativeLayout>
20 changes: 20 additions & 0 deletions mobile/src/main/res/values-h800dp/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<!-- media browser listview -->
<dimen name="media_item_height">96dp</dimen>
</resources>
17 changes: 17 additions & 0 deletions mobile/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<color name="bt_accent">#00B8D4</color>
<color name="media_item_icon_playing">@color/bt_accent</color>
<color name="media_item_icon_not_playing">#ccc</color>
</resources>
16 changes: 11 additions & 5 deletions mobile/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,24 @@
limitations under the License.
-->
<resources>

<!-- error infobar -->
<dimen name="error_horizontal_padding">4dp</dimen>
<dimen name="error_vertical_padding">16dp</dimen>
<dimen name="list_item_padding">4dp</dimen>
<dimen name="margin_text_view">6dp</dimen>
<dimen name="horizontal_margin_around_albumart">8dp</dimen>
<dimen name="max_height_albumart">64dp</dimen>

<!-- playback controls -->
<dimen name="playback_controls_albumart_horizontal_margin">8dp</dimen>
<dimen name="playback_controls_albumart_size">64dp</dimen>
<dimen name="playback_controls_padding">8dp</dimen>

<!-- navigation drawer -->
<dimen name="drawer_item_icon_horizontal_margin">12dp</dimen>
<dimen name="drawer_item_left_margin">16dp</dimen>
<dimen name="drawer_item_right_margin">56dp</dimen>
<dimen name="drawer_item_height">48dp</dimen>

<!-- media browser listview -->
<dimen name="media_item_height">72dp</dimen>
<dimen name="media_item_icon_margin_start">12dp</dimen>
<dimen name="media_item_text_margin_start">60dp</dimen>
<dimen name="toolbar_inset_start">60dp</dimen>
</resources>

0 comments on commit 39a49be

Please sign in to comment.