Loading res/values/strings.xml +6 −3 Original line number Diff line number Diff line Loading @@ -341,10 +341,13 @@ <string name="name_conflict">A file with this name already exists.</string> <!-- Error message shown when more authentication is necessary to view files --> <string name="authentication_required">Authentication is required to see the content of this directory</string> <string name="authentication_required">To view this directory, sign in to <xliff:g id="name" example="Cloud Storage">%1$s</xliff:g></string> <!-- Text shown on button to open an application --> <string name="open_app">Open <xliff:g id="name" example="Cloud Storage">%1$s</xliff:g></string> <!-- Error message shown when content cannot be displayed due to lack of authentication --> <string name="cant_display_content">Can\u2019t display contents</string> <!-- Text shown on button to open an application that needs user to sign in --> <string name="sign_in">Sign in</string> <!-- File name of an archive file created when compressing files, without the file extension (.zip). --> <string name="new_archive_file_name">archive<xliff:g id="extension" example=".zip">%s</xliff:g></string> Loading src/com/android/documentsui/dirlist/Message.java +14 −5 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.app.PendingIntent; import android.graphics.drawable.Drawable; import android.util.Log; import com.android.documentsui.DocumentsApplication; import com.android.documentsui.Model.Update; import com.android.documentsui.R; import com.android.documentsui.base.RootInfo; Loading Loading @@ -106,7 +107,7 @@ abstract class Message { // TODO: These should be different Message objects getting updated instead of // overwriting. if (event.hasAuthenticationException()) { updateToRecoverableExceptionHeader(event); updateToAuthenticationExceptionHeader(event); } else if (mEnv.getModel().error != null) { update(mEnv.getModel().error, null, mEnv.getContext().getDrawable(R.drawable.ic_dialog_alert)); Loading @@ -116,12 +117,14 @@ abstract class Message { } } private void updateToRecoverableExceptionHeader(Update event) { private void updateToAuthenticationExceptionHeader(Update event) { assert(mEnv.getFeatures().isRemoteActionsEnabled()); RootInfo root = mEnv.getDisplayState().stack.getRoot(); update(mEnv.getContext().getResources().getText(R.string.authentication_required), mEnv.getContext().getString(R.string.open_app, root.title), String appName = DocumentsApplication .getProvidersCache(mEnv.getContext()).getApplicationName(root.authority); update(mEnv.getContext().getString(R.string.authentication_required, appName), mEnv.getContext().getResources().getText(R.string.sign_in), mEnv.getContext().getDrawable(R.drawable.ic_dialog_info)); mCallback = () -> { AuthenticationRequiredException exception = Loading @@ -147,12 +150,13 @@ abstract class Message { if (event.hasException() && !event.hasAuthenticationException()) { updateToInflatedErrorMesage( Shared.DEBUG ? Shared.getStackTrace(event.getException()) : null); } else if (event.hasAuthenticationException()) { updateToCantDisplayContentMessage(); } else if (mEnv.getModel().getModelIds().length == 0) { updateToInflatedEmptyMessage(); } } private void updateToInflatedErrorMesage(@Nullable String debugString) { if (debugString == null) { update(mEnv.getContext().getResources().getText(R.string.query_error), null, Loading @@ -163,6 +167,11 @@ abstract class Message { } } private void updateToCantDisplayContentMessage() { update(mEnv.getContext().getResources().getText(R.string.cant_display_content), null, mEnv.getContext().getDrawable(R.drawable.cabinet)); } private void updateToInflatedEmptyMessage() { final CharSequence message; if (mEnv.isInSearchMode()) { Loading tests/functional/com/android/documentsui/FilesActivityUiTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ public class FilesActivityUiTest extends ActivityTest<FilesActivity> { bots.main.switchToListMode(); bots.directory.openDocument("throw a authentication exception"); bots.directory.assertHeaderMessageText( "Authentication is required to see the content of this directory"); "To view this directory, sign in to DocumentsUI Tests"); } Loading Loading
res/values/strings.xml +6 −3 Original line number Diff line number Diff line Loading @@ -341,10 +341,13 @@ <string name="name_conflict">A file with this name already exists.</string> <!-- Error message shown when more authentication is necessary to view files --> <string name="authentication_required">Authentication is required to see the content of this directory</string> <string name="authentication_required">To view this directory, sign in to <xliff:g id="name" example="Cloud Storage">%1$s</xliff:g></string> <!-- Text shown on button to open an application --> <string name="open_app">Open <xliff:g id="name" example="Cloud Storage">%1$s</xliff:g></string> <!-- Error message shown when content cannot be displayed due to lack of authentication --> <string name="cant_display_content">Can\u2019t display contents</string> <!-- Text shown on button to open an application that needs user to sign in --> <string name="sign_in">Sign in</string> <!-- File name of an archive file created when compressing files, without the file extension (.zip). --> <string name="new_archive_file_name">archive<xliff:g id="extension" example=".zip">%s</xliff:g></string> Loading
src/com/android/documentsui/dirlist/Message.java +14 −5 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.app.PendingIntent; import android.graphics.drawable.Drawable; import android.util.Log; import com.android.documentsui.DocumentsApplication; import com.android.documentsui.Model.Update; import com.android.documentsui.R; import com.android.documentsui.base.RootInfo; Loading Loading @@ -106,7 +107,7 @@ abstract class Message { // TODO: These should be different Message objects getting updated instead of // overwriting. if (event.hasAuthenticationException()) { updateToRecoverableExceptionHeader(event); updateToAuthenticationExceptionHeader(event); } else if (mEnv.getModel().error != null) { update(mEnv.getModel().error, null, mEnv.getContext().getDrawable(R.drawable.ic_dialog_alert)); Loading @@ -116,12 +117,14 @@ abstract class Message { } } private void updateToRecoverableExceptionHeader(Update event) { private void updateToAuthenticationExceptionHeader(Update event) { assert(mEnv.getFeatures().isRemoteActionsEnabled()); RootInfo root = mEnv.getDisplayState().stack.getRoot(); update(mEnv.getContext().getResources().getText(R.string.authentication_required), mEnv.getContext().getString(R.string.open_app, root.title), String appName = DocumentsApplication .getProvidersCache(mEnv.getContext()).getApplicationName(root.authority); update(mEnv.getContext().getString(R.string.authentication_required, appName), mEnv.getContext().getResources().getText(R.string.sign_in), mEnv.getContext().getDrawable(R.drawable.ic_dialog_info)); mCallback = () -> { AuthenticationRequiredException exception = Loading @@ -147,12 +150,13 @@ abstract class Message { if (event.hasException() && !event.hasAuthenticationException()) { updateToInflatedErrorMesage( Shared.DEBUG ? Shared.getStackTrace(event.getException()) : null); } else if (event.hasAuthenticationException()) { updateToCantDisplayContentMessage(); } else if (mEnv.getModel().getModelIds().length == 0) { updateToInflatedEmptyMessage(); } } private void updateToInflatedErrorMesage(@Nullable String debugString) { if (debugString == null) { update(mEnv.getContext().getResources().getText(R.string.query_error), null, Loading @@ -163,6 +167,11 @@ abstract class Message { } } private void updateToCantDisplayContentMessage() { update(mEnv.getContext().getResources().getText(R.string.cant_display_content), null, mEnv.getContext().getDrawable(R.drawable.cabinet)); } private void updateToInflatedEmptyMessage() { final CharSequence message; if (mEnv.isInSearchMode()) { Loading
tests/functional/com/android/documentsui/FilesActivityUiTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ public class FilesActivityUiTest extends ActivityTest<FilesActivity> { bots.main.switchToListMode(); bots.directory.openDocument("throw a authentication exception"); bots.directory.assertHeaderMessageText( "Authentication is required to see the content of this directory"); "To view this directory, sign in to DocumentsUI Tests"); } Loading