am 70cdfe7e: Merge "Item layout tweaking, hook up more assets." into klp-dev
* commit '70cdfe7eb1d42d5e928f5c7c6106be4ebb8fde51': Item layout tweaking, hook up more assets.
This commit is contained in:
19
packages/DocumentsUI/res/drawable/item_doc_grid.xml
Normal file
19
packages/DocumentsUI/res/drawable/item_doc_grid.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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:drawable="@drawable/ic_grid_card_background" />
|
||||
</selector>
|
||||
22
packages/DocumentsUI/res/drawable/item_root.xml
Normal file
22
packages/DocumentsUI/res/drawable/item_root.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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_pressed="true" android:drawable="@color/item_root_activated" />
|
||||
<item android:state_activated="true" android:drawable="@color/item_root_activated" />
|
||||
<item android:state_focused="true" android:drawable="@color/item_root_activated" />
|
||||
<item android:drawable="@android:color/white" />
|
||||
</selector>
|
||||
@@ -38,8 +38,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:listSelector="@android:color/transparent"
|
||||
android:paddingTop="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
|
||||
@@ -16,110 +16,111 @@
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="180dip"
|
||||
android:paddingBottom="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||
android:layout_height="@dimen/grid_height"
|
||||
android:background="@drawable/item_doc_grid"
|
||||
android:foreground="@drawable/item_background">
|
||||
|
||||
<FrameLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/chip"
|
||||
android:foreground="@drawable/item_background"
|
||||
android:duplicateParentState="true">
|
||||
android:paddingBottom="6dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="6dp"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"
|
||||
android:background="#fff">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"
|
||||
android:background="#bbb"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerInside"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/ic_grid_gradient_bg"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textAlignment="viewStart" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/summary_grid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon1"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
android:layout_marginEnd="6dip"
|
||||
android:scaleType="centerInside"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||
|
||||
<View
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/size"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@android:id/icon1"
|
||||
android:layout_width="@dimen/root_icon_size"
|
||||
android:layout_height="@dimen/root_icon_size"
|
||||
android:layout_marginStart="8dip"
|
||||
android:scaleType="centerInside"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/line2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:minWidth="80dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/size"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="8dp"
|
||||
android:minWidth="80dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="8dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
@@ -27,9 +27,10 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="@android:dimen/app_icon_size"
|
||||
android:layout_height="@android:dimen/app_icon_size"
|
||||
android:layout_marginEnd="8dip"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:scaleType="centerInside"
|
||||
android:contentDescription="@null" />
|
||||
@@ -41,36 +42,43 @@
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textAlignment="viewStart" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/summary_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textAlignment="viewStart" />
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon1"
|
||||
android:layout_width="24dip"
|
||||
android:layout_height="24dip"
|
||||
android:layout_marginEnd="6dip"
|
||||
android:layout_width="@dimen/root_icon_size"
|
||||
android:layout_height="@dimen/root_icon_size"
|
||||
android:layout_marginStart="8dip"
|
||||
android:scaleType="centerInside"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/line2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:minWidth="70dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAlignment="viewStart"
|
||||
@@ -78,23 +86,26 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/size"
|
||||
android:layout_width="70dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:minWidth="70dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="70dp"
|
||||
android:id="@android:id/summary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="8dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -17,17 +17,17 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/item_root">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="@android:dimen/app_icon_size"
|
||||
android:layout_height="@android:dimen/app_icon_size"
|
||||
android:layout_rowSpan="2"
|
||||
android:layout_width="@dimen/icon_size"
|
||||
android:layout_height="@dimen/icon_size"
|
||||
android:layout_marginEnd="8dip"
|
||||
android:scaleType="centerInside"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
@@ -16,14 +16,4 @@
|
||||
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textAlignment="viewStart" />
|
||||
style="?android:attr/listSeparatorTextViewStyle" />
|
||||
|
||||
@@ -17,8 +17,20 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/subdir"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="centerInside"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/ic_subdirectory_arrow"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
|
||||
@@ -16,4 +16,5 @@
|
||||
|
||||
<resources>
|
||||
<color name="chip">#ddd</color>
|
||||
<color name="item_root_activated">#cccccc</color>
|
||||
</resources>
|
||||
|
||||
@@ -15,5 +15,8 @@
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<dimen name="icon_size">32dp</dimen>
|
||||
<dimen name="root_icon_size">24dp</dimen>
|
||||
<dimen name="grid_width">180dp</dimen>
|
||||
<dimen name="grid_height">180dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -214,6 +214,12 @@ public class DirectoryFragment extends Fragment {
|
||||
updateDisplayState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
updateDisplayState();
|
||||
}
|
||||
|
||||
public void updateDisplayState() {
|
||||
final State state = getDisplayState(this);
|
||||
|
||||
@@ -541,7 +547,7 @@ public class DirectoryFragment extends Fragment {
|
||||
|
||||
final ImageView icon = (ImageView) convertView.findViewById(android.R.id.icon);
|
||||
final TextView title = (TextView) convertView.findViewById(android.R.id.title);
|
||||
final View summaryGrid = convertView.findViewById(R.id.summary_grid);
|
||||
final View line2 = convertView.findViewById(R.id.line2);
|
||||
final ImageView icon1 = (ImageView) convertView.findViewById(android.R.id.icon1);
|
||||
final TextView summary = (TextView) convertView.findViewById(android.R.id.summary);
|
||||
final TextView date = (TextView) convertView.findViewById(R.id.date);
|
||||
@@ -571,31 +577,32 @@ public class DirectoryFragment extends Fragment {
|
||||
|
||||
title.setText(docDisplayName);
|
||||
|
||||
boolean hasLine2 = false;
|
||||
|
||||
if (mType == TYPE_RECENT_OPEN) {
|
||||
final RootInfo root = roots.getRoot(docAuthority, docRootId);
|
||||
icon1.setVisibility(View.VISIBLE);
|
||||
icon1.setImageDrawable(root.loadIcon(context));
|
||||
summary.setText(root.getDirectoryString());
|
||||
summary.setVisibility(View.VISIBLE);
|
||||
summary.setTextAlignment(TextView.TEXT_ALIGNMENT_TEXT_END);
|
||||
hasLine2 = true;
|
||||
} else {
|
||||
icon1.setVisibility(View.GONE);
|
||||
if (docSummary != null) {
|
||||
summary.setText(docSummary);
|
||||
summary.setVisibility(View.VISIBLE);
|
||||
hasLine2 = true;
|
||||
} else {
|
||||
summary.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (summaryGrid != null) {
|
||||
summaryGrid.setVisibility(
|
||||
(summary.getVisibility() == View.VISIBLE) ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
if (docLastModified == -1) {
|
||||
date.setText(null);
|
||||
} else {
|
||||
date.setText(formatTime(context, docLastModified));
|
||||
hasLine2 = true;
|
||||
}
|
||||
|
||||
if (state.showSize) {
|
||||
@@ -604,11 +611,14 @@ public class DirectoryFragment extends Fragment {
|
||||
size.setText(null);
|
||||
} else {
|
||||
size.setText(Formatter.formatFileSize(context, docSize));
|
||||
hasLine2 = true;
|
||||
}
|
||||
} else {
|
||||
size.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
line2.setVisibility(hasLine2 ? View.VISIBLE : View.GONE);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.SearchView;
|
||||
import android.widget.SearchView.OnCloseListener;
|
||||
import android.widget.SearchView.OnQueryTextListener;
|
||||
@@ -481,6 +482,8 @@ public class DocumentsActivity extends Activity {
|
||||
title.setText(doc.displayName);
|
||||
}
|
||||
|
||||
// No padding when shown in actionbar
|
||||
convertView.setPadding(0, 0, 0, 0);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@@ -488,17 +491,20 @@ public class DocumentsActivity extends Activity {
|
||||
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
convertView = LayoutInflater.from(parent.getContext())
|
||||
.inflate(android.R.layout.simple_dropdown_item_1line, parent, false);
|
||||
.inflate(R.layout.item_title, parent, false);
|
||||
}
|
||||
|
||||
final TextView text1 = (TextView) convertView.findViewById(android.R.id.text1);
|
||||
final ImageView subdir = (ImageView) convertView.findViewById(R.id.subdir);
|
||||
final TextView title = (TextView) convertView.findViewById(android.R.id.title);
|
||||
final DocumentInfo doc = getItem(position);
|
||||
|
||||
if (position == 0) {
|
||||
final RootInfo root = getCurrentRoot();
|
||||
text1.setText(root.title);
|
||||
title.setText(root.title);
|
||||
subdir.setVisibility(View.GONE);
|
||||
} else {
|
||||
text1.setText(doc.displayName);
|
||||
title.setText(doc.displayName);
|
||||
subdir.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
return convertView;
|
||||
@@ -566,6 +572,11 @@ public class DocumentsActivity extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
final RootsFragment roots = RootsFragment.get(fm);
|
||||
if (roots != null) {
|
||||
roots.onCurrentRootChanged();
|
||||
}
|
||||
|
||||
updateActionBar();
|
||||
invalidateOptionsMenu();
|
||||
dumpStack();
|
||||
|
||||
@@ -181,7 +181,6 @@ public class RecentsCreateFragment extends Fragment {
|
||||
|
||||
final ImageView icon = (ImageView) convertView.findViewById(android.R.id.icon);
|
||||
final TextView title = (TextView) convertView.findViewById(android.R.id.title);
|
||||
final View summaryList = convertView.findViewById(R.id.summary_list);
|
||||
|
||||
final DocumentStack stack = getItem(position);
|
||||
final RootInfo root = stack.getRoot(roots);
|
||||
@@ -197,8 +196,6 @@ public class RecentsCreateFragment extends Fragment {
|
||||
title.setText(builder.toString());
|
||||
title.setEllipsize(TruncateAt.MIDDLE);
|
||||
|
||||
summaryList.setVisibility(View.GONE);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.android.documentsui.DocumentsActivity.State;
|
||||
import com.android.documentsui.SectionedListAdapter.SectionAdapter;
|
||||
import com.android.documentsui.model.DocumentInfo;
|
||||
import com.android.documentsui.model.RootInfo;
|
||||
import com.android.internal.util.Objects;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
@@ -78,6 +79,7 @@ public class RootsFragment extends Fragment {
|
||||
final View view = inflater.inflate(R.layout.fragment_roots, container, false);
|
||||
mList = (ListView) view.findViewById(android.R.id.list);
|
||||
mList.setOnItemClickListener(mItemListener);
|
||||
mList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
|
||||
|
||||
return view;
|
||||
}
|
||||
@@ -100,6 +102,21 @@ public class RootsFragment extends Fragment {
|
||||
|
||||
mAdapter = new SectionedRootsAdapter(context, matchingRoots, includeApps);
|
||||
mList.setAdapter(mAdapter);
|
||||
|
||||
onCurrentRootChanged();
|
||||
}
|
||||
|
||||
public void onCurrentRootChanged() {
|
||||
if (mAdapter == null) return;
|
||||
|
||||
final RootInfo root = ((DocumentsActivity) getActivity()).getCurrentRoot();
|
||||
for (int i = 0; i < mAdapter.getCount(); i++) {
|
||||
final Object item = mAdapter.getItem(i);
|
||||
if (Objects.equal(item, root)) {
|
||||
mList.setItemChecked(i, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private OnItemClickListener mItemListener = new OnItemClickListener() {
|
||||
|
||||
Reference in New Issue
Block a user