Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ffed6588 authored by Selim Cinek's avatar Selim Cinek
Browse files

Changed behaviour of the wallpaper picker.

When opening the picker, the currently chosen wallpaper is
shown in the background.
In this change also the nullpointer was fixed when deleting
the currently selected wallpaper and setting it, because we
revert to the old wallpaper in that case.
When going into the same live wallpaper than the currently
selected we are going back to home if the user sets it or
goes back now, in order for the user not to loose state.
The real fix for this will be done later when the following
bug will be fixed: b/13241760

Bug: 12063773
Bug: 13219612
Change-Id: I7c6abb25755eca99c3255278e0884d1ff4749b55
parent 4f462f4a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@

        <activity
            android:name="com.android.launcher3.LauncherWallpaperPickerActivity"
            android:theme="@style/Theme.WallpaperCropper"
            android:theme="@style/Theme.WallpaperPicker"
            android:label="@string/pick_wallpaper"
            android:icon="@mipmap/ic_launcher_wallpaper"
            android:finishOnCloseSystemDialogs="true"
+10 −13
Original line number Diff line number Diff line
@@ -18,18 +18,15 @@
*/
-->

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    style="?android:actionButtonStyle"
<com.android.launcher3.AlphaDisableableButton
    xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/ActionBarSetWallpaperStyle"
    android:id="@+id/set_wallpaper_button"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <TextView style="?android:actionBarTabTextStyle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="start|center_vertical"
    android:layout_height="match_parent"
    android:paddingRight="20dp"
    android:drawableLeft="@drawable/ic_actionbar_accept"
    android:drawablePadding="8dp"
        android:gravity="center_vertical"
        android:text="@string/wallpaper_instructions" />
</FrameLayout>
    android:gravity="start|center_vertical"
    android:text="@string/wallpaper_instructions">
</com.android.launcher3.AlphaDisableableButton>
+10 −0
Original line number Diff line number Diff line
@@ -24,6 +24,12 @@
        <item name="android:windowActionBarOverlay">true</item>
    </style>

    <style name="Theme.WallpaperPicker" parent="Theme.WallpaperCropper">
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:colorBackgroundCacheHint">@null</item>
        <item name="android:windowShowWallpaper">true</item>
    </style>

    <style name="WallpaperCropperActionBar" parent="android:style/Widget.Holo.ActionBar">
        <item name="android:displayOptions">showCustom</item>
        <item name="android:background">#88000000</item>
@@ -31,4 +37,8 @@

    <style name="Theme" parent="@android:style/Theme.Holo.Wallpaper.NoTitleBar">
    </style>

    <style name="ActionBarSetWallpaperStyle" parent="@android:style/Widget.Holo.ActionButton">
        <item name="android:textColor">#ffffffff</item>
    </style>
</resources>
+50 −0
Original line number Diff line number Diff line
/*
 * 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
 */

package com.android.launcher3;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.Button;

/**
 * A Button which becomes translucent when it is disabled
 */
public class AlphaDisableableButton extends Button {
    public static float DISABLED_ALPHA_VALUE = 0.4f;
    public AlphaDisableableButton(Context context) {
        this(context, null);
    }

    public AlphaDisableableButton(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public AlphaDisableableButton(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        setLayerType(LAYER_TYPE_HARDWARE, null);
    }

    @Override
    public void setEnabled(boolean enabled) {
        super.setEnabled(enabled);
        if(enabled) {
            setAlpha(1.0f);
        } else {
            setAlpha(DISABLED_ALPHA_VALUE);
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ public class LiveWallpaperListAdapter extends BaseAdapter implements ListAdapter
            Intent preview = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
            preview.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
                    mInfo.getComponent());
            a.onLiveWallpaperPickerLaunch();
            a.onLiveWallpaperPickerLaunch(mInfo);
            a.startActivityForResultSafely(preview, WallpaperPickerActivity.PICK_LIVE_WALLPAPER);
        }
    }
Loading