Merge "Lights out."
This commit is contained in:
committed by
Android (Google) Code Review
commit
7e04056ca9
@@ -2,4 +2,5 @@
|
||||
public void notificationIconsClicked(android.view.View);
|
||||
public void systemInfoClicked(android.view.View);
|
||||
public void recentButtonClicked(android.view.View);
|
||||
public void toggleLightsOut(android.view.View);
|
||||
}
|
||||
|
||||
25
packages/SystemUI/res/anim/lights_out_in.xml
Normal file
25
packages/SystemUI/res/anim/lights_out_in.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 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.
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
>
|
||||
<translate android:fromYDelta="100%p" android:toYDelta="0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
/>
|
||||
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
/>
|
||||
</set>
|
||||
25
packages/SystemUI/res/anim/lights_out_out.xml
Normal file
25
packages/SystemUI/res/anim/lights_out_out.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 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.
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
>
|
||||
<translate android:toYDelta="100%p" android:fromYDelta="0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
/>
|
||||
<alpha android:toAlpha="0.1" android:fromAlpha="1.0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
/>
|
||||
</set>
|
||||
25
packages/SystemUI/res/anim/status_bar_in.xml
Normal file
25
packages/SystemUI/res/anim/status_bar_in.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 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.
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
>
|
||||
<translate android:fromYDelta="-100%p" android:toYDelta="0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
/>
|
||||
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
/>
|
||||
</set>
|
||||
25
packages/SystemUI/res/anim/status_bar_out.xml
Normal file
25
packages/SystemUI/res/anim/status_bar_out.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 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.
|
||||
-->
|
||||
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
>
|
||||
<translate android:toYDelta="-100%p" android:fromYDelta="0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
/>
|
||||
<alpha android:toAlpha="0.0" android:fromAlpha="1.0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
/>
|
||||
</set>
|
||||
@@ -19,13 +19,16 @@
|
||||
-->
|
||||
|
||||
<!-- android:background="@drawable/status_bar_closed_default_background" -->
|
||||
<RelativeLayout
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
|
||||
android:background="@drawable/status_bar_background"
|
||||
android:focusable="true"
|
||||
android:descendantFocusability="afterDescendants"
|
||||
>
|
||||
<RelativeLayout
|
||||
android:id="@+id/bar_contents"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
<com.android.systemui.statusbar.tablet.NotificationIconArea
|
||||
android:id="@+id/notificationIcons"
|
||||
@@ -144,5 +147,19 @@
|
||||
android:background="@drawable/ic_sysbar_icon_bg"
|
||||
systemui:keyCode="4"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- It's curtains for you. -->
|
||||
<ImageView
|
||||
android:id="@+id/lights_out"
|
||||
android:src="@drawable/ic_sysbar_lightsout"
|
||||
android:gravity="center"
|
||||
android:background="#FF000000"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="invisible"
|
||||
android:clickable="true"
|
||||
android:onClick="toggleLightsOut"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ import android.os.IBinder;
|
||||
import android.os.Message;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -82,6 +84,9 @@ public class TabletStatusBarService extends StatusBarService {
|
||||
ImageView mSignalMeter;
|
||||
ImageView mSignalIcon;
|
||||
|
||||
View mBarContents;
|
||||
View mCurtains;
|
||||
|
||||
NotificationIconArea.IconLayout mIconLayout;
|
||||
|
||||
KickerController mKicker;
|
||||
@@ -150,6 +155,19 @@ public class TabletStatusBarService extends StatusBarService {
|
||||
final View sb = View.inflate(this, R.layout.status_bar, null);
|
||||
mStatusBarView = sb;
|
||||
|
||||
mBarContents = sb.findViewById(R.id.bar_contents);
|
||||
mCurtains = sb.findViewById(R.id.lights_out);
|
||||
View systemInfo = sb.findViewById(R.id.systemInfo);
|
||||
View.OnLongClickListener toggle = new View.OnLongClickListener() {
|
||||
public boolean onLongClick(View v) {
|
||||
toggleLightsOut(v);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
systemInfo.setOnLongClickListener(toggle);
|
||||
mCurtains.setOnLongClickListener(toggle);
|
||||
|
||||
// the more notifications icon
|
||||
mNotificationIconArea = (NotificationIconArea)sb.findViewById(R.id.notificationIcons);
|
||||
|
||||
@@ -719,6 +737,28 @@ public class TabletStatusBarService extends StatusBarService {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void setLightsOut(boolean out) {
|
||||
if (out) {
|
||||
mCurtains.setAnimation(AnimationUtils.loadAnimation((Context)this,
|
||||
R.anim.lights_out_in));
|
||||
mCurtains.setVisibility(View.VISIBLE);
|
||||
mBarContents.setAnimation(AnimationUtils.loadAnimation((Context)this,
|
||||
R.anim.status_bar_out));
|
||||
mBarContents.setVisibility(View.GONE);
|
||||
} else {
|
||||
mCurtains.setAnimation(AnimationUtils.loadAnimation((Context)this,
|
||||
R.anim.lights_out_out));
|
||||
mCurtains.setVisibility(View.GONE);
|
||||
mBarContents.setAnimation(AnimationUtils.loadAnimation((Context)this,
|
||||
R.anim.status_bar_in));
|
||||
mBarContents.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public void toggleLightsOut(View v) {
|
||||
setLightsOut(mCurtains.getVisibility() != View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user