1 /*
2  * Copyright (C) 2016 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.documentsui;
18 
19 import com.android.documentsui.base.DocumentStack;
20 import com.android.documentsui.base.State;
21 
22 /**
23  * Provides support for specializing the DirectoryFragment to the "host" Activity.
24  * Feel free to expand the role of this class to handle other specializations.
25  */
26 public abstract class ActivityConfig {
27 
28     // Subtly different from isDocumentEnabled. The reason may be illuminated as follows.
29     // A folder is enabled such that it may be double clicked, even in settings
30     // when the folder itself cannot be selected. This may also be true of container types.
canSelectType(String docMimeType, int docFlags, State state)31     public boolean canSelectType(String docMimeType, int docFlags, State state) {
32         return true;
33     }
34 
isDocumentEnabled(String docMimeType, int docFlags, State state)35     public boolean isDocumentEnabled(String docMimeType, int docFlags, State state) {
36         return true;
37     }
38 
39     /**
40      * When managed mode is enabled, there will be special UI behaviors:
41      * 1) active downloads will be visible in the UI.
42      * 2) Android/[data|obb|sandbox] directories will not be hidden.
43      */
managedModeEnabled(DocumentStack stack)44     public boolean managedModeEnabled(DocumentStack stack) {
45         return false;
46     }
47 
48     /**
49      * Whether drag n' drop is allowed in this context
50      */
dragAndDropEnabled()51     public boolean dragAndDropEnabled() {
52         return false;
53     }
54 }
55