Merge "Breadcrumb arrow for rtl Language" into rvc-dev am: c68c9a1fea am: 32869a467b
Change-Id: Id927e5cfe465f439710f9cdad8fa38fc68dea975
diff --git a/res/drawable/ic_breadcrumb_arrow.xml b/res/drawable/ic_breadcrumb_arrow.xml
index f13be0f..e08d0d7 100644
--- a/res/drawable/ic_breadcrumb_arrow.xml
+++ b/res/drawable/ic_breadcrumb_arrow.xml
@@ -17,6 +17,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
+ android:autoMirrored="true"
android:viewportWidth="24"
android:viewportHeight="24">
<path
diff --git a/res/drawable/ic_breadcrumb_arrow_down.xml b/res/drawable/ic_breadcrumb_arrow_down.xml
deleted file mode 100644
index 199a308..0000000
--- a/res/drawable/ic_breadcrumb_arrow_down.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<rotate xmlns:android="http://schemas.android.com/apk/res/android"
- android:fromDegrees="90"
- android:toDegrees="90"
- android:pivotX="50%"
- android:pivotY="50%"
- android:drawable="@drawable/ic_breadcrumb_arrow">
-</rotate>
\ No newline at end of file
diff --git a/res/layout/item_subdir.xml b/res/layout/item_subdir.xml
deleted file mode 100644
index c00b14b..0000000
--- a/res/layout/item_subdir.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?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.
--->
-
-<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="horizontal"
- android:baselineAligned="false">
-
- <TextView
- android:id="@android:id/title"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:singleLine="true"
- android:ellipsize="end"
- android:textAlignment="viewStart"
- android:textAppearance="?android:attr/textAppearanceListItem"
- android:textColor="?android:attr/textColorPrimary" />
-
-</LinearLayout>
diff --git a/res/layout/item_subdir_title.xml b/res/layout/item_subdir_title.xml
deleted file mode 100644
index 6d71fca..0000000
--- a/res/layout/item_subdir_title.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingEnd="8dp"
- android:orientation="horizontal"
- android:baselineAligned="false">
-
- <TextView
- android:id="@android:id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:singleLine="true"
- android:ellipsize="end"
- android:textAlignment="viewStart"
- android:drawablePadding="12dp"
- android:drawableRight="@drawable/ic_breadcrumb_arrow_down"
- android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title"
- android:gravity="center_vertical"/>
-</LinearLayout>
diff --git a/src/com/android/documentsui/DropdownBreadcrumb.java b/src/com/android/documentsui/DropdownBreadcrumb.java
deleted file mode 100644
index 8e9b07f..0000000
--- a/src/com/android/documentsui/DropdownBreadcrumb.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-package com.android.documentsui;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.accessibility.AccessibilityEvent;
-import android.widget.AdapterView;
-import android.widget.BaseAdapter;
-import android.widget.Spinner;
-import android.widget.TextView;
-
-import com.android.documentsui.NavigationViewManager.Breadcrumb;
-import com.android.documentsui.NavigationViewManager.Environment;
-import com.android.documentsui.base.DocumentInfo;
-import com.android.documentsui.base.RootInfo;
-import com.android.documentsui.base.State;
-
-import java.util.function.IntConsumer;
-
-/**
- * Dropdown implementation of breadcrumb used for phone device layouts
- */
-
-public final class DropdownBreadcrumb extends Spinner implements Breadcrumb {
-
- private DropdownAdapter mAdapter;
-
- public DropdownBreadcrumb(
- Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- }
-
- public DropdownBreadcrumb(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- }
-
- public DropdownBreadcrumb(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public DropdownBreadcrumb(Context context) {
- super(context);
- }
-
- @Override
- public void setup(Environment env, State state, IntConsumer listener) {
- mAdapter = new DropdownAdapter(state, env);
- setOnItemSelectedListener(
- new OnItemSelectedListener() {
- @Override
- public void onItemSelected(
- AdapterView<?> parent, View view, int position, long id) {
- listener.accept(position);
- }
-
- @Override
- public void onNothingSelected(AdapterView<?> parent) {}
- });
- setAccessibilityDelegate(new AccessibilityDelegate() {
- @Override
- public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
- if (event.getEventType() != AccessibilityEvent.TYPE_VIEW_SELECTED) {
- super.onInitializeAccessibilityEvent(host, event);
- }
- }
- });
- }
-
- @Override
- public void show(boolean visibility) {
- if (visibility) {
- setVisibility(VISIBLE);
- setAdapter(mAdapter);
- } else {
- setVisibility(GONE);
- setAdapter(null);
- }
- }
-
- @Override
- public void postUpdate() {
- setSelection(mAdapter.getCount() - 1, false);
- }
-
- private static final class DropdownAdapter extends BaseAdapter {
- private Environment mEnv;
- private State mState;
-
- public DropdownAdapter(State state, Environment env) {
- mState = state;
- mEnv = env;
- }
-
- @Override
- public int getCount() {
- return mState.stack.size();
- }
-
- @Override
- public DocumentInfo getItem(int position) {
- return mState.stack.get(position);
- }
-
- @Override
- public long getItemId(int position) {
- return position;
- }
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- if (convertView == null) {
- convertView = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.item_subdir_title, parent, false);
- }
-
- final TextView title = (TextView) convertView.findViewById(android.R.id.title);
- final DocumentInfo doc = getItem(position);
-
- if (position == 0) {
- final RootInfo root = mEnv.getCurrentRoot();
- title.setText(root.title);
- } else {
- title.setText(doc.displayName);
- }
-
- return convertView;
- }
-
- @Override
- public View getDropDownView(int position, View convertView, ViewGroup parent) {
- if (convertView == null) {
- convertView = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.item_subdir, parent, false);
- }
-
- final TextView title = (TextView) convertView.findViewById(android.R.id.title);
- final DocumentInfo doc = getItem(position);
-
- if (position == 0) {
- final RootInfo root = mEnv.getCurrentRoot();
- title.setText(root.title);
- } else {
- title.setText(doc.displayName);
- }
-
- return convertView;
- }
- }
-
-}