Merge "Improve handling of small largeIcons in tablet ticker." into ics-mr1
This commit is contained in:
committed by
Android (Google) Code Review
commit
29933fb26a
@ -15,20 +15,29 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:gravity="bottom"
|
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_height="@*android:dimen/status_bar_height"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:background="@drawable/status_bar_ticker_background"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:clickable="false"
|
||||||
|
/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/large_icon"
|
android:id="@+id/large_icon"
|
||||||
android:layout_width="@android:dimen/notification_large_icon_height"
|
android:layout_width="@android:dimen/notification_large_icon_height"
|
||||||
android:layout_height="@android:dimen/notification_large_icon_width"
|
android:layout_height="@android:dimen/notification_large_icon_width"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
@ -36,6 +45,8 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_height="@*android:dimen/status_bar_height"
|
android:layout_height="@*android:dimen/status_bar_height"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:background="@drawable/status_bar_ticker_background"
|
android:layout_toRightOf="@id/large_icon"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignWithParentIfMissing="true"
|
||||||
/>
|
/>
|
||||||
</LinearLayout>
|
</RelativeLayout>
|
||||||
|
@ -73,6 +73,8 @@ public class TabletTicker
|
|||||||
private StatusBarNotification[] mQueue = new StatusBarNotification[QUEUE_LENGTH];
|
private StatusBarNotification[] mQueue = new StatusBarNotification[QUEUE_LENGTH];
|
||||||
private int mQueuePos;
|
private int mQueuePos;
|
||||||
|
|
||||||
|
private final int mLargeIconHeight;
|
||||||
|
|
||||||
private TabletStatusBar mBar;
|
private TabletStatusBar mBar;
|
||||||
|
|
||||||
private LayoutTransition mLayoutTransition;
|
private LayoutTransition mLayoutTransition;
|
||||||
@ -81,6 +83,9 @@ public class TabletTicker
|
|||||||
public TabletTicker(TabletStatusBar bar) {
|
public TabletTicker(TabletStatusBar bar) {
|
||||||
mBar = bar;
|
mBar = bar;
|
||||||
mContext = bar.getContext();
|
mContext = bar.getContext();
|
||||||
|
final Resources res = mContext.getResources();
|
||||||
|
mLargeIconHeight = res.getDimensionPixelSize(
|
||||||
|
android.R.dimen.notification_large_icon_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(IBinder key, StatusBarNotification notification) {
|
public void add(IBinder key, StatusBarNotification notification) {
|
||||||
@ -209,8 +214,6 @@ public class TabletTicker
|
|||||||
final Resources res = mContext.getResources();
|
final Resources res = mContext.getResources();
|
||||||
final FrameLayout view = new FrameLayout(mContext);
|
final FrameLayout view = new FrameLayout(mContext);
|
||||||
final int width = res.getDimensionPixelSize(R.dimen.notification_ticker_width);
|
final int width = res.getDimensionPixelSize(R.dimen.notification_ticker_width);
|
||||||
final int height = res.getDimensionPixelSize(
|
|
||||||
android.R.dimen.notification_large_icon_height);
|
|
||||||
int windowFlags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
int windowFlags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
|
||||||
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
||||||
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
|
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
|
||||||
@ -219,7 +222,7 @@ public class TabletTicker
|
|||||||
} else {
|
} else {
|
||||||
windowFlags |= WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
|
windowFlags |= WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
|
||||||
}
|
}
|
||||||
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(width, height,
|
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(width, mLargeIconHeight,
|
||||||
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, windowFlags,
|
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL, windowFlags,
|
||||||
PixelFormat.TRANSLUCENT);
|
PixelFormat.TRANSLUCENT);
|
||||||
lp.gravity = Gravity.BOTTOM | Gravity.RIGHT;
|
lp.gravity = Gravity.BOTTOM | Gravity.RIGHT;
|
||||||
@ -297,6 +300,16 @@ public class TabletTicker
|
|||||||
if (n.largeIcon != null) {
|
if (n.largeIcon != null) {
|
||||||
largeIcon.setImageBitmap(n.largeIcon);
|
largeIcon.setImageBitmap(n.largeIcon);
|
||||||
largeIcon.setVisibility(View.VISIBLE);
|
largeIcon.setVisibility(View.VISIBLE);
|
||||||
|
final ViewGroup.LayoutParams lp = largeIcon.getLayoutParams();
|
||||||
|
final int statusBarHeight = mBar.getStatusBarHeight();
|
||||||
|
if (n.largeIcon.getHeight() <= statusBarHeight) {
|
||||||
|
// for smallish largeIcons, it looks a little odd to have them floating halfway up
|
||||||
|
// the ticker, so we vertically center them in the status bar area instead
|
||||||
|
lp.height = statusBarHeight;
|
||||||
|
} else {
|
||||||
|
lp.height = mLargeIconHeight;
|
||||||
|
}
|
||||||
|
largeIcon.setLayoutParams(lp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CLICKABLE_TICKER) {
|
if (CLICKABLE_TICKER) {
|
||||||
|
@ -605,6 +605,11 @@
|
|||||||
style="@style/FieldContents"
|
style="@style/FieldContents"
|
||||||
android:text="pineapple2"
|
android:text="pineapple2"
|
||||||
/>
|
/>
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/large_icon_small"
|
||||||
|
style="@style/FieldContents"
|
||||||
|
android:text="small"
|
||||||
|
/>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
|
||||||
|
|
||||||
|
@ -287,6 +287,9 @@ public class NotificationBuilderTest extends Activity
|
|||||||
case R.id.large_icon_pineapple2:
|
case R.id.large_icon_pineapple2:
|
||||||
b.setLargeIcon(loadBitmap(R.drawable.pineapple2));
|
b.setLargeIcon(loadBitmap(R.drawable.pineapple2));
|
||||||
break;
|
break;
|
||||||
|
case R.id.large_icon_small:
|
||||||
|
b.setLargeIcon(loadBitmap(R.drawable.icon2));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sound TODO
|
// sound TODO
|
||||||
|
Reference in New Issue
Block a user