• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009 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 
17 package com.android.sdkuilib.internal.repository;
18 
19 import java.net.URL;
20 import java.util.Properties;
21 
22 /**
23  * Interface that a settings page must implement.
24  */
25 public interface ISettingsPage {
26 
27     /**
28      * Java system setting picked up by {@link URL} for http proxy port.
29      * Type: String.
30      */
31     public static final String KEY_HTTP_PROXY_PORT = "http.proxyPort";           //$NON-NLS-1$
32     /**
33      * Java system setting picked up by {@link URL} for http proxy host.
34      * Type: String.
35      */
36     public static final String KEY_HTTP_PROXY_HOST = "http.proxyHost";           //$NON-NLS-1$
37     /**
38      * Setting to force using http:// instead of https:// connections.
39      * Type: Boolean.
40      * Default: False.
41      */
42     public static final String KEY_FORCE_HTTP = "sdkman.force.http";             //$NON-NLS-1$
43     /**
44      * Setting to display only packages that are new or updates.
45      * Type: Boolean.
46      * Default: True.
47      */
48     public static final String KEY_SHOW_UPDATE_ONLY = "sdkman.show.update.only"; //$NON-NLS-1$
49     /**
50      * Setting to ask for permission before restarting ADB.
51      * Type: Boolean.
52      * Default: True.
53      */
54     public static final String KEY_ASK_ADB_RESTART = "sdkman.ask.adb.restart";   //$NON-NLS-1$
55     /**
56      * Setting to set the density of the monitor.
57      * Type: Integer.
58      * Default: -1
59      */
60     public static final String KEY_MONITOR_DENSITY = "sdkman.monitor.density"; //$NON-NLS-1$
61 
62     /** Loads settings from the given {@link Properties} container and update the page UI. */
loadSettings(Properties in_settings)63     public abstract void loadSettings(Properties in_settings);
64 
65     /** Called by the application to retrieve settings from the UI and store them in
66      * the given {@link Properties} container. */
retrieveSettings(Properties out_settings)67     public abstract void retrieveSettings(Properties out_settings);
68 
69     /**
70      * Called by the application to give a callback that the page should invoke when
71      * settings have changed.
72      */
setOnSettingsChanged(SettingsChangedCallback settingsChangedCallback)73     public abstract void setOnSettingsChanged(SettingsChangedCallback settingsChangedCallback);
74 
75     /**
76      * Callback used to notify the application that settings have changed and need to be
77      * applied.
78      */
79     public interface SettingsChangedCallback {
80         /**
81          * Invoked by the settings page when settings have changed and need to be
82          * applied. The application will call {@link ISettingsPage#retrieveSettings(Properties)}
83          * and apply the new settings.
84          */
onSettingsChanged(ISettingsPage page)85         public abstract void onSettingsChanged(ISettingsPage page);
86     }
87 }
88