Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ec97392 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

More UX work for thumbnails, search, management.

Hide non-finished downloads from normal picker UI, but keep them
around in management mode.  Uses a Uri query parameter and a hidden
API on DocumentsProvider.

Scale thumbnails to fit viewport, always show MIME icon while waiting
on thumbnails, and crossfade between them.  Cancel thumbnail tasks
when views are recycled.

Filter directories out of search results for now.  Also leave sort
ordering from backend intact, since it's custom ranking.  Fix
SearchView interaction to dismiss properly and restore across
orientation and drawer state changes.

Hide most actions when drawer is open.  Invalidate RootInfo cache
when locale changes.  Apply sort ordering when showing recent create
directories.  Hide recent summary string when icon is enough for user
to disambiguate.

Bug: 10667184, 10665663
Change-Id: I331d3272a08c497f88dc659d9e112231cb35aa69
parent 1d2daa78
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -459,6 +459,7 @@ public final class DocumentsContract {
    private static final String PATH_SEARCH = "search";
    private static final String PATH_SEARCH = "search";


    private static final String PARAM_QUERY = "query";
    private static final String PARAM_QUERY = "query";
    private static final String PARAM_MANAGE = "manage";


    /**
    /**
     * Build Uri representing the roots of a document provider. When queried, a
     * Build Uri representing the roots of a document provider. When queried, a
@@ -583,6 +584,16 @@ public final class DocumentsContract {
        return searchDocumentsUri.getQueryParameter(PARAM_QUERY);
        return searchDocumentsUri.getQueryParameter(PARAM_QUERY);
    }
    }


    /** {@hide} */
    public static Uri setManageMode(Uri uri) {
        return uri.buildUpon().appendQueryParameter(PARAM_MANAGE, "true").build();
    }

    /** {@hide} */
    public static boolean isManageMode(Uri uri) {
        return uri.getBooleanQueryParameter(PARAM_MANAGE, false);
    }

    /**
    /**
     * Return list of all documents that the calling package has "open." These
     * Return list of all documents that the calling package has "open." These
     * are Uris matching {@link DocumentsContract} to which persistent
     * are Uris matching {@link DocumentsContract} to which persistent
+14 −1
Original line number Original line Diff line number Diff line
@@ -167,6 +167,14 @@ public abstract class DocumentsProvider extends ContentProvider {
            String parentDocumentId, String[] projection, String sortOrder)
            String parentDocumentId, String[] projection, String sortOrder)
            throws FileNotFoundException;
            throws FileNotFoundException;


    /** {@hide} */
    @SuppressWarnings("unused")
    public Cursor queryChildDocumentsForManage(
            String parentDocumentId, String[] projection, String sortOrder)
            throws FileNotFoundException {
        throw new UnsupportedOperationException("Manage not supported");
    }

    /**
    /**
     * Return documents that that match the given query, starting the search at
     * Return documents that that match the given query, starting the search at
     * the given directory.
     * the given directory.
@@ -262,7 +270,12 @@ public abstract class DocumentsProvider extends ContentProvider {
                case MATCH_DOCUMENT:
                case MATCH_DOCUMENT:
                    return queryDocument(getDocumentId(uri), projection);
                    return queryDocument(getDocumentId(uri), projection);
                case MATCH_CHILDREN:
                case MATCH_CHILDREN:
                    if (DocumentsContract.isManageMode(uri)) {
                        return queryChildDocumentsForManage(
                                getDocumentId(uri), projection, sortOrder);
                    } else {
                        return queryChildDocuments(getDocumentId(uri), projection, sortOrder);
                        return queryChildDocuments(getDocumentId(uri), projection, sortOrder);
                    }
                case MATCH_SEARCH:
                case MATCH_SEARCH:
                    return querySearchDocuments(
                    return querySearchDocuments(
                            getDocumentId(uri), getSearchDocumentsQuery(uri), projection);
                            getDocumentId(uri), getSearchDocumentsQuery(uri), projection);
+18 −4
Original line number Original line Diff line number Diff line
@@ -32,13 +32,27 @@
            android:layout_weight="1"
            android:layout_weight="1"
            android:background="#fff">
            android:background="#fff">


            <ImageView
            <FrameLayout
                android:id="@android:id/icon"
                android:id="@android:id/icon"
                android:layout_width="match_parent"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <ImageView
                    android:id="@+id/icon_mime"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="centerInside"
                    android:scaleType="centerInside"
                    android:contentDescription="@null" />
                    android:contentDescription="@null" />


                <ImageView
                    android:id="@+id/icon_thumb"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="centerCrop"
                    android:contentDescription="@null" />

            </FrameLayout>

            <ImageView
            <ImageView
                android:layout_width="match_parent"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_height="match_parent"
+18 −4
Original line number Original line Diff line number Diff line
@@ -25,16 +25,30 @@
    android:paddingBottom="8dip"
    android:paddingBottom="8dip"
    android:orientation="horizontal">
    android:orientation="horizontal">


    <ImageView
    <FrameLayout
        android:id="@android:id/icon"
        android:id="@android:id/icon"
        android:layout_width="@dimen/icon_size"
        android:layout_width="@dimen/icon_size"
        android:layout_height="@dimen/icon_size"
        android:layout_height="@dimen/icon_size"
        android:layout_marginStart="12dp"
        android:layout_marginStart="12dp"
        android:layout_marginEnd="20dp"
        android:layout_marginEnd="20dp"
        android:layout_gravity="center_vertical"
        android:layout_gravity="center_vertical">

        <ImageView
            android:id="@+id/icon_mime"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="centerInside"
            android:scaleType="centerInside"
            android:contentDescription="@null" />
            android:contentDescription="@null" />


        <ImageView
            android:id="@+id/icon_thumb"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="centerCrop"
            android:contentDescription="@null" />

    </FrameLayout>

    <LinearLayout
    <LinearLayout
        android:layout_width="0dip"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_height="wrap_content"
+10 −3
Original line number Original line Diff line number Diff line
@@ -14,6 +14,13 @@
     limitations under the License.
     limitations under the License.
-->
-->


<TextView xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="12dp">

    <TextView
        android:id="@android:id/title"
        android:id="@android:id/title"
        style="?android:attr/listSeparatorTextViewStyle" />
        style="?android:attr/listSeparatorTextViewStyle" />

</FrameLayout>
Loading