1e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav/*
2e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav * Copyright (C) 2014 The Android Open Source Project
3e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav *
4e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav * Licensed under the Apache License, Version 2.0 (the "License");
5e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav * you may not use this file except in compliance with the License.
6e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav * You may obtain a copy of the License at
7e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav *
8e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav *      http://www.apache.org/licenses/LICENSE-2.0
9e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav *
10e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav * Unless required by applicable law or agreed to in writing, software
11e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav * distributed under the License is distributed on an "AS IS" BASIS,
12e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav * See the License for the specific language governing permissions and
14e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav * limitations under the License.
15e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav */
16e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav
17e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslavpackage com.android.printspooler.widget;
18e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav
19e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslavimport android.content.Context;
20e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslavimport android.util.AttributeSet;
21e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslavimport android.view.accessibility.AccessibilityEvent;
22e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslavimport android.view.accessibility.AccessibilityNodeInfo;
23e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslavimport android.widget.CompoundButton;
24e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslavimport android.widget.LinearLayout;
25e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav
26e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav/**
27e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav * This class represents the frame of page in the print preview list
28e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav * that contains the page and a footer.
29e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav */
30e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslavpublic final class PreviewPageFrame extends LinearLayout {
31e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav    public PreviewPageFrame(Context context, AttributeSet attrs) {
32e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav        super(context, attrs);
33e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav    }
34e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav
35e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav    @Override
36a7bb6fbeab933326d58aa806d8194b7b13239d34Dianne Hackborn    public CharSequence getAccessibilityClassName() {
37a7bb6fbeab933326d58aa806d8194b7b13239d34Dianne Hackborn        return CompoundButton.class.getName();
38a7bb6fbeab933326d58aa806d8194b7b13239d34Dianne Hackborn    }
39a7bb6fbeab933326d58aa806d8194b7b13239d34Dianne Hackborn
40a7bb6fbeab933326d58aa806d8194b7b13239d34Dianne Hackborn    @Override
41e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav    public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
42e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav        super.onInitializeAccessibilityEvent(event);
43e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav        event.setChecked(isSelected());
44e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav    }
45e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav
46e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav    @Override
47e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
48e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav        super.onInitializeAccessibilityNodeInfo(info);
49e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav        info.setSelected(false);
50e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav        info.setCheckable(true);
51e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav        info.setChecked(isSelected());
52e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav    }
53e652b02d45bbda11c9cb8f663fa7f25903b90225Svetoslav}
54