From 0e28ba89caf9f9e72b1138f5b2847311fa641cff Mon Sep 17 00:00:00 2001 From: Andreas Stefl Date: Mon, 27 Jul 2026 07:45:08 +0200 Subject: [PATCH] Drop the open action from the toolbar The landing screen already offers to open a document twice - the fab, and the labelled button in the empty state - and both go straight to the system picker since the chooser dialog went away. The toolbar icon was a third copy of the same intent, sitting in the one place where it is least explained: an unlabelled folder glyph next to the title. Inside a document it was the odd one out too. Every other toolbar action acts on the document that is open; this one threw it away and started over, which is what back already does, and back lands on the list where the next document is picked anyway. The tests clicked the toolbar icon to reach the picker, so they now click whichever landing entry point is on screen. Which of the two it is depends on whether an earlier test already left something in the recent list, so they match either. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01RxF8q9WCwGcu5AHr9yZber --- .../app/opendocument/droid/test/MainActivityTests.kt | 11 +++++++---- .../opendocument/droid/ui/activity/MainActivity.kt | 11 ----------- app/src/main/res/menu/menu_main.xml | 7 ------- app/src/main/res/values/strings.xml | 1 - 4 files changed, 7 insertions(+), 23 deletions(-) diff --git a/app/src/androidTest/java/app/opendocument/droid/test/MainActivityTests.kt b/app/src/androidTest/java/app/opendocument/droid/test/MainActivityTests.kt index 8f200797694f..ec18c4b0b3d1 100644 --- a/app/src/androidTest/java/app/opendocument/droid/test/MainActivityTests.kt +++ b/app/src/androidTest/java/app/opendocument/droid/test/MainActivityTests.kt @@ -10,6 +10,7 @@ import android.content.Intent import android.net.Uri import android.os.SystemClock import android.util.Log +import android.view.View import androidx.core.content.FileProvider import androidx.test.espresso.Espresso.onView import androidx.test.espresso.IdlingRegistry @@ -48,6 +49,7 @@ import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicReference import org.hamcrest.Matchers.allOf +import org.hamcrest.Matchers.anyOf import org.hamcrest.Matchers.equalTo import org.junit.After import org.junit.AfterClass @@ -253,13 +255,14 @@ class MainActivityTests { ) } - // the toolbar action now launches ACTION_OPEN_DOCUMENT directly, which the test stubs out. - // it used to raise a chooser of our own that a file manager had to be picked from first. + // the landing screen is the only thing offering to open a document now that the toolbar + // action is gone. exactly one of its two entry points is on screen - the fab is hidden + // while the empty state is up - and which one depends on whether an earlier test already + // left a document in the recent list, so match either. private fun openDocumentThroughPicker() { onView( allOf( - withId(R.id.menu_open), - withContentDescription("Open document"), + anyOf(withId(R.id.landing_open_fab), withId(R.id.landing_empty_open)), isDisplayed(), ) ) diff --git a/app/src/main/java/app/opendocument/droid/ui/activity/MainActivity.kt b/app/src/main/java/app/opendocument/droid/ui/activity/MainActivity.kt index 7656b7466ac1..a5688407183c 100644 --- a/app/src/main/java/app/opendocument/droid/ui/activity/MainActivity.kt +++ b/app/src/main/java/app/opendocument/droid/ui/activity/MainActivity.kt @@ -452,17 +452,6 @@ class MainActivity : AppCompatActivity(), MenuProvider { analyticsManager.report(AnalyticsConstants.EVENT_SEARCH) } - R.id.menu_open -> { - findDocument() - - analyticsManager.report("menu_open") - analyticsManager.report( - AnalyticsConstants.EVENT_SELECT_CONTENT, - AnalyticsConstants.PARAM_CONTENT_TYPE, - "choose", - ) - } - R.id.menu_open_with -> { documentFragment?.openWith(this) diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index 9c0df3c4e1b0..7e8de18e11dc 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -3,13 +3,6 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"> - - Uploaded files are private and automatically deleted after 24 hours. We aren\'t able to open this document, because we don\'t support its format. Do you want to upload it to our server temporarily, so we can display it for you anyway? Uploaded files are private and automatically deleted after 24 hours. Search in document - Open document Open with... Share document Edit document