1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.tv.settings.device.display.daydream;
18
19import android.content.Context;
20import android.content.Intent;
21import android.graphics.drawable.Drawable;
22import android.os.Parcel;
23import android.os.Parcelable;
24
25
26public class NoneDreamInfoAction extends DreamInfoAction {
27
28    private static final String TAG = "DreamInfoAction";
29
30    NoneDreamInfoAction(String title, boolean dreamsEnabled) {
31        super(null, !dreamsEnabled, title, null, null);
32    }
33
34    NoneDreamInfoAction(NoneDreamInfoAction noneDreamInfoAction, boolean dreamsEnabled) {
35        this(noneDreamInfoAction.getTitle(), dreamsEnabled);
36    }
37
38    @Override
39    public Drawable getIndicator(Context context) {
40        return null;
41    }
42
43    @SuppressWarnings("hiding")
44    public static Parcelable.Creator<NoneDreamInfoAction> CREATOR =
45            new Parcelable.Creator<NoneDreamInfoAction>() {
46
47                @Override
48                public NoneDreamInfoAction createFromParcel(Parcel source) {
49                    return new NoneDreamInfoAction(source.readString(),
50                            source.readInt() == 1);
51                }
52
53                @Override
54                public NoneDreamInfoAction[] newArray(int size) {
55                    return new NoneDreamInfoAction[size];
56                }
57            };
58
59    @Override
60    public void writeToParcel(Parcel dest, int flags) {
61        dest.writeString(getTitle());
62        dest.writeInt(isChecked() ? 1 : 0);
63    }
64
65    @Override
66    public Intent getSettingsIntent() {
67        return null;
68    }
69
70    @Override
71    public void setDream(DreamBackend dreamBackend) {
72        if (dreamBackend.isEnabled()) {
73            dreamBackend.setEnabled(false);
74        }
75        dreamBackend.setActiveDreamInfoAction(this);
76    }
77}
78