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

Commit 89d0ef9c authored by Tony Huang's avatar Tony Huang
Browse files

Add header message for scope storage

Fix: 146390449
Test: manual
Test: atest DocumentsUIGoogleTests
Change-Id: Iacfb4200cb75ca707cfd4a658899bc8ad8ebfe5e
parent 2fe45775
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -17,9 +17,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24">
        android:viewportWidth="24.0"
        android:viewportHeight="24.0"
        android:tint="?android:attr/colorPrimary">
    <path
        android:fillColor="?android:attr/colorControlNormal"
        android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-2h2v2zM13,13h-2L11,7h2v6z"/>
        android:fillColor="?android:attr/colorBackground"
        android:pathData="M12,5.99L19.53,19L4.47,19L12,5.99M12,2L1,21h22L12,2zM13,16h-2v2h2v-2zM13,10h-2v4h2v-4z"/>
</vector>
 No newline at end of file
+34 −22
Original line number Diff line number Diff line
@@ -31,41 +31,53 @@
        app:strokeWidth="1dp"
        app:strokeColor="?android:strokeColor">

        <RelativeLayout
        <LinearLayout
            android:animateLayoutChanges="true"
            android:id="@+id/message_container"
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:minHeight="?android:attr/listPreferredItemHeightSmall">
            android:minHeight="60dp"
            android:orientation="horizontal">

            <ImageView
                android:contentDescription="@null"
                android:id="@+id/message_icon"
                android:layout_height="@dimen/icon_size"
                android:layout_width="@dimen/icon_size"
                android:layout_marginStart="0dp"
                android:layout_marginEnd="10dp"
                android:layout_marginTop="4dp"
                android:layout_margin="8dp"
                android:layout_gravity="center"
                android:scaleType="centerInside"/>

            <LinearLayout
                android:layout_height="wrap_content"
                android:layout_width="match_parent"
                android:minHeight="48dp"
                android:paddingTop="12dp"
                android:paddingEnd="12dp"
                android:gravity="center_vertical"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/message_title"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:textAppearance="@style/DrawerMenuPrimary"/>

                <TextView
                    android:id="@+id/message_textview"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                android:layout_toEndOf="@+id/message_icon"
                android:layout_marginStart="0dp"
                android:layout_marginEnd="8dp"
                android:layout_marginTop="12dp"
                    android:selectAllOnFocus="true"/>

                <Button
                    android:id="@+id/button_dismiss"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                android:layout_alignEnd="@+id/message_textview"
                android:layout_below="@+id/message_textview"
                    android:layout_gravity="end"
                    android:text="@android:string/ok"
                    style="@style/DialogTextButton"/>
        </RelativeLayout>

            </LinearLayout>
        </LinearLayout>
    </com.google.android.material.card.MaterialCardView>
</FrameLayout>
+8 −0
Original line number Diff line number Diff line
@@ -469,6 +469,14 @@
    <string name="open_tree_dialog_title">Allow <xliff:g id="appName" example="Drive">%1$s</xliff:g> to access files in <xliff:g id="directory" example="DCIM">%2$s</xliff:g>?</string>
    <!-- Confrim dialog message show on open document tree flow.-->
    <string name="open_tree_dialog_message">This will let <xliff:g id="appName" example="Drive">%1$s</xliff:g> access current and future content stored in <xliff:g id="directory" example="DCIM">%2$s</xliff:g>.</string>
    <!-- Header message title show on open document tree flow. [CHAR_LIMIT=48] -->
    <string name="open_tree_header_title">Can\u2019t share <xliff:g id="folderName" example="Download">%1$s</xliff:g> folder with <xliff:g id="appName" example="Drive">%2$s</xliff:g></string>
    <!-- Header message content show on open document tree flow and on root top. [CHAR_LIMIT=80]-->
    <string name="open_tree_header_message_root">Choose a folder below, or create a new one</string>
    <!-- Header message content show on open document tree flow and in child folder. [CHAR_LIMIT=80]-->
    <string name="open_tree_header_message_child">Choose another folder, or create a new one</string>



    <!-- Search hint on search view. [CHAR LIMIT=48] -->
    <string name="search_bar_hint">Search this phone</string>
+26 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.util.Log;
import android.view.View;
import android.view.WindowManager;

import androidx.annotation.NonNull;
import androidx.annotation.PluralsRes;
import androidx.appcompat.app.AlertDialog;

@@ -231,6 +232,31 @@ public final class Shared {
        return callingPackage;
    }

    /**
     * Returns the calling app name.
     * @param activity
     * @return the calling app name or general anonymous name if not found
     */
    @NonNull
    public static String getCallingAppName(Activity activity) {
        final String anonymous = activity.getString(R.string.anonymous_application);
        final String packageName = getCallingPackageName(activity);
        if (TextUtils.isEmpty(packageName)) {
            return anonymous;
        }

        final PackageManager pm = activity.getPackageManager();
        ApplicationInfo ai;
        try {
            ai = pm.getApplicationInfo(packageName, 0);
        } catch (final PackageManager.NameNotFoundException e) {
            return anonymous;
        }

        CharSequence result = pm.getApplicationLabel(ai);
        return TextUtils.isEmpty(result) ? anonymous : result.toString();
    }

    /**
     * Returns the default directory to be presented after starting the activity.
     * Method can be overridden if the change of the behavior of the the child activity is needed.
+5 −0
Original line number Diff line number Diff line
@@ -1292,5 +1292,10 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On
        public ActionHandler getActionHandler() {
            return mActions;
        }

        @Override
        public String getCallingAppName() {
            return Shared.getCallingAppName(mActivity);
        }
    }
}
Loading