[frameworks/base] MultiWindow SystemUI:default show notification on HeadsUpNotificationView,fix Calendar

This commit is contained in:
Firefly
2015-12-24 14:41:10 +08:00
committed by cjp
parent d62086c2af
commit ae4e7bbca6
6 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,33 @@
<?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.
-->
<!-- extends FrameLayout -->
<com.android.systemui.statusbar.policy.HeadsUpNotificationView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@drawable/heads_up_scrim">
<FrameLayout
android:layout_width="@dimen/notification_panel_width"
android:layout_height="wrap_content"
android:layout_gravity="@integer/notification_panel_layout_gravity_left"
android:paddingStart="@dimen/notification_side_padding"
android:paddingEnd="@dimen/notification_side_padding"
android:elevation="8dp"
android:id="@+id/content_holder" />
</com.android.systemui.statusbar.policy.HeadsUpNotificationView>

View File

@ -146,6 +146,9 @@
<!-- milliseconds before the heads up notification auto-dismisses. -->
<integer name="heads_up_notification_decay">10000</integer>
<!--For MultiWindow mode: milliseconds before the heads up notification auto-dismisses. -->
<integer name="heads_up_notification_decay_win">2000</integer>
<!-- milliseconds after a heads up notification is pushed back
before the app can interrupt again. -->

View File

@ -2197,6 +2197,9 @@ public abstract class BaseStatusBar extends SystemUI implements
boolean accessibilityForcesLaunch = isFullscreen
&& mAccessibilityManager.isTouchExplorationEnabled();
if(mContext.getResources().getConfiguration().enableMultiWindow()&&!isFullscreen)
isFullscreen = true&&!sbn.isOngoing();
boolean interrupt = (isFullscreen || (isHighPriority && (isNoisy || hasTicker)))
&& isAllowed
&& !accessibilityForcesLaunch

View File

@ -161,7 +161,10 @@ public class CalendarDialog implements OnDateSelectedListener{
}
Log.d(TAG, "closeCalendar...");
}
public boolean isCalendarShow(){
return mDateCenter.isShowing();
}
/**
* Simulate an API call to show how to add decorators
*/

View File

@ -1085,8 +1085,13 @@ final Object mScreenshotLock = new Object();
R.color.notification_panel_solid_background)));
}
if (ENABLE_HEADS_UP) {
if(mContext.getResources().getConfiguration().enableMultiWindow()){
mHeadsUpNotificationView =
(HeadsUpNotificationView) View.inflate(context, R.layout.heads_up_win, null);
} else {
mHeadsUpNotificationView =
(HeadsUpNotificationView) View.inflate(context, R.layout.heads_up, null);
}
mHeadsUpNotificationView.setVisibility(View.GONE);
mHeadsUpNotificationView.setBar(this);
}
@ -2708,7 +2713,10 @@ private String popupAppName = null;
int action = event.getAction() & MotionEvent.ACTION_MASK;
if(action == MotionEvent.ACTION_UP){
if(null != mCalendarDialog){
if(!mCalendarDialog.isCalendarShow())
mCalendarDialog.openCalendar();
else
mCalendarDialog.closeCalendar();
}
return true;
}
@ -5050,6 +5058,9 @@ private String popupAppName = null;
MUL_CON_POS = MUL_CON_PAD+ (int)(MUL_IMA_SIZE/2);
mHeadsUpNotificationDecay = res.getInteger(R.integer.heads_up_notification_decay);
if(mContext.getResources().getConfiguration().enableMultiWindow())
mHeadsUpNotificationDecay = res.getInteger(R.integer.heads_up_notification_decay_win);
mRowMinHeight = res.getDimensionPixelSize(R.dimen.notification_min_height);
mRowMaxHeight = res.getDimensionPixelSize(R.dimen.notification_max_height);

View File

@ -94,6 +94,9 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
final LayoutParams lp = (LayoutParams) mContentHolder.getLayoutParams();
lp.width = getResources().getDimensionPixelSize(R.dimen.notification_panel_width);
lp.gravity = getResources().getInteger(R.integer.notification_panel_layout_gravity);
if(getResources().getConfiguration().enableMultiWindow()){
lp.gravity = getResources().getInteger(R.integer.notification_panel_layout_gravity_left);
}
mContentHolder.setLayoutParams(lp);
}
}