1/*
2 * Copyright (C) 2013 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 android.support.v7.app;
18
19/**
20 * The media route dialog factory is responsible for creating the media route
21 * chooser and controller dialogs as needed.
22 * <p>
23 * The application can customize the dialogs by providing a subclass of the
24 * dialog factory to the {@link MediaRouteButton} using the
25 * {@link MediaRouteButton#setDialogFactory setDialogFactory} method.
26 * </p>
27 */
28public class MediaRouteDialogFactory {
29    private static final MediaRouteDialogFactory sDefault = new MediaRouteDialogFactory();
30
31    /**
32     * Creates a default media route dialog factory.
33     */
34    public MediaRouteDialogFactory() {
35    }
36
37    /**
38     * Gets the default factory instance.
39     *
40     * @return The default media route dialog factory, never null.
41     */
42    public static MediaRouteDialogFactory getDefault() {
43        return sDefault;
44    }
45
46    /**
47     * Called when the chooser dialog is being opened and it is time to create the fragment.
48     * <p>
49     * Subclasses may override this method to create a customized fragment.
50     * </p>
51     *
52     * @return The media route chooser dialog fragment, must not be null.
53     */
54    public MediaRouteChooserDialogFragment onCreateChooserDialogFragment() {
55        return new MediaRouteChooserDialogFragment();
56    }
57
58    /**
59     * Called when the controller dialog is being opened and it is time to create the fragment.
60     * <p>
61     * Subclasses may override this method to create a customized fragment.
62     * </p>
63     *
64     * @return The media route controller dialog fragment, must not be null.
65     */
66    public MediaRouteControllerDialogFragment onCreateControllerDialogFragment() {
67        return new MediaRouteControllerDialogFragment();
68    }
69}
70