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

Commit 0c255a94 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "Changed behaviour of the wallpaper picker." into ub-now-lunchbox

parents 7da05a50 ffed6588
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -106,7 +106,7 @@


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


<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.android.launcher3.AlphaDisableableButton
    style="?android:actionButtonStyle"
    xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/ActionBarSetWallpaperStyle"
    android:id="@+id/set_wallpaper_button"
    android:id="@+id/set_wallpaper_button"
    android:layout_width="match_parent"
    android:layout_width="match_parent"
    android:layout_height="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:paddingRight="20dp"
    android:paddingRight="20dp"
    android:drawableLeft="@drawable/ic_actionbar_accept"
    android:drawableLeft="@drawable/ic_actionbar_accept"
    android:drawablePadding="8dp"
    android:drawablePadding="8dp"
        android:gravity="center_vertical"
    android:gravity="start|center_vertical"
        android:text="@string/wallpaper_instructions" />
    android:text="@string/wallpaper_instructions">
</FrameLayout>
</com.android.launcher3.AlphaDisableableButton>
+10 −0
Original line number Original line Diff line number Diff line
@@ -24,6 +24,12 @@
        <item name="android:windowActionBarOverlay">true</item>
        <item name="android:windowActionBarOverlay">true</item>
    </style>
    </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">
    <style name="WallpaperCropperActionBar" parent="android:style/Widget.Holo.ActionBar">
        <item name="android:displayOptions">showCustom</item>
        <item name="android:displayOptions">showCustom</item>
        <item name="android:background">#88000000</item>
        <item name="android:background">#88000000</item>
@@ -31,4 +37,8 @@


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

    <style name="ActionBarSetWallpaperStyle" parent="@android:style/Widget.Holo.ActionButton">
        <item name="android:textColor">#ffffffff</item>
    </style>
</resources>
</resources>
+50 −0
Original line number Original line 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 Original line 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);
            Intent preview = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
            preview.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
            preview.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
                    mInfo.getComponent());
                    mInfo.getComponent());
            a.onLiveWallpaperPickerLaunch();
            a.onLiveWallpaperPickerLaunch(mInfo);
            a.startActivityForResultSafely(preview, WallpaperPickerActivity.PICK_LIVE_WALLPAPER);
            a.startActivityForResultSafely(preview, WallpaperPickerActivity.PICK_LIVE_WALLPAPER);
        }
        }
    }
    }
Loading