Skip to content

Commit 61a887c

Browse files
SystemUI: Improvise weather on lockscreen code [1/2]
* current_weather_view -> extra_weather_view * Single toggle for extar weather info * A bit of code changes Signed-off-by: Jayant-Deshmukh <jayantdeshmuk008@gmail.com>
1 parent a0191c7 commit 61a887c

File tree

8 files changed

+125
-100
lines changed

8 files changed

+125
-100
lines changed

core/java/android/provider/Settings.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6483,12 +6483,7 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean
64836483
/**
64846484
* @hide
64856485
*/
6486-
public static final String LOCKSCREEN_WEATHER_WIND_INFO = "lockscreen_weather_wind_info";
6487-
6488-
/**
6489-
* @hide
6490-
*/
6491-
public static final String LOCKSCREEN_WEATHER_HUMIDITY_INFO = "lockscreen_weather_humidity_info";
6486+
public static final String LOCKSCREEN_WEATHER_EXTRA_INFO = "lockscreen_weather_extra_info";
64926487

64936488
/**
64946489
* Whether to play notification sound and vibration if screen is ON

packages/SystemUI/res-keyguard/layout/current_weather_view.xml renamed to packages/SystemUI/res-keyguard/layout/extra_weather_view.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
-->
17-
<com.android.systemui.superior.CurrentWeatherView
17+
<com.android.systemui.superior.ExtraWeatherView
1818
xmlns:android="http://schemas.android.com/apk/res/android"
1919
android:layout_width="match_parent"
2020
android:layout_height="wrap_content"
@@ -140,4 +140,4 @@
140140
</LinearLayout>
141141

142142
</LinearLayout>
143-
</com.android.systemui.superior.CurrentWeatherView>
143+
</com.android.systemui.superior.ExtraWeatherView>

packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
android:layout_width="match_parent"
5757
android:layout_height="wrap_content" />
5858

59-
<include layout="@layout/current_weather_view"
60-
android:id="@+id/weather_container"
59+
<include layout="@layout/extra_weather_view"
60+
android:id="@+id/extra_weather_container"
6161
android:layout_width="match_parent"
6262
android:layout_height="wrap_content"
6363
android:visibility="gone" />

packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
import com.android.systemui.Dependency;
3939
import com.android.systemui.Dumpable;
40-
import com.android.systemui.superior.CurrentWeatherView;
40+
import com.android.systemui.superior.ExtraWeatherView;
4141
import com.android.systemui.dagger.qualifiers.Background;
4242
import com.android.systemui.dagger.qualifiers.Main;
4343
import com.android.systemui.dump.DumpManager;
@@ -115,7 +115,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
115115
private final KeyguardUnlockAnimationController mKeyguardUnlockAnimationController;
116116
private final InWindowLauncherUnlockAnimationManager mInWindowLauncherUnlockAnimationManager;
117117

118-
private CurrentWeatherView mCurrentWeatherView;
118+
private ExtraWeatherView mExtraWeatherView;
119119
private boolean mShowWeather;
120120

121121
private boolean mShownOnSecondaryDisplay = false;
@@ -243,7 +243,7 @@ protected void onInit() {
243243
mLargeClockFrame = mView
244244
.findViewById(com.android.systemui.customization.R.id.lockscreen_clock_view_large);
245245
}
246-
mCurrentWeatherView = mView.findViewById(R.id.weather_container);
246+
mExtraWeatherView = mView.findViewById(R.id.extra_weather_container);
247247

248248
if (!mOnlyClock) {
249249
mDumpManager.unregisterDumpable(getClass().getSimpleName()); // unregister previous
@@ -388,13 +388,13 @@ public void onTuningChanged(String key, String newValue) {
388388

389389
public void updateWeatherView() {
390390
mUiExecutor.execute(() -> {
391-
if (mCurrentWeatherView != null) {
391+
if (mExtraWeatherView != null) {
392392
if (mShowWeather && !mOnlyClock) {
393-
mCurrentWeatherView.enableUpdates();
394-
mCurrentWeatherView.setVisibility(View.VISIBLE);
393+
mExtraWeatherView.enableUpdates();
394+
mExtraWeatherView.setVisibility(View.VISIBLE);
395395
} else {
396-
mCurrentWeatherView.disableUpdates();
397-
mCurrentWeatherView.setVisibility(View.GONE);
396+
mExtraWeatherView.disableUpdates();
397+
mExtraWeatherView.setVisibility(View.GONE);
398398
}
399399
}
400400
});

packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardRootViewBinder.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ object KeyguardRootViewBinder {
187187
childViews[statusViewId]?.alpha = alpha
188188
childViews[burnInLayerId]?.alpha = alpha
189189
childViews[sliceViewId]?.alpha = alpha
190-
childViews[weatherContainerId]?.alpha = alpha
190+
childViews[extraWeatherContainerId]?.alpha = alpha
191191
}
192192
}
193193
}
@@ -201,7 +201,7 @@ object KeyguardRootViewBinder {
201201
viewModel.translationY.collect { y ->
202202
childViews[burnInLayerId]?.translationY = y
203203
childViews[sliceViewId]?.translationY = y
204-
childViews[weatherContainerId]?.translationY = y
204+
childViews[extraWeatherContainerId]?.translationY = y
205205
childViews[largeClockId]?.translationY = y
206206
childViews[aodNotificationIconContainerId]?.translationY = y
207207
}
@@ -215,7 +215,7 @@ object KeyguardRootViewBinder {
215215
// Large Clock is not translated in the x direction
216216
childViews[burnInLayerId]?.translationX = px
217217
childViews[sliceViewId]?.translationX = px
218-
childViews[weatherContainerId]?.translationX = px
218+
childViews[extraWeatherContainerId]?.translationX = px
219219
childViews[aodNotificationIconContainerId]?.translationX =
220220
px
221221
}
@@ -274,7 +274,7 @@ object KeyguardRootViewBinder {
274274
viewModel.burnInLayerVisibility.collect { visibility ->
275275
childViews[burnInLayerId]?.visibility = visibility
276276
childViews[sliceViewId]?.visibility = visibility
277-
childViews[weatherContainerId]?.visibility = visibility
277+
childViews[extraWeatherContainerId]?.visibility = visibility
278278
}
279279
}
280280

@@ -625,7 +625,7 @@ object KeyguardRootViewBinder {
625625
private val statusViewId = R.id.keyguard_status_view
626626
private val burnInLayerId = R.id.burn_in_layer
627627
private val sliceViewId = R.id.keyguard_slice_view
628-
private val weatherContainerId = R.id.weather_container
628+
private val extraWeatherContainerId = R.id.extra_weather_container
629629
private val aodNotificationIconContainerId = R.id.aod_notification_icon_container
630630
private val largeClockId = customR.id.lockscreen_clock_view_large
631631
private val smallClockId = customR.id.lockscreen_clock_view

packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/blueprints/DefaultKeyguardBlueprint.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import com.android.systemui.keyguard.ui.view.layout.sections.DefaultUdfpsAccessi
3636
import com.android.systemui.keyguard.ui.view.layout.sections.KeyguardSectionsModule.Companion.KEYGUARD_AMBIENT_INDICATION_AREA_SECTION
3737
import com.android.systemui.keyguard.ui.view.layout.sections.KeyguardSliceViewSection
3838
import com.android.systemui.keyguard.ui.view.layout.sections.SmartspaceSection
39-
import com.android.systemui.keyguard.ui.view.layout.sections.WeatherViewSection
39+
import com.android.systemui.keyguard.ui.view.layout.sections.ExtraWeatherViewSection
4040
import java.util.Optional
4141
import javax.inject.Inject
4242
import javax.inject.Named
@@ -71,7 +71,7 @@ constructor(
7171
smartspaceSection: SmartspaceSection,
7272
keyguardSliceViewSection: KeyguardSliceViewSection,
7373
udfpsAccessibilityOverlaySection: DefaultUdfpsAccessibilityOverlaySection,
74-
weatherViewSection: WeatherViewSection,
74+
extraWeatherViewSection: ExtraWeatherViewSection,
7575
) : KeyguardBlueprint {
7676
override val id: String = DEFAULT
7777

@@ -91,7 +91,7 @@ constructor(
9191
communalTutorialIndicatorSection,
9292
clockSection,
9393
keyguardSliceViewSection,
94-
weatherViewSection,
94+
extraWeatherViewSection,
9595
defaultDeviceEntrySection,
9696
udfpsAccessibilityOverlaySection, // Add LAST: Intentionally has z-order above others
9797
)

packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/WeatherViewSection.kt renamed to packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/ExtraWeatherViewSection.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import com.android.systemui.res.R
2828
import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController
2929
import javax.inject.Inject
3030

31-
class WeatherViewSection
31+
class ExtraWeatherViewSection
3232
@Inject
3333
constructor(
3434
val smartspaceController: LockscreenSmartspaceController,
@@ -37,7 +37,7 @@ constructor(
3737
if (!MigrateClocksToBlueprint.isEnabled) return
3838
if (smartspaceController.isEnabled) return
3939

40-
constraintLayout.findViewById<View?>(R.id.weather_container)?.let {
40+
constraintLayout.findViewById<View?>(R.id.extra_weather_container)?.let {
4141
(it.parent as ViewGroup).removeView(it)
4242
constraintLayout.addView(it)
4343
}
@@ -50,21 +50,21 @@ constructor(
5050

5151
constraintSet.apply {
5252
connect(
53-
R.id.weather_container,
53+
R.id.extra_weather_container,
5454
ConstraintSet.START,
5555
R.id.keyguard_slice_view,
5656
ConstraintSet.START
5757
)
5858
connect(
59-
R.id.weather_container,
59+
R.id.extra_weather_container,
6060
ConstraintSet.END,
6161
ConstraintSet.PARENT_ID,
6262
ConstraintSet.END
6363
)
64-
constrainHeight(R.id.weather_container, ConstraintSet.WRAP_CONTENT)
64+
constrainHeight(R.id.extra_weather_container, ConstraintSet.WRAP_CONTENT)
6565

6666
connect(
67-
R.id.weather_container,
67+
R.id.extra_weather_container,
6868
ConstraintSet.TOP,
6969
R.id.keyguard_slice_view,
7070
ConstraintSet.BOTTOM
@@ -74,7 +74,7 @@ constructor(
7474
R.id.smart_space_barrier_bottom,
7575
Barrier.BOTTOM,
7676
0,
77-
*intArrayOf(R.id.weather_container)
77+
*intArrayOf(R.id.extra_weather_container)
7878
)
7979
}
8080
}
@@ -83,6 +83,6 @@ constructor(
8383
if (!MigrateClocksToBlueprint.isEnabled) return
8484
if (!smartspaceController.isEnabled) return
8585

86-
constraintLayout.removeView(R.id.weather_container)
86+
constraintLayout.removeView(R.id.extra_weather_container)
8787
}
8888
}

0 commit comments

Comments
 (0)