summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2016-05-23 20:38:41 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-06-09 14:10:31 -0700
commite704fc0d3a5bcf8c815c4af58d196e27c6ee47d3 (patch)
tree8380beafcabc5bdb627ab9e1de77d5f287d39b92 /packages
parent6c769a702f40cd0e029196620a1838c9481d5dca (diff)
downloadframeworks_base-e704fc0d3a5bcf8c815c4af58d196e27c6ee47d3.zip
frameworks_base-e704fc0d3a5bcf8c815c4af58d196e27c6ee47d3.tar.gz
frameworks_base-e704fc0d3a5bcf8c815c4af58d196e27c6ee47d3.tar.bz2
Keyguard: Get your weather on... the lock screen [1/3]
Change-Id: Ieed59aa488a0a26fa9fc27bd77cbdc6156baac68
Diffstat (limited to 'packages')
-rw-r--r--packages/Keyguard/res/layout/keyguard_status_view.xml14
-rw-r--r--packages/SystemUI/res/values/cm_strings.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java42
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java2
4 files changed, 59 insertions, 3 deletions
diff --git a/packages/Keyguard/res/layout/keyguard_status_view.xml b/packages/Keyguard/res/layout/keyguard_status_view.xml
index fc0b568..e957f6a 100644
--- a/packages/Keyguard/res/layout/keyguard_status_view.xml
+++ b/packages/Keyguard/res/layout/keyguard_status_view.xml
@@ -34,6 +34,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:orientation="vertical" >
+
<TextClock
android:id="@+id/clock_view"
android:layout_width="wrap_content"
@@ -47,6 +48,19 @@
android:layout_marginBottom="@dimen/bottom_text_spacing_digital" />
<include layout="@layout/keyguard_status_area" />
+
+ <TextView android:id="@+id/weather_info"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:textColor="@color/clock_white"
+ style="@style/widget_label"
+ android:textAllCaps="true"
+ android:letterSpacing="0.15"
+ android:gravity="center"
+ android:singleLine="true"
+ android:visibility="gone"/>
+
<TextView
android:id="@+id/owner_info"
android:layout_marginLeft="16dp"
diff --git a/packages/SystemUI/res/values/cm_strings.xml b/packages/SystemUI/res/values/cm_strings.xml
index 1dea2d9..af1e0d2 100644
--- a/packages/SystemUI/res/values/cm_strings.xml
+++ b/packages/SystemUI/res/values/cm_strings.xml
@@ -271,4 +271,8 @@
<!-- Path data for circle battery -->
<string name="battery_circle_path" translatable="false">M 12 3.5 C 16.6944203736 3.5 20.5 7.30557962644 20.5 12 C 20.5 16.6944203736 16.6944203736 20.5 12 20.5 C 7.30557962644 20.5 3.5 16.6944203736 3.5 12 C 3.5 7.30557962644 7.30557962644 3.5 12 3.5 Z</string>
+
+ <!-- Weather string format in keyguard -->
+ <string name="keyguard_status_view_weather_format"><xliff:g id="temp">%1$s</xliff:g> <xliff:g id="condition">%2$s</xliff:g></string>
+
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 7f16f31..a105f24 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -77,10 +77,13 @@ import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import com.android.systemui.statusbar.policy.KeyguardUserSwitcher;
import com.android.systemui.statusbar.policy.LiveLockScreenController;
+import com.android.systemui.statusbar.policy.WeatherController;
+import com.android.systemui.statusbar.policy.WeatherControllerImpl;
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.stack.StackStateAnimator;
import cyanogenmod.providers.CMSettings;
+import cyanogenmod.weather.util.WeatherUtils;
import java.util.List;
@@ -88,7 +91,7 @@ public class NotificationPanelView extends PanelView implements
ExpandableView.OnHeightChangedListener, ObservableScrollView.Listener,
View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener,
KeyguardAffordanceHelper.Callback, NotificationStackScrollLayout.OnEmptySpaceClickListener,
- HeadsUpManager.OnHeadsUpChangedListener {
+ HeadsUpManager.OnHeadsUpChangedListener, WeatherController.Callback {
private static final boolean DEBUG = false;
@@ -265,6 +268,11 @@ public class NotificationPanelView extends PanelView implements
private ViewLinker mViewLinker;
private final UnlockMethodCache mUnlockMethodCache;
private boolean mDetailScrollLock;
+
+ private boolean mKeyguardWeatherEnabled;
+ private TextView mKeyguardWeatherInfo;
+ private WeatherControllerImpl mWeatherController;
+
private enum SwipeLockedDirection {
UNKNOWN,
HORIZONTAL,
@@ -402,6 +410,11 @@ public class NotificationPanelView extends PanelView implements
mLiveLockscreenController = liveController;
}
+ public void setWeatherController(WeatherControllerImpl weatherController) {
+ mWeatherController = weatherController;
+ mWeatherController.addCallback(this);
+ }
+
@Override
protected void onFinishInflate() {
super.onFinishInflate();
@@ -504,6 +517,8 @@ public class NotificationPanelView extends PanelView implements
}
}
});
+
+ mKeyguardWeatherInfo = (TextView) mKeyguardStatusView.findViewById(R.id.weather_info);
}
public boolean isAffordanceSwipeInProgress() {
@@ -521,6 +536,7 @@ public class NotificationPanelView extends PanelView implements
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mSettingsObserver.unobserve();
+ mWeatherController.removeCallback(this);
}
@Override
@@ -2749,6 +2765,8 @@ public class NotificationPanelView extends PanelView implements
CMSettings.System.STATUS_BAR_QUICK_QS_PULLDOWN), false, this);
resolver.registerContentObserver(CMSettings.System.getUriFor(
CMSettings.System.DOUBLE_TAP_SLEEP_GESTURE), false, this);
+ resolver.registerContentObserver(CMSettings.Secure.getUriFor(
+ CMSettings.Secure.LOCK_SCREEN_WEATHER_ENABLED), false, this);
update();
}
@@ -2774,8 +2792,13 @@ public class NotificationPanelView extends PanelView implements
mDoubleTapToSleepEnabled = CMSettings.System.getInt(
resolver, CMSettings.System.DOUBLE_TAP_SLEEP_GESTURE, 1) == 1;
- boolean liveLockScreenEnabled = CMSettings.Secure.getInt(
- resolver, CMSettings.Secure.LIVE_LOCK_SCREEN_ENABLED, 0) == 1;
+ boolean wasKeyguardWeatherEnabled = mKeyguardWeatherEnabled;
+ mKeyguardWeatherEnabled = CMSettings.Secure.getInt(
+ resolver, CMSettings.Secure.LOCK_SCREEN_WEATHER_ENABLED, 0) == 1;
+ if (mWeatherController != null
+ && wasKeyguardWeatherEnabled != mKeyguardWeatherEnabled) {
+ onWeatherChanged(mWeatherController.getWeatherInfo());
+ }
}
}
@@ -2876,6 +2899,19 @@ public class NotificationPanelView extends PanelView implements
}
}
+ @Override
+ public void onWeatherChanged(WeatherController.WeatherInfo info) {
+ if (!mKeyguardWeatherEnabled || Double.isNaN(info.temp) || info.condition == null) {
+ mKeyguardWeatherInfo.setVisibility(GONE);
+ } else {
+ mKeyguardWeatherInfo.setText(mContext.getString(
+ R.string.keyguard_status_view_weather_format,
+ WeatherUtils.formatTemperature(info.temp, info.tempUnit),
+ info.condition));
+ mKeyguardWeatherInfo.setVisibility(VISIBLE);
+ }
+ }
+
private class SlideInAnimationListener implements ValueAnimator.AnimatorUpdateListener,
ValueAnimator.AnimatorListener {
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 2076c27..39ef494 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -1328,6 +1328,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mHeader.setNextAlarmController(mNextAlarmController);
mHeader.setWeatherController(mWeatherController);
+ mNotificationPanel.setWeatherController(mWeatherController);
+
PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
mBroadcastReceiver.onReceive(mContext,
new Intent(pm.isScreenOn() ? Intent.ACTION_SCREEN_ON : Intent.ACTION_SCREEN_OFF));