am a83f447b: am 949de5e4: am 27173217: Merge "FullWidthDetailsOverviewRowPresenter: fix NPE" into mnc-dev
* commit 'a83f447bc6ef6f58d2c61204178099189517d9b9':
FullWidthDetailsOverviewRowPresenter: fix NPE
diff --git a/v17/leanback/api/current.txt b/v17/leanback/api/current.txt
index d25529c..3acc9a2 100644
--- a/v17/leanback/api/current.txt
+++ b/v17/leanback/api/current.txt
@@ -934,9 +934,10 @@
}
public class ImageCardView extends android.support.v17.leanback.widget.BaseCardView {
+ ctor public ImageCardView(android.content.Context, int);
+ ctor public ImageCardView(android.content.Context, android.util.AttributeSet, int);
ctor public ImageCardView(android.content.Context);
ctor public ImageCardView(android.content.Context, android.util.AttributeSet);
- ctor public ImageCardView(android.content.Context, android.util.AttributeSet, int);
method public android.graphics.drawable.Drawable getBadgeImage();
method public java.lang.CharSequence getContentText();
method public android.graphics.drawable.Drawable getInfoAreaBackground();
@@ -947,12 +948,17 @@
method public void setContentText(java.lang.CharSequence);
method public void setInfoAreaBackground(android.graphics.drawable.Drawable);
method public void setInfoAreaBackgroundColor(int);
- method public void setMainImage(android.graphics.drawable.Drawable);
method public void setMainImage(android.graphics.drawable.Drawable, boolean);
+ method public void setMainImage(android.graphics.drawable.Drawable);
method public void setMainImageAdjustViewBounds(boolean);
method public void setMainImageDimensions(int, int);
method public void setMainImageScaleType(android.widget.ImageView.ScaleType);
method public void setTitleText(java.lang.CharSequence);
+ field public static final int CARD_TYPE_FLAG_CONTENT = 2; // 0x2
+ field public static final int CARD_TYPE_FLAG_ICON_LEFT = 8; // 0x8
+ field public static final int CARD_TYPE_FLAG_ICON_RIGHT = 4; // 0x4
+ field public static final int CARD_TYPE_FLAG_IMAGE_ONLY = 0; // 0x0
+ field public static final int CARD_TYPE_FLAG_TITLE = 1; // 0x1
}
public final class ItemAlignmentFacet {
diff --git a/v17/leanback/res/layout/lb_image_card_view.xml b/v17/leanback/res/layout/lb_image_card_view.xml
index 2261965..1bc23f8 100644
--- a/v17/leanback/res/layout/lb_image_card_view.xml
+++ b/v17/leanback/res/layout/lb_image_card_view.xml
@@ -15,59 +15,16 @@
limitations under the License.
-->
-<merge
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:lb="http://schemas.android.com/apk/res-auto">
+<merge xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:lb="http://schemas.android.com/apk/res-auto" >
<ImageView
android:id="@+id/main_image"
- lb:layout_viewType="main"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:scaleType="centerCrop"
- android:adjustViewBounds="true"
- android:contentDescription="@null" />
- <android.support.v17.leanback.widget.NonOverlappingRelativeLayout
- lb:layout_viewType="info"
- android:id="@+id/info_field"
- android:layout_width="match_parent"
- android:layout_height="@dimen/lb_basic_card_info_height"
- android:paddingStart="@dimen/lb_basic_card_info_padding_horizontal"
- android:paddingEnd="@dimen/lb_basic_card_info_padding_horizontal"
- android:paddingTop="@dimen/lb_basic_card_info_padding_top"
- android:layout_centerHorizontal="true" >
- <TextView
- android:id="@+id/title_text"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentStart="true"
- android:layout_marginBottom="@dimen/lb_basic_card_info_text_margin"
- android:maxLines="1"
- android:fontFamily="sans-serif-condensed"
- android:textColor="@color/lb_basic_card_title_text_color"
- android:textSize="@dimen/lb_basic_card_title_text_size"
- android:ellipsize="end" />
- <TextView
- android:id="@+id/content_text"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/title_text"
- android:layout_alignParentStart="true"
- android:layout_toStartOf="@+id/extra_badge"
- android:maxLines="1"
- android:fontFamily="sans-serif-condensed"
- android:textColor="@color/lb_basic_card_content_text_color"
- android:textSize="@dimen/lb_basic_card_content_text_size"
- android:ellipsize="none" />
- <ImageView
- android:id="@+id/extra_badge"
- android:layout_width="@dimen/lb_basic_card_info_badge_size"
- android:layout_height="@dimen/lb_basic_card_info_badge_size"
- android:layout_marginStart="@dimen/lb_basic_card_info_badge_margin"
- android:layout_alignBottom="@id/content_text"
- android:layout_alignParentEnd="true"
- android:scaleType="fitCenter"
- android:visibility="gone"
- android:contentDescription="@null" />
- </android.support.v17.leanback.widget.NonOverlappingRelativeLayout>
-</merge>
+ style="?attr/lbImageCardViewImageStyle" />
+
+ <android.support.v17.leanback.widget.NonOverlappingRelativeLayout
+ android:id="@+id/info_field"
+ style="?attr/lbImageCardViewInfoAreaStyle">
+ </android.support.v17.leanback.widget.NonOverlappingRelativeLayout>
+
+</merge>
\ No newline at end of file
diff --git a/v17/leanback/res/layout/lb_image_card_view_themed_badge_left.xml b/v17/leanback/res/layout/lb_image_card_view_themed_badge_left.xml
new file mode 100644
index 0000000..35d2da6
--- /dev/null
+++ b/v17/leanback/res/layout/lb_image_card_view_themed_badge_left.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/extra_badge"
+ android:layout_alignBottom="@+id/content_text"
+ android:layout_alignParentStart="true"
+ android:layout_marginEnd="@dimen/lb_basic_card_info_badge_margin"
+ style="?attr/lbImageCardViewBadgeStyle" />
\ No newline at end of file
diff --git a/v17/leanback/res/layout/lb_image_card_view_themed_badge_right.xml b/v17/leanback/res/layout/lb_image_card_view_themed_badge_right.xml
new file mode 100644
index 0000000..02dd917
--- /dev/null
+++ b/v17/leanback/res/layout/lb_image_card_view_themed_badge_right.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/extra_badge"
+ android:layout_alignBottom="@+id/content_text"
+ android:layout_alignParentEnd="true"
+ android:layout_marginStart="@dimen/lb_basic_card_info_badge_margin"
+ style="?attr/lbImageCardViewBadgeStyle" />
\ No newline at end of file
diff --git a/v17/leanback/res/layout/lb_image_card_view_themed_content.xml b/v17/leanback/res/layout/lb_image_card_view_themed_content.xml
new file mode 100644
index 0000000..5592371
--- /dev/null
+++ b/v17/leanback/res/layout/lb_image_card_view_themed_content.xml
@@ -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.
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/content_text"
+ style="?attr/lbImageCardViewContentStyle" />
diff --git a/v17/leanback/res/layout/lb_image_card_view_themed_title.xml b/v17/leanback/res/layout/lb_image_card_view_themed_title.xml
new file mode 100644
index 0000000..67e2493
--- /dev/null
+++ b/v17/leanback/res/layout/lb_image_card_view_themed_title.xml
@@ -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.
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/title_text"
+ style="?attr/lbImageCardViewTitleStyle" />
diff --git a/v17/leanback/res/values-az-rAZ/strings.xml b/v17/leanback/res/values-az-rAZ/strings.xml
deleted file mode 100644
index d1e685f..0000000
--- a/v17/leanback/res/values-az-rAZ/strings.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?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 xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="orb_search_action" msgid="5651268540267663887">"Axtarış Fəaliyyəti"</string>
- <string name="lb_search_bar_hint" msgid="8325490927970116252">"Axtarış"</string>
- <string name="lb_search_bar_hint_speech" msgid="5511270823320183816">"Axtarış üçün danışın"</string>
- <string name="lb_search_bar_hint_with_title" msgid="1627103380996590035">"Axtarış: <xliff:g id="SEARCH_CONTEXT">%1$s</xliff:g>"</string>
- <string name="lb_search_bar_hint_with_title_speech" msgid="2712734639766312034">"Axtarış üçün danışın: <xliff:g id="SEARCH_CONTEXT">%1$s</xliff:g>"</string>
- <string name="lb_control_display_fast_forward_multiplier" msgid="4541442045214207774">"%1$dX"</string>
- <string name="lb_control_display_rewind_multiplier" msgid="3097220783222910245">"%1$dX"</string>
- <string name="lb_playback_controls_play" msgid="731953341987346903">"Oyun"</string>
- <string name="lb_playback_controls_pause" msgid="6189521112079849518">"Pauza"</string>
- <string name="lb_playback_controls_fast_forward" msgid="8569951318244687220">"İrəli Ötürmə"</string>
- <string name="lb_playback_controls_fast_forward_multiplier" msgid="1058753672110224526">"İrəli sarı %1$dX"</string>
- <string name="lb_playback_controls_rewind" msgid="2227196334132350684">"Geri ötürmə"</string>
- <string name="lb_playback_controls_rewind_multiplier" msgid="1640629531440849942">"Geri sarı %1$dX"</string>
- <string name="lb_playback_controls_skip_next" msgid="2946499493161095772">"Növbətini atlayın"</string>
- <string name="lb_playback_controls_skip_previous" msgid="2326801832933178348">"Öncəkini atlayın"</string>
- <string name="lb_playback_controls_more_actions" msgid="2330770008796987655">"Digər fəaliyyətlər"</string>
- <string name="lb_playback_controls_thumb_up" msgid="6530420347129222601">"Bəyənməkdən imtina edin"</string>
- <string name="lb_playback_controls_thumb_up_outline" msgid="1577637924003500946">"Bəyənin"</string>
- <string name="lb_playback_controls_thumb_down" msgid="4498041193172964797">"Bəyənməməkdən imtina edin"</string>
- <string name="lb_playback_controls_thumb_down_outline" msgid="2936020280629424365">"Bəyənməyin"</string>
- <string name="lb_playback_controls_repeat_none" msgid="87476947476529036">"Təkrarlanmasın"</string>
- <string name="lb_playback_controls_repeat_all" msgid="6730354406289599000">"Hamısını təkrarlayın"</string>
- <string name="lb_playback_controls_repeat_one" msgid="3285202316452203619">"Biri təkrarlansın"</string>
- <string name="lb_playback_controls_shuffle_enable" msgid="1099874107835264529">"Qarışdırma aktiv edilsin"</string>
- <string name="lb_playback_controls_shuffle_disable" msgid="8388150597335115226">"Qarışdırma deaktiv edilsin"</string>
- <string name="lb_playback_controls_high_quality_enable" msgid="202415780019335254">"Yüksək keyfiyyəti aktiv edin"</string>
- <string name="lb_playback_controls_high_quality_disable" msgid="8637371582779057866">"Yüksək keyfiyyəti deaktiv edin"</string>
- <string name="lb_playback_controls_closed_captioning_enable" msgid="2429655367176440226">"Qapalı çəkilişi aktiv edin"</string>
- <string name="lb_playback_controls_closed_captioning_disable" msgid="6133362019475930048">"Qapalı çəkilişi deaktiv edin"</string>
-</resources>
diff --git a/v17/leanback/res/values/attrs.xml b/v17/leanback/res/values/attrs.xml
index e7da321..00381ff 100644
--- a/v17/leanback/res/values/attrs.xml
+++ b/v17/leanback/res/values/attrs.xml
@@ -116,7 +116,23 @@
</declare-styleable>
<declare-styleable name="lbImageCardView">
+ <!-- Deprecated. Use 'lbImageCardViewInfoAreaStyle' instead. -->
<attr name="infoAreaBackground" format="reference|color"/>
+ <!-- Use these attributes to override a ImageCardView's component style. -->
+ <attr name="lbImageCardViewImageStyle" format="reference" />
+ <attr name="lbImageCardViewTitleStyle" format="reference" />
+ <attr name="lbImageCardViewContentStyle" format="reference" />
+ <attr name="lbImageCardViewBadgeStyle" format="reference" />
+ <attr name="lbImageCardViewInfoAreaStyle" format="reference" />
+ <!-- Defines what components the ImageCardView will use. -->
+ <attr name="lbImageCardViewType">
+ <flag name="Title" value="1" />
+ <flag name="Content" value="2" />
+ <flag name="IconOnRight" value="4" />
+ <flag name="IconOnLeft" value="8" />
+ <!-- Only display the main image. -->
+ <flag name="ImageOnly" value="0" />
+ </attr>
</declare-styleable>
<declare-styleable name="lbSearchOrbView">
@@ -431,4 +447,4 @@
</declare-styleable>
-</resources>
+</resources>
\ No newline at end of file
diff --git a/v17/leanback/res/values/dimens.xml b/v17/leanback/res/values/dimens.xml
index 275612e..8bc221b 100644
--- a/v17/leanback/res/values/dimens.xml
+++ b/v17/leanback/res/values/dimens.xml
@@ -203,6 +203,7 @@
<dimen name="lb_basic_card_info_height">52dp</dimen>
<dimen name="lb_basic_card_info_height_no_content">34dp</dimen>
<dimen name="lb_basic_card_info_padding_top">7dp</dimen>
+ <dimen name="lb_basic_card_info_padding_bottom">8dp</dimen>
<dimen name="lb_basic_card_info_padding_horizontal">11dp</dimen>
<dimen name="lb_basic_card_info_text_margin">1dp</dimen>
<dimen name="lb_basic_card_title_text_size">14sp</dimen>
diff --git a/v17/leanback/res/values/ids.xml b/v17/leanback/res/values/ids.xml
index 6b67919..06a5d2e 100644
--- a/v17/leanback/res/values/ids.xml
+++ b/v17/leanback/res/values/ids.xml
@@ -30,5 +30,4 @@
<item type="id" name="lb_control_shuffle" />
<item type="id" name="lb_control_high_quality" />
<item type="id" name="lb_control_closed_captioning" />
-
</resources>
diff --git a/v17/leanback/res/values/styles.xml b/v17/leanback/res/values/styles.xml
index 3ee2821..ce0984c 100644
--- a/v17/leanback/res/values/styles.xml
+++ b/v17/leanback/res/values/styles.xml
@@ -90,13 +90,6 @@
<item name="android:foreground">@drawable/lb_card_foreground</item>
</style>
- <style name="Widget.Leanback.ImageCardViewStyle" parent="Widget.Leanback.BaseCardViewStyle">
- <item name="cardType">infoUnder</item>
- <item name="infoVisibility">activated</item>
- <item name="android:background">@color/lb_basic_card_bg_color</item>
- <item name="infoAreaBackground">@color/lb_basic_card_info_bg_color</item>
- </style>
-
<style name="Widget.Leanback.TitleView" >
<item name="android:paddingTop">?attr/browsePaddingTop</item>
<item name="android:paddingBottom">?attr/browsePaddingTop</item>
@@ -104,6 +97,84 @@
<item name="android:paddingEnd">?attr/browsePaddingEnd</item>
</style>
+ <style name="Widget.Leanback.ImageCardViewStyle" parent="Widget.Leanback.BaseCardViewStyle">
+ <item name="cardType">infoUnder</item>
+ <item name="infoVisibility">activated</item>
+ <item name="android:background">@color/lb_basic_card_bg_color</item>
+ <item name="android:focusable">true</item>
+ <item name="android:focusableInTouchMode">true</item>
+ <!-- In order to keep backward compatibility we have to create an icon on right. -->
+ <item name="lbImageCardViewType">Title|Content|IconOnRight</item>
+ <item name="lbImageCardViewImageStyle">@style/Widget.Leanback.ImageCardView.ImageStyle</item>
+ <item name="lbImageCardViewTitleStyle">@style/Widget.Leanback.ImageCardView.TitleStyle</item>
+ <item name="lbImageCardViewContentStyle">@style/Widget.Leanback.ImageCardView.ContentStyle</item>
+ <item name="lbImageCardViewBadgeStyle">@style/Widget.Leanback.ImageCardView.BadgeStyle</item>
+ <item name="lbImageCardViewInfoAreaStyle">@style/Widget.Leanback.ImageCardView.InfoAreaStyle</item>
+ <!-- Deprecated. Use 'Widget.Leanback.ImageCardView.InfoAreaStyle' instead. -->
+ <item name="infoAreaBackground">@null</item>
+ </style>
+
+ <style name="Widget.Leanback.ImageCardView" />
+
+ <style name="Widget.Leanback.ImageCardView.ImageStyle">
+ <item name="android:layout_width">wrap_content</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:adjustViewBounds">true</item>
+ <item name="android:contentDescription">@null</item>
+ <item name="android:scaleType">centerCrop</item>
+ <item name="layout_viewType">main</item>
+ <item name="android:background">@null</item>
+ </style>
+
+ <style name="Widget.Leanback.ImageCardView.InfoAreaStyle">
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:layout_centerHorizontal">true</item>
+ <item name="layout_viewType">info</item>
+ <item name="android:paddingBottom">@dimen/lb_basic_card_info_padding_bottom</item>
+ <item name="android:paddingEnd">@dimen/lb_basic_card_info_padding_horizontal</item>
+ <item name="android:paddingStart">@dimen/lb_basic_card_info_padding_horizontal</item>
+ <item name="android:paddingTop">@dimen/lb_basic_card_info_padding_top</item>
+ <item name="android:background">@color/lb_basic_card_info_bg_color</item>
+ </style>
+
+ <style name="Widget.Leanback.ImageCardView.TitleStyle">
+ <item name="android:id">@id/title_text</item>
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:maxLines">1</item>
+ <item name="android:layout_marginBottom">@dimen/lb_basic_card_info_text_margin</item>
+ <item name="android:fontFamily">sans-serif-condensed</item>
+ <item name="android:textColor">@color/lb_basic_card_title_text_color</item>
+ <item name="android:textSize">@dimen/lb_basic_card_title_text_size</item>
+ <item name="android:ellipsize">end</item>
+ <item name="android:background">@null</item>
+ </style>
+
+ <style name="Widget.Leanback.ImageCardView.ContentStyle">
+ <item name="android:id">@id/content_text</item>
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:layout_alignParentStart">true</item>
+ <item name="android:layout_below">@+id/title_text</item>
+ <item name="android:layout_toStartOf">@+id/extra_badge</item>
+ <item name="android:maxLines">1</item>
+ <item name="android:fontFamily">sans-serif-condensed</item>
+ <item name="android:textColor">@color/lb_basic_card_content_text_color</item>
+ <item name="android:textSize">@dimen/lb_basic_card_content_text_size</item>
+ <item name="android:ellipsize">none</item>
+ <item name="android:background">@null</item>
+ </style>
+
+ <style name="Widget.Leanback.ImageCardView.BadgeStyle">
+ <item name="android:id">@id/extra_badge</item>
+ <item name="android:layout_width">@dimen/lb_basic_card_info_badge_size</item>
+ <item name="android:layout_height">@dimen/lb_basic_card_info_badge_size</item>
+ <item name="android:contentDescription">@null</item>
+ <item name="android:scaleType">fitCenter</item>
+ <item name="android:background">@null</item>
+ </style>
+
<style name="Widget.Leanback.Title" />
<style name="Widget.Leanback.Title.Text">
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/ImageCardView.java b/v17/leanback/src/android/support/v17/leanback/widget/ImageCardView.java
index 2c1c7e0..68e976d 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/ImageCardView.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/ImageCardView.java
@@ -18,60 +18,284 @@
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorInt;
import android.support.v17.leanback.R;
-import android.text.TextUtils;
import android.util.AttributeSet;
+import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
+import android.widget.RelativeLayout;
import android.widget.TextView;
/**
- * A subclass of {@link BaseCardView} with an {@link ImageView} as its main region.
+ * A subclass of {@link BaseCardView} with an {@link ImageView} as its main
+ * region. The {@link ImageCardView} is highly customizable and can be used for
+ * various use-cases by adjusting the ImageViewCard's type to any combination of
+ * Title, Content, Badge or ImageOnly.
+ * <p>
+ * <h3>Styling</h3> There are three different ways to style the ImageCardView.
+ * <br>
+ * No matter what way you use, all your styles applied to an ImageCardView have
+ * to extend the style {@link R.style#Widget_Leanback_ImageCardViewStyle}.
+ * <p>
+ * <u>Example:</u><br>
+ *
+ * <pre>
+ * {@code <style name="CustomImageCardViewStyle" parent="Widget.Leanback.ImageCardViewStyle">
+ <item name="android:background">#F0F</item>
+ <item name="lbImageCardViewType">Title|Content</item>
+ <item name="lbImageCardViewInfoAreaStyle">@style/ImageCardViewColoredInfoArea</item>
+ <item name="lbImageCardViewTitleStyle">@style/ImageCardViewColoredTitle</item>
+ </style>}
+ * </pre>
+ * <p>
+ * The first possibility is to set a custom Style in the Leanback Theme's
+ * attribute <code>imageCardViewStyle</code>. The style set here, is the default
+ * style for all ImageCardViews. The other two possibilities allow you to style
+ * a particular ImageCardView. This is usefull if you want to create multiple
+ * types of cards. E.g. you might want to display a card with only a title and
+ * another one with title and content. Thus you need to define two different
+ * <code>ImageCardViewStyles</code> and apply them to the ImageCardViews. You
+ * can do this by either using a the {@link #ImageCardView(Context, int)}
+ * constructor and passing a style as second argument or by setting the style in
+ * a layout.
+ * <p>
+ * <u>Example (using constructor):</u><br>
+ *
+ * <pre>
+ * {@code
+ * new ImageCardView(context, R.style.CustomImageCardViewStyle);
+ * }
+ * </pre>
+ *
+ * <u>Example (using style attribute in a layout):</u><br>
+ *
+ * <pre>
+ * {@code <android.support.v17.leanback.widget.ImageCardView
+ android:id="@+id/imageCardView"
+ style="@style/CustomImageCardViewStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+ </android.support.v17.leanback.widget.ImageCardView>}
+ * </pre>
+ * <p>
+ * You can style all ImageCardView's components such as the title, content,
+ * badge, infoArea and the image itself by extending the corresponding style and
+ * overriding the specific attribute in your custom
+ * <code>ImageCardViewStyle</code>.
+ *
+ * <h3>Components</h3> The ImageCardView contains three components which can be
+ * combined in any combination:
+ * <ul>
+ * <li>Title: The card's title</li>
+ * <li>Content: A short description</li>
+ * <li>Badge: An icon which can be displayed on the right or left side of the
+ * card.</li>
+ * </ul>
+ * In order to choose the components you want to use in your ImageCardView, you
+ * have to specify them in the <code>lbImageCardViewType</code> attribute of
+ * your custom <code>ImageCardViewStyle</code>. You can combine the following
+ * values: <code>Title, Content, IconOnRight, IconOnLeft, ImageOnly</code>.
+ * <p>
+ * <u>Examples:</u><br>
+ *
+ * <pre>
+ * {@code <style name="CustomImageCardViewStyle" parent="Widget.Leanback.ImageCardViewStyle">
+ ...
+ <item name="lbImageCardViewType">Title|Content|IconOnLeft</item>
+ ...
+ </style>}
+ * </pre>
+ *
+ * <pre>
+ * {@code <style name="CustomImageCardViewStyle" parent="Widget.Leanback.ImageCardViewStyle">
+ ...
+ <item name="lbImageCardViewType">ImageOnly</item>
+ ...
+ </style>}
+ * </pre>
+ *
+ * @attr ref android.support.v17.leanback.R.styleable#LeanbackTheme_imageCardViewStyle
+ * @attr ref android.support.v17.leanback.R.styleable#lbImageCardView_lbImageCardViewType
+ * @attr ref android.support.v17.leanback.R.styleable#lbImageCardView_lbImageCardViewTitleStyle
+ * @attr ref android.support.v17.leanback.R.styleable#lbImageCardView_lbImageCardViewContentStyle
+ * @attr ref android.support.v17.leanback.R.styleable#lbImageCardView_lbImageCardViewBadgeStyle
+ * @attr ref android.support.v17.leanback.R.styleable#lbImageCardView_lbImageCardViewImageStyle
+ * @attr ref android.support.v17.leanback.R.styleable#lbImageCardView_lbImageCardViewInfoAreaStyle
*/
public class ImageCardView extends BaseCardView {
+ public static final int CARD_TYPE_FLAG_IMAGE_ONLY = 0;
+ public static final int CARD_TYPE_FLAG_TITLE = 1;
+ public static final int CARD_TYPE_FLAG_CONTENT = 2;
+ public static final int CARD_TYPE_FLAG_ICON_RIGHT = 4;
+ public static final int CARD_TYPE_FLAG_ICON_LEFT = 8;
+
private ImageView mImageView;
- private View mInfoArea;
+ private ViewGroup mInfoArea;
private TextView mTitleView;
private TextView mContentView;
private ImageView mBadgeImage;
private boolean mAttachedToWindow;
+ /**
+ * Create an ImageCardView using a given style for customization.
+ *
+ * @param context
+ * The Context the view is running in, through which it can
+ * access the current theme, resources, etc.
+ * @param styleResId
+ * The resourceId of the style you want to apply to the
+ * ImageCardView. The style has to extend
+ * {@link R.style#Widget_Leanback_ImageCardViewStyle}.
+ */
+ public ImageCardView(Context context, int styleResId) {
+ super(new ContextThemeWrapper(context, styleResId), null, 0);
+ buildImageCardView(styleResId);
+ }
+
+ /**
+ * @see #View(Context, AttributeSet, int)
+ */
+ public ImageCardView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(getStyledContext(context, attrs, defStyleAttr), attrs, defStyleAttr);
+ buildImageCardView(getImageCardViewStyle(context, attrs, defStyleAttr));
+ }
+
+ private void buildImageCardView(int styleResId) {
+ LayoutInflater inflater = LayoutInflater.from(getContext());
+ inflater.inflate(R.layout.lb_image_card_view, this);
+ TypedArray cardAttrs = getContext().obtainStyledAttributes(styleResId, R.styleable.lbImageCardView);
+ int cardType = cardAttrs.getInt(R.styleable.lbImageCardView_lbImageCardViewType, CARD_TYPE_FLAG_IMAGE_ONLY);
+ boolean hasImageOnly = cardType == CARD_TYPE_FLAG_IMAGE_ONLY;
+ boolean hasTitle = (cardType & CARD_TYPE_FLAG_TITLE) == CARD_TYPE_FLAG_TITLE;
+ boolean hasContent = (cardType & CARD_TYPE_FLAG_CONTENT) == CARD_TYPE_FLAG_CONTENT;
+ boolean hasIconRight = (cardType & CARD_TYPE_FLAG_ICON_RIGHT) == CARD_TYPE_FLAG_ICON_RIGHT;
+ boolean hasIconLeft = !hasIconRight && (cardType & CARD_TYPE_FLAG_ICON_LEFT) == CARD_TYPE_FLAG_ICON_LEFT;
+
+ mImageView = (ImageView) findViewById(R.id.main_image);
+ if (mImageView.getDrawable() == null) {
+ mImageView.setVisibility(View.INVISIBLE);
+ }
+
+ mInfoArea = (ViewGroup) findViewById(R.id.info_field);
+ if (hasImageOnly) {
+ removeView(mInfoArea);
+ cardAttrs.recycle();
+ return;
+ }
+ // Create children
+ if (hasTitle) {
+ mTitleView = (TextView) inflater.inflate(R.layout.lb_image_card_view_themed_title, mInfoArea, false);
+ mInfoArea.addView(mTitleView);
+ }
+
+ if (hasContent) {
+ mContentView = (TextView) inflater.inflate(R.layout.lb_image_card_view_themed_content, mInfoArea, false);
+ mInfoArea.addView(mContentView);
+ }
+
+ if (hasIconRight || hasIconLeft) {
+ int layoutId = R.layout.lb_image_card_view_themed_badge_right;
+ if (hasIconLeft) {
+ layoutId = R.layout.lb_image_card_view_themed_badge_left;
+ }
+ mBadgeImage = (ImageView) inflater.inflate(layoutId, mInfoArea, false);
+ mInfoArea.addView(mBadgeImage);
+ }
+
+ // Set up LayoutParams for children
+ if (hasTitle && !hasContent && mBadgeImage != null) {
+ RelativeLayout.LayoutParams relativeLayoutParams = (RelativeLayout.LayoutParams) mTitleView
+ .getLayoutParams();
+ // Adjust title TextView if there is an icon but no content
+ if (hasIconLeft) {
+ relativeLayoutParams.addRule(RelativeLayout.END_OF, mBadgeImage.getId());
+ } else {
+ relativeLayoutParams.addRule(RelativeLayout.START_OF, mBadgeImage.getId());
+ }
+ mTitleView.setLayoutParams(relativeLayoutParams);
+ }
+
+ // Set up LayoutParams for children
+ if (hasContent) {
+ RelativeLayout.LayoutParams relativeLayoutParams = (RelativeLayout.LayoutParams) mContentView
+ .getLayoutParams();
+ if (!hasTitle) {
+ relativeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+ }
+ // Adjust content TextView if icon is on the left
+ if (hasIconLeft) {
+ relativeLayoutParams.removeRule(RelativeLayout.START_OF);
+ relativeLayoutParams.removeRule(RelativeLayout.ALIGN_PARENT_START);
+ relativeLayoutParams.addRule(RelativeLayout.END_OF, mBadgeImage.getId());
+ }
+ mContentView.setLayoutParams(relativeLayoutParams);
+ }
+
+ if (mBadgeImage != null) {
+ RelativeLayout.LayoutParams relativeLayoutParams = (RelativeLayout.LayoutParams) mBadgeImage
+ .getLayoutParams();
+ if (hasContent) {
+ relativeLayoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, mContentView.getId());
+ } else if (hasTitle) {
+ relativeLayoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, mTitleView.getId());
+ }
+ mBadgeImage.setLayoutParams(relativeLayoutParams);
+ }
+
+ // Backward compatibility: Newly created ImageCardViews should change
+ // the InfoArea's background color in XML using the corresponding style.
+ // However, since older implementations might make use of the
+ // 'infoAreaBackground' attribute, we have to make sure to support it.
+ // If the user has set a specific value here, it will differ from null.
+ // In this case, we do want to override the value set in the style.
+ Drawable background = cardAttrs.getDrawable(R.styleable.lbImageCardView_infoAreaBackground);
+ if (null != background) {
+ setInfoAreaBackground(background);
+ }
+ // Backward compatibility: There has to be an icon in the default
+ // version. If there is one, we have to set it's visibility to 'GONE'.
+ // Disabling 'adjustIconVisibility' allows the user to set the icon's
+ // visibility state in XML rather than code.
+ if (mBadgeImage != null && mBadgeImage.getDrawable() == null) {
+ mBadgeImage.setVisibility(View.GONE);
+ }
+ cardAttrs.recycle();
+ }
+
+ private static Context getStyledContext(Context context, AttributeSet attrs, int defStyleAttr) {
+ int style = getImageCardViewStyle(context, attrs, defStyleAttr);
+ return new ContextThemeWrapper(context, style);
+ }
+
+ private static int getImageCardViewStyle(Context context, AttributeSet attrs, int defStyleAttr) {
+ // Read style attribute defined in XML layout.
+ int style = null == attrs ? 0 : attrs.getStyleAttribute();
+ if (0 == style) {
+ // Not found? Read global ImageCardView style from Theme attribute.
+ TypedArray styledAttrs = context.obtainStyledAttributes(R.styleable.LeanbackTheme);
+ style = styledAttrs.getResourceId(R.styleable.LeanbackTheme_imageCardViewStyle, 0);
+ styledAttrs.recycle();
+ }
+ return style;
+ }
+
+ /**
+ * @see #View(Context)
+ */
public ImageCardView(Context context) {
this(context, null);
}
+ /**
+ * @see #View(Context, AttributeSet)
+ */
public ImageCardView(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.imageCardViewStyle);
}
- public ImageCardView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
-
- LayoutInflater inflater = LayoutInflater.from(context);
- View v = inflater.inflate(R.layout.lb_image_card_view, this);
-
- mImageView = (ImageView) v.findViewById(R.id.main_image);
- mImageView.setVisibility(View.INVISIBLE);
- mInfoArea = v.findViewById(R.id.info_field);
- mTitleView = (TextView) v.findViewById(R.id.title_text);
- mContentView = (TextView) v.findViewById(R.id.content_text);
- mBadgeImage = (ImageView) v.findViewById(R.id.extra_badge);
-
- if (mInfoArea != null) {
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.lbImageCardView,
- defStyle, 0);
- try {
- setInfoAreaBackground(
- a.getDrawable(R.styleable.lbImageCardView_infoAreaBackground));
- } finally {
- a.recycle();
- }
- }
- }
-
/**
* Returns the main image view.
*/
@@ -170,7 +394,7 @@
/**
* Sets the info area background color.
- */
+ */
public void setInfoAreaBackgroundColor(@ColorInt int color) {
if (mInfoArea != null) {
mInfoArea.setBackgroundColor(color);
@@ -184,7 +408,6 @@
if (mTitleView == null) {
return;
}
-
mTitleView.setText(text);
}
@@ -206,7 +429,6 @@
if (mContentView == null) {
return;
}
-
mContentView.setText(text);
}
@@ -229,7 +451,7 @@
return;
}
mBadgeImage.setImageDrawable(drawable);
- if (drawable != null && mContentView!= null && mContentView.getVisibility() != GONE) {
+ if (drawable != null) {
mBadgeImage.setVisibility(View.VISIBLE);
} else {
mBadgeImage.setVisibility(View.GONE);
@@ -250,8 +472,8 @@
private void fadeIn() {
mImageView.setAlpha(0f);
if (mAttachedToWindow) {
- mImageView.animate().alpha(1f).setDuration(mImageView.getResources().getInteger(
- android.R.integer.config_shortAnimTime));
+ mImageView.animate().alpha(1f)
+ .setDuration(mImageView.getResources().getInteger(android.R.integer.config_shortAnimTime));
}
}
@@ -276,4 +498,5 @@
mImageView.setAlpha(1f);
super.onDetachedFromWindow();
}
+
}
diff --git a/v17/preference-leanback/res/color/lb_preference_item_primary_text_color.xml b/v17/preference-leanback/res/color/lb_preference_item_primary_text_color.xml
new file mode 100644
index 0000000..efdf1c0
--- /dev/null
+++ b/v17/preference-leanback/res/color/lb_preference_item_primary_text_color.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 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
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_enabled="false" android:color="@color/lb_preference_item_primary_text_color_disabled" />
+ <item android:color="@color/lb_preference_item_primary_text_color_default"/>
+</selector>
diff --git a/v17/preference-leanback/res/color/lb_preference_item_secondary_text_color.xml b/v17/preference-leanback/res/color/lb_preference_item_secondary_text_color.xml
new file mode 100644
index 0000000..68bb81a
--- /dev/null
+++ b/v17/preference-leanback/res/color/lb_preference_item_secondary_text_color.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 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
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_enabled="false" android:color="@color/lb_preference_item_secondary_text_color_disabled" />
+ <item android:color="@color/lb_preference_item_secondary_text_color_default"/>
+</selector>
diff --git a/v17/preference-leanback/res/layout/leanback_list_preference_fragment.xml b/v17/preference-leanback/res/layout/leanback_list_preference_fragment.xml
index 9fae0f8..c0a5bf9 100644
--- a/v17/preference-leanback/res/layout/leanback_list_preference_fragment.xml
+++ b/v17/preference-leanback/res/layout/leanback_list_preference_fragment.xml
@@ -35,11 +35,11 @@
android:id="@+id/decor_title"
android:layout_width="match_parent"
android:layout_height="@dimen/lb_preference_decor_title_text_height"
+ android:layout_marginTop="@dimen/lb_preference_decor_title_margin_top"
+ android:layout_marginStart="@dimen/lb_preference_decor_title_margin_start"
+ android:layout_marginEnd="@dimen/lb_preference_decor_title_margin_end"
android:fontFamily="sans-serif-condensed"
android:gravity="center_vertical"
- android:paddingTop="@dimen/lb_preference_decor_title_padding_top"
- android:paddingStart="@dimen/lb_preference_decor_title_padding_start"
- android:paddingEnd="@dimen/lb_preference_decor_title_padding_end"
android:singleLine="true"
android:textSize="@dimen/lb_preference_decor_title_text_size"
android:textColor="?android:attr/textColorPrimary"
diff --git a/v17/preference-leanback/res/layout/leanback_list_preference_item_multi.xml b/v17/preference-leanback/res/layout/leanback_list_preference_item_multi.xml
index 3b1345c..04ea1dc 100644
--- a/v17/preference-leanback/res/layout/leanback_list_preference_item_multi.xml
+++ b/v17/preference-leanback/res/layout/leanback_list_preference_item_multi.xml
@@ -18,20 +18,34 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
android:layout_width="match_parent"
- android:layout_height="?android:attr/listPreferredItemHeight"
+ android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:descendantFocusability="blocksDescendants"
- android:orientation="horizontal">
+ android:orientation="horizontal"
+ android:paddingStart="@dimen/lb_preference_item_padding_start"
+ android:paddingEnd="@dimen/lb_preference_item_padding_end" >
+
<CheckBox
android:id="@+id/button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
- <TextView
- android:id="@android:id/title"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:gravity="center_vertical" />
+ android:layout_width="@dimen/lb_preference_item_icon_size"
+ android:layout_height="@dimen/lb_preference_item_icon_size"
+ android:layout_marginEnd="@dimen/lb_preference_item_icon_margin_end"
+ android:layout_gravity="center_vertical" />
+
+ <LinearLayout android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <Space android:layout_width="0dp" android:layout_height="@dimen/lb_preference_item_text_space_top" />
+ <TextView
+ android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/lb_preference_item_primary_text_margin_bottom"
+ android:textColor="@color/lb_preference_item_primary_text_color"
+ android:textSize="@dimen/lb_preference_item_primary_text_size"/>
+ <Space android:layout_width="0dp" android:layout_height="@dimen/lb_preference_item_text_space_bottom" />
+ </LinearLayout>
+
</LinearLayout>
diff --git a/v17/preference-leanback/res/layout/leanback_list_preference_item_single.xml b/v17/preference-leanback/res/layout/leanback_list_preference_item_single.xml
index eaf42a4..23e94bc 100644
--- a/v17/preference-leanback/res/layout/leanback_list_preference_item_single.xml
+++ b/v17/preference-leanback/res/layout/leanback_list_preference_item_single.xml
@@ -18,20 +18,34 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
android:layout_width="match_parent"
- android:layout_height="?android:attr/listPreferredItemHeight"
+ android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:descendantFocusability="blocksDescendants"
- android:orientation="horizontal">
+ android:orientation="horizontal"
+ android:paddingStart="@dimen/lb_preference_item_padding_start"
+ android:paddingEnd="@dimen/lb_preference_item_padding_end" >
+
<RadioButton
android:id="@+id/button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
- <TextView
- android:id="@android:id/title"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:gravity="center_vertical" />
+ android:layout_width="@dimen/lb_preference_item_icon_size"
+ android:layout_height="@dimen/lb_preference_item_icon_size"
+ android:layout_marginEnd="@dimen/lb_preference_item_icon_margin_end"
+ android:layout_gravity="center_vertical" />
+
+ <LinearLayout android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+ <Space android:layout_width="0dp" android:layout_height="@dimen/lb_preference_item_text_space_top" />
+ <TextView
+ android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/lb_preference_item_primary_text_margin_bottom"
+ android:textColor="@color/lb_preference_item_primary_text_color"
+ android:textSize="@dimen/lb_preference_item_primary_text_size"/>
+ <Space android:layout_width="0dp" android:layout_height="@dimen/lb_preference_item_text_space_bottom" />
+ </LinearLayout>
+
</LinearLayout>
diff --git a/v17/preference-leanback/res/layout/leanback_preference.xml b/v17/preference-leanback/res/layout/leanback_preference.xml
new file mode 100644
index 0000000..ca391c9
--- /dev/null
+++ b/v17/preference-leanback/res/layout/leanback_preference.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 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
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/container"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="?android:attr/selectableItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:descendantFocusability="blocksDescendants"
+ android:orientation="horizontal"
+ android:paddingStart="@dimen/lb_preference_item_padding_start"
+ android:paddingEnd="@dimen/lb_preference_item_padding_end" >
+
+ <FrameLayout
+ android:id="@+id/icon_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical" >
+ <ImageView
+ android:id="@android:id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ />
+ </FrameLayout>
+
+ <LinearLayout android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical">
+ <Space android:layout_width="0dp" android:layout_height="@dimen/lb_preference_item_text_space_top" />
+ <TextView
+ android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/lb_preference_item_primary_text_margin_bottom"
+ android:textColor="@color/lb_preference_item_primary_text_color"
+ android:textSize="@dimen/lb_preference_item_primary_text_size"/>
+ <TextView
+ android:id="@android:id/summary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@color/lb_preference_item_secondary_text_color"
+ android:textSize="@dimen/lb_preference_item_secondary_text_size"
+ android:maxLines="4" />
+ <Space android:layout_width="0dp" android:layout_height="@dimen/lb_preference_item_text_space_bottom" />
+ </LinearLayout>
+
+ <!-- Preference should place its actual preference widget here. -->
+ <LinearLayout android:id="@android:id/widget_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical"
+ android:orientation="vertical" />
+
+</LinearLayout>
diff --git a/v17/preference-leanback/res/layout/leanback_preference_category.xml b/v17/preference-leanback/res/layout/leanback_preference_category.xml
new file mode 100644
index 0000000..b3c2067
--- /dev/null
+++ b/v17/preference-leanback/res/layout/leanback_preference_category.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 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
+ -->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/lb_preference_category_height"
+ android:paddingStart="@dimen/lb_preference_item_padding_start"
+ android:paddingEnd="@dimen/lb_preference_item_padding_end">
+
+ <TextView
+ android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:textColor="@color/lb_preference_item_primary_text_color"
+ android:textSize="@dimen/lb_preference_category_text_size"/>
+</FrameLayout>
diff --git a/v17/preference-leanback/res/layout/leanback_preference_fragment.xml b/v17/preference-leanback/res/layout/leanback_preference_fragment.xml
index d119c2d..ffbbf66 100644
--- a/v17/preference-leanback/res/layout/leanback_preference_fragment.xml
+++ b/v17/preference-leanback/res/layout/leanback_preference_fragment.xml
@@ -35,11 +35,11 @@
android:id="@+id/decor_title"
android:layout_width="match_parent"
android:layout_height="@dimen/lb_preference_decor_title_text_height"
+ android:layout_marginTop="@dimen/lb_preference_decor_title_margin_top"
+ android:layout_marginStart="@dimen/lb_preference_decor_title_margin_start"
+ android:layout_marginEnd="@dimen/lb_preference_decor_title_margin_end"
android:fontFamily="sans-serif-condensed"
android:gravity="center_vertical"
- android:paddingTop="@dimen/lb_preference_decor_title_padding_top"
- android:paddingStart="@dimen/lb_preference_decor_title_padding_start"
- android:paddingEnd="@dimen/lb_preference_decor_title_padding_end"
android:singleLine="true"
android:textSize="@dimen/lb_preference_decor_title_text_size"
android:textColor="?android:attr/textColorPrimary"
diff --git a/v17/preference-leanback/res/layout/leanback_preference_information.xml b/v17/preference-leanback/res/layout/leanback_preference_information.xml
new file mode 100644
index 0000000..8c0c4b9
--- /dev/null
+++ b/v17/preference-leanback/res/layout/leanback_preference_information.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 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
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/container"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="?android:attr/selectableItemBackground"
+ android:clickable="false"
+ android:focusable="false"
+ android:descendantFocusability="blocksDescendants"
+ android:orientation="horizontal"
+ android:paddingStart="@dimen/lb_preference_item_padding_start"
+ android:paddingEnd="@dimen/lb_preference_item_padding_end" >
+
+ <LinearLayout android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:orientation="vertical">
+ <Space android:layout_width="0dp" android:layout_height="@dimen/lb_preference_item_text_space_top" />
+ <TextView
+ android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="@dimen/lb_preference_item_primary_text_margin_bottom"
+ android:textColor="@color/lb_preference_item_primary_text_color"
+ android:textSize="@dimen/lb_preference_item_primary_text_size"/>
+ <TextView
+ android:id="@android:id/summary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@color/lb_preference_item_secondary_text_color"
+ android:textSize="@dimen/lb_preference_item_secondary_text_size"
+ android:maxLines="4" />
+ <Space android:layout_width="0dp" android:layout_height="@dimen/lb_preference_item_text_space_bottom" />
+ </LinearLayout>
+
+ <!-- Preference should place its actual preference widget here. -->
+ <LinearLayout android:id="@android:id/widget_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical"
+ android:orientation="vertical" />
+
+</LinearLayout>
diff --git a/v17/preference-leanback/res/values/colors.xml b/v17/preference-leanback/res/values/colors.xml
index de6c888..30a373a 100644
--- a/v17/preference-leanback/res/values/colors.xml
+++ b/v17/preference-leanback/res/values/colors.xml
@@ -16,4 +16,11 @@
-->
<resources>
<color name="lb_preference_decor_list_background">#263238</color>
+
+ <color name="lb_preference_item_primary_text_color_default">#EEEEEE</color>
+ <color name="lb_preference_item_primary_text_color_disabled">#4DEEEEEE</color>
+
+ <color name="lb_preference_item_secondary_text_color_default">#B3EEEEEE</color>
+ <color name="lb_preference_item_secondary_text_color_disabled">#4DEEEEEE</color>
+
</resources>
diff --git a/v17/preference-leanback/res/values/dimens.xml b/v17/preference-leanback/res/values/dimens.xml
index 49763fe..dbd3b04 100644
--- a/v17/preference-leanback/res/values/dimens.xml
+++ b/v17/preference-leanback/res/values/dimens.xml
@@ -15,11 +15,25 @@
~ limitations under the License
-->
<resources>
- <dimen name="lb_preference_decor_title_text_height">64dp</dimen>
- <dimen name="lb_preference_decor_title_padding_top">27dp</dimen>
- <dimen name="lb_preference_decor_title_padding_start">24dp</dimen>
- <dimen name="lb_preference_decor_title_padding_end">56dp</dimen>
- <dimen name="lb_preference_decor_title_text_size">20sp</dimen>
+ <dimen name="lb_preference_decor_title_text_height">64dp</dimen>
+ <dimen name="lb_preference_decor_title_margin_top">27dp</dimen>
+ <dimen name="lb_preference_decor_title_margin_start">24dp</dimen>
+ <dimen name="lb_preference_decor_title_margin_end">56dp</dimen>
+ <dimen name="lb_preference_decor_title_text_size">20sp</dimen>
- <dimen name="lb_settings_pane_width">360dp</dimen>
+ <dimen name="lb_preference_item_padding_start">24dp</dimen>
+ <dimen name="lb_preference_item_padding_end">56dp</dimen>
+ <dimen name="lb_preference_item_icon_size">32dp</dimen>
+ <dimen name="lb_preference_item_icon_margin_end">16dp</dimen>
+
+ <dimen name="lb_preference_item_primary_text_size">14sp</dimen>
+ <dimen name="lb_preference_item_primary_text_margin_bottom">2dp</dimen>
+ <dimen name="lb_preference_item_secondary_text_size">12sp</dimen>
+ <dimen name="lb_preference_item_text_space_top">14dp</dimen>
+ <dimen name="lb_preference_item_text_space_bottom">13dp</dimen>
+
+ <dimen name="lb_preference_category_text_size">12sp</dimen>
+ <dimen name="lb_preference_category_height">40dp</dimen>
+
+ <dimen name="lb_settings_pane_width">360dp</dimen>
</resources>
diff --git a/v17/preference-leanback/res/values/styles.xml b/v17/preference-leanback/res/values/styles.xml
new file mode 100644
index 0000000..0b315a8
--- /dev/null
+++ b/v17/preference-leanback/res/values/styles.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 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>
+
+ <style name="LeanbackPreference">
+ <item name="layout">@layout/leanback_preference</item>
+ </style>
+
+ <style name="LeanbackPreference.Information">
+ <item name="layout">@layout/leanback_preference_information</item>
+ <item name="enabled">false</item>
+ <item name="shouldDisableView">false</item>
+ </style>
+
+ <style name="LeanbackPreference.Category">
+ <item name="layout">@layout/leanback_preference_category</item>
+ <!-- The title should not dim if the category is disabled, instead only the preference children should dim. -->
+ <item name="shouldDisableView">false</item>
+ <item name="selectable">false</item>
+ </style>
+
+ <style name="LeanbackPreference.CheckBoxPreference">
+ <item name="widgetLayout">@layout/preference_widget_checkbox</item>
+ </style>
+
+ <style name="LeanbackPreference.SwitchPreferenceCompat">
+ <item name="widgetLayout">@layout/preference_widget_switch_compat</item>
+ <item name="switchTextOn">@string/v7_preference_on</item>
+ <item name="switchTextOff">@string/v7_preference_off</item>
+ </style>
+
+ <style name="LeanbackPreference.SwitchPreference">
+ <item name="widgetLayout">@layout/preference_widget_switch</item>
+ <item name="switchTextOn">@string/v7_preference_on</item>
+ <item name="switchTextOff">@string/v7_preference_off</item>
+ </style>
+
+ <style name="LeanbackPreference.PreferenceScreen">
+ </style>
+
+ <style name="LeanbackPreference.DialogPreference">
+ <item name="positiveButtonText">@android:string/ok</item>
+ <item name="negativeButtonText">@android:string/cancel</item>
+ </style>
+
+ <style name="LeanbackPreference.DialogPreference.EditTextPreference">
+ <item name="dialogLayout">@layout/preference_dialog_edittext</item>
+ </style>
+
+</resources>
diff --git a/v17/preference-leanback/res/values/themes.xml b/v17/preference-leanback/res/values/themes.xml
new file mode 100644
index 0000000..b3060d9
--- /dev/null
+++ b/v17/preference-leanback/res/values/themes.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 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>
+ <style name="PreferenceThemeOverlay.v14.Leanback">
+ <item name="preferenceScreenStyle">@style/LeanbackPreference.PreferenceScreen</item>
+ <item name="preferenceCategoryStyle">@style/LeanbackPreference.Category</item>
+ <item name="preferenceStyle">@style/LeanbackPreference</item>
+ <item name="preferenceInformationStyle">@style/LeanbackPreference.Information</item>
+ <item name="checkBoxPreferenceStyle">@style/LeanbackPreference.CheckBoxPreference</item>
+ <item name="switchPreferenceCompatStyle">@style/LeanbackPreference.SwitchPreferenceCompat</item>
+ <item name="switchPreferenceStyle">@style/LeanbackPreference.SwitchPreference</item>
+ <item name="dialogPreferenceStyle">@style/LeanbackPreference.DialogPreference</item>
+ <item name="editTextPreferenceStyle">@style/LeanbackPreference.DialogPreference.EditTextPreference</item>
+ </style>
+</resources>
diff --git a/v7/appcompat/res/values-az-rAZ/strings.xml b/v7/appcompat/res/values-az-rAZ/strings.xml
deleted file mode 100644
index a39f5f4..0000000
--- a/v7/appcompat/res/values-az-rAZ/strings.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (C) 2012 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 xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="abc_action_mode_done" msgid="4076576682505996667">"Hazırdır"</string>
- <string name="abc_action_bar_home_description" msgid="4600421777120114993">"Evə get"</string>
- <string name="abc_action_bar_up_description" msgid="1594238315039666878">"Yuxarı get"</string>
- <string name="abc_action_menu_overflow_description" msgid="3588849162933574182">"Daha çox seçim"</string>
- <string name="abc_toolbar_collapse_description" msgid="1603543279005712093">"Dağıt"</string>
- <string name="abc_action_bar_home_description_format" msgid="1397052879051804371">"%1$s, %2$s"</string>
- <string name="abc_action_bar_home_subtitle_description_format" msgid="6623331958280229229">"%1$s, %2$s, %3$s"</string>
- <string name="abc_searchview_description_search" msgid="8264924765203268293">"Axtarış"</string>
- <string name="abc_search_hint" msgid="7723749260725869598">"Axtarış..."</string>
- <string name="abc_searchview_description_query" msgid="2550479030709304392">"Axtarış sorğusu"</string>
- <string name="abc_searchview_description_clear" msgid="3691816814315814921">"Sorğunu təmizlə"</string>
- <string name="abc_searchview_description_submit" msgid="8928215447528550784">"Sorğunu göndərin"</string>
- <string name="abc_searchview_description_voice" msgid="893419373245838918">"Səsli axtarış"</string>
- <string name="abc_activitychooserview_choose_application" msgid="2031811694353399454">"Tətbiq seçin"</string>
- <string name="abc_activity_chooser_view_see_all" msgid="7468859129482906941">"Hamısına baxın"</string>
- <!-- String.format failed for translation -->
- <!-- no translation found for abc_shareactionprovider_share_with_application (7165123711973476752) -->
- <skip />
- <string name="abc_shareactionprovider_share_with" msgid="3421042268587513524">"Bununla paylaşın"</string>
- <string name="status_bar_notification_info_overflow" msgid="2869576371154716097">"999+"</string>
-</resources>
diff --git a/v7/appcompat/res/values-kk-rKZ/strings.xml b/v7/appcompat/res/values-kk-rKZ/strings.xml
index 2ce080f..52b9af5 100644
--- a/v7/appcompat/res/values-kk-rKZ/strings.xml
+++ b/v7/appcompat/res/values-kk-rKZ/strings.xml
@@ -16,7 +16,7 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="abc_action_mode_done" msgid="4076576682505996667">"Дайын"</string>
+ <string name="abc_action_mode_done" msgid="4076576682505996667">"Орындалды"</string>
<string name="abc_action_bar_home_description" msgid="4600421777120114993">"Негізгі бетте қозғалу"</string>
<string name="abc_action_bar_up_description" msgid="1594238315039666878">"Жоғары қозғалу"</string>
<string name="abc_action_menu_overflow_description" msgid="3588849162933574182">"Басқа опциялар"</string>
diff --git a/v7/mediarouter/res/values-az-rAZ/strings.xml b/v7/mediarouter/res/values-az-rAZ/strings.xml
deleted file mode 100644
index 2f3ff74..0000000
--- a/v7/mediarouter/res/values-az-rAZ/strings.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (C) 2013 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 xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <string name="mr_system_route_name" msgid="5441529851481176817">"Sistem"</string>
- <string name="mr_user_route_category_name" msgid="7498112907524977311">"Cihazlar"</string>
- <string name="mr_media_route_button_content_description" msgid="8327680881775995150">"İştirakçılar"</string>
- <string name="mr_media_route_chooser_title" msgid="7106830097177242655">"Cihaza qoş"</string>
- <string name="mr_media_route_chooser_searching" msgid="7553005460920830010">"Cihazları axtarır..."</string>
- <string name="mr_media_route_controller_disconnect" msgid="109793632378378069">"Bağlantını kəs"</string>
- <string name="mr_media_route_controller_stop" msgid="5398645111664294430">"Yayımı dayandır"</string>
- <string name="mr_media_route_controller_settings_description" msgid="379358765881274425">"Marşrut parametrləri"</string>
- <string name="mr_media_route_controller_play" msgid="5214423499524760404">"Göstər"</string>
- <string name="mr_media_route_controller_pause" msgid="8315773974194466049">"Fasilə ver"</string>
-</resources>
diff --git a/v7/preference/res/layout/preference_category.xml b/v7/preference/res/layout/preference_category.xml
index 0b58063..258f7da 100644
--- a/v7/preference/res/layout/preference_category.xml
+++ b/v7/preference/res/layout/preference_category.xml
@@ -20,6 +20,6 @@
android:layout_height="wrap_content" >
<TextView
style="?android:attr/listSeparatorTextViewStyle"
- android:id="@+android:id/title"
+ android:id="@android:id/title"
/>
</FrameLayout>
diff --git a/v7/preference/res/layout/preference_information.xml b/v7/preference/res/layout/preference_information.xml
index e3be3820..5815c46 100644
--- a/v7/preference/res/layout/preference_information.xml
+++ b/v7/preference/res/layout/preference_information.xml
@@ -33,14 +33,14 @@
android:layout_marginBottom="6sp"
android:layout_weight="1">
- <TextView android:id="@+android:id/title"
+ <TextView android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="?android:attr/textColorSecondary" />
- <TextView android:id="@+android:id/summary"
+ <TextView android:id="@android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@android:id/title"
@@ -52,7 +52,7 @@
</RelativeLayout>
<!-- Preference should place its actual preference widget here. -->
- <LinearLayout android:id="@+android:id/widget_frame"
+ <LinearLayout android:id="@android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"