+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_focused="true" android:state_activated="true">
- <color android:color="@color/material_grey_300" />
- </item>
- <item android:state_focused="false" android:state_activated="true">
- <color android:color="@color/material_grey_300" />
- </item>
-</selector>
<com.android.documentsui.ListItem xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@drawable/item_doc_list_background"
+ android:background="@color/item_doc_background"
android:orientation="horizontal"
android:focusable="true">
android:layout_gravity="start"
android:orientation="vertical"
android:elevation="16dp"
- android:background="@*android:color/white">
+ android:background="@color/window_background">
<Toolbar
android:id="@+id/roots_toolbar"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
- android:baselineAligned="false"
- android:divider="?android:attr/dividerVertical"
- android:showDividers="middle">
+ android:baselineAligned="false">
<FrameLayout
android:id="@+id/container_roots"
<include layout="@layout/directory_cluster"
android:layout_width="0dp"
android:layout_weight="1"
- android:elevation="8dp"
- android:background="@color/material_grey_50" />
+ android:elevation="8dp" />
</LinearLayout>
<com.android.documentsui.DirectoryView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@color/material_grey_50"
android:orientation="vertical"
android:animateLayoutChanges="true">
android:paddingBottom="0dp"
android:clipToPadding="false"
android:scrollbarStyle="outsideOverlay"
- android:drawSelectorOnTop="true"
- android:background="@color/directory_background" />
+ android:drawSelectorOnTop="true" />
</FrameLayout>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/grid_item_margin"
- android:background="@color/item_doc_grid_background"
+ android:background="@color/item_doc_background"
android:focusable="true">
<!-- Main item thumbnail. Comprised of two overlapping images, the
visibility of which is controlled by code in
DirectoryFragment.java. -->
+
<FrameLayout
android:id="@+id/thumbnail"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingBottom="8dp">
-
+ android:layout_height="wrap_content">
+
<com.android.documentsui.GridItemThumbnail
android:id="@+id/icon_thumb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:contentDescription="@null" />
-
- <ImageView
+
+ <com.android.documentsui.GridItemThumbnail
android:id="@+id/icon_mime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:contentDescription="@null" />
-
+
</FrameLayout>
-
+
<!-- Item nameplate. Has a mime-type icon and some text fields (title,
size, mod-time, etc). -->
- <TextView
- android:id="@android:id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/thumbnail"
- android:layout_toEndOf="@android:id/icon1"
- android:singleLine="true"
- android:ellipsize="middle"
- android:textAlignment="viewStart"
- android:paddingEnd="12dp"
- android:textAppearance="@android:style/TextAppearance.Material.Subhead"
- android:textColor="@*android:color/primary_text_default_material_light" />
-
- <TextView
- android:id="@+id/size"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@android:id/title"
- android:layout_toEndOf="@android:id/icon1"
- android:paddingEnd="4dp"
- android:singleLine="true"
- android:ellipsize="end"
- android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Caption"
- android:textColor="@*android:color/primary_text_default_material_light" />
-
- <TextView
- android:id="@+id/date"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@android:id/title"
- android:layout_toEndOf="@id/size"
- android:paddingEnd="12dp"
- android:singleLine="true"
- android:ellipsize="end"
- android:textAlignment="viewStart"
- android:textAppearance="@android:style/TextAppearance.Material.Caption"
- android:textColor="@*android:color/primary_text_default_material_light" />
-
- <ImageView
- android:id="@android:id/icon1"
- android:layout_width="wrap_content"
+
+ <RelativeLayout
+ android:id="@+id/nameplate"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginEnd="8dp"
android:layout_below="@id/thumbnail"
- android:layout_alignParentLeft="true"
- android:layout_alignBottom="@id/size"
- android:layout_alignTop="@android:id/title"
- android:scaleType="centerInside"
- android:contentDescription="@null"
- android:paddingStart="12dp"
- android:paddingEnd="8dp"/>
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:paddingLeft="12dp"
+ android:paddingRight="12dp">
- <!-- Use an explicit spacer so we can align things to it. -->
- <Space
- android:id="@+id/bottomPadding"
- android:layout_width="match_parent"
- android:layout_height="8dp"
- android:layout_below="@id/size" />
+ <ImageView
+ android:id="@android:id/icon1"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_marginEnd="8dp"
+ android:layout_alignParentStart="true"
+ android:layout_centerVertical="true"
+ android:scaleType="centerInside"
+ android:contentDescription="@null"/>
+
+ <TextView
+ android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_toEndOf="@android:id/icon1"
+ android:singleLine="true"
+ android:ellipsize="middle"
+ android:textAlignment="viewStart"
+ android:textAppearance="@android:style/TextAppearance.Material.Subhead"
+ android:textColor="@*android:color/primary_text_default_material_light" />
+
+ <TextView
+ android:id="@+id/size"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_toEndOf="@android:id/icon1"
+ android:layout_below="@android:id/title"
+ android:layout_marginEnd="4dp"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:textAlignment="viewStart"
+ android:textAppearance="@android:style/TextAppearance.Material.Caption"
+ android:textColor="@*android:color/primary_text_default_material_light" />
+
+ <TextView
+ android:id="@+id/date"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@android:id/title"
+ android:layout_toEndOf="@id/size"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:textAlignment="viewStart"
+ android:textAppearance="@android:style/TextAppearance.Material.Caption"
+ android:textColor="@*android:color/primary_text_default_material_light" />
+
+ </RelativeLayout>
<!-- An overlay that draws the item border when it is focused. -->
<View
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignBottom="@id/bottomPadding"
+ android:layout_alignBottom="@id/nameplate"
android:layout_alignTop="@id/thumbnail"
android:layout_alignLeft="@id/thumbnail"
android:layout_alignRight="@id/thumbnail"
<com.android.documentsui.ListItem xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@drawable/item_doc_list_background"
+ android:background="@color/item_doc_background"
android:orientation="horizontal"
android:focusable="true">
-
+
<View
android:id="@+id/focus_indicator"
android:layout_width="4dp"
android:paddingEnd="@dimen/list_item_padding"
android:gravity="center_vertical"
android:orientation="horizontal"
- android:baselineAligned="false"
- android:background="@drawable/item_root_background">
+ android:baselineAligned="false">
<FrameLayout
android:layout_width="@dimen/icon_size"
<resources>
<color name="material_grey_400">#ffbdbdbd</color>
+ <!-- This is the window background, but also the background for anything
+ else that needs to manually declare a background matching the "default"
+ app background (e.g. the drawer overlay). -->
+ <color name="window_background">#fff1f1f1</color>
+
<color name="primary_dark">@*android:color/primary_dark_material_dark</color>
<color name="primary">@*android:color/material_blue_grey_900</color>
<color name="accent">@*android:color/accent_material_light</color>
<color name="action_mode">@color/material_grey_400</color>
-
- <color name="directory_background">@*android:color/material_grey_300</color>
- <color name="item_doc_grid_background">@android:color/white</color>
- <color name="item_doc_grid_protect_background">@android:color/white</color>
+
<color name="band_select_background">#88ffffff</color>
<color name="band_select_border">#44000000</color>
+
+ <color name="item_doc_background">#fffafafa</color>
+ <color name="item_doc_background_selected">#ffe0f2f1</color>
+
</resources>
<item name="actionBarTheme">@style/ActionBarTheme</item>
<item name="actionBarPopupTheme">@style/ActionBarPopupTheme</item>
+ <item name="android:windowBackground">@color/window_background</item>
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorAccent">@color/accent</item>
<item name="actionBarTheme">@style/ActionBarTheme</item>
<item name="actionBarPopupTheme">@style/ActionBarPopupTheme</item>
+ <item name="android:windowBackground">@color/window_background</item>
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorAccent">@color/accent</item>
public void setSelected(boolean selected) {
itemView.setActivated(selected);
- itemView.setBackgroundColor(selected ? mSelectedItemColor : mDefaultItemColor);
}
@Override
holder.setSelected(isSelected(position));
- final View line2 = itemView.findViewById(R.id.line2);
-
final ImageView iconMime = (ImageView) itemView.findViewById(R.id.icon_mime);
final ImageView iconThumb = (ImageView) itemView.findViewById(R.id.icon_thumb);
final TextView title = (TextView) itemView.findViewById(android.R.id.title);
getDocumentIcon(mContext, docAuthority, docId, docMimeType, docIcon, state));
}
- boolean hasLine2 = false;
-
- final boolean hideTitle = (state.derivedMode == MODE_GRID) && mHideGridTitles;
- if (!hideTitle) {
+ if ((state.derivedMode == MODE_GRID) && mHideGridTitles) {
+ title.setVisibility(View.GONE);
+ } else {
title.setText(docDisplayName);
title.setVisibility(View.VISIBLE);
- } else {
- title.setVisibility(View.GONE);
}
Drawable iconDrawable = null;
if (alwaysShowSummary) {
summary.setText(root.getDirectoryString());
summary.setVisibility(View.VISIBLE);
- hasLine2 = true;
} else {
if (iconDrawable != null && roots.isIconUniqueBlocking(root)) {
// No summary needed if icon speaks for itself
summary.setText(root.getDirectoryString());
summary.setVisibility(View.VISIBLE);
summary.setTextAlignment(TextView.TEXT_ALIGNMENT_TEXT_END);
- hasLine2 = true;
}
}
}
if (docSummary != null) {
summary.setText(docSummary);
summary.setVisibility(View.VISIBLE);
- hasLine2 = true;
} else {
summary.setVisibility(View.INVISIBLE);
}
}
}
- if (icon1 != null) icon1.setVisibility(View.GONE);
-
if (iconDrawable != null) {
icon1.setVisibility(View.VISIBLE);
icon1.setImageDrawable(iconDrawable);
+ } else {
+ icon1.setVisibility(View.GONE);
}
if (docLastModified == -1) {
date.setText(null);
} else {
date.setText(formatTime(mContext, docLastModified));
- hasLine2 = true;
}
- if (state.showSize) {
- size.setVisibility(View.VISIBLE);
- if (Document.MIME_TYPE_DIR.equals(docMimeType) || docSize == -1) {
- size.setText(null);
- } else {
- size.setText(Formatter.formatFileSize(mContext, docSize));
- hasLine2 = true;
- }
- } else {
+ if (!state.showSize || Document.MIME_TYPE_DIR.equals(docMimeType) || docSize == -1) {
size.setVisibility(View.GONE);
- }
-
- if (line2 != null) {
- line2.setVisibility(hasLine2 ? View.VISIBLE : View.GONE);
+ } else {
+ size.setVisibility(View.VISIBLE);
+ size.setText(Formatter.formatFileSize(mContext, docSize));
}
setEnabledRecursive(itemView, enabled);
iconMime.setAlpha(iconAlpha);
iconThumb.setAlpha(iconAlpha);
- if (icon1 != null) icon1.setAlpha(iconAlpha);
+ icon1.setAlpha(iconAlpha);
if (DEBUG_ENABLE_DND) {
setupDragAndDropOnDocumentView(itemView, cursor);
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
+import com.android.documentsui.R;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
private final Integer mSelectedColor;
public DirectoryItemAnimator(Context context) {
- mDefaultColor = context.getResources().getColor(android.R.color.transparent);
- // Get the accent color.
- TypedValue selColor = new TypedValue();
- context.getTheme().resolveAttribute(android.R.attr.colorAccent, selColor, true);
- // Set the opacity to 10%.
- mSelectedColor = (selColor.data & 0x00ffffff) | 0x16000000;
+ mDefaultColor = context.getResources().getColor(R.color.item_doc_background);
+ mSelectedColor = context.getResources().getColor(R.color.item_doc_background_selected);
}
@Override