Recently Written · git

sbm-android

sbm bookmarks for Android: fuzzy search, share to add, sync with bm and the browser add-on

git clone https://github.com/equwal/sbm-android

Log | Files | Refs


commit 373b6a927fb7ba831144b89e7ce180a5ea918bb4
equwal <truex@equwal.com>
2026-09-21 04:28:06 -0700

sbm for Android 0.1.0

The app lists the bookmarks of an sbm file and searches them as you
type, with the fuzzy match of fzf. A tap opens a bookmark; a long press
copies or shares it. Share from a browser adds a page. Go opens the
first match, or an address, or a web search, as bm does.

The file is one that the user opens (Storage Access Framework), or,
after a sign-in to an sbm-sync server, a file of the app. The app syncs
when it opens and after an add. INTERNET is only for sync.

The app uses the Android framework only: no AndroidX, no Google
libraries. The Google Play build (-PplayStore=true) has no Ko-fi link.
The file format, the search and the server address have tests; the
format and the search have property tests (jqwik).

Store texts and images are in fastlane/, the F-Droid recipe is in
fdroid/, and the Play Console answers are in play/listing.md.

 .gitattributes                                     |   4 +
 .github/FUNDING.yml                                |   1 +
 .gitignore                                         |   6 +
 LICENSE                                            | 662 +++++++++++++++++++++
 README.md                                          |  53 ++
 app/.jqwik-database                                | Bin 0 -> 4 bytes
 app/build.gradle.kts                               |  80 +++
 app/src/main/AndroidManifest.xml                   |  40 ++
 app/src/main/java/com/equwal/sbm/AddActivity.kt    |  67 +++
 app/src/main/java/com/equwal/sbm/Fuzzy.kt          |  47 ++
 app/src/main/java/com/equwal/sbm/MainActivity.kt   | 266 +++++++++
 app/src/main/java/com/equwal/sbm/Store.kt          |  69 +++
 app/src/main/java/com/equwal/sbm/Sync.kt           | 154 +++++
 app/src/main/java/com/equwal/sbm/Tsv.kt            |  87 +++
 .../main/res/drawable/ic_launcher_foreground.xml   |  11 +
 app/src/main/res/layout/activity_add.xml           |  66 ++
 app/src/main/res/layout/activity_main.xml          |  46 ++
 app/src/main/res/layout/dialog_sign_in.xml         |  49 ++
 app/src/main/res/layout/item.xml                   |  25 +
 app/src/main/res/menu/main.xml                     |  32 +
 app/src/main/res/mipmap-anydpi/ic_launcher.xml     |   6 +
 app/src/main/res/values-night/themes.xml           |  14 +
 app/src/main/res/values/strings.xml                |  53 ++
 app/src/main/res/values/themes.xml                 |  16 +
 app/src/main/res/xml/backup_rules.xml              |   9 +
 app/src/main/res/xml/data_extraction_rules.xml     |  19 +
 app/src/test/java/com/equwal/sbm/FuzzyTest.kt      |  59 ++
 app/src/test/java/com/equwal/sbm/SyncTest.kt       |  16 +
 app/src/test/java/com/equwal/sbm/TsvTest.kt        | 124 ++++
 build.gradle.kts                                   |   6 +
 fastlane/metadata/android/en-US/changelogs/1.txt   |   1 +
 .../metadata/android/en-US/full_description.txt    |  17 +
 .../android/en-US/images/featureGraphic.png        | Bin 0 -> 17143 bytes
 fastlane/metadata/android/en-US/images/icon.png    | Bin 0 -> 4671 bytes
 .../android/en-US/images/phoneScreenshots/1.png    | Bin 0 -> 87198 bytes
 .../android/en-US/images/phoneScreenshots/2.png    | Bin 0 -> 53815 bytes
 .../metadata/android/en-US/short_description.txt   |   1 +
 fastlane/metadata/android/en-US/title.txt          |   1 +
 fdroid/com.equwal.sbm.yml                          |  26 +
 gradle.properties                                  |   2 +
 gradle/wrapper/gradle-wrapper.jar                  | Bin 0 -> 45457 bytes
 gradle/wrapper/gradle-wrapper.properties           |   9 +
 gradlew                                            | 251 ++++++++
 gradlew.bat                                        |  94 +++
 play/listing.md                                    |  60 ++
 play/make-graphics.ps1                             |  42 ++
 settings.gradle.kts                                |  18 +
 47 files changed, 2609 insertions(+)
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..a2aebd1
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,4 @@
+* text=auto eol=lf
+*.bat text eol=crlf
+*.jar binary
+*.png binary
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..d303709
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1 @@
+ko_fi: truex
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a3a3629
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+.gradle/
+.kotlin/
+build/
+local.properties
+*.jks
+*.keystore
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..fe6b903
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,662 @@
+                    GNU AFFERO GENERAL PUBLIC LICENSE
+                       Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+  A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate.  Many developers of free software are heartened and
+encouraged by the resulting cooperation.  However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+  The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community.  It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server.  Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+  An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals.  This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU Affero General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Remote Network Interaction; Use with the GNU General Public License.
+
+  Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software.  This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time.  Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as published
+    by the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source.  For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code.  There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+<https://www.gnu.org/licenses/>.
+
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..96cbf94
--- /dev/null
+++ b/README.md
@@ -0,0 +1,53 @@
+# sbm for Android
+
+Your [sbm](https://github.com/equwal/sbm) bookmarks on your phone.
+
+- **Search as you type**, with the fuzzy match of fzf. Go opens the first
+  match. Text that is no bookmark opens as an address, or as a web search,
+  as in bm.
+- **Tap to open**, press and hold to copy or share.
+- **Share to sbm** from any browser to add the page.
+- **Sync** with bm on your computers and the sbm add-on for Firefox and
+  Chrome, through an [sbm-sync](https://github.com/equwal/sbm-sync) server.
+- Or **open a bookmark file** that Syncthing, git or a file app keeps.
+
+The bookmarks stay an sbm file: one bookmark per line,
+`URL<tab>description<tab>tags`.
+
+## Sync
+
+In the menu, "Sign in to sync" uses https://sbm.subread.space unless you
+type another server. Create an account on the website of the server. The
+account on sbm.subread.space is free for 30 days, then $3 a month or $30 a
+year. Or [run your own server](https://github.com/equwal/sbm-sync): it is
+free software.
+
+After a sign-in, the app syncs when you open it and after you add a
+bookmark. Without a file of your own, the app keeps the file in its own
+storage.
+
+## Privacy
+
+The app has no ads, no analytics and no trackers. It uses the network only
+for sync, after you sign in, and only with the server that you choose. See
+the [privacy policy](https://sbm.subread.space/privacy).
+
+## Build
+
+    ./gradlew assembleDebug testDebugUnitTest
+
+JDK 17 or later and the Android SDK (platform 36). The app uses only the
+Android framework: no AndroidX, no Google libraries.
+
+Release builds are signed when `SBM_KEYSTORE_FILE` and
+`SBM_KEYSTORE_PASSWORD` are set (key alias `sbm`). The Google Play build has
+no link to Ko-fi, because Google Play does not allow links to payments
+outside Google Play:
+
+    ./gradlew bundleRelease -PplayStore=true    # Google Play
+    ./gradlew assembleRelease                   # F-Droid and GitHub
+
+## License
+
+AGPL-3.0. If sbm is useful to you, you can support it on
+[Ko-fi](https://ko-fi.com/truex).
diff --git a/app/.jqwik-database b/app/.jqwik-database
new file mode 100644
index 0000000..711006c
Binary files /dev/null and b/app/.jqwik-database differ
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
new file mode 100644
index 0000000..4ddc01b
--- /dev/null
+++ b/app/build.gradle.kts
@@ -0,0 +1,80 @@
+plugins {
+    id("com.android.application")
+}
+
+// Release signing comes from the environment, so the key never lives in the
+// repository. Without it the release build is left unsigned.
+val keystorePath = providers.environmentVariable("SBM_KEYSTORE_FILE").orNull
+val keystorePassword = providers.environmentVariable("SBM_KEYSTORE_PASSWORD").orNull
+val signingReady = !keystorePath.isNullOrBlank() && !keystorePassword.isNullOrBlank() &&
+    file(keystorePath).isFile
+
+// Google Play does not allow links to payments outside Google Play, so the
+// Play build has no Ko-fi link: ./gradlew bundleRelease -PplayStore=true
+val playStore = providers.gradleProperty("playStore").map { it.toBoolean() }.getOrElse(false)
+
+android {
+    namespace = "com.equwal.sbm"
+    compileSdk = 36
+
+    defaultConfig {
+        applicationId = "com.equwal.sbm"
+        minSdk = 26
+        targetSdk = 36
+        versionCode = 1
+        versionName = "0.1.0"
+        buildConfigField("boolean", "DONATE", (!playStore).toString())
+    }
+
+    buildFeatures { buildConfig = true }
+
+    if (signingReady) {
+        signingConfigs {
+            create("release") {
+                storeFile = file(keystorePath!!)
+                storePassword = keystorePassword
+                keyAlias = "sbm"
+                keyPassword = keystorePassword
+            }
+        }
+    }
+
+    buildTypes {
+        debug { applicationIdSuffix = ".debug" }
+        release {
+            isMinifyEnabled = true
+            isShrinkResources = true
+            proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"))
+            if (signingReady) signingConfig = signingConfigs.getByName("release")
+        }
+    }
+
+    compileOptions {
+        sourceCompatibility = JavaVersion.VERSION_17
+        targetCompatibility = JavaVersion.VERSION_17
+    }
+
+    // Google encrypts this block into the APK. F-Droid does not accept it.
+    dependenciesInfo {
+        includeInApk = false
+        includeInBundle = false
+    }
+
+    testOptions {
+        unitTests.all { it.useJUnitPlatform() }
+    }
+
+    lint {
+        // These checks report newer versions of tools and platforms. Their
+        // result changes with the date, not with the code: upgrades are
+        // separate work. Google Play asks for target API 36 until August 2027.
+        disable += setOf("OldTargetApi", "GradleDependency", "AndroidGradlePluginVersion", "NewerVersionAvailable")
+        warningsAsErrors = true
+    }
+}
+
+dependencies {
+    // Property tests for the file format and the search.
+    testImplementation("net.jqwik:jqwik:1.10.1")
+    testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.14.4")
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..ce21cad
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- The app reads the file that the user picks, and a browser opens the
+     links. INTERNET is only for sync, after the user signs in. -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <uses-permission android:name="android.permission.INTERNET" />
+
+    <application
+        android:allowBackup="false"
+        android:dataExtractionRules="@xml/data_extraction_rules"
+        android:fullBackupContent="@xml/backup_rules"
+        android:icon="@mipmap/ic_launcher"
+        android:label="@string/app_name"
+        android:supportsRtl="true"
+        android:theme="@style/Theme.Sbm">
+
+        <activity
+            android:name=".MainActivity"
+            android:exported="true"
+            android:windowSoftInputMode="adjustResize">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+
+        <activity
+            android:name=".AddActivity"
+            android:excludeFromRecents="true"
+            android:exported="true"
+            android:label="@string/add_label"
+            android:theme="@style/Theme.Sbm.Add">
+            <intent-filter>
+                <action android:name="android.intent.action.SEND" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <data android:mimeType="text/plain" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest>
diff --git a/app/src/main/java/com/equwal/sbm/AddActivity.kt b/app/src/main/java/com/equwal/sbm/AddActivity.kt
new file mode 100644
index 0000000..09cf3bb
--- /dev/null
+++ b/app/src/main/java/com/equwal/sbm/AddActivity.kt
@@ -0,0 +1,67 @@
+package com.equwal.sbm
+
+import android.app.Activity
+import android.content.Intent
+import android.os.Bundle
+import android.view.View
+import android.widget.Button
+import android.widget.EditText
+import android.widget.TextView
+import android.widget.Toast
+
+/** Add a bookmark: from "Share" in a browser, or from the menu of the list. */
+class AddActivity : Activity() {
+    override fun onCreate(state: Bundle?) {
+        super.onCreate(state)
+        if (Store.file(this) == null) {
+            toast(getString(R.string.choose_first))
+            finish()
+            return
+        }
+        setContentView(R.layout.activity_add)
+        val url = findViewById<EditText>(R.id.url)
+        val desc = findViewById<EditText>(R.id.desc)
+        val tags = findViewById<EditText>(R.id.tags)
+
+        if (state == null && intent.action == Intent.ACTION_SEND) {
+            val text = intent.getStringExtra(Intent.EXTRA_TEXT).orEmpty()
+            url.setText(Tsv.firstUrl(text) ?: text.trim())
+            desc.setText(intent.getStringExtra(Intent.EXTRA_SUBJECT).orEmpty())
+        }
+
+        val known = try {
+            Tsv.parse(Store.read(this)).flatMap { it.tags }.distinct().sorted()
+        } catch (e: Exception) {
+            emptyList()
+        }
+        val hint = findViewById<TextView>(R.id.known)
+        if (known.isEmpty()) {
+            hint.visibility = View.GONE
+        } else {
+            hint.text = getString(R.string.known_tags, known.joinToString(" "))
+        }
+
+        findViewById<Button>(R.id.cancel).setOnClickListener { finish() }
+        findViewById<Button>(R.id.save).setOnClickListener {
+            val b = Bookmark(
+                url.text.toString().filterNot { it.isWhitespace() },
+                Tsv.clean(desc.text.toString()).trim(),
+                tags.text.toString().split(' ', '\t', '\n').filter { it.isNotEmpty() })
+            if (b.url.isEmpty()) {
+                url.error = getString(R.string.need_url)
+                return@setOnClickListener
+            }
+            try {
+                val existing = Store.add(this, b)
+                toast(if (existing == null) getString(R.string.added) else getString(R.string.already, existing.desc.ifEmpty { existing.url }))
+                // The list syncs when it opens; this sends the new bookmark now.
+                if (existing == null && Sync.signedIn(this)) Sync.run(this) {}
+                finish()
+            } catch (e: Exception) {
+                toast(getString(R.string.cannot_write, e.message))
+            }
+        }
+    }
+
+    private fun toast(text: String) = Toast.makeText(this, text, Toast.LENGTH_LONG).show()
+}
diff --git a/app/src/main/java/com/equwal/sbm/Fuzzy.kt b/app/src/main/java/com/equwal/sbm/Fuzzy.kt
new file mode 100644
index 0000000..ccde619
--- /dev/null
+++ b/app/src/main/java/com/equwal/sbm/Fuzzy.kt
@@ -0,0 +1,47 @@
+package com.equwal.sbm
+
+/**
+ * Search as in fzf. Each word of the query must occur in the text, with its
+ * letters in order but not always together. Case does not matter.
+ */
+object Fuzzy {
+    /** The score of [query] in [text], or null when a word does not occur. Higher is better. */
+    fun score(query: String, text: String): Int? {
+        val hay = text.lowercase()
+        var total = 0
+        for (word in query.lowercase().split(' ', '\t')) {
+            if (word.isEmpty()) continue
+            total += scoreWord(word, hay) ?: return null
+        }
+        return total
+    }
+
+    private fun scoreWord(word: String, hay: String): Int? {
+        // The whole word in one place scores highest, most at the start of a word.
+        val at = hay.indexOf(word)
+        if (at >= 0) return 100 + word.length + (if (startsWord(hay, at)) 20 else 0)
+        var score = 0
+        var previous = -2
+        var from = 0
+        for (c in word) {
+            val i = hay.indexOf(c, from)
+            if (i < 0) return null
+            score += 1
+            if (i == previous + 1) score += 5
+            if (startsWord(hay, i)) score += 3
+            previous = i
+            from = i + 1
+        }
+        return score
+    }
+
+    private fun startsWord(hay: String, i: Int) = i == 0 || !hay[i - 1].isLetterOrDigit()
+
+    /** The items that match [query], best first. Items with the same score keep their order. */
+    fun <T> filter(items: List<T>, query: String, text: (T) -> String): List<T> {
+        if (query.isBlank()) return items
+        return items.mapIndexedNotNull { i, item -> score(query, text(item))?.let { Triple(it, i, item) } }
+            .sortedWith(compareByDescending<Triple<Int, Int, T>> { it.first }.thenBy { it.second })
+            .map { it.third }
+    }
+}
diff --git a/app/src/main/java/com/equwal/sbm/MainActivity.kt b/app/src/main/java/com/equwal/sbm/MainActivity.kt
new file mode 100644
index 0000000..1b4bf24
--- /dev/null
+++ b/app/src/main/java/com/equwal/sbm/MainActivity.kt
@@ -0,0 +1,266 @@
+package com.equwal.sbm
+
+import android.app.Activity
+import android.app.AlertDialog
+import android.content.ActivityNotFoundException
+import android.content.ClipData
+import android.content.ClipboardManager
+import android.content.Intent
+import android.net.Uri
+import android.os.Build
+import android.os.Bundle
+import android.text.Editable
+import android.text.TextWatcher
+import android.view.Menu
+import android.view.MenuItem
+import android.view.View
+import android.view.ViewGroup
+import android.view.WindowInsets
+import android.view.inputmethod.EditorInfo
+import android.widget.BaseAdapter
+import android.widget.EditText
+import android.widget.ListView
+import android.widget.TextView
+import android.widget.Toast
+import android.widget.Toolbar
+
+/** The list: search as you type, tap to open, press and hold for more. */
+class MainActivity : Activity() {
+    private lateinit var search: EditText
+    private lateinit var empty: TextView
+    private val rows = Rows()
+    private var all: List<Bookmark> = emptyList()
+
+    override fun onCreate(state: Bundle?) {
+        super.onCreate(state)
+        setContentView(R.layout.activity_main)
+        val toolbar = findViewById<Toolbar>(R.id.toolbar)
+        setActionBar(toolbar)
+        search = findViewById(R.id.search)
+        empty = findViewById(R.id.empty)
+        val list = findViewById<ListView>(R.id.list)
+        list.adapter = rows
+        list.emptyView = empty
+
+        // Android 15 and later draw the app under the system bars and the
+        // keyboard. The toolbar colour goes under the status bar, and the
+        // rest of the screen stays clear of the bars and the keyboard.
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+            findViewById<View>(R.id.root).setOnApplyWindowInsetsListener { v, insets ->
+                val bars = insets.getInsets(WindowInsets.Type.systemBars() or WindowInsets.Type.ime())
+                toolbar.setPadding(0, bars.top, 0, 0)
+                v.setPadding(bars.left, 0, bars.right, bars.bottom)
+                insets
+            }
+        }
+
+        search.addTextChangedListener(object : TextWatcher {
+            override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
+            override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
+            override fun afterTextChanged(s: Editable?) = show()
+        })
+        search.setOnEditorActionListener { _, action, _ ->
+            if (action == EditorInfo.IME_ACTION_GO) {
+                go()
+                true
+            } else {
+                false
+            }
+        }
+        list.setOnItemClickListener { _, _, position, _ -> open(rows.items[position].url) }
+        list.setOnItemLongClickListener { _, _, position, _ ->
+            more(rows.items[position])
+            true
+        }
+    }
+
+    override fun onResume() {
+        super.onResume()
+        load()
+        if (Sync.signedIn(this)) sync(quiet = true)
+    }
+
+    /** Sync, then show the file again. A quiet sync reports only what the user must act on. */
+    private fun sync(quiet: Boolean) {
+        Sync.run(this) { result ->
+            if (isDestroyed) return@run
+            result.onSuccess { changed ->
+                if (changed) load()
+                if (!quiet) toast(resources.getQuantityString(R.plurals.synced, all.size, all.size))
+            }.onFailure { e ->
+                if (!quiet || (e is Sync.Failure && e.urgent)) toast(getString(R.string.sync_failed, e.message))
+                if (e is Sync.Failure && e.signIn) invalidateOptionsMenu()
+            }
+        }
+    }
+
+    private fun showSignIn() {
+        val form = layoutInflater.inflate(R.layout.dialog_sign_in, null)
+        val server = form.findViewById<EditText>(R.id.server)
+        val email = form.findViewById<EditText>(R.id.email)
+        val password = form.findViewById<EditText>(R.id.password)
+        server.setText(Sync.server(this))
+        email.setText(Sync.email(this))
+        AlertDialog.Builder(this)
+            .setTitle(R.string.sign_in)
+            .setView(form)
+            .setNegativeButton(android.R.string.cancel, null)
+            .setPositiveButton(R.string.sign_in_button) { _, _ ->
+                toast(getString(R.string.signing_in))
+                Sync.signIn(this, server.text.toString(), email.text.toString(), password.text.toString()) { result ->
+                    if (isDestroyed) return@signIn
+                    result.onSuccess { n ->
+                        toast(resources.getQuantityString(R.plurals.signed_in, n, Sync.email(this), n))
+                        invalidateOptionsMenu()
+                        load()
+                    }.onFailure { e -> toast(getString(R.string.sync_failed, e.message)) }
+                }
+            }
+            .show()
+    }
+
+    private fun load() {
+        all = try {
+            // Newest first: bm adds bookmarks at the end of the file.
+            Tsv.parse(Store.read(this)).asReversed()
+        } catch (e: Exception) {
+            toast(getString(R.string.cannot_read, e.message))
+            emptyList()
+        }
+        empty.setText(if (Store.file(this) == null) R.string.no_file else R.string.no_match)
+        show()
+    }
+
+    private fun show() {
+        rows.items = Fuzzy.filter(all, search.text.toString()) { "${it.desc} ${it.tags.joinToString(" ")} ${it.url}" }
+        rows.notifyDataSetChanged()
+    }
+
+    /** Go opens the first bookmark. Without one, the text is an address or a web search, as in bm. */
+    private fun go() {
+        val first = rows.items.firstOrNull()
+        when {
+            first != null -> open(first.url)
+            search.text.isNotBlank() -> open(Tsv.target(search.text.toString()))
+        }
+    }
+
+    private fun open(url: String) {
+        try {
+            startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)).addCategory(Intent.CATEGORY_BROWSABLE))
+        } catch (e: ActivityNotFoundException) {
+            toast(getString(R.string.no_app, url))
+        }
+    }
+
+    private fun more(b: Bookmark) {
+        val actions = arrayOf(getString(R.string.open), getString(R.string.copy), getString(R.string.share))
+        AlertDialog.Builder(this)
+            .setTitle(b.desc.ifEmpty { b.url })
+            .setItems(actions) { _, which ->
+                when (which) {
+                    0 -> open(b.url)
+                    1 -> copy(b.url)
+                    else -> share(b)
+                }
+            }
+            .show()
+    }
+
+    private fun copy(url: String) {
+        getSystemService(ClipboardManager::class.java).setPrimaryClip(ClipData.newPlainText("URL", url))
+        // Android 13 and later show their own message.
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) toast(getString(R.string.copied))
+    }
+
+    private fun share(b: Bookmark) {
+        val send = Intent(Intent.ACTION_SEND).setType("text/plain")
+            .putExtra(Intent.EXTRA_TEXT, b.url)
+            .putExtra(Intent.EXTRA_SUBJECT, b.desc)
+        startActivity(Intent.createChooser(send, null))
+    }
+
+    override fun onCreateOptionsMenu(menu: Menu): Boolean {
+        menuInflater.inflate(R.menu.main, menu)
+        return true
+    }
+
+    override fun onPrepareOptionsMenu(menu: Menu): Boolean {
+        val on = Sync.signedIn(this)
+        menu.findItem(R.id.sync_now).isVisible = on
+        menu.findItem(R.id.sign_out).isVisible = on
+        menu.findItem(R.id.sign_in).isVisible = !on
+        // Google Play does not allow links to payments outside Google Play.
+        menu.findItem(R.id.donate).isVisible = BuildConfig.DONATE
+        return true
+    }
+
+    override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) {
+        R.id.add -> {
+            startActivity(Intent(this, AddActivity::class.java))
+            true
+        }
+        R.id.sync_now -> {
+            sync(quiet = false)
+            true
+        }
+        R.id.sign_in -> {
+            showSignIn()
+            true
+        }
+        R.id.sign_out -> {
+            Sync.signOut(this)
+            invalidateOptionsMenu()
+            load()
+            true
+        }
+        R.id.donate -> {
+            open(KOFI)
+            true
+        }
+        R.id.open_file -> {
+            val pick = Intent(Intent.ACTION_OPEN_DOCUMENT).addCategory(Intent.CATEGORY_OPENABLE).setType("*/*")
+            startActivityForResult(pick, CHOOSE)
+            true
+        }
+        R.id.new_file -> {
+            val make = Intent(Intent.ACTION_CREATE_DOCUMENT).addCategory(Intent.CATEGORY_OPENABLE)
+                .setType("text/plain").putExtra(Intent.EXTRA_TITLE, "bookmarks")
+            startActivityForResult(make, CHOOSE)
+            true
+        }
+        else -> super.onOptionsItemSelected(item)
+    }
+
+    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+        val uri = data?.data
+        if (requestCode == CHOOSE && resultCode == RESULT_OK && uri != null) {
+            Store.choose(this, uri)
+            load()
+        }
+    }
+
+    private fun toast(text: String) = Toast.makeText(this, text, Toast.LENGTH_LONG).show()
+
+    private inner class Rows : BaseAdapter() {
+        var items: List<Bookmark> = emptyList()
+
+        override fun getCount() = items.size
+        override fun getItem(position: Int) = items[position]
+        override fun getItemId(position: Int) = position.toLong()
+
+        override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
+            val view = convertView ?: layoutInflater.inflate(R.layout.item, parent, false)
+            val b = items[position]
+            view.findViewById<TextView>(R.id.title).text = b.desc.ifEmpty { b.url }
+            view.findViewById<TextView>(R.id.detail).text =
+                listOf(Tsv.host(b.url), b.tags.joinToString(" ")).filter { it.isNotEmpty() }.joinToString("  ·  ")
+            return view
+        }
+    }
+
+    private companion object {
+        const val CHOOSE = 1
+        const val KOFI = "https://ko-fi.com/truex"
+    }
+}
diff --git a/app/src/main/java/com/equwal/sbm/Store.kt b/app/src/main/java/com/equwal/sbm/Store.kt
new file mode 100644
index 0000000..690eacc
--- /dev/null
+++ b/app/src/main/java/com/equwal/sbm/Store.kt
@@ -0,0 +1,69 @@
+package com.equwal.sbm
+
+import android.content.Context
+import android.content.Intent
+import android.net.Uri
+import java.io.File
+import java.io.FileNotFoundException
+import java.io.IOException
+
+/**
+ * The bookmark file. It is the file that the user chose, or else, after a
+ * sign-in to sync, a file of the app. The app keeps only the address of the
+ * file and reads the file again each time, so a file that Syncthing or git
+ * changes is always current.
+ */
+object Store {
+    private const val PREFS = "sbm"
+    private const val KEY = "file"
+
+    /** The file that the user chose, or null. */
+    fun uri(ctx: Context): Uri? =
+        ctx.getSharedPreferences(PREFS, Context.MODE_PRIVATE).getString(KEY, null)?.let(Uri::parse)
+
+    /** The file to use: the chosen file, else the file of the app when sync is on. */
+    fun file(ctx: Context): Uri? =
+        uri(ctx) ?: if (Sync.signedIn(ctx)) Uri.fromFile(File(ctx.filesDir, "bookmarks")) else null
+
+    fun choose(ctx: Context, uri: Uri) {
+        ctx.contentResolver.takePersistableUriPermission(
+            uri, Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
+        ctx.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().putString(KEY, uri.toString()).apply()
+    }
+
+    fun read(ctx: Context): String {
+        val uri = file(ctx) ?: return ""
+        return try {
+            ctx.contentResolver.openInputStream(uri)?.use { it.readBytes().toString(Charsets.UTF_8) } ?: ""
+        } catch (e: FileNotFoundException) {
+            if (uri.scheme == "file") "" else throw e // the file of the app comes with the first sync
+        }
+    }
+
+    /** Write the whole file. */
+    fun write(ctx: Context, text: String) {
+        val uri = file(ctx) ?: throw IOException("no bookmark file")
+        ctx.contentResolver.openOutputStream(uri, "wt")?.use { it.write(text.toByteArray(Charsets.UTF_8)) }
+            ?: throw IOException("cannot write the bookmark file")
+    }
+
+    /**
+     * Add [b] at the end of the file. When the file already has the same page,
+     * add nothing and return that bookmark.
+     */
+    fun add(ctx: Context, b: Bookmark): Bookmark? {
+        val uri = file(ctx) ?: throw IOException("no bookmark file")
+        val text = read(ctx)
+        Tsv.find(Tsv.parse(text), b.url)?.let { return it }
+        val extra = Tsv.appendix(text, Tsv.format(b))
+        val appended = try {
+            ctx.contentResolver.openOutputStream(uri, "wa")?.use { it.write(extra.toByteArray(Charsets.UTF_8)) } != null
+        } catch (e: Exception) {
+            false
+        }
+        // Some document providers cannot append, and some write over the file
+        // instead. Then write the whole file.
+        if (!appended || read(ctx) != text + extra) write(ctx, text + extra)
+        return null
+    }
+}
diff --git a/app/src/main/java/com/equwal/sbm/Sync.kt b/app/src/main/java/com/equwal/sbm/Sync.kt
new file mode 100644
index 0000000..e4b6c5c
--- /dev/null
+++ b/app/src/main/java/com/equwal/sbm/Sync.kt
@@ -0,0 +1,154 @@
+package com.equwal.sbm
+
+import android.content.Context
+import android.os.Handler
+import android.os.Looper
+import java.io.IOException
+import java.net.HttpURLConnection
+import java.net.URL
+import java.net.URLEncoder
+import java.util.concurrent.Executors
+
+/**
+ * Sync with an sbm-sync server (https://github.com/equwal/sbm-sync). The app
+ * sends the file and the name of the version that the server gave last time.
+ * The server merges and sends back the file, which the app then writes.
+ */
+object Sync {
+    const val DEFAULT_SERVER = "https://sbm.subread.space"
+    private const val PREFS = "sync"
+    private val worker by lazy { Executors.newSingleThreadExecutor() }
+    private val main by lazy { Handler(Looper.getMainLooper()) }
+
+    /**
+     * A sync that did not work, with a message for the user. [urgent] means
+     * that the user must act: sign in again, or see the account.
+     */
+    class Failure(message: String, val signIn: Boolean = false, val urgent: Boolean = signIn) : IOException(message)
+
+    private fun prefs(ctx: Context) = ctx.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
+
+    fun signedIn(ctx: Context) = prefs(ctx).getString("token", null) != null
+    fun server(ctx: Context): String = prefs(ctx).getString("server", null) ?: DEFAULT_SERVER
+    fun email(ctx: Context): String = prefs(ctx).getString("email", null).orEmpty()
+
+    /** Sign in, keep the token, then sync. [done] gets the result on the main thread. */
+    fun signIn(ctx: Context, server: String, email: String, password: String, done: (Result<Int>) -> Unit) {
+        val app = ctx.applicationContext
+        background(done) {
+            val site = address(server)
+            val form = "email=" + URLEncoder.encode(email.trim(), "UTF-8") +
+                "&password=" + URLEncoder.encode(password, "UTF-8")
+            val r = post(app, "$site/api/login", form.toByteArray(), "application/x-www-form-urlencoded", null)
+            when (r.code) {
+                200 -> {}
+                401 -> throw Failure(app.getString(R.string.wrong_login))
+                else -> throw Failure(r.text.trim())
+            }
+            prefs(app).edit().clear()
+                .putString("server", site).putString("email", email.trim()).putString("token", r.text.trim())
+                .apply()
+            syncNow(app)
+            count(app)
+        }
+    }
+
+    fun signOut(ctx: Context) {
+        val app = ctx.applicationContext
+        val token = prefs(app).getString("token", null) ?: return
+        val site = server(app)
+        prefs(app).edit().remove("token").remove("version").remove("file").apply()
+        worker.execute {
+            try {
+                post(app, "$site/api/logout", ByteArray(0), "text/plain", token)
+            } catch (e: IOException) {
+                // The token stays valid on the server; nothing else is lost.
+            }
+        }
+    }
+
+    /** Sync now. [done] gets, on the main thread, whether the file changed. */
+    fun run(ctx: Context, done: (Result<Boolean>) -> Unit) {
+        val app = ctx.applicationContext
+        background(done) { syncNow(app) }
+    }
+
+    private fun count(ctx: Context) = Tsv.parse(Store.read(ctx)).size
+
+    private fun syncNow(ctx: Context): Boolean {
+        val p = prefs(ctx)
+        val token = p.getString("token", null) ?: throw Failure(ctx.getString(R.string.sign_in_again), true)
+        val file = Store.file(ctx)?.toString() ?: throw Failure(ctx.getString(R.string.choose_first))
+        repeat(3) {
+            // The version belongs to the file that it came from.
+            val base = if (p.getString("file", null) == file) p.getString("version", null).orEmpty() else ""
+            val sent = Store.read(ctx)
+            val r = post(ctx, server(ctx) + "/api/sync?base=" + base, sent.toByteArray(Charsets.UTF_8),
+                "text/plain; charset=utf-8", token)
+            when (r.code) {
+                200 -> {}
+                401 -> {
+                    p.edit().remove("token").apply()
+                    throw Failure(ctx.getString(R.string.sign_in_again), true)
+                }
+                402 -> throw Failure(ctx.getString(R.string.sync_paused), urgent = true)
+                else -> throw Failure(r.text.trim())
+            }
+            val version = r.version ?: throw Failure(ctx.getString(R.string.no_version))
+            // A bookmark came in while the request ran: send the file again.
+            if (Store.read(ctx) != sent) return@repeat
+            val changed = r.text != sent
+            if (changed) Store.write(ctx, r.text)
+            p.edit().putString("file", file).putString("version", version).apply()
+            return changed
+        }
+        throw Failure(ctx.getString(R.string.file_busy))
+    }
+
+    /** The address of a server as the user typed it, with https:// when it has no scheme. */
+    fun address(typed: String): String {
+        val t = typed.trim().trimEnd('/')
+        return if ("://" in t) t else "https://$t"
+    }
+
+    private class Reply(val code: Int, val text: String, val version: String?)
+
+    private fun post(ctx: Context, url: String, body: ByteArray, type: String, token: String?): Reply {
+        val c = try {
+            URL(url).openConnection() as HttpURLConnection
+        } catch (e: Exception) {
+            throw Failure(ctx.getString(R.string.bad_server, url))
+        }
+        try {
+            c.requestMethod = "POST"
+            c.connectTimeout = 15_000
+            c.readTimeout = 60_000
+            c.doOutput = true
+            c.setRequestProperty("Content-Type", type)
+            if (token != null) c.setRequestProperty("Authorization", "Bearer $token")
+            c.setFixedLengthStreamingMode(body.size)
+            c.outputStream.use { it.write(body) }
+            val code = c.responseCode
+            val text = (if (code < 400) c.inputStream else c.errorStream)
+                ?.use { it.readBytes().toString(Charsets.UTF_8) }.orEmpty()
+            return Reply(code, text, c.getHeaderField("Sbm-Version"))
+        } catch (e: Failure) {
+            throw e
+        } catch (e: IOException) {
+            throw Failure(ctx.getString(R.string.no_server, URL(url).host))
+        } finally {
+            c.disconnect()
+        }
+    }
+
+    private fun <T> background(done: (Result<T>) -> Unit, work: () -> T) {
+        worker.execute {
+            val result = try {
+                Result.success(work())
+            } catch (e: Exception) {
+                Result.failure(e)
+            }
+            main.post { done(result) }
+        }
+    }
+}
diff --git a/app/src/main/java/com/equwal/sbm/Tsv.kt b/app/src/main/java/com/equwal/sbm/Tsv.kt
new file mode 100644
index 0000000..0549d15
--- /dev/null
+++ b/app/src/main/java/com/equwal/sbm/Tsv.kt
@@ -0,0 +1,87 @@
+package com.equwal.sbm
+
+import java.net.URLEncoder
+
+/** One line of an sbm bookmark file: URL<tab>description<tab>tags. */
+data class Bookmark(val url: String, val desc: String, val tags: List<String>)
+
+/**
+ * The bookmark file of sbm, as bm reads and writes it. This file has no
+ * Android code, so the tests run on any JVM.
+ */
+object Tsv {
+    private val control = Regex("[\t\r\n]")
+    private val scheme = Regex("^[A-Za-z][A-Za-z0-9+.-]*://")
+    private val space = Regex("\\s+")
+    private val web = Regex("""https?://\S+""")
+
+    /** The bookmarks in the text of a file. Blank lines and lines that start with # are not bookmarks. */
+    fun parse(text: String): List<Bookmark> =
+        text.split('\n').mapNotNull { raw ->
+            val line = raw.removeSuffix("\r")
+            if (line.isBlank() || line.startsWith("#")) null else parseLine(line)
+        }
+
+    private fun parseLine(line: String): Bookmark? {
+        val fields = line.split('\t')
+        if (fields.size == 1) {
+            // A line of the old format: "URL description | tags". bm-migrate
+            // converts it. Until then the first word is the URL.
+            val words = line.trim().split(space, limit = 2)
+            return Bookmark(words[0], words.getOrElse(1) { "" }, emptyList())
+        }
+        val url = fields[0].trim()
+        if (url.isEmpty()) return null
+        val tags = fields.getOrElse(2) { "" }.split(' ').filter { it.isNotEmpty() }
+        return Bookmark(url, fields[1], tags)
+    }
+
+    /** The line of a bookmark, without the newline. */
+    fun format(b: Bookmark): String =
+        b.url.filterNot { it.isWhitespace() } + "\t" + clean(b.desc) + "\t" +
+            b.tags.flatMap { it.split(space) }.filter { it.isNotEmpty() }.joinToString(" ")
+
+    /** Text for one field: tabs and line breaks become spaces. */
+    fun clean(text: String): String = control.replace(text, " ")
+
+    /**
+     * The same page for bm: two URLs match when they differ only in the
+     * scheme, a leading www., trailing slashes or the case of the host.
+     */
+    fun norm(url: String): String {
+        val u = scheme.replace(url, "")
+        val slash = u.indexOf('/')
+        val host = (if (slash >= 0) u.substring(0, slash) else u).lowercase().removePrefix("www.")
+        val rest = if (slash >= 0) u.substring(slash).trimEnd('/') else ""
+        return host + rest
+    }
+
+    /** The bookmark for the same page as [url], if there is one. */
+    fun find(bookmarks: List<Bookmark>, url: String): Bookmark? {
+        val n = norm(url)
+        return bookmarks.firstOrNull { norm(it.url) == n }
+    }
+
+    /** The text to add to a file that holds [text], so that [line] is a line of its own. */
+    fun appendix(text: String, line: String): String =
+        if (text.isEmpty() || text.endsWith("\n")) "$line\n" else "\n$line\n"
+
+    /** The host of a URL, for display. */
+    fun host(url: String): String = scheme.replace(url, "").substringBefore('/').substringBefore('?').substringBefore('#')
+
+    /** The first web address in shared text. */
+    fun firstUrl(text: String): String? = web.find(text)?.value
+
+    /**
+     * Where text that is no bookmark goes, as in bm: one word with "://" or
+     * a dot is an address. Other text is a web search.
+     */
+    fun target(text: String): String {
+        val t = text.trim()
+        if (!t.contains(' ')) {
+            if (t.contains("://")) return t
+            if (t.contains('.')) return "https://$t"
+        }
+        return "https://duckduckgo.com/?q=" + URLEncoder.encode(t, "UTF-8")
+    }
+}
diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 0000000..2c5632f
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- A bookmark ribbon inside the 66dp safe zone of an adaptive icon. -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="108dp"
+    android:height="108dp"
+    android:viewportWidth="108"
+    android:viewportHeight="108">
+    <path
+        android:fillColor="#FFFFFF"
+        android:pathData="M40,30 L68,30 L68,80 L54,69 L40,80 Z" />
+</vector>
diff --git a/app/src/main/res/layout/activity_add.xml b/app/src/main/res/layout/activity_add.xml
new file mode 100644
index 0000000..2f04342
--- /dev/null
+++ b/app/src/main/res/layout/activity_add.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:padding="16dp">
+
+        <EditText
+            android:id="@+id/url"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="@string/url"
+            android:importantForAutofill="no"
+            android:inputType="textUri" />
+
+        <EditText
+            android:id="@+id/desc"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="@string/desc"
+            android:importantForAutofill="no"
+            android:inputType="textCapSentences" />
+
+        <EditText
+            android:id="@+id/tags"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="@string/tags"
+            android:importantForAutofill="no"
+            android:inputType="text|textNoSuggestions" />
+
+        <TextView
+            android:id="@+id/known"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:paddingHorizontal="4dp"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textColor="?android:attr/textColorSecondary" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="end"
+            android:orientation="horizontal"
+            android:paddingTop="8dp">
+
+            <Button
+                android:id="@+id/cancel"
+                style="?android:attr/buttonBarButtonStyle"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@android:string/cancel" />
+
+            <Button
+                android:id="@+id/save"
+                style="?android:attr/buttonBarButtonStyle"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/save" />
+        </LinearLayout>
+    </LinearLayout>
+</ScrollView>
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..804ed4d
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/root"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <Toolbar
+        android:id="@+id/toolbar"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="?android:attr/colorPrimary"
+        android:minHeight="?android:attr/actionBarSize"
+        android:theme="@android:style/ThemeOverlay.Material.Dark.ActionBar"
+        android:title="@string/app_name" />
+
+    <EditText
+        android:id="@+id/search"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_margin="8dp"
+        android:hint="@string/search_hint"
+        android:imeOptions="actionGo"
+        android:importantForAutofill="no"
+        android:inputType="text|textNoSuggestions"
+        android:singleLine="true" />
+
+    <FrameLayout
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1">
+
+        <ListView
+            android:id="@+id/list"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" />
+
+        <TextView
+            android:id="@+id/empty"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:gravity="center"
+            android:padding="24dp"
+            android:textAppearance="?android:attr/textAppearanceMedium" />
+    </FrameLayout>
+</LinearLayout>
diff --git a/app/src/main/res/layout/dialog_sign_in.xml b/app/src/main/res/layout/dialog_sign_in.xml
new file mode 100644
index 0000000..016c6ce
--- /dev/null
+++ b/app/src/main/res/layout/dialog_sign_in.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:paddingLeft="24dp"
+        android:paddingTop="8dp"
+        android:paddingRight="24dp">
+
+        <EditText
+            android:id="@+id/server"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:hint="@string/server"
+            android:importantForAutofill="no"
+            android:inputType="textUri"
+            android:singleLine="true" />
+
+        <EditText
+            android:id="@+id/email"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:autofillHints="emailAddress"
+            android:hint="@string/email"
+            android:inputType="textEmailAddress"
+            android:singleLine="true" />
+
+        <EditText
+            android:id="@+id/password"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:autofillHints="password"
+            android:hint="@string/password"
+            android:imeOptions="actionDone"
+            android:inputType="textPassword"
+            android:singleLine="true" />
+
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:paddingTop="8dp"
+            android:text="@string/sign_in_note"
+            android:textAppearance="?android:attr/textAppearanceSmall" />
+    </LinearLayout>
+</ScrollView>
diff --git a/app/src/main/res/layout/item.xml b/app/src/main/res/layout/item.xml
new file mode 100644
index 0000000..50abfd6
--- /dev/null
+++ b/app/src/main/res/layout/item.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:paddingHorizontal="16dp"
+    android:paddingVertical="10dp">
+
+    <TextView
+        android:id="@+id/title"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:ellipsize="end"
+        android:maxLines="2"
+        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+    <TextView
+        android:id="@+id/detail"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:ellipsize="end"
+        android:singleLine="true"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textColor="?android:attr/textColorSecondary" />
+</LinearLayout>
diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/main.xml
new file mode 100644
index 0000000..ae31135
--- /dev/null
+++ b/app/src/main/res/menu/main.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:id="@+id/add"
+        android:icon="@android:drawable/ic_menu_add"
+        android:showAsAction="ifRoom"
+        android:title="@string/add" />
+    <item
+        android:id="@+id/sync_now"
+        android:showAsAction="never"
+        android:title="@string/sync_now" />
+    <item
+        android:id="@+id/sign_in"
+        android:showAsAction="never"
+        android:title="@string/sign_in" />
+    <item
+        android:id="@+id/open_file"
+        android:showAsAction="never"
+        android:title="@string/open_file" />
+    <item
+        android:id="@+id/new_file"
+        android:showAsAction="never"
+        android:title="@string/new_file" />
+    <item
+        android:id="@+id/sign_out"
+        android:showAsAction="never"
+        android:title="@string/sign_out" />
+    <item
+        android:id="@+id/donate"
+        android:showAsAction="never"
+        android:title="@string/donate" />
+</menu>
diff --git a/app/src/main/res/mipmap-anydpi/ic_launcher.xml b/app/src/main/res/mipmap-anydpi/ic_launcher.xml
new file mode 100644
index 0000000..5c84730
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi/ic_launcher.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+    <background android:drawable="@color/ic_launcher_background" />
+    <foreground android:drawable="@drawable/ic_launcher_foreground" />
+    <monochrome android:drawable="@drawable/ic_launcher_foreground" />
+</adaptive-icon>
diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
new file mode 100644
index 0000000..0e9efd4
--- /dev/null
+++ b/app/src/main/res/values-night/themes.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <style name="Theme.Sbm" parent="android:Theme.Material.NoActionBar">
+        <item name="android:colorPrimary">#005577</item>
+        <item name="android:colorPrimaryDark">#003B53</item>
+        <item name="android:colorAccent">#4FB3D9</item>
+    </style>
+
+    <style name="Theme.Sbm.Add" parent="android:Theme.Material.Dialog">
+        <item name="android:colorAccent">#4FB3D9</item>
+        <item name="android:windowMinWidthMajor">90%</item>
+        <item name="android:windowMinWidthMinor">90%</item>
+    </style>
+</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..946e080
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">sbm</string>
+    <string name="add_label">Add to sbm</string>
+    <string name="search_hint">Search, or type an address</string>
+    <string name="no_file">Sign in to sync with the menu. Or open your sbm bookmark file: Open file. To start a new file, use New file.</string>
+    <string name="no_match">No bookmark matches. Press Go to search the web.</string>
+    <string name="open">Open</string>
+    <string name="copy">Copy the URL</string>
+    <string name="share">Share</string>
+    <string name="copied">The URL is copied</string>
+    <string name="add">Add</string>
+    <string name="open_file">Open file</string>
+    <string name="new_file">New file</string>
+    <string name="url">URL</string>
+    <string name="desc">Description</string>
+    <string name="tags">Tags, with spaces between them</string>
+    <string name="known_tags">Tags in your file: %1$s</string>
+    <string name="save">Save</string>
+    <string name="added">Bookmark added</string>
+    <string name="already">Already a bookmark: %1$s</string>
+    <string name="need_url">Give a URL</string>
+    <string name="choose_first">Open sbm, then sign in to sync or open your bookmark file.</string>
+    <string name="cannot_read">Cannot read the bookmark file: %1$s</string>
+    <string name="cannot_write">Cannot write the bookmark file: %1$s</string>
+    <string name="no_app">No app can open %1$s</string>
+    <string name="sync_now">Sync now</string>
+    <string name="sign_in">Sign in to sync</string>
+    <string name="sign_in_button">Sign in</string>
+    <string name="sign_out">Sign out of sync</string>
+    <string name="donate">Support sbm on Ko-fi</string>
+    <string name="server">Sync server</string>
+    <string name="email">Email</string>
+    <string name="password">Password</string>
+    <string name="sign_in_note">No account? Create one on the website of the sync server. The app sends your bookmarks only to this server.</string>
+    <string name="signing_in">Signing in</string>
+    <plurals name="signed_in">
+        <item quantity="one">Signed in as %1$s. %2$d bookmark.</item>
+        <item quantity="other">Signed in as %1$s. %2$d bookmarks.</item>
+    </plurals>
+    <plurals name="synced">
+        <item quantity="one">In sync: %1$d bookmark</item>
+        <item quantity="other">In sync: %1$d bookmarks</item>
+    </plurals>
+    <string name="sync_failed">Sync: %1$s</string>
+    <string name="sync_paused">sbm Sync is paused for this account. See your account on the website of the server.</string>
+    <string name="sign_in_again">sign in to sync again.</string>
+    <string name="wrong_login">wrong email or password.</string>
+    <string name="no_server">cannot reach %1$s.</string>
+    <string name="bad_server">%1$s is not a server address.</string>
+    <string name="no_version">the server gave no version.</string>
+    <string name="file_busy">the file changes all the time. Try again later.</string>
+</resources>
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
new file mode 100644
index 0000000..2d7bfe7
--- /dev/null
+++ b/app/src/main/res/values/themes.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="ic_launcher_background">#005577</color>
+
+    <style name="Theme.Sbm" parent="android:Theme.Material.Light.NoActionBar">
+        <item name="android:colorPrimary">#005577</item>
+        <item name="android:colorPrimaryDark">#003B53</item>
+        <item name="android:colorAccent">#005577</item>
+    </style>
+
+    <style name="Theme.Sbm.Add" parent="android:Theme.Material.Light.Dialog">
+        <item name="android:colorAccent">#005577</item>
+        <item name="android:windowMinWidthMajor">90%</item>
+        <item name="android:windowMinWidthMinor">90%</item>
+    </style>
+</resources>
diff --git a/app/src/main/res/xml/backup_rules.xml b/app/src/main/res/xml/backup_rules.xml
new file mode 100644
index 0000000..2bcdb2c
--- /dev/null
+++ b/app/src/main/res/xml/backup_rules.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Android 11 and earlier: no backup, as in data_extraction_rules.xml. -->
+<full-backup-content>
+    <exclude domain="root" path="." />
+    <exclude domain="file" path="." />
+    <exclude domain="database" path="." />
+    <exclude domain="sharedpref" path="." />
+    <exclude domain="external" path="." />
+</full-backup-content>
diff --git a/app/src/main/res/xml/data_extraction_rules.xml b/app/src/main/res/xml/data_extraction_rules.xml
new file mode 100644
index 0000000..43786ab
--- /dev/null
+++ b/app/src/main/res/xml/data_extraction_rules.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- No backup and no device transfer: the sign-in token must stay on this
+     device, and the bookmarks are in the user's own file or on the server. -->
+<data-extraction-rules>
+    <cloud-backup>
+        <exclude domain="root" path="." />
+        <exclude domain="file" path="." />
+        <exclude domain="database" path="." />
+        <exclude domain="sharedpref" path="." />
+        <exclude domain="external" path="." />
+    </cloud-backup>
+    <device-transfer>
+        <exclude domain="root" path="." />
+        <exclude domain="file" path="." />
+        <exclude domain="database" path="." />
+        <exclude domain="sharedpref" path="." />
+        <exclude domain="external" path="." />
+    </device-transfer>
+</data-extraction-rules>
diff --git a/app/src/test/java/com/equwal/sbm/FuzzyTest.kt b/app/src/test/java/com/equwal/sbm/FuzzyTest.kt
new file mode 100644
index 0000000..d2e2c80
--- /dev/null
+++ b/app/src/test/java/com/equwal/sbm/FuzzyTest.kt
@@ -0,0 +1,59 @@
+package com.equwal.sbm
+
+import net.jqwik.api.Arbitraries
+import net.jqwik.api.Arbitrary
+import net.jqwik.api.Example
+import net.jqwik.api.ForAll
+import net.jqwik.api.Property
+import net.jqwik.api.Provide
+
+class FuzzyTest {
+    @Provide
+    fun letters(): Arbitrary<String> = Arbitraries.strings().withCharRange('a', 'z').ofMinLength(1).ofMaxLength(30)
+
+    @Provide
+    fun early(): Arbitrary<String> = Arbitraries.strings().withCharRange('a', 'm').ofMinLength(1).ofMaxLength(30)
+
+    @Provide
+    fun late(): Arbitrary<String> = Arbitraries.strings().withCharRange('n', 'z').ofMinLength(1).ofMaxLength(5)
+
+    @Provide
+    fun lists(): Arbitrary<List<String>> = letters().list().ofMaxSize(10)
+
+    @Property
+    fun `letters of the text, in order, match`(@ForAll("letters") text: String, @ForAll mask: List<Boolean>): Boolean {
+        val query = text.filterIndexed { i, _ -> mask.getOrElse(i) { false } }.ifEmpty { text.take(1) }
+        return Fuzzy.score(query, text) != null
+    }
+
+    @Property
+    fun `a letter that is not in the text does not match`(@ForAll("early") text: String, @ForAll("late") query: String): Boolean =
+        Fuzzy.score(query, text) == null
+
+    @Property
+    fun `every word must match`(@ForAll("letters") a: String, @ForAll("letters") b: String, @ForAll("letters") text: String): Boolean =
+        (Fuzzy.score("$a $b", text) != null) == (Fuzzy.score(a, text) != null && Fuzzy.score(b, text) != null)
+
+    @Property
+    fun `case does not matter`(@ForAll("letters") query: String, @ForAll("letters") text: String): Boolean =
+        Fuzzy.score(query.uppercase(), text) == Fuzzy.score(query, text.uppercase())
+
+    @Property
+    fun `the filter keeps the matches and only them`(@ForAll("lists") items: List<String>, @ForAll("letters") query: String): Boolean =
+        Fuzzy.filter(items, query) { it } .sorted() == items.filter { Fuzzy.score(query, it) != null }.sorted()
+
+    @Example
+    fun `a blank query keeps every item in its order`() {
+        check(Fuzzy.filter(listOf("b", "a"), " ") { it } == listOf("b", "a"))
+    }
+
+    @Example
+    fun `the word in one place ranks above scattered letters`() {
+        check(Fuzzy.filter(listOf("s x b x m", "the sbm tool"), "sbm") { it } == listOf("the sbm tool", "s x b x m"))
+    }
+
+    @Example
+    fun `the start of a word ranks above the inside of a word`() {
+        check(Fuzzy.filter(listOf("absbm", "a sbm"), "sbm") { it } == listOf("a sbm", "absbm"))
+    }
+}
diff --git a/app/src/test/java/com/equwal/sbm/SyncTest.kt b/app/src/test/java/com/equwal/sbm/SyncTest.kt
new file mode 100644
index 0000000..ea1b974
--- /dev/null
+++ b/app/src/test/java/com/equwal/sbm/SyncTest.kt
@@ -0,0 +1,16 @@
+package com.equwal.sbm
+
+import net.jqwik.api.Example
+
+class SyncTest {
+    @Example
+    fun `an address without a scheme gets https`() {
+        check(Sync.address(" sbm.example.org/ ") == "https://sbm.example.org")
+    }
+
+    @Example
+    fun `an address with a scheme stays`() {
+        check(Sync.address("https://sbm.example.org") == "https://sbm.example.org")
+        check(Sync.address("http://10.0.2.2:8750/") == "http://10.0.2.2:8750")
+    }
+}
diff --git a/app/src/test/java/com/equwal/sbm/TsvTest.kt b/app/src/test/java/com/equwal/sbm/TsvTest.kt
new file mode 100644
index 0000000..19f2eab
--- /dev/null
+++ b/app/src/test/java/com/equwal/sbm/TsvTest.kt
@@ -0,0 +1,124 @@
+package com.equwal.sbm
+
+import net.jqwik.api.Arbitraries
+import net.jqwik.api.Arbitrary
+import net.jqwik.api.Combinators
+import net.jqwik.api.Example
+import net.jqwik.api.ForAll
+import net.jqwik.api.Property
+import net.jqwik.api.Provide
+
+class TsvTest {
+    @Provide
+    fun bookmarks(): Arbitrary<Bookmark> {
+        val url = Arbitraries.strings().withCharRange('!', '~').ofMinLength(1).ofMaxLength(40)
+            .filter { !it.startsWith("#") }
+        val desc = Arbitraries.strings().ofMaxLength(40)
+            .filter { d -> d.none { it == '\t' || it == '\r' || it == '\n' } }
+        val tag = Arbitraries.strings().withCharRange('a', 'z').withChars('-', '0', '9')
+            .ofMinLength(1).ofMaxLength(10)
+        return Combinators.combine(url, desc, tag.list().ofMaxSize(5)).`as` { u, d, t -> Bookmark(u, d, t) }
+    }
+
+    @Provide
+    fun files(): Arbitrary<List<Bookmark>> = bookmarks().list().ofMaxSize(20)
+
+    @Property
+    fun `a written bookmark reads back the same`(@ForAll("bookmarks") b: Bookmark): Boolean =
+        Tsv.parse(Tsv.format(b) + "\n") == listOf(b)
+
+    @Property
+    fun `a written file reads back the same`(@ForAll("files") bs: List<Bookmark>): Boolean =
+        Tsv.parse(bs.joinToString("") { Tsv.format(it) + "\n" }) == bs
+
+    @Property
+    fun `a file with CRLF line ends reads the same`(@ForAll("files") bs: List<Bookmark>): Boolean {
+        val text = bs.joinToString("") { Tsv.format(it) + "\n" }
+        return Tsv.parse(text.replace("\n", "\r\n")) == Tsv.parse(text)
+    }
+
+    // Web addresses as people bookmark them: scheme, host, path.
+    @Provide
+    fun hosts(): Arbitrary<String> {
+        val label = Arbitraries.strings().withCharRange('a', 'z').withCharRange('0', '9')
+            .ofMinLength(1).ofMaxLength(10)
+        val tld = Arbitraries.strings().withCharRange('a', 'z').ofMinLength(2).ofMaxLength(4)
+        return Combinators.combine(label.list().ofMinSize(1).ofMaxSize(3), tld)
+            .`as` { labels, t -> labels.joinToString(".") + "." + t }
+            .filter { !it.startsWith("www.") }
+    }
+
+    @Provide
+    fun paths(): Arbitrary<String> =
+        Arbitraries.strings().withCharRange('a', 'z').withCharRange('A', 'Z').ofMinLength(1).ofMaxLength(6)
+            .list().ofMaxSize(3).map { segments -> segments.joinToString("") { "/$it" } }
+
+    @Property
+    fun `the scheme does not matter`(@ForAll("hosts") h: String, @ForAll("paths") p: String): Boolean =
+        Tsv.norm("http://$h$p") == Tsv.norm("https://$h$p")
+
+    @Property
+    fun `a leading www does not matter`(@ForAll("hosts") h: String, @ForAll("paths") p: String): Boolean =
+        Tsv.norm("https://www.$h$p") == Tsv.norm("https://$h$p")
+
+    @Property
+    fun `trailing slashes do not matter`(@ForAll("hosts") h: String, @ForAll("paths") p: String): Boolean =
+        Tsv.norm("https://$h$p/") == Tsv.norm("https://$h$p") &&
+            Tsv.norm("https://$h$p//") == Tsv.norm("https://$h$p")
+
+    @Property
+    fun `the case of the host does not matter`(@ForAll("hosts") h: String, @ForAll("paths") p: String): Boolean =
+        Tsv.norm("https://${h.uppercase()}$p") == Tsv.norm("https://$h$p")
+
+    @Property
+    fun `the path counts`(@ForAll("hosts") h: String, @ForAll("paths") p: String): Boolean =
+        Tsv.norm("https://$h$p") == h + p
+
+    @Example
+    fun `comments, blank lines and old lines`() {
+        val text = "# notes\n\nhttps://a.example\tA\tcode sec\nhttps://b.example B site | tag\n"
+        check(Tsv.parse(text) == listOf(
+            Bookmark("https://a.example", "A", listOf("code", "sec")),
+            Bookmark("https://b.example", "B site | tag", emptyList())))
+    }
+
+    @Example
+    fun `a line without tags`() {
+        check(Tsv.parse("https://a.example\tA\t\n") == listOf(Bookmark("https://a.example", "A", emptyList())))
+    }
+
+    @Example
+    fun `writing cleans each field`() {
+        val b = Bookmark(" https://a.example/x \n", "one\ttwo\nthree", listOf("a b", "", "c"))
+        check(Tsv.format(b) == "https://a.example/x\tone two three\ta b c")
+    }
+
+    @Example
+    fun `the same page, as bm finds it`() {
+        val known = listOf(Bookmark("https://www.Example.com/a/", "A", emptyList()))
+        check(Tsv.find(known, "http://example.com/a") == known[0])
+        check(Tsv.find(known, "https://example.com/b") == null)
+    }
+
+    @Example
+    fun `a new line always starts on a line of its own`() {
+        check(Tsv.appendix("", "x") == "x\n")
+        check(Tsv.appendix("a\n", "x") == "x\n")
+        check(Tsv.appendix("a", "x") == "\nx\n")
+    }
+
+    @Example
+    fun `text that is no bookmark goes where bm sends it`() {
+        check(Tsv.target("suckless.org/dwm") == "https://suckless.org/dwm")
+        check(Tsv.target("gopher://x") == "gopher://x")
+        check(Tsv.target("posix sh printf") == "https://duckduckgo.com/?q=posix+sh+printf")
+    }
+
+    @Example
+    fun `host and first address`() {
+        check(Tsv.host("https://www.a.example/x?y#z") == "www.a.example")
+        check(Tsv.host("a.example") == "a.example")
+        check(Tsv.firstUrl("Look at https://a.example/x now") == "https://a.example/x")
+        check(Tsv.firstUrl("no address") == null)
+    }
+}
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000..503d3eb
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,6 @@
+// AGP compiles the Kotlin code itself. The Kotlin plugin is here only to set
+// the Kotlin version.
+plugins {
+    id("com.android.application") version "9.2.0" apply false
+    id("org.jetbrains.kotlin.jvm") version "2.3.21" apply false
+}
diff --git a/fastlane/metadata/android/en-US/changelogs/1.txt b/fastlane/metadata/android/en-US/changelogs/1.txt
new file mode 100644
index 0000000..3d61c39
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/1.txt
@@ -0,0 +1 @@
+First version: search, open, share to add, sync with sbm-sync, open a bookmark file.
diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt
new file mode 100644
index 0000000..ce71996
--- /dev/null
+++ b/fastlane/metadata/android/en-US/full_description.txt
@@ -0,0 +1,17 @@
+sbm keeps your bookmarks in one plain text file, one bookmark per line: the address, a description and tags. This app brings that file to your phone.
+
+<b>Find a bookmark fast</b>
+Type a few letters. The search is fuzzy, as in fzf: the letters of each word must come in order, but not always together. Tap a bookmark to open it; press and hold to copy the address or share it. Text that is no bookmark opens as an address, or as a web search.
+
+<b>Add from any app</b>
+Share a page from your browser to sbm, add a description and tags, and save.
+
+<b>Sync, or keep your own file</b>
+Sign in to an sbm-sync server, and the app syncs with bm on your computers and with the sbm add-on for Firefox and Chrome. Bookmarks that you add or remove on one device are added or removed on the others.
+The server is free software, so you can run your own. The default server, sbm.subread.space, is a paid service after a free trial.
+Or do not sign in: open a bookmark file that Syncthing, git or a file app keeps on your phone.
+
+<b>Small and private</b>
+No ads, no analytics, no trackers, no Google libraries. The app uses the network only for sync, and only after you sign in.
+
+sbm is free software under the AGPL-3.0.
diff --git a/fastlane/metadata/android/en-US/images/featureGraphic.png b/fastlane/metadata/android/en-US/images/featureGraphic.png
new file mode 100644
index 0000000..9335b07
Binary files /dev/null and b/fastlane/metadata/android/en-US/images/featureGraphic.png differ
diff --git a/fastlane/metadata/android/en-US/images/icon.png b/fastlane/metadata/android/en-US/images/icon.png
new file mode 100644
index 0000000..c55f5a5
Binary files /dev/null and b/fastlane/metadata/android/en-US/images/icon.png differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png
new file mode 100644
index 0000000..76eeeec
Binary files /dev/null and b/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png
new file mode 100644
index 0000000..49ec5ff
Binary files /dev/null and b/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png differ
diff --git a/fastlane/metadata/android/en-US/short_description.txt b/fastlane/metadata/android/en-US/short_description.txt
new file mode 100644
index 0000000..b8e65bc
--- /dev/null
+++ b/fastlane/metadata/android/en-US/short_description.txt
@@ -0,0 +1 @@
+Plain-text bookmarks: fuzzy search, share to add, sync with bm and browsers
diff --git a/fastlane/metadata/android/en-US/title.txt b/fastlane/metadata/android/en-US/title.txt
new file mode 100644
index 0000000..13ec9a3
--- /dev/null
+++ b/fastlane/metadata/android/en-US/title.txt
@@ -0,0 +1 @@
+sbm bookmarks
diff --git a/fdroid/com.equwal.sbm.yml b/fdroid/com.equwal.sbm.yml
new file mode 100644
index 0000000..750e303
--- /dev/null
+++ b/fdroid/com.equwal.sbm.yml
@@ -0,0 +1,26 @@
+Categories:
+  - Bookmark
+License: AGPL-3.0-only
+AuthorName: Spenser Truex
+WebSite: https://github.com/equwal/sbm
+SourceCode: https://github.com/equwal/sbm-android
+IssueTracker: https://github.com/equwal/sbm-android/issues
+Donate: https://ko-fi.com/truex
+
+AutoName: sbm bookmarks
+
+RepoType: git
+Repo: https://github.com/equwal/sbm-android.git
+
+Builds:
+  - versionName: 0.1.0
+    versionCode: 1
+    commit: v0.1.0
+    subdir: app
+    gradle:
+      - yes
+
+AutoUpdateMode: Version
+UpdateCheckMode: Tags
+CurrentVersion: 0.1.0
+CurrentVersionCode: 1
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..265ded2
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,2 @@
+org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
+kotlin.code.style=official
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..8bdaf60
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..bb25ae9
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,9 @@
+#Tue Apr 28 00:13:17 CST 2026
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionSha256Sum=2ab2958f2a1e51120c326cad6f385153bb11ee93b3c216c5fccebfdfbb7ec6cb
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..ef07e01
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,251 @@
+#!/bin/sh
+
+#
+# Copyright © 2015 the original authors.
+#
+# 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
+#
+#      https://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.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+##############################################################################
+#
+#   Gradle start up script for POSIX generated by Gradle.
+#
+#   Important for running:
+#
+#   (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+#       noncompliant, but you have some other compliant shell such as ksh or
+#       bash, then to run this script, type that shell name before the whole
+#       command line, like:
+#
+#           ksh Gradle
+#
+#       Busybox and similar reduced shells will NOT work, because this script
+#       requires all of these POSIX shell features:
+#         * functions;
+#         * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+#           «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+#         * compound commands having a testable exit status, especially «case»;
+#         * various built-in commands including «command», «set», and «ulimit».
+#
+#   Important for patching:
+#
+#   (2) This script targets any POSIX shell, so it avoids extensions provided
+#       by Bash, Ksh, etc; in particular arrays are avoided.
+#
+#       The "traditional" practice of packing multiple parameters into a
+#       space-separated string is a well documented source of bugs and security
+#       problems, so this is (mostly) avoided, by progressively accumulating
+#       options in "$@", and eventually passing that to Java.
+#
+#       Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+#       and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+#       see the in-line comments for details.
+#
+#       There are tweaks for specific operating systems such as AIX, CygWin,
+#       Darwin, MinGW, and NonStop.
+#
+#   (3) This script is generated from the Groovy template
+#       https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+#       within the Gradle project.
+#
+#       You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+    APP_HOME=${app_path%"${app_path##*/}"}  # leaves a trailing /; empty if no leading path
+    [ -h "$app_path" ]
+do
+    ls=$( ls -ld "$app_path" )
+    link=${ls#*' -> '}
+    case $link in             #(
+      /*)   app_path=$link ;; #(
+      *)    app_path=$APP_HOME$link ;;
+    esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+    echo "$*"
+} >&2
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in                #(
+  CYGWIN* )         cygwin=true  ;; #(
+  Darwin* )         darwin=true  ;; #(
+  MSYS* | MINGW* )  msys=true    ;; #(
+  NONSTOP* )        nonstop=true ;;
+esac
+
+CLASSPATH="\\\"\\\""
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD=$JAVA_HOME/jre/sh/java
+    else
+        JAVACMD=$JAVA_HOME/bin/java
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD=java
+    if ! command -v java >/dev/null 2>&1
+    then
+        die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+    case $MAX_FD in #(
+      max*)
+        # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+        # shellcheck disable=SC2039,SC3045
+        MAX_FD=$( ulimit -H -n ) ||
+            warn "Could not query maximum file descriptor limit"
+    esac
+    case $MAX_FD in  #(
+      '' | soft) :;; #(
+      *)
+        # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+        # shellcheck disable=SC2039,SC3045
+        ulimit -n "$MAX_FD" ||
+            warn "Could not set maximum file descriptor limit to $MAX_FD"
+    esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+#   * args from the command line
+#   * the main class name
+#   * -classpath
+#   * -D...appname settings
+#   * --module-path (only if needed)
+#   * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+    APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+    CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+    JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    for arg do
+        if
+            case $arg in                                #(
+              -*)   false ;;                            # don't mess with options #(
+              /?*)  t=${arg#/} t=/${t%%/*}              # looks like a POSIX filepath
+                    [ -e "$t" ] ;;                      #(
+              *)    false ;;
+            esac
+        then
+            arg=$( cygpath --path --ignore --mixed "$arg" )
+        fi
+        # Roll the args list around exactly as many times as the number of
+        # args, so each arg winds up back in the position where it started, but
+        # possibly modified.
+        #
+        # NB: a `for` loop captures its iteration list before it begins, so
+        # changing the positional parameters here affects neither the number of
+        # iterations, nor the values presented in `arg`.
+        shift                   # remove old arg
+        set -- "$@" "$arg"      # push replacement arg
+    done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+#   * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+#     and any embedded shellness will be escaped.
+#   * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+#     treated as '${Hostname}' itself on the command line.
+
+set -- \
+        "-Dorg.gradle.appname=$APP_BASE_NAME" \
+        -classpath "$CLASSPATH" \
+        -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
+        "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+    die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+#   readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+#   set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+        printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+        xargs -n1 |
+        sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+        tr '\n' ' '
+    )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..db3a6ac
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,94 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem      https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/play/listing.md b/play/listing.md
new file mode 100644
index 0000000..b601a63
--- /dev/null
+++ b/play/listing.md
@@ -0,0 +1,60 @@
+# Google Play: what to enter in Play Console
+
+The legal declarations are yours: read each answer before you submit it.
+
+## Upload
+
+- File: the Play bundle, built with `./gradlew bundleRelease -PplayStore=true`
+  (no Ko-fi link: Google Play does not allow links to payments outside
+  Google Play). Upload key: `Desktop\sbm-android-signing` (see its README).
+- Use Play App Signing (the default).
+- Personal developer accounts made after 13 November 2023 must run a closed
+  test with at least 12 testers for 14 days in a row before production.
+
+## Store listing
+
+- App name: `sbm bookmarks`
+- Short and full description: `fastlane/metadata/android/en-US/`
+- App icon (512 px), feature graphic (1024x500), phone screenshots:
+  `fastlane/metadata/android/en-US/images/`. The screenshots show demo
+  bookmarks only.
+- Category: Productivity
+- Contact email: truex@equwal.com
+- Website: https://github.com/equwal/sbm-android
+- Privacy policy: https://sbm.subread.space/privacy
+
+## App content
+
+- **Privacy policy:** https://sbm.subread.space/privacy
+- **Ads:** no ads.
+- **App access:** some functions need an account (sync). Give the review
+  account in `Desktop\sbm-android-signing\play-review-account.txt`, with
+  these steps: "Open the menu, tap Sign in to sync. The server is filled in.
+  Enter the email and the password, tap Sign in."
+- **Content rating** (IARC questionnaire), category "Utility, Productivity,
+  Communication, or Other": no violence, no sexual content, no bad
+  language, no drugs, no gambling; users do not talk to other users or
+  share content with other users; no sharing of location; no purchases of
+  digital goods. Expected result: Everyone / PEGI 3.
+- **Target audience:** 18 and over.
+- **News app:** no. **Government app:** no. **Financial features:** none.
+  **Health:** no.
+- **Data safety:**
+  - Does the app collect or share user data? Yes, it collects; it shares
+    nothing.
+  - Is all data encrypted in transit? Yes (HTTPS).
+  - Can users ask for deletion of their data? Yes:
+    https://sbm.subread.space/privacy#delete
+  - Personal info, email address: collected, optional, for account
+    management. Not shared.
+  - App activity, other user-generated content (the bookmarks): collected,
+    optional, for app functionality. Not shared.
+  - No location, no contacts, no device IDs, no crash logs, no analytics.
+  - Data is collected only when the user signs in to sync.
+- **Account deletion:** users make accounts on the website, not in the app.
+  Deletion URL: https://sbm.subread.space/privacy#delete
+
+## Pricing
+
+Free. No in-app purchases. The app does not link to the paid plan of
+sbm.subread.space.
diff --git a/play/make-graphics.ps1 b/play/make-graphics.ps1
new file mode 100644
index 0000000..0214c82
--- /dev/null
+++ b/play/make-graphics.ps1
@@ -0,0 +1,42 @@
+# Draws the store graphics: the 512 px icon and the 1024x500 feature graphic.
+# Usage: powershell -File play/make-graphics.ps1 -Out fastlane/metadata/android/en-US/images
+param([string]$Out)
+Add-Type -AssemblyName System.Drawing
+
+$blue = [System.Drawing.Color]::FromArgb(255, 0, 0x55, 0x77)
+
+# The ribbon of the launcher icon (M40,30 L68,30 L68,80 L54,69 L40,80 Z),
+# with its centre at (cx, cy) and h pixels high.
+function Ribbon($g, $cx, $cy, $h) {
+    $s = $h / 50
+    $pts = @(@(-14, -25), @(14, -25), @(14, 25), @(0, 14), @(-14, 25)) | ForEach-Object {
+        New-Object System.Drawing.PointF ([single]($cx + $_[0] * $s)), ([single]($cy + $_[1] * $s))
+    }
+    $g.FillPolygon([System.Drawing.Brushes]::White, [System.Drawing.PointF[]]$pts)
+}
+
+function Canvas($w, $h) {
+    $bmp = New-Object System.Drawing.Bitmap $w, $h
+    $g = [System.Drawing.Graphics]::FromImage($bmp)
+    $g.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
+    $g.TextRenderingHint = [System.Drawing.Text.TextRenderingHint]::AntiAliasGridFit
+    $g.Clear($blue)
+    return $bmp, $g
+}
+
+# Icon: Google Play rounds the corners itself, so the square is full.
+$bmp, $g = Canvas 512 512
+Ribbon $g 256 256 300
+$bmp.Save((Join-Path $Out "icon.png"), [System.Drawing.Imaging.ImageFormat]::Png)
+$g.Dispose(); $bmp.Dispose()
+
+# Feature graphic.
+$bmp, $g = Canvas 1024 500
+Ribbon $g 190 250 250
+$big = New-Object System.Drawing.Font "Segoe UI Semibold", 96
+$small = New-Object System.Drawing.Font "Segoe UI", 34
+$g.DrawString("sbm", $big, [System.Drawing.Brushes]::White, 330, 110)
+$g.DrawString("Your bookmarks, the same", $small, [System.Drawing.Brushes]::White, 340, 270)
+$g.DrawString("on each of your devices", $small, [System.Drawing.Brushes]::White, 340, 320)
+$bmp.Save((Join-Path $Out "featureGraphic.png"), [System.Drawing.Imaging.ImageFormat]::Png)
+$g.Dispose(); $bmp.Dispose()
diff --git a/settings.gradle.kts b/settings.gradle.kts
new file mode 100644
index 0000000..0013a82
--- /dev/null
+++ b/settings.gradle.kts
@@ -0,0 +1,18 @@
+pluginManagement {
+    repositories {
+        google()
+        mavenCentral()
+        gradlePluginPortal()
+    }
+}
+
+dependencyResolutionManagement {
+    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+    repositories {
+        google()
+        mavenCentral()
+    }
+}
+
+rootProject.name = "sbm-android"
+include(":app")