LocalPreferences.java revision 669f8e7c70c595964a1c9ca154ac123da84d99a1
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 com.android.documentsui;
18
19import android.content.Context;
20import android.preference.PreferenceManager;
21
22public class LocalPreferences {
23    private static final String KEY_ADVANCED_DEVICES = "advancedDevices";
24    private static final String KEY_FILE_SIZE = "fileSize";
25
26    public static boolean getDisplayAdvancedDevices(Context context) {
27        return PreferenceManager.getDefaultSharedPreferences(context)
28                .getBoolean(KEY_ADVANCED_DEVICES, false);
29    }
30
31    public static boolean getDisplayFileSize(Context context) {
32        return PreferenceManager.getDefaultSharedPreferences(context)
33                .getBoolean(KEY_FILE_SIZE, false);
34    }
35
36    public static void setDisplayAdvancedDevices(Context context, boolean display) {
37        PreferenceManager.getDefaultSharedPreferences(context).edit()
38                .putBoolean(KEY_ADVANCED_DEVICES, display).apply();
39    }
40
41    public static void setDisplayFileSize(Context context, boolean display) {
42        PreferenceManager.getDefaultSharedPreferences(context).edit()
43                .putBoolean(KEY_FILE_SIZE, display).apply();
44    }
45}
46