1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 package org.chromium.chrome.browser.settings;
6 
7 import android.content.Context;
8 import android.content.Intent;
9 import android.os.Bundle;
10 
11 import androidx.annotation.Nullable;
12 import androidx.fragment.app.Fragment;
13 
14 /**
15  * Interface for launching Settings.
16  */
17 public interface SettingsLauncher {
18     /**
19      * Launches a Settings Activity with the default (top-level) fragment.
20      *
21      * @param context The current Activity, or an application context if no Activity is available.
22      */
launchSettingsActivity(Context context)23     void launchSettingsActivity(Context context);
24 
25     /**
26      * Launches a Settings Activity with the specified fragment.
27      *
28      * @param context The current Activity, or an application context if no Activity is available.
29      * @param fragment The fragment to show, or null to show the default fragment.
30      */
launchSettingsActivity(Context context, @Nullable Class<? extends Fragment> fragment)31     void launchSettingsActivity(Context context, @Nullable Class<? extends Fragment> fragment);
32 
33     /**
34      * Launches a Settings Activity with the specified fragment and arguments.
35      *
36      * @param context The current Activity, or an application context if no Activity is available.
37      * @param fragment The fragment to show, or null to show the default fragment.
38      * @param fragmentArgs A bundle of additional fragment arguments.
39      */
launchSettingsActivity(Context context, @Nullable Class<? extends Fragment> fragment, @Nullable Bundle fragmentArgs)40     void launchSettingsActivity(Context context, @Nullable Class<? extends Fragment> fragment,
41             @Nullable Bundle fragmentArgs);
42 
43     /**
44      * Creates an intent for launching a Settings Activity with the specified fragment.
45      *
46      * @param context The current Activity, or an application context if no Activity is available.
47      * @param fragmentName The name of the fragment to show, or null to show the default fragment.
48      */
createSettingsActivityIntent(Context context, @Nullable String fragmentName)49     Intent createSettingsActivityIntent(Context context, @Nullable String fragmentName);
50 
51     /**
52      * Creates an intent for launching a Settings Activity with the specified fragment and
53      * arguments.
54      *
55      * @param context The current Activity, or an application context if no Activity is available.
56      * @param fragmentName The name of the fragment to show, or null to show the default fragment.
57      * @param fragmentArgs A bundle of additional fragment arguments.
58      */
createSettingsActivityIntent( Context context, @Nullable String fragmentName, @Nullable Bundle fragmentArgs)59     Intent createSettingsActivityIntent(
60             Context context, @Nullable String fragmentName, @Nullable Bundle fragmentArgs);
61 }
62