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 com.android.tv.settings.dialog.old.Action;
20
21import android.content.Context;
22import android.content.Intent;
23import android.graphics.drawable.Drawable;
24import android.os.Parcel;
25import android.os.Parcelable;
26
27
28public class NoneDreamInfoAction extends DreamInfoAction {
29
30    private static final String TAG = "DreamInfoAction";
31
32    NoneDreamInfoAction(String title, boolean dreamsEnabled) {
33        super(null, !dreamsEnabled, title, null, null);
34    }
35
36    NoneDreamInfoAction(NoneDreamInfoAction noneDreamInfoAction, boolean dreamsEnabled) {
37        this(noneDreamInfoAction.getTitle(), dreamsEnabled);
38    }
39
40    @Override
41    public Drawable getIndicator(Context context) {
42        return null;
43    }
44
45    @SuppressWarnings("hiding")
46    public static Parcelable.Creator<NoneDreamInfoAction> CREATOR =
47            new Parcelable.Creator<NoneDreamInfoAction>() {
48
49                @Override
50                public NoneDreamInfoAction createFromParcel(Parcel source) {
51                    return new NoneDreamInfoAction(source.readString(),
52                            source.readInt() == 1);
53                }
54
55                @Override
56                public NoneDreamInfoAction[] newArray(int size) {
57                    return new NoneDreamInfoAction[size];
58                }
59            };
60
61    @Override
62    public void writeToParcel(Parcel dest, int flags) {
63        dest.writeString(getTitle());
64        dest.writeInt(isChecked() ? 1 : 0);
65    }
66
67    @Override
68    public Intent getSettingsIntent() {
69        return null;
70    }
71
72    @Override
73    public void setDream(DreamBackend dreamBackend) {
74        if (dreamBackend.isEnabled()) {
75            dreamBackend.setEnabled(false);
76        }
77        dreamBackend.setActiveDreamInfoAction(this);
78    }
79}
80