Separating out Launcher3 resources from Wallpaper resources

Change-Id: I7e33c83df8b16e8552fe588cadbcf3bf7881cb95
This commit is contained in:
Sunny Goyal 2016-02-09 15:22:42 -08:00
parent 7c50b31f57
commit 5abb9f88ef
15 changed files with 68 additions and 40 deletions

View File

@ -76,7 +76,7 @@
android:launchMode="singleTask"
android:clearTaskOnLaunch="true"
android:stateNotNeeded="true"
android:theme="@style/Theme"
android:theme="@style/LauncherTheme"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="nosensor"
android:configChanges="keyboard|keyboardHidden|navigation"

View File

@ -24,9 +24,4 @@
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
<style name="Theme" parent="@style/BaseWallpaperTheme">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
</resources>

View File

@ -32,12 +32,4 @@
<item name="android:textColor">#ffffffff</item>
<item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
</style>
<style name="Theme" parent="@style/BaseWallpaperTheme">
<item name="android:statusBarColor">#00000000</item>
<item name="android:navigationBarColor">#00000000</item>
<item name="android:colorControlActivated">@color/launcher_accent_color</item>
<item name="android:colorAccent">@color/launcher_accent_color</item>
<item name="android:colorPrimary">@color/launcher_accent_color</item>
</style>
</resources>

View File

@ -19,6 +19,4 @@
-->
<resources>
<color name="wallpaper_picker_translucent_gray">#66000000</color>
<color name="launcher_accent_color">#ff009688</color>
</resources>

View File

@ -35,15 +35,6 @@
<item name="android:background">#88000000</item>
</style>
<style name="BaseWallpaperTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowShowWallpaper">true</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="Theme" parent="@style/BaseWallpaperTheme"></style>
<style name="ActionBarSetWallpaperStyle" parent="@android:style/Widget.DeviceDefault.ActionButton">
<item name="android:textColor">#ffffffff</item>
<item name="android:background">?android:attr/selectableItemBackground</item>

View File

@ -27,7 +27,7 @@
<!-- DO NOT CHANGE THE ID -->
<com.android.launcher3.allapps.AllAppsRecyclerView
android:id="@+id/apps_list_view"
android:theme="@style/Theme.Light.CustomOverscroll"
android:theme="@style/CustomOverscroll.Light"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal|top"

View File

@ -51,7 +51,7 @@
<HorizontalScrollView
android:id="@+id/widgets_scroll_container"
android:theme="@style/Theme.Dark.CustomOverscroll"
android:theme="@style/CustomOverscroll.Dark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="none">

View File

@ -36,7 +36,7 @@
<com.android.launcher3.widget.WidgetsRecyclerView
android:id="@+id/main_content"
android:theme="@style/Theme.Dark.CustomOverscroll"
android:theme="@style/CustomOverscroll.Dark"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"

View File

@ -19,6 +19,14 @@
<resources>
<style name="BaseLauncherTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowShowWallpaper">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionModeOverlay">true</item>
</style>
<!-- Workspace -->
<style name="DropTargetButtonContainer">
<item name="android:layout_width">0dp</item>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright (C) 2013 The Android Open Source Project
* Copyright (C) 2016 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.
@ -16,13 +16,11 @@
* limitations under the License.
*/
-->
<resources>
<style name="BaseWallpaperTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowShowWallpaper">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionModeOverlay">true</item>
<style name="LauncherTheme" parent="@style/BaseLauncherTheme">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
</resources>
</resources>

28
res/values-v21/styles.xml Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright (C) 2016 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.
*/
-->
<resources>
<style name="LauncherTheme" parent="@style/BaseLauncherTheme">
<item name="android:statusBarColor">#00000000</item>
<item name="android:navigationBarColor">#00000000</item>
<item name="android:colorControlActivated">@color/launcher_accent_color</item>
<item name="android:colorAccent">@color/launcher_accent_color</item>
<item name="android:colorPrimary">@color/launcher_accent_color</item>
</style>
</resources>

View File

@ -37,6 +37,7 @@
<color name="quantum_panel_bg_color_dark">#FF374248</color>
<color name="outline_color">#FFFFFFFF</color>
<color name="launcher_accent_color">#ff009688</color>
<!-- Containers -->
<color name="container_fastscroll_thumb_inactive_color">#009688</color>

View File

@ -18,14 +18,26 @@
-->
<resources>
<style name="Theme.Light.CustomOverscroll" parent="@android:style/Theme.DeviceDefault">
<!-- Launcher theme -->
<style name="BaseLauncherTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowShowWallpaper">true</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="LauncherTheme" parent="@style/BaseLauncherTheme"></style>
<!-- Overscroll effect -->
<style name="CustomOverscroll.Light" parent="@android:style/Theme.DeviceDefault">
<item name="android:colorEdgeEffect">@color/folder_edge_effect_color</item>
</style>
<style name="Theme.Dark.CustomOverscroll" parent="@android:style/Theme.DeviceDefault">
<style name="CustomOverscroll.Dark" parent="@android:style/Theme.DeviceDefault">
<item name="android:colorEdgeEffect">@color/workspace_edge_effect_color</item>
</style>
<!-- Different icons -->
<style name="Icon">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
@ -56,6 +68,7 @@
<item name="customShadows">false</item>
</style>
<!-- Drop targets -->
<style name="DropTargetButtonContainer">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">match_parent</item>
@ -81,6 +94,7 @@
<style name="DropTargetButton" parent="DropTargetButtonBase" />
<!-- Virtual preloaders -->
<style name="PreloadIcon">
<item name="background">@drawable/virtual_preload</item>
<item name="indicatorSize">4dp</item>

View File

@ -113,6 +113,7 @@ import com.android.launcher3.util.LongArrayMap;
import com.android.launcher3.util.TestingUtils;
import com.android.launcher3.util.Thunk;
import com.android.launcher3.util.ViewOnDrawExecutor;
import com.android.launcher3.util.WallpaperUtils;
import com.android.launcher3.widget.PendingAddWidgetInfo;
import com.android.launcher3.widget.WidgetHostViewLoader;
import com.android.launcher3.widget.WidgetsContainerView;
@ -2764,7 +2765,7 @@ public class Launcher extends Activity
int pageScroll = mWorkspace.getScrollForPage(mWorkspace.getPageNearestToCenterOfScreen());
float offset = mWorkspace.mWallpaperOffset.wallpaperOffsetForScroll(pageScroll);
startActivityForResult(new Intent(Intent.ACTION_SET_WALLPAPER).setPackage(getPackageName())
.putExtra(WallpaperPickerActivity.EXTRA_WALLPAPER_OFFSET, offset),
.putExtra(WallpaperUtils.EXTRA_WALLPAPER_OFFSET, offset),
REQUEST_PICK_WALLPAPER);
if (mLauncherCallbacks != null) {

View File

@ -38,6 +38,8 @@ public final class WallpaperUtils {
public static final String WALLPAPER_HEIGHT_KEY = "wallpaper.height";
public static final float WALLPAPER_SCREENS_SPAN = 2f;
public static final String EXTRA_WALLPAPER_OFFSET = "com.android.launcher3.WALLPAPER_OFFSET";
public static void saveWallpaperDimensions(int width, int height, Activity activity) {
if (Utilities.ATLEAST_KITKAT) {
// From Kitkat onwards, ImageWallpaper does not care about the