1 /* 2 * Copyright (C) 2017 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 package com.android.documentsui.inspector; 17 18 import android.content.Context; 19 import android.util.AttributeSet; 20 21 import com.android.documentsui.R; 22 import com.android.documentsui.base.DocumentInfo; 23 24 import java.util.function.Consumer; 25 26 /** 27 * Organizes and Displays the basic details about a file 28 */ 29 public class DebugView extends TableView implements Consumer<DocumentInfo> { 30 DebugView(Context context)31 public DebugView(Context context) { 32 this(context, null); 33 } 34 DebugView(Context context, AttributeSet attrs)35 public DebugView(Context context, AttributeSet attrs) { 36 this(context, attrs, 0); 37 } 38 DebugView(Context context, AttributeSet attrs, int defStyleAttr)39 public DebugView(Context context, AttributeSet attrs, int defStyleAttr) { 40 super(context, attrs, defStyleAttr); 41 } 42 43 @Override accept(DocumentInfo info)44 public void accept(DocumentInfo info) { 45 setTitle(this, R.string.inspector_debug_section); 46 47 put("Content uri", info.derivedUri); 48 put("Document id", info.documentId); 49 put("Mimetype: ", info.mimeType); 50 put("Is archive", info.isArchive()); 51 put("Is container", info.isContainer()); 52 put("Is partial", info.isPartial()); 53 put("Is virtual", info.isVirtual()); 54 put("Supports create", info.isCreateSupported()); 55 put("Supports delete", info.isDeleteSupported()); 56 put("Supports rename", info.isRenameSupported()); 57 put("Supports settings", info.isSettingsSupported()); 58 put("Supports thumbnail", info.isThumbnailSupported()); 59 put("Supports weblink", info.isWeblinkSupported()); 60 put("Supports write", info.isWriteSupported()); 61 } 62 put(String key, Object value)63 private void put(String key, Object value) { 64 put(key, String.valueOf(value)); 65 } 66 } 67