blob: 8f31ef97f2d1495072a28a5f21b4e3817ee9f175 [file] [log] [blame]
The Android Open Source Project0c908882009-03-03 19:32:16 -08001/*
2 * Copyright (C) 2008 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
Bijan Amirzada41242f22014-03-21 12:12:18 -070017package com.android.browser;
The Android Open Source Project0c908882009-03-03 19:32:16 -080018
Pankaj Gargb3b57462014-11-18 17:28:30 -080019import android.app.Activity;
Enrico Rosd6efa972014-12-02 19:49:59 -080020import android.content.Intent;
Ben Murdoch7ed9bd72010-12-13 14:30:33 +000021import android.os.Bundle;
Enrico Rosd6efa972014-12-02 19:49:59 -080022import android.preference.PreferenceActivity;
Bjorn Bringertd69f51d2010-09-13 14:06:41 +010023
Pankaj Gargb3b57462014-11-18 17:28:30 -080024import com.android.browser.preferences.GeneralPreferencesFragment;
John Reck7b182d72011-07-08 10:30:53 -070025
Pankaj Gargb3b57462014-11-18 17:28:30 -080026public class BrowserPreferencesPage extends Activity {
The Android Open Source Project0c908882009-03-03 19:32:16 -080027
Enrico Rosd6efa972014-12-02 19:49:59 -080028 public static void startPreferencesForResult(Activity callerActivity, String url, int requestCode) {
29 final Intent intent = new Intent(callerActivity, BrowserPreferencesPage.class);
30 intent.putExtra(GeneralPreferencesFragment.EXTRA_CURRENT_PAGE, url);
31 callerActivity.startActivityForResult(intent, requestCode);
32 }
33
34 public static void startPreferenceFragmentForResult(Activity callerActivity, String fragmentName, int requestCode) {
35 final Intent intent = new Intent(callerActivity, BrowserPreferencesPage.class);
36 intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, fragmentName);
37 callerActivity.startActivityForResult(intent, requestCode);
38 }
39
Nicolas Roard78a98e42009-05-11 13:34:17 +010040
Ben Murdoch7ed9bd72010-12-13 14:30:33 +000041 @Override
42 public void onCreate(Bundle icicle) {
43 super.onCreate(icicle);
44
Enrico Rosd6efa972014-12-02 19:49:59 -080045 Intent intent = getIntent();
46 if (intent != null) {
47 String action = intent.getAction();
48 // check if this page was invoked by 'App Data Usage' on the global data monitor
49 if ("android.intent.action.MANAGE_NETWORK_USAGE".equals(action)) {
50 // TODO: switch to the Network fragment here?
51 }
52 }
53
Pankaj Gargb3b57462014-11-18 17:28:30 -080054 getFragmentManager().beginTransaction().replace(android.R.id.content,
55 new GeneralPreferencesFragment()).commit();
Ben Murdoch7ed9bd72010-12-13 14:30:33 +000056 }
The Android Open Source Project0c908882009-03-03 19:32:16 -080057}