blob: a1da1b6fde373e2a49e10a2598b5d09b1241af8d [file] [log] [blame]
Rahul Chaturvedi7fc77ca2015-05-19 18:02:16 -07001/*
2 * Copyright (C) 2015 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 com.android.launcher3;
18
19import android.app.Activity;
20import android.content.Context;
21import android.os.Bundle;
22import android.preference.PreferenceFragment;
23
24/**
25 * Settings activity for Launcher. Currently implements the following setting:
26 * LockToPortrait
27 */
28public class SettingsActivity extends Activity {
29 @Override
30 protected void onCreate(Bundle savedInstanceState) {
31 super.onCreate(savedInstanceState);
32
33 // Display the fragment as the main content.
34 getFragmentManager().beginTransaction()
35 .replace(android.R.id.content, new LauncherSettingsFragment())
36 .commit();
37 }
38
39 /**
40 * This fragment shows the launcher preferences.
41 */
42 @SuppressWarnings("WeakerAccess")
43 public static class LauncherSettingsFragment extends PreferenceFragment {
44
45 @Override
46 public void onCreate(Bundle savedInstanceState) {
47 super.onCreate(savedInstanceState);
48 getPreferenceManager().setSharedPreferencesMode(Context.MODE_PRIVATE);
49 getPreferenceManager().setSharedPreferencesName(LauncherFiles.ROTATION_PREF_FILE);
50 addPreferencesFromResource(R.xml.launcher_preferences);
51 }
52 }
53}