am 3be3919c: am c1975a18: am 4fd20a99: Merge "QS: Add scanning progress state indication." into lmp-dev
* commit '3be3919c17c048fd9aa3e4baad534215cba4b2eb': QS: Add scanning progress state indication.
This commit is contained in:
45
packages/SystemUI/res/drawable/indeterminate.xml
Normal file
45
packages/SystemUI/res/drawable/indeterminate.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="2dp"
|
||||
android:viewportHeight="1"
|
||||
android:viewportWidth="360"
|
||||
android:width="360dp" >
|
||||
|
||||
<group
|
||||
android:name="linear_indeterminate"
|
||||
android:translateX="180.0"
|
||||
android:translateY="0.0" >
|
||||
<group
|
||||
android:name="path1"
|
||||
android:scaleX="0.1"
|
||||
android:translateX="-522.59" >
|
||||
<path
|
||||
android:name="rect1"
|
||||
android:fillColor="?android:attr/colorControlActivated"
|
||||
android:pathData="m 0 0 l 288 0 l 0 1 l -288 0 z" />
|
||||
</group>
|
||||
<group
|
||||
android:name="path2"
|
||||
android:scaleX="0.1"
|
||||
android:translateX="-197.6" >
|
||||
<path
|
||||
android:name="rect2"
|
||||
android:fillColor="?android:attr/colorControlActivated"
|
||||
android:pathData="m 0 0 l 288 0 l 0 1 l -288 0 z" />
|
||||
</group>
|
||||
</group>
|
||||
</vector>
|
||||
32
packages/SystemUI/res/drawable/indeterminate_anim.xml
Normal file
32
packages/SystemUI/res/drawable/indeterminate_anim.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@drawable/indeterminate" >
|
||||
|
||||
<target
|
||||
android:name="path1"
|
||||
android:animation="@*android:anim/progress_indeterminate_horizontal_rect1_translate" />
|
||||
<target
|
||||
android:name="path1"
|
||||
android:animation="@*android:anim/progress_indeterminate_horizontal_rect1_scale" />
|
||||
|
||||
<target
|
||||
android:name="path2"
|
||||
android:animation="@*android:anim/progress_indeterminate_horizontal_rect2_translate" />
|
||||
<target
|
||||
android:name="path2"
|
||||
android:animation="@*android:anim/progress_indeterminate_horizontal_rect2_scale" />
|
||||
</animated-vector>
|
||||
@@ -148,6 +148,16 @@
|
||||
android:layout_alignParentBottom="true"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/qs_detail_header_progress"
|
||||
android:src="@drawable/indeterminate_anim"
|
||||
android:alpha="0"
|
||||
android:background="@color/qs_detail_progress_track"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header_debug_info"
|
||||
android:visibility="invisible"
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
<color name="qs_subhead">#99FFFFFF</color><!-- 60% white -->
|
||||
<color name="qs_detail_empty">#24B0BEC5</color><!-- 14% blue grey 200-->
|
||||
<color name="qs_detail_transition">#66FFFFFF</color>
|
||||
<color name="qs_detail_progress_track">#99009688</color><!-- 60% deep teal 500 -->
|
||||
<color name="data_usage_secondary">#99FFFFFF</color><!-- 60% white -->
|
||||
<color name="data_usage_graph_track">#33FFFFFF</color><!-- 20% white -->
|
||||
<color name="data_usage_graph_warning">#FFFFFFFF</color>
|
||||
|
||||
@@ -234,8 +234,9 @@ public class QSPanel extends ViewGroup {
|
||||
}
|
||||
@Override
|
||||
public void onScanStateChanged(boolean state) {
|
||||
r.scanState = state;
|
||||
if (mDetailRecord == r) {
|
||||
fireScanStateChanged(state);
|
||||
fireScanStateChanged(r.scanState);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -310,9 +311,10 @@ public class QSPanel extends ViewGroup {
|
||||
mDetailContent.removeAllViews();
|
||||
mDetail.bringToFront();
|
||||
mDetailContent.addView(r.detailView);
|
||||
mDetailRecord = r;
|
||||
setDetailRecord(r);
|
||||
} else {
|
||||
listener = mTeardownDetailWhenDone;
|
||||
fireScanStateChanged(false);
|
||||
}
|
||||
fireShowingDetail(show ? detailAdapter : null);
|
||||
mClipper.animateCircularClip(x, y, show, listener);
|
||||
@@ -425,6 +427,14 @@ public class QSPanel extends ViewGroup {
|
||||
}
|
||||
}
|
||||
|
||||
private void setDetailRecord(Record r) {
|
||||
if (r == mDetailRecord) return;
|
||||
mDetailRecord = r;
|
||||
final boolean scanState = mDetailRecord instanceof TileRecord
|
||||
&& ((TileRecord) mDetailRecord).scanState;
|
||||
fireScanStateChanged(scanState);
|
||||
}
|
||||
|
||||
private class H extends Handler {
|
||||
private static final int SHOW_DETAIL = 1;
|
||||
private static final int SET_TILE_VISIBILITY = 2;
|
||||
@@ -448,12 +458,13 @@ public class QSPanel extends ViewGroup {
|
||||
QSTileView tileView;
|
||||
int row;
|
||||
int col;
|
||||
boolean scanState;
|
||||
}
|
||||
|
||||
private final AnimatorListenerAdapter mTeardownDetailWhenDone = new AnimatorListenerAdapter() {
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mDetailContent.removeAllViews();
|
||||
mDetailRecord = null;
|
||||
setDetailRecord(null);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Animatable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
@@ -68,6 +69,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
|
||||
private View mQsDetailHeader;
|
||||
private TextView mQsDetailHeaderTitle;
|
||||
private Switch mQsDetailHeaderSwitch;
|
||||
private ImageView mQsDetailHeaderProgress;
|
||||
private View mEmergencyCallsOnly;
|
||||
private TextView mBatteryLevel;
|
||||
private TextView mAlarmStatus;
|
||||
@@ -137,6 +139,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
|
||||
mQsDetailHeader.setAlpha(0);
|
||||
mQsDetailHeaderTitle = (TextView) mQsDetailHeader.findViewById(android.R.id.title);
|
||||
mQsDetailHeaderSwitch = (Switch) mQsDetailHeader.findViewById(android.R.id.toggle);
|
||||
mQsDetailHeaderProgress = (ImageView) findViewById(R.id.qs_detail_header_progress);
|
||||
mEmergencyCallsOnly = findViewById(R.id.header_emergency_calls_only);
|
||||
mBatteryLevel = (TextView) findViewById(R.id.battery_level);
|
||||
mAlarmStatus = (TextView) findViewById(R.id.alarm_status);
|
||||
@@ -658,6 +661,8 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
|
||||
}
|
||||
|
||||
private final QSPanel.Callback mQsPanelCallback = new QSPanel.Callback() {
|
||||
private boolean mScanState;
|
||||
|
||||
@Override
|
||||
public void onToggleStateChanged(final boolean state) {
|
||||
post(new Runnable() {
|
||||
@@ -693,7 +698,16 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
|
||||
}
|
||||
|
||||
private void handleScanStateChanged(boolean state) {
|
||||
// TODO - waiting on framework asset
|
||||
if (mScanState == state) return;
|
||||
mScanState = state;
|
||||
final Animatable anim = (Animatable) mQsDetailHeaderProgress.getDrawable();
|
||||
if (state) {
|
||||
mQsDetailHeaderProgress.animate().alpha(1f);
|
||||
anim.start();
|
||||
} else {
|
||||
mQsDetailHeaderProgress.animate().alpha(0f);
|
||||
anim.stop();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleShowingDetail(final QSTile.DetailAdapter detail) {
|
||||
|
||||
Reference in New Issue
Block a user