update readme

This commit is contained in:
Ariane 2020-11-19 10:36:14 +00:00
parent 6f28feb312
commit bcd1e748a9
133 changed files with 2 additions and 6083 deletions

674
LICENSE
View File

@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 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 General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is 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. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
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.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
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 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. Use with the GNU Affero General Public License.
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 Affero 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 special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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 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 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 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 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 General Public License for more details.
You should have received a copy of the GNU 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 the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
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 GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@ -1,76 +1,5 @@
# Ariane
A Gemini Protocol browser for Android based OS. Formerly called Två, and briefly Gem.
## Releases
* See the project page on Öppenlab.net for latest download: [oppenlab.net/pr/ariane](https://oppenlab.net/pr/ariane/)
* Install on [Google Play](https://play.google.com/store/apps/details?id=oppen.gemini.ariane)
## Issue tracker
[todo.sr.ht/~oppen/ariane](https://todo.sr.ht/~oppen/ariane)
## Contact and Mailing Lists
Email direct to `ariane@fastmail.se` or join a mailing list
### Mailing Lists:
* [lists.sr.ht/~oppen/ariane-announce](https://lists.sr.ht/~oppen/ariane-announce) - project announcements and new releases
* [lists.sr.ht/~oppen/ariane-discuss](https://lists.sr.ht/~oppen/ariane-discuss) - general queries, suggestions, chat
* [lists.sr.ht/~oppen/ariane-devel](https://lists.sr.ht/~oppen/ariane-devel) - for develop discussion and to submit patches
# TLS
From the [Gemini specification](https://gemini.circumlunar.space/docs/specification.html):
> Use of TLS for Gemini transactions is mandatory.
> Use of the Server Name Indication (SNI) extension to TLS is also mandatory, to facilitate name-based virtual hosting.
Ariane uses TLS but does not implement TOFU at all:
> Clients can validate TLS connections however they like (including not at all) but the strongly RECOMMENDED approach is to implement a lightweight "TOFU" certificate-pinning system which treats self-signed certificates as first- class citizens
See [Drew's note on TOFU](https://drewdevault.com/2020/09/21/Gemini-TOFU.html)
## Client TLS
> Although rarely seen on the web, TLS permits clients to identify themselves to servers using certificates
From the spec:
* Short-lived client certificates which are generated on demand and deleted immediately after use can be used as "session identifiers" to maintain server-side state for applications. In this role, client certificates act as a substitute for HTTP cookies, but unlike cookies they are generated voluntarily by the client, and once the client deletes a certificate and its matching key, the server cannot possibly "resurrect" the same value later (unlike so-called "super cookies").
* Long-lived client certificates can reliably identify a user to a multi-user application without the need for passwords which may be brute-forced. Even a stolen database table mapping certificate hashes to user identities is not a security risk, as rainbow tables for certificates are not feasible.
* Self-hosted, single-user applications can be easily and reliably secured in a manner familiar from OpenSSH: the user generates a self-signed certificate and adds its hash to a server-side list of permitted certificates, analogous to the .authorized_keys file for SSH).
Looking at [Kristall](https://kristall.random-projects.net/) a client should offer full cert management, including import and export. Ariane has NONE of this currently.
A key sentence in the spec:
> Gemini requests will typically be made without a client certificate.
Client certs should only be required for protected content:
> Gemini requests will typically be made without a client certificate. If a requested resource requires a client certificate and one is not included in a request, the server can respond with a status code of 60, 61 or 62 (see Appendix 1 below for a description of all status codes related to client certificates). A client certificate which is generated or loaded in response to such a status code has its scope bound to the same hostname as the request URL and to all paths below the path of the request URL path. E.g. if a request for gemini://example.com/foo returns status 60 and the user chooses to generate a new client certificate in response to this, that same certificate should be used for subsequent requests to gemini://example.com/foo, gemini://example.com/foo/bar/, gemini://example.com/foo/bar/baz, etc., until such time as the user decides to delete the certificate or to temporarily deactivate it. Interactive clients for human users are strongly recommended to make such actions easy and to generally give users full control over the use of client certificates.
From this it's clear general requests should NOT use a client cert (to protect user identity if nothing else), if a server requests a client cert we should offer various configurations:
* Always use identity cert
* Always use a fresh session cert
* Prompt user
That's it as far as the spec is concered, the rest is down to the Android API
## Ariane TLS
Not implemented yet.
Display a servers certs with:
`openssl s_client -showcerts -connect gus.guru:1965`
## Android API
* [SSLSocket](https://developer.android.com/reference/javax/net/ssl/SSLSocket)
* [Android keystore system](https://developer.android.com/training/articles/keystore.html)
A Gemini Protocol browser for Android based OS.
This project is now hosted at: [codeberg.org/oppenlab/Ariane](https://codeberg.org/oppenlab/Ariane)

1
app/.gitignore vendored
View File

@ -1 +0,0 @@
/build

View File

@ -1,70 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "oppen.gemini.ariane"
minSdkVersion 21
targetSdkVersion 30
versionCode 17
versionName "2.0.9"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures{
dataBinding true
}
compileOptions{
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions{
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'com.google.android.material:material:1.3.0-alpha03'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.activity:activity-ktx:1.1.0'
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
//ROOM DB
def room_version = "2.2.5"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'com.google.truth:truth:1.0'
}

View File

@ -1,36 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep class * extends com.bumptech.glide.module.AppGlideModule {
<init>(...);
}
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
-keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
*** rewind();
}
# for DexGuard only
# -keepresourcexmlelements manifest/application/meta-data@value=GlideModule

View File

@ -1,18 +0,0 @@
{
"version": 2,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "oppen.gemini.ariane",
"variantName": "processReleaseResources",
"elements": [
{
"type": "SINGLE",
"filters": [],
"versionCode": 17,
"versionName": "2.0.9",
"outputFile": "app-release.apk"
}
]
}

View File

@ -1,24 +0,0 @@
package oppen.ariane
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("oppen.tva", appContext.packageName)
}
}

View File

@ -1,88 +0,0 @@
package oppen.ariane.io.gemini
import android.net.Uri
import oppen.ariane.Ariane
import com.google.common.truth.Truth.assertThat
import org.junit.Test
class AddressTests {
@Test
fun uriApiTests(){
var uri = Uri.parse(Ariane.DEFAULT_HOME_CAPSULE)
assertThat(uri.toString()).isEqualTo("gemini://gemini.circumlunar.space/~oppen/index.gmi")
assertThat(uri.isAbsolute).isTrue()
assertThat(uri.isHierarchical).isTrue()
assertThat(uri.isRelative).isFalse()
val lastSegment = uri.lastPathSegment
assertThat(lastSegment).isEqualTo("index.gmi")
uri = Uri.parse(uri.pathSegments.joinToString("/"))
assertThat(uri.toString()).isEqualTo("~oppen/index.gmi")
assertThat(uri.isRelative).isTrue()
}
@Test
fun arianeUriTests(){
val builder = AddressBuilder()
var uri = builder.request("gemini://gemini.circumlunar.space/~oppen/index.gmi").uri()
assertThat(uri.toString()).isEqualTo("gemini://gemini.circumlunar.space/~oppen/index.gmi")
assertThat(uri.path).isEqualTo("/~oppen/index.gmi")
uri = builder.request("hello/index.gmi").uri()
assertThat(uri.toString()).isEqualTo("gemini://gemini.circumlunar.space/~oppen/hello/index.gmi")
uri = builder.request("world/index.gmi").uri()
assertThat(uri.toString()).isEqualTo("gemini://gemini.circumlunar.space/~oppen/hello/world/index.gmi")
uri = builder.request("./foo/index.gmi").uri()
assertThat(uri.toString()).isEqualTo("gemini://gemini.circumlunar.space/~oppen/hello/world/foo/index.gmi")
uri = builder.request("bar/").uri()
assertThat(uri.toString()).isEqualTo("gemini://gemini.circumlunar.space/~oppen/hello/world/foo/bar/index.gmi")
}
//https://todo.sr.ht/~oppen/ariane/28
@Test
fun userTicketUriTests(){
val builder = AddressBuilder()
builder.request("gemini://mycapsule.com")
val relativeWithGmi = builder.request("art/index.gmi").uri()
assertThat(relativeWithGmi.toString()).isEqualTo("gemini://mycapsule.com/art/index.gmi")
builder.request("gemini://mycapsule.com")
val relativeWithoutGmi = builder.request("art/").uri()
assertThat(relativeWithoutGmi.toString()).isEqualTo("gemini://mycapsule.com/art/index.gmi")
}
@Test
fun doubleSlashTest(){
val builder = AddressBuilder()
val uri = builder.request("//mycapsule.com").uri()
assertThat(uri.toString()).isEqualTo("gemini://mycapsule.com")
}
@Test
fun pathTest(){
val builder = AddressBuilder()
var uri = builder
.request("gemini://mycapsule.com")
.request("hello/")
.uri()
assertThat(uri.toString()).isEqualTo("gemini://mycapsule.com/hello/index.gmi")
uri = builder.request("/world/").uri()
assertThat(uri.toString()).isEqualTo("gemini://mycapsule.com/world/index.gmi")
}
}

View File

@ -1,44 +0,0 @@
package oppen.ariane.io.gemini
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import java.security.SecureRandom
import javax.net.ssl.SSLContext
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
@RunWith(AndroidJUnit4::class)
class DeviceTLSTests {
lateinit var socket: SSLSocket
@Before
fun setupSocket(){
val sslContext = SSLContext.getInstance("TLS")
sslContext.init(null, null, SecureRandom())
val factory: SSLSocketFactory = sslContext.socketFactory
socket = factory.createSocket() as SSLSocket
}
@Test
fun supportsTLSv1(){
socket.supportedProtocols.contains("TLSv1")
}
@Test
fun supportsTLSv1_1(){
socket.supportedProtocols.contains("TLSv1.1")
}
@Test
fun supportsTLSv1_2(){
socket.supportedProtocols.contains("TLSv1.2")
}
@Test
fun supportsTLSv1_3(){
socket.supportedProtocols.contains("TLSv1.3")
}
}

View File

@ -1,90 +0,0 @@
package oppen.ariane.io.gemini
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import oppen.ariane.Ariane
import oppen.toURI
import com.google.common.truth.Truth.assertThat
import oppen.ariane.io.GemState
import oppen.ariane.io.database.ArianeDatabase
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class GeminiDatasourceTests {
private lateinit var gemini: Datasource
private val capsules = listOf(
"gemini://gemini.circumlunar.space",
"gemini://rawtext.club",
"gemini://drewdevault.com",
"gemini://talon.computer",
"gemini://tilde.team",
"gemini://tilde.pink",
"gemini://gemini.conman.org",
"gemini://idiomdrottning.org"
)
private var capsuleIndex = 0
@Before
fun setup(){
val capsule = capsules.random()
println("Using $capsule for Gemini tests")
capsuleIndex = capsules.indexOf(capsule)
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
val db = ArianeDatabase(appContext)
gemini = Datasource.factory(InstrumentationRegistry.getInstrumentation().targetContext, db.history())
}
@Test
fun arianeHomePageTest(){
var hasRequested = false
var hasResponded = false
gemini.request(Ariane.DEFAULT_HOME_CAPSULE.toURI()){ state ->
when(state){
is GemState.Requesting -> {
assertThat(state.uri.toString()).isEqualTo(Ariane.DEFAULT_HOME_CAPSULE)
hasRequested = true
}
is GemState.ResponseGemtext -> {
assertThat(state.uri.toString()).isEqualTo(Ariane.DEFAULT_HOME_CAPSULE)
hasResponded = true
}
else -> {
//This will cause a failed test if request fails
assertThat(hasRequested).isTrue()
assertThat(hasResponded).isTrue()
}
}
}
}
@Test
fun aCapsuleTest(){
var hasRequested = false
var hasResponded = false
gemini.request(capsules[capsuleIndex].toURI()){ state ->
when(state){
is GemState.Requesting -> {
assertThat(state.uri.toString()).isEqualTo(capsules[capsuleIndex])
hasRequested = true
}
is GemState.ResponseGemtext -> {
assertThat(state.uri.toString()).isEqualTo(capsules[capsuleIndex])
hasResponded = true
}
else -> {
//This will cause a failed test if request fails
assertThat(hasRequested).isTrue()
assertThat(hasResponded).isTrue()
}
}
}
}
}

View File

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="oppen.ariane">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name="oppen.ariane.Ariane"
android:allowBackup="true"
android:icon="@drawable/vector_ariane"
android:label="@string/app_name"
android:roundIcon="@drawable/vector_ariane"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:networkSecurityConfig="@xml/network_security_config">
<activity android:name="oppen.ariane.ui.ProcessTextActivity" android:label="Open in Ariane" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" />
<data android:mimeType="text/plain"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="oppen.ariane.ui.GemActivity"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="gemini" />
</intent-filter>
</activity>
<activity
android:name="oppen.ariane.ui.settings.SettingsActivity"
android:label="@string/settings"
android:theme="@style/SettingsTheme"/>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
</application>
</manifest>

View File

@ -1,67 +0,0 @@
package oppen
import android.annotation.SuppressLint
import android.content.Context
import android.net.Uri
import android.os.CountDownTimer
import android.view.View
import android.view.inputmethod.InputMethodManager
import androidx.core.content.ContextCompat.getSystemService
import java.net.URI
fun View.visible(visible: Boolean) = when {
visible -> this.visibility = View.VISIBLE
else -> this.visibility = View.GONE
}
fun View.visibleRetainingSpace(visible: Boolean) = when {
visible -> this.visibility = View.VISIBLE
else -> this.visibility = View.INVISIBLE
}
fun View.hideKeyboard(){
val imm: InputMethodManager? = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager?
imm?.hideSoftInputFromWindow(windowToken, 0)
}
fun String.toURI(): URI {
return URI.create(this)
}
fun URI.toUri(): Uri {
return Uri.parse(this.toString())
}
fun Uri.toURI(): URI {
return URI.create(this.toString())
}
fun Uri.isGemini(): Boolean{
return this.toString().startsWith("gemini://")
}
@SuppressLint("DefaultLocale")
fun String.endsWithImage(): Boolean{
return this.toLowerCase().endsWith(".png") ||
this.toLowerCase().endsWith(".jpg") ||
this.toLowerCase().endsWith(".jpeg") ||
this.toLowerCase().endsWith(".gif")
}
@SuppressLint("DefaultLocale")
fun String.isWeb(): Boolean{
return this.toLowerCase().startsWith("https://") ||
this.toLowerCase().startsWith("http://")
}
fun delay(ms: Long, action: () -> Unit){
object : CountDownTimer(ms, ms/2) {
override fun onTick(millisUntilFinished: Long) {}
override fun onFinish() {
action.invoke()
}
}.start()
}

View File

@ -1,29 +0,0 @@
package oppen.ariane
import android.app.Application
import androidx.appcompat.app.AppCompatDelegate
import androidx.preference.PreferenceManager
class Ariane: Application() {
override fun onCreate() {
super.onCreate()
val prefs = PreferenceManager.getDefaultSharedPreferences(this)
when {
prefs.getBoolean("theme_Light", false) -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
prefs.getBoolean("theme_Dark", false) -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
prefs.getBoolean("theme_FollowSystem", true) -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
}
}
companion object{
const val DEFAULT_HOME_CAPSULE = "gemini://gemini.circumlunar.space/~oppen/index.gmi"
const val GEMINI_USER_SEARCH_BASE = "gemini://gus.guru/search?"
const val GEMINI_BACKLINK_BASE = "gemini://gus.guru/backlinks?"
const val FEATURE_CLIENT_CERTS = true
}
}

View File

@ -1,22 +0,0 @@
package oppen.ariane.io
import android.net.Uri
import oppen.ariane.io.gemini.GeminiResponse
import java.net.URI
sealed class GemState {
data class AppQuery(val uri: URI): GemState()
data class Requesting(val uri: URI): GemState()
data class NotGeminiRequest(val uri: URI) : GemState()
data class ResponseGemtext(val uri: URI, val header: GeminiResponse.Header, val lines: List<String>) : GemState()
data class ResponseInput(val uri: URI, val header: GeminiResponse.Header) : GemState()
data class ResponseText(val uri: URI, val header: GeminiResponse.Header, val content: String) : GemState()
data class ResponseImage(val uri: URI, val header: GeminiResponse.Header, val cacheUri: Uri) : GemState()
data class ResponseAudio(val uri: URI, val header: GeminiResponse.Header, val cacheUri: Uri) : GemState()
data class ResponseBinary(val uri: URI, val header: GeminiResponse.Header, val cacheUri: Uri) : GemState()
data class ResponseUnknownMime(val uri: URI, val header: GeminiResponse.Header) : GemState()
data class ResponseError(val header: GeminiResponse.Header): GemState()
object Blank: GemState()
}

View File

@ -1,14 +0,0 @@
package oppen.ariane.io.database
import androidx.room.Database
import androidx.room.RoomDatabase
import oppen.ariane.io.database.bookmarks.BookmarkEntity
import oppen.ariane.io.database.bookmarks.BookmarksDao
import oppen.ariane.io.database.history.HistoryDao
import oppen.ariane.io.database.history.HistoryEntity
@Database(entities = [BookmarkEntity::class, HistoryEntity::class], version = 3)
abstract class ArianeAbstractDatabase: RoomDatabase() {
abstract fun bookmarks(): BookmarksDao
abstract fun history(): HistoryDao
}

View File

@ -1,14 +0,0 @@
package oppen.ariane.io.database
import android.content.Context
import androidx.room.Room
import oppen.ariane.io.database.bookmarks.ArianeBookmarks
import oppen.ariane.io.database.history.ArianeHistory
class ArianeDatabase(context: Context) {
private val db: ArianeAbstractDatabase = Room.databaseBuilder(context, ArianeAbstractDatabase::class.java, "ariane_database_v1").build()
fun bookmarks(): ArianeBookmarks = ArianeBookmarks(db)
fun history(): ArianeHistory = ArianeHistory(db)
}

View File

@ -1,80 +0,0 @@
package oppen.ariane.io.database.bookmarks
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import oppen.ariane.io.database.ArianeAbstractDatabase
import java.net.URI
class ArianeBookmarks(private val db: ArianeAbstractDatabase): BookmarksDatasource {
override fun get(onBookmarks: (List<BookmarkEntry>) -> Unit) {
GlobalScope.launch(Dispatchers.IO){
val dbBookmarks = db.bookmarks().getAll()
val bookmarks = mutableListOf<BookmarkEntry>()
dbBookmarks.forEach { bookmarkEntity ->
bookmarks.add(
BookmarkEntry(
uid = bookmarkEntity.uid,
label = bookmarkEntity.label ?: "Unknown",
uri = URI.create(bookmarkEntity.uri),
index = bookmarkEntity.uiIndex ?: 0)
)
}
onBookmarks(bookmarks)
}
}
override fun add(bookmarkEntry: BookmarkEntry, onAdded: () -> Unit) {
GlobalScope.launch(Dispatchers.IO){
val bookmarkEntity = BookmarkEntity(
label = bookmarkEntry.label,
uri = bookmarkEntry.uri.toString(),
uiIndex = bookmarkEntry.index,
folder = "~/")
db.bookmarks().insertAll(bookmarkEntity)
onAdded()
}
}
override fun moveUp(bookmarkEntry: BookmarkEntry, onMoved: () -> Unit) {
GlobalScope.launch(Dispatchers.IO){
//todo - this method is broken:
val prev = db.bookmarks().getBookmark(bookmarkEntry.index -1)
val target = db.bookmarks().getBookmark(bookmarkEntry.index)
db.bookmarks().updateUIIndex(prev.uid, bookmarkEntry.index)
db.bookmarks().updateUIIndex(target.uid, bookmarkEntry.index - 1)
onMoved()
}
}
override fun moveDown(bookmarkEntry: BookmarkEntry, onMoved: () -> Unit) {
GlobalScope.launch(Dispatchers.IO){
val next = db.bookmarks().getBookmark(bookmarkEntry.index + 1)
val target = db.bookmarks().getBookmark(bookmarkEntry.index)
db.bookmarks().updateUIIndex(next.uid, bookmarkEntry.index)
db.bookmarks().updateUIIndex(target.uid, bookmarkEntry.index + 1)
onMoved()
}
}
override fun update(bookmarkEntry: BookmarkEntry, label: String?, uri: String?, onUpdate: () -> Unit) {
GlobalScope.launch(Dispatchers.IO){
db.bookmarks().updateContent(bookmarkEntry.uid, label ?: "", uri ?: "")
onUpdate()
}
}
override fun delete(bookmarkEntry: BookmarkEntry, onDelete: () -> Unit) {
GlobalScope.launch(Dispatchers.IO){
val entity = db.bookmarks().getBookmark(bookmarkEntry.index)
db.bookmarks().delete(entity)
onDelete()
}
}
}

View File

@ -1,16 +0,0 @@
package oppen.ariane.io.database.bookmarks
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "bookmarks")
class BookmarkEntity(
@ColumnInfo(name = "label") val label: String?,
@ColumnInfo(name = "uri") val uri: String?,
@ColumnInfo(name = "uiIndex") val uiIndex: Int?,
@ColumnInfo(name = "folder") val folder: String?
){
@PrimaryKey(autoGenerate = true)
var uid: Int = 0
}

View File

@ -1,12 +0,0 @@
package oppen.ariane.io.database.bookmarks
import java.net.URI
class BookmarkEntry(
val uid: Int,
val label: String,
val uri: URI,
val index: Int
){
var visible = true
}

View File

@ -1,24 +0,0 @@
package oppen.ariane.io.database.bookmarks
import androidx.room.*
@Dao
interface BookmarksDao {
@Query("SELECT * FROM bookmarks ORDER BY uiIndex ASC")
suspend fun getAll(): List<BookmarkEntity>
@Query("SELECT * from bookmarks WHERE uiIndex = :index LIMIT 1")
suspend fun getBookmark(index: Int): BookmarkEntity
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertAll(vararg bookmarks: BookmarkEntity)
@Query("UPDATE bookmarks SET uiIndex=:index WHERE uid = :id")
fun updateUIIndex(id: Int, index: Int)
@Query("UPDATE bookmarks SET label=:label, uri=:uri WHERE uid = :id")
fun updateContent(id: Int, label: String, uri: String)
@Delete
suspend fun delete(bookmark: BookmarkEntity)
}

View File

@ -1,12 +0,0 @@
package oppen.ariane.io.database.bookmarks
interface BookmarksDatasource {
fun get(onBookmarks: (List<BookmarkEntry>) -> Unit)
fun add(bookmarkEntry: BookmarkEntry, onAdded: () -> Unit)
fun delete(bookmarkEntry: BookmarkEntry, onDelete: () -> Unit)
fun moveUp(bookmarkEntry: BookmarkEntry, onMoved: () -> Unit)
fun moveDown(bookmarkEntry: BookmarkEntry, onMoved: () -> Unit)
fun update(bookmarkEntry: BookmarkEntry, label: String?, uri: String?, onUpdate: () -> Unit)
}

View File

@ -1,70 +0,0 @@
package oppen.ariane.io.database.history
import android.net.Uri
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import oppen.ariane.io.database.ArianeAbstractDatabase
class ArianeHistory(private val db: ArianeAbstractDatabase): HistoryDatasource {
override fun get(onHistory: (List<HistoryEntry>) -> Unit) {
GlobalScope.launch(Dispatchers.IO){
val dbBookmarks = db.history().getAll()
val history = mutableListOf<HistoryEntry>()
dbBookmarks.forEach { entity ->
history.add(HistoryEntry(entity.uid, entity.timestamp ?: 0L, Uri.parse(entity.uri)))
}
onHistory(history)
}
}
override fun add(entry: HistoryEntry, onAdded: () -> Unit) {
GlobalScope.launch(Dispatchers.IO){
val lastAdded = db.history().getLastAdded()
val entity = HistoryEntity(entry.uri.toString(), System.currentTimeMillis())
when (lastAdded) {
null -> db.history().insert(entity)
else -> {
when {
lastAdded.uri.toString() != entry.uri.toString() -> db.history().insert(entity)
}
}
}
onAdded()
}
}
override fun add(uri: Uri, onAdded: () -> Unit) {
GlobalScope.launch(Dispatchers.IO){
val lastAdded = db.history().getLastAdded()
val entity = HistoryEntity(uri.toString(), System.currentTimeMillis())
when (lastAdded) {
null -> db.history().insert(entity)
else -> {
when {
lastAdded.uri.toString() != uri.toString() -> db.history().insert(entity)
}
}
}
onAdded()
}
}
override fun clear(onClear: () -> Unit) {
//todo
}
override fun delete(entry: HistoryEntry, onDelete: () -> Unit) {
GlobalScope.launch(Dispatchers.IO){
val entity = db.history().getEntry(entry.uid)
db.history().delete(entity)
onDelete()
}
}
}

View File

@ -1,24 +0,0 @@
package oppen.ariane.io.database.history
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
@Dao
interface HistoryDao {
@Query("SELECT * FROM history ORDER BY timestamp DESC")
suspend fun getAll(): List<HistoryEntity>
@Query("SELECT * FROM history WHERE uid = :uid LIMIT 1")
fun getEntry(uid: Int): HistoryEntity
@Query("SELECT * FROM history ORDER BY timestamp DESC LIMIT 1")
fun getLastAdded(): HistoryEntity?
@Insert
fun insert(vararg history: HistoryEntity)
@Delete
fun delete(history: HistoryEntity)
}

View File

@ -1,12 +0,0 @@
package oppen.ariane.io.database.history
import android.net.Uri
interface HistoryDatasource {
fun get(onHistory: (List<HistoryEntry>) -> Unit)
fun add(entry: HistoryEntry, onAdded: () -> Unit)
fun add(uri: Uri, onAdded: () -> Unit)
fun clear(onClear: () -> Unit)
fun delete(entry: HistoryEntry, onDelete: () -> Unit)
}

View File

@ -1,14 +0,0 @@
package oppen.ariane.io.database.history
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "history")
class HistoryEntity(
@ColumnInfo(name = "uri") val uri: String?,
@ColumnInfo(name = "timestamp") val timestamp: Long?
){
@PrimaryKey(autoGenerate = true)
var uid: Int = 0
}

View File

@ -1,9 +0,0 @@
package oppen.ariane.io.database.history
import android.net.Uri
class HistoryEntry(
val uid: Int,
val timestamp: Long,
val uri: Uri
)

View File

@ -1,70 +0,0 @@
package oppen.ariane.io.gemini
import android.net.Uri
import java.net.URI
class AddressBuilder {
private var uri: Uri = Uri.EMPTY
fun set(uri: Uri){
this.uri = uri
}
fun request(link: URI): AddressBuilder {
return request(link.toString())
}
fun request(link: String): AddressBuilder {
val linkUri = Uri.parse(link)
when {
linkUri.isAbsolute -> {
uri = linkUri
}
linkUri.toString().startsWith("//") -> {
uri = Uri.parse("gemini:$link")
}
linkUri.toString().startsWith("/") -> {
val pathLink = "${uri.scheme}://${uri.host}$linkUri"
uri = when {
pathLink.endsWith("/") -> Uri.parse("${pathLink}index.gmi")
else -> Uri.parse(pathLink)
}
}
else -> {
val currentAddress = uri.toString()
val directoryPath = when {
currentAddress.lastIndexOf("/") > 8 -> {
currentAddress.substring(0, currentAddress.lastIndexOf("/")+1)
}
else -> {
"${uri.scheme}://${uri.host}/"
}
}
var cleanedLink = when {
link.startsWith("./") -> {
link.substring(2)
}
link.startsWith("/") -> {
link.substring(1)
}
else -> {
link
}
}
if(link.endsWith("/")) cleanedLink += "index.gmi"
uri = Uri.parse("$directoryPath$cleanedLink")
}
}
return this
}
fun uri(): Uri{
return uri
}
}

View File

@ -1,19 +0,0 @@
package oppen.ariane.io.gemini
import android.content.Context
import oppen.ariane.io.GemState
import oppen.ariane.io.database.history.ArianeHistory
import java.net.URI
interface Datasource {
fun request(uri: URI, forceDownload: Boolean, onUpdate: (state: GemState) -> Unit)
fun request(uri: URI, onUpdate: (state: GemState) -> Unit)
fun canGoBack(): Boolean
fun goBack(onUpdate: (state: GemState) -> Unit)
companion object{
fun factory(context: Context, history: ArianeHistory): Datasource {
return GeminiDatasource(context, history)
}
}
}

View File

@ -1,37 +0,0 @@
package oppen.ariane.io.gemini
import java.security.cert.X509Certificate
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
import javax.security.cert.CertificateException
import kotlin.jvm.Throws
object DummyTrustManager {
fun get(): Array<TrustManager> {
return arrayOf(
object : X509TrustManager {
override fun checkClientTrusted(
chain: Array<out X509Certificate>?,
authType: String?
) {
}
override fun checkServerTrusted(
chain: Array<out X509Certificate>?,
authType: String?
) {
println("checkServerTrusted()")
println("checkServerTrusted() authType: $authType")
chain?.forEach { cert ->
println("checkServerTrusted() cert: ${cert.subjectDN}")
}
}
override fun getAcceptedIssuers(): Array<X509Certificate> {
return arrayOf()
}
})
}
}

View File

@ -1,263 +0,0 @@
package oppen.ariane.io.gemini
import android.content.Context
import androidx.core.net.toUri
import androidx.preference.PreferenceManager
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import oppen.ariane.io.GemState
import oppen.ariane.io.database.history.ArianeHistory
import oppen.ariane.io.database.history.HistoryEntry
import oppen.ariane.io.keymanager.ArianeKeyManager
import oppen.isGemini
import oppen.toURI
import oppen.toUri
import java.io.*
import java.lang.IllegalStateException
import java.net.ConnectException
import java.net.URI
import javax.net.ssl.*
const val GEMINI_SCHEME = "gemini"
class GeminiDatasource(private val context: Context, val history: ArianeHistory): Datasource {
private val prefs = PreferenceManager.getDefaultSharedPreferences(context)
private val addressBuilder = AddressBuilder()
private val runtimeHistory = mutableListOf<URI>()
private var forceDownload = false
private val arianeKeyManager = ArianeKeyManager()
override fun request(uri: URI, onUpdate: (state: GemState) -> Unit) = request(uri, false, onUpdate)
override fun request(uri: URI, forceDownload: Boolean, onUpdate: (state: GemState) -> Unit) {
this.forceDownload = forceDownload
//Any inputted uri starting with a colon is an app-specific command, eg. :prefs :settings
if(uri.toString().startsWith(":")){
onUpdate(GemState.AppQuery(uri))
return
}
when (uri.scheme) {
GEMINI_SCHEME -> {
addressBuilder.set(uri.toUri())
val cached = RuntimeCache.get(uri)
when {
cached != null -> {
updateHistory(uri)
onUpdate(GemState.ResponseGemtext(uri, cached.first, cached.second))
return
}
else -> {
onUpdate(GemState.Requesting(uri))
GlobalScope.launch {
geminiRequest(uri, onUpdate)
}
}
}
}
else -> {
val parsedUri = addressBuilder.request(uri).uri()
if(parsedUri.isGemini()){
val cached = RuntimeCache.get(parsedUri)
when {
cached != null -> {
updateHistory(uri)
onUpdate(GemState.ResponseGemtext(parsedUri.toURI(), cached.first, cached.second))
}
else -> request(parsedUri.toURI(), forceDownload, onUpdate)
}
}else{
onUpdate(GemState.NotGeminiRequest(uri))
return
}
}
}
}
private fun geminiRequest(uri: URI, onUpdate: (state: GemState) -> Unit){
//todo - extract and reuse this ------------------------------------------------------------
val protocol = prefs.getString("tls_protocol", "TLS")
println("REQ_PROTOCOL: $protocol")
val sslContext = when (protocol) {
"TLS_ALL" -> SSLContext.getInstance("TLS")
else -> SSLContext.getInstance(protocol)
}
sslContext.init(arianeKeyManager.getFactory()?.keyManagers, DummyTrustManager.get(), null)
val factory: SSLSocketFactory = sslContext.socketFactory
//todo to here ----------------------------------------------------------------------------
val socket: SSLSocket?
try {
socket = factory.createSocket(uri.host, 1965) as SSLSocket
when (protocol) {
"TLS" -> {}//Use default enabled protocols
"TLS_ALL" -> socket.enabledProtocols = socket.supportedProtocols
else -> socket.enabledProtocols = arrayOf(protocol)
}
println("Ariane socket handshake with ${uri.host}")
socket.startHandshake()
}catch (ce: ConnectException){
println("Ariane socket error: $ce")
onUpdate(GemState.ResponseError(GeminiResponse.Header(-1, ce.message ?: ce.toString())))
return
}catch (she: SSLHandshakeException){
println("Ariane socket error: $she")
onUpdate(GemState.ResponseError(GeminiResponse.Header(-2, she.message ?: she.toString())))
return
}
// OUT >>>>>>>>>>>>>>>>>>>>>>>>>>
val outputStreamWriter = OutputStreamWriter(socket.outputStream)
val bufferedWriter = BufferedWriter(outputStreamWriter)
val outWriter = PrintWriter(bufferedWriter)
val requestEntity = uri.toString() + "\r\n"
println("Ariane socket requesting $requestEntity")
outWriter.print(requestEntity)
outWriter.flush()
if (outWriter.checkError()) {
onUpdate(GemState.ResponseError(GeminiResponse.Header(-1, "Print Writer Error")))
outWriter.close()
return
}
// IN <<<<<<<<<<<<<<<<<<<<<<<<<<<
val inputStream = socket.inputStream
val headerInputReader = InputStreamReader(inputStream)
val bufferedReader = BufferedReader(headerInputReader)
val headerLine = bufferedReader.readLine()
println("Ariane: response header: $headerLine")
if(headerLine == null){
onUpdate(GemState.ResponseError(GeminiResponse.Header(-2, "Server did not respond with a Gemini header")))
return
}
val header = GeminiResponse.parseHeader(headerLine)
when {
header.code == GeminiResponse.INPUT -> onUpdate(GemState.ResponseInput(uri, header))
header.code == GeminiResponse.REDIRECT -> request(URI.create(header.meta), forceDownload, onUpdate)
header.code != GeminiResponse.SUCCESS -> onUpdate(GemState.ResponseError(header))
header.meta.startsWith("text/gemini") -> getGemtext(bufferedReader, uri, header, onUpdate)
header.meta.startsWith("text/") -> getString(socket, uri, header, onUpdate)
header.meta.startsWith("image/") -> getBinary(socket, uri, header, onUpdate)
header.meta.startsWith("audio/") -> getBinary(socket, uri, header, onUpdate)
else -> {
//File served over Gemini but not handled in-app, eg .pdf
if(forceDownload){
getBinary(socket, uri, header, onUpdate)
}else{
onUpdate(GemState.ResponseUnknownMime(uri, header))
}
}
}
//Close input
bufferedReader.close()
headerInputReader.close()
//Close output:
outputStreamWriter.close()
bufferedWriter.close()
outWriter.close()
socket.close()
}
private fun getGemtext(reader: BufferedReader, uri: URI, header: GeminiResponse.Header, onUpdate: (state: GemState) -> Unit){
val lines = mutableListOf<String>()
lines.addAll(reader.readLines())
val processed = GemtextHelper.findCodeBlocks(lines)
when {
!uri.toString().startsWith("gemini://") -> throw IllegalStateException("Not a Gemini Uri")
}
RuntimeCache.put(uri, header, processed)
updateHistory(uri)
onUpdate(GemState.ResponseGemtext(uri, header, processed))
}
private fun updateHistory(uri: URI) {
if (runtimeHistory.isEmpty() || runtimeHistory.last().toString() != uri.toString()) {
runtimeHistory.add(uri)
println("Ariane added $uri to runtime history (size ${runtimeHistory.size})")
}
history.add(uri.toUri()){}
}
private fun getString(socket: SSLSocket?, uri: URI, header: GeminiResponse.Header, onUpdate: (state: GemState) -> Unit){
val content = socket?.inputStream?.bufferedReader().use {
reader -> reader?.readText()
}
socket?.close()
onUpdate(GemState.ResponseText(uri, header, content ?: "Error fetching content"))
}
private fun getBinary(socket: SSLSocket?, uri: URI, header: GeminiResponse.Header, onUpdate: (state: GemState) -> Unit){
var filename: String? = null
val fileSegmentIndex: Int = uri.path.lastIndexOf('/')
when {
fileSegmentIndex != -1 -> filename = uri.path.substring(fileSegmentIndex + 1)
}
val host = uri.host.replace(".", "_")
val cacheName = "${host}_$filename"
println("Caching file: $filename from uri: $uri, cacheName: $cacheName")
val cacheFile = File(context.cacheDir, cacheName)
when {
cacheFile.exists() -> {
when {
header.meta.startsWith("image/") -> onUpdate(GemState.ResponseImage(uri, header, cacheFile.toUri()))
header.meta.startsWith("audio/") -> onUpdate(GemState.ResponseAudio(uri, header, cacheFile.toUri()))
else -> onUpdate(GemState.ResponseBinary(uri, header, cacheFile.toUri()))
}
}
else -> {
cacheFile.createNewFile()
cacheFile.outputStream().use{ outputStream ->
socket?.inputStream?.copyTo(outputStream)
socket?.close()
}
when {
header.meta.startsWith("image/") -> onUpdate(GemState.ResponseImage(uri, header, cacheFile.toUri()))
header.meta.startsWith("audio/") -> onUpdate(GemState.ResponseAudio(uri, header, cacheFile.toUri()))
else -> onUpdate(GemState.ResponseBinary(uri, header, cacheFile.toUri()))
}
}
}
}
override fun canGoBack(): Boolean = runtimeHistory.isEmpty() || runtimeHistory.size > 1
override fun goBack(onUpdate: (state: GemState) -> Unit) {
runtimeHistory.removeLast()
request(runtimeHistory.last(), onUpdate)
}
}

View File

@ -1,78 +0,0 @@
package oppen.ariane.io.gemini
object GeminiResponse {
const val INPUT = 1
const val SUCCESS = 2
const val REDIRECT = 3
const val TEMPORARY_FAILURE = 4
const val PERMANENT_FAILURE = 5
const val CLIENT_CERTIFICATE_REQUIRED = 6
const val UNKNOWN = -1
fun parseHeader(header: String): Header {
val cleanHeader = header.replace("\\s+".toRegex(), " ")
val meta: String
when {
header.startsWith("2") -> {
val segments = cleanHeader.trim().split(" ")
meta = when {
segments.size > 1 -> segments[1]
else -> "text/gemini; charset=utf-8"
}
}
else -> {
meta = when {
cleanHeader.contains(" ") -> cleanHeader.substring(cleanHeader.indexOf(" ") + 1)
else -> cleanHeader
}
}
}
return when {
header.startsWith("1") -> Header(
INPUT,
meta
)
header.startsWith("2") -> Header(
SUCCESS,
meta
)
header.startsWith("3") -> Header(
REDIRECT,
meta
)
header.startsWith("4") -> Header(
TEMPORARY_FAILURE,
meta
)
header.startsWith("5") -> Header(
PERMANENT_FAILURE,
meta
)
header.startsWith("6") -> Header(
CLIENT_CERTIFICATE_REQUIRED,
meta
)
else -> Header(
UNKNOWN,
meta
)
}
}
fun getCodeString(code: Int): String{
return when(code){
1 -> "Input"
2 -> "Success"
3 -> "Redirect"
4 -> "Temporary Failure"
5 -> "Permanent Failure"
6 -> "Client Certificate Required"
else -> "Unknown: $code"
}
}
class Header(val code: Int, val meta: String)
}

View File

@ -1,38 +0,0 @@
package oppen.ariane.io.gemini
import java.lang.StringBuilder
object GemtextHelper {
/**
*
* This is safe for most cases but fails when a line starts with ``` _within_ a code block
*
*/
fun findCodeBlocks(source: List<String>): List<String>{
val sb = StringBuilder()
var inCodeBlock = false
val parsed = mutableListOf<String>()
source.forEach { line ->
if (line.startsWith("```")) {
if (!inCodeBlock) {
//New code block starting
sb.clear()
sb.append("```")
} else {
//End of code block
parsed.add(sb.toString())
}
inCodeBlock = !inCodeBlock
} else {
if (inCodeBlock) {
sb.append("$line\n")
} else {
parsed.add(line)
}
}
}
return parsed
}
}

View File

@ -1,26 +0,0 @@
package oppen.ariane.io.gemini
import android.net.Uri
import androidx.collection.LruCache
import java.net.URI
object RuntimeCache {
private const val CACHE_SIZE = 4 * 1024 * 1024
private val lruCache = LruCache<String, Pair<GeminiResponse.Header, List<String>>>(
CACHE_SIZE
)
fun put(uri: URI, header: GeminiResponse.Header, lines: List<String>){
lruCache.put(uri.toString(), Pair(header, lines))
}
fun get(uri: URI): Pair<GeminiResponse.Header, List<String>>? = lruCache[uri.toString()]
fun get(uri: Uri): Pair<GeminiResponse.Header, List<String>>? = lruCache[uri.toString()]
fun clear() = lruCache.evictAll()
fun remove(address: String) {
lruCache.remove(address)
}
}

View File

@ -1,44 +0,0 @@
package oppen.ariane.io.history.uris
import android.content.Context
/**
*
* Another shared prefs implementation so I don't get slowed down by a Room implementation at this point
*
*/
class BasicURIHistory(context: Context): HistoryInterface {
private val DELIM = "||"
private val prefsKey = "oppen.tva.io.history.BasicURIHistory.prefsKey"
private val prefsHistoryKey = "oppen.tva.io.history.BasicURIHistory.prefsHistoryKey"
private val prefs = context.getSharedPreferences(prefsKey, Context.MODE_PRIVATE)
override fun add(address: String) {
val history = get()
when {
history.size >= 50 -> history.removeAt(0)
}
if(history.isNotEmpty() && history.size > 10){
if(history.subList(history.size - 10, history.size).contains(address)) return
}
history.add(address)
val raw = history.joinToString(DELIM)
prefs.edit().putString(prefsHistoryKey, raw).apply()
}
override fun clear(){
prefs.edit().clear().apply()
}
override fun get(): ArrayList<String> {
return when (val raw = prefs.getString(prefsHistoryKey, null)) {
null -> arrayListOf()
else -> ArrayList(raw.split(DELIM))
}
}
}

View File

@ -1,15 +0,0 @@
package oppen.ariane.io.history.uris
import android.content.Context
interface HistoryInterface {
fun add(address: String)
fun get(): List<String>
fun clear()
companion object{
fun default(context: Context): HistoryInterface {
return BasicURIHistory(context)
}
}
}

View File

@ -1,43 +0,0 @@
package oppen.ariane.io.keymanager
import android.content.Context
import oppen.ariane.R
import java.io.ByteArrayInputStream
import java.io.InputStream
import java.security.KeyStore
import javax.net.ssl.KeyManagerFactory
class ArianeKeyManager {
//todo - add other methods to update state
//If the user has a key loaded load it here - or else return null
fun getFactory(): KeyManagerFactory? {
val hasLoadedKey = false
return when {
hasLoadedKey -> {
val keyStore: KeyStore = KeyStore.getInstance("BKS")//or "pkcs12"v?
val inputStream: InputStream = ByteArrayInputStream("dummy".toByteArray())
keyStore.load(inputStream, "yourKeyStorePassword".toCharArray())
inputStream.close()
val keyManagerFactory: KeyManagerFactory = KeyManagerFactory.getInstance("X509")
keyManagerFactory.init(keyStore, "yourKeyStorePassword".toCharArray())
keyManagerFactory
}
else -> null
}
}
fun getFactoryDemo(context: Context): KeyManagerFactory? {
val keyStore: KeyStore = KeyStore.getInstance("pkcs12")//or "pkcs12"v?
keyStore.load(context.resources.openRawResource(R.raw.cert), "PASSWORD".toCharArray())
val keyManagerFactory: KeyManagerFactory = KeyManagerFactory.getInstance("X509")
keyManagerFactory.init(keyStore, "PASSWORD".toCharArray())
return keyManagerFactory
}
}

View File

@ -1,413 +0,0 @@
package oppen.ariane.ui
import android.app.DownloadManager
import android.content.ActivityNotFoundException
import android.content.Intent
import android.media.MediaPlayer
import android.net.Uri
import android.os.Bundle
import android.view.inputmethod.EditorInfo
import androidx.activity.viewModels
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.preference.PreferenceManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.snackbar.Snackbar
import oppen.ariane.Ariane
import oppen.ariane.R
import oppen.ariane.databinding.ActivityGemBinding
import oppen.ariane.io.GemState
import oppen.ariane.io.database.ArianeDatabase
import oppen.ariane.io.database.bookmarks.BookmarksDatasource
import oppen.ariane.io.gemini.Datasource
import oppen.ariane.io.gemini.GeminiResponse
import oppen.ariane.io.gemini.RuntimeCache
import oppen.ariane.ui.audio_player.AudioPlayer
import oppen.ariane.ui.bookmarks.BookmarkDialog
import oppen.ariane.ui.bookmarks.BookmarksDialog
import oppen.ariane.ui.content_image.ImageDialog
import oppen.ariane.ui.content_text.TextDialog
import oppen.ariane.ui.modals_menus.LinkPopup
import oppen.ariane.ui.modals_menus.about.AboutDialog
import oppen.ariane.ui.modals_menus.history.HistoryDialog
import oppen.ariane.ui.modals_menus.input.InputDialog
import oppen.ariane.ui.modals_menus.overflow.OverflowPopup
import oppen.ariane.ui.settings.SettingsActivity
import oppen.hideKeyboard
import oppen.visibleRetainingSpace
import java.io.File
import java.io.FileInputStream
import java.io.FileOutputStream
import java.net.URLEncoder
const val CREATE_IMAGE_FILE_REQ = 628
const val CREATE_AUDIO_FILE_REQ = 629
const val CREATE_BINARY_FILE_REQ = 630
class GemActivity : AppCompatActivity() {
private var inSearch = false
private val mediaPlayer = MediaPlayer()
private lateinit var bookmarkDatasource: BookmarksDatasource
private val model by viewModels<GemViewModel>()
private lateinit var binding: ActivityGemBinding
private val adapter = GemtextAdapter { adapter, uri, longTap, position: Int, view ->
if(longTap){
LinkPopup.show(view, uri){ menuId ->
when (menuId) {
R.id.link_menu_load_image -> {
loadingView(true)
model.requestInlineImage(uri){ imageUri ->
imageUri?.let{
runOnUiThread {
loadingView(false)
adapter.loadImage(position, imageUri)
}
}
}
}
R.id.link_menu_copy -> {
Intent().apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_TEXT, uri.toString())
type = "text/plain"
startActivity(Intent.createChooser(this, null))
}
}
}
}
}else{
//Reset input text hint after user has been searching
if(inSearch) {
binding.addressEdit.hint = getString(R.string.main_input_hint)
inSearch = false
}
model.request(uri)
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val db = ArianeDatabase(applicationContext)
bookmarkDatasource = db.bookmarks()
binding = DataBindingUtil.setContentView(this, R.layout.activity_gem)
binding.viewmodel = model
binding.lifecycleOwner = this
binding.gemtextRecycler.layoutManager = LinearLayoutManager(this)
binding.gemtextRecycler.adapter = adapter
model.initialise(
home = PreferenceManager.getDefaultSharedPreferences(this).getString("home_capsule", Ariane.DEFAULT_HOME_CAPSULE) ?: Ariane.DEFAULT_HOME_CAPSULE,
gemini = Datasource.factory(this, db.history()),
db = db,
onState = this::handleState)
binding.addressEdit.setOnEditorActionListener { _, actionId, _ ->
when (actionId) {
EditorInfo.IME_ACTION_GO -> {
val input = binding.addressEdit.text.toString()
when {
input.startsWith("gemini://") -> model.request(input)
else -> model.request("${Ariane.GEMINI_USER_SEARCH_BASE}${URLEncoder.encode(input, "UTF-8")}")
}
binding.addressEdit.hideKeyboard()
return@setOnEditorActionListener true
}
else -> return@setOnEditorActionListener false
}
}
binding.more.setOnClickListener {
OverflowPopup.show(binding.more){ menuId ->
when (menuId) {
R.id.overflow_menu_search -> {
binding.addressEdit.hint = getString(R.string.main_input_search_hint)
binding.addressEdit.text?.clear()
binding.addressEdit.requestFocus()
inSearch = true
}
R.id.overflow_menu_bookmark -> {
println("Bookmark: ---------------------------")
val name = adapter.inferTitle()
BookmarkDialog(
this,
BookmarkDialog.mode_new,
bookmarkDatasource,
binding.addressEdit.text.toString(),
name ?: ""
) { _, _ ->
bookmarkDatasource.get { bookmarks ->
bookmarks.forEach { bookmark ->
println("Bookmark: ${bookmark.label}: ${bookmark.uri}")
}
}
}.show()
}
R.id.overflow_menu_bookmarks -> {
println("Bookmarks: --------------------------")
BookmarksDialog(this, bookmarkDatasource) { bookmark ->
model.request(bookmark.uri)
}.show()
}
R.id.overflow_menu_share -> {
Intent().apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_TEXT, binding.addressEdit.text.toString())
type = "text/plain"
startActivity(Intent.createChooser(this, null))
}
}
R.id.overflow_menu_history -> HistoryDialog.show(this, db.history()) { historyAddress ->
model.request(historyAddress)
}
R.id.overflow_menu_about -> AboutDialog.show(this)
R.id.overflow_menu_settings -> {
startActivity(Intent(this, SettingsActivity::class.java))
}
}
}
}
binding.home.setOnClickListener {
val home = PreferenceManager.getDefaultSharedPreferences(this).getString("home_capsule", Ariane.DEFAULT_HOME_CAPSULE)
model.request(home!!)
}
binding.pullToRefresh.setOnRefreshListener {
val address = binding.addressEdit.text.toString()
RuntimeCache.remove(address)
model.request(address)
}
checkIntentExtras(intent)
}
private fun handleState(state: GemState) {
binding.pullToRefresh.isRefreshing = false
when (state) {
is GemState.AppQuery -> runOnUiThread { showAlert("App backdoor/query not implemented yet") }
is GemState.ResponseInput -> runOnUiThread {
loadingView(false)
InputDialog.show(this, state) { queryAddress ->
model.request(queryAddress)
}
}
is GemState.Requesting -> loadingView(true)
is GemState.NotGeminiRequest -> externalProtocol(state)
is GemState.ResponseError -> showAlert("${GeminiResponse.getCodeString(state.header.code)}: ${state.header.meta}")
is GemState.ResponseGemtext -> renderGemtext(state)
is GemState.ResponseText -> renderText(state)
is GemState.ResponseImage -> renderImage(state)
is GemState.ResponseAudio -> renderAudio(state)
is GemState.ResponseBinary -> renderBinary(state)
is GemState.Blank -> {
binding.addressEdit.setText("")
adapter.render(arrayListOf())
}
is GemState.ResponseUnknownMime -> {
runOnUiThread {
loadingView(false)
AlertDialog.Builder(this, R.style.AppDialogTheme)
.setTitle(R.string.unknown_mime_dialog_title)
.setMessage("Address: ${state.uri}\nMeta: ${state.header.meta}")
.setPositiveButton("Download") { _, _ ->
loadingView(true)
model.requestBinaryDownload(state.uri)
}
.setNegativeButton("Cancel") { _, _ -> }
.show()
}
}
}
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
intent?.let{
checkIntentExtras(intent)
}
}
/**
*
* Checks intent to see if Activity was opened to handle selected text
*
*/
private fun checkIntentExtras(intent: Intent) {
//Via ProcessTextActivity from selected text in another app
if(intent.hasExtra("process_text")){
val processText = intent.getStringExtra("process_text")
binding.addressEdit.setText(processText)
model.request(processText ?: "")
return
}
//From clicking a gemini:// address
val uri = intent.data
if(uri != null){
binding.addressEdit.setText(uri.toString())
model.request(uri.toString())
return
}
}
private fun showAlert(message: String) = runOnUiThread{
loadingView(false)
if(message.length > 40){
AlertDialog.Builder(this)
.setMessage(message)
.show()
}else {
Snackbar.make(binding.root, message, Snackbar.LENGTH_SHORT).show()
}
}
private fun externalProtocol(state: GemState.NotGeminiRequest) = runOnUiThread {
loadingView(false)
val browserIntent = Intent(Intent.ACTION_VIEW)
browserIntent.data = Uri.parse(state.uri.toString())
try {
startActivity(browserIntent)
}catch (e: ActivityNotFoundException){
showAlert("No app installed that can open ${state.uri}")
}
}
private fun renderGemtext(state: GemState.ResponseGemtext) = runOnUiThread {
loadingView(false)
//todo - colours didn't change when switching themes, so disabled for now
//val addressSpan = SpannableString(state.uri.toString())
//addressSpan.set(0, 9, ForegroundColorSpan(resources.getColor(R.color.protocol_address)))
binding.addressEdit.setText(state.uri.toString())
adapter.render(state.lines)
//Scroll to top
binding.gemtextRecycler.post {
binding.gemtextRecycler.scrollToPosition(0)
}
}
private fun renderText(state: GemState.ResponseText) = runOnUiThread {
loadingView(false)
TextDialog.show(this, state)
}
var imageState: GemState.ResponseImage? = null
var audioState: GemState.ResponseAudio? = null
var binaryState: GemState.ResponseBinary? = null
private fun renderAudio(state: GemState.ResponseAudio) = runOnUiThread {
loadingView(false)
AudioPlayer.play(this, binding, mediaPlayer, state){ state ->
audioState = state
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT)
intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.type = "audio/mpeg"
intent.putExtra(Intent.EXTRA_TITLE, File(state.uri.path).name)
startActivityForResult(intent, CREATE_AUDIO_FILE_REQ)
}
}
private fun renderImage(state: GemState.ResponseImage) = runOnUiThread{
loadingView(false)
ImageDialog.show(this, state){ state ->
imageState = state
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT)
intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.type = "image/*"
intent.putExtra(Intent.EXTRA_TITLE, File(state.uri.path).name)
startActivityForResult(intent, CREATE_IMAGE_FILE_REQ)
}
}
private fun renderBinary(state: GemState.ResponseBinary) = runOnUiThread{
loadingView(false)
binaryState = state
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT)
intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.type = state.header.meta
intent.putExtra(Intent.EXTRA_TITLE, File(state.uri.path).name)
startActivityForResult(intent, CREATE_BINARY_FILE_REQ)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if(resultCode == RESULT_OK && (requestCode == CREATE_IMAGE_FILE_REQ || requestCode == CREATE_AUDIO_FILE_REQ || requestCode == CREATE_BINARY_FILE_REQ)){
//todo - tidy this mess up... refactor - none of this should be here
if(imageState == null && audioState == null && binaryState == null) return
data?.data?.let{ uri ->
val cachedFile = when {
imageState != null -> File(imageState!!.cacheUri.path ?: "")
audioState != null -> File(audioState!!.cacheUri.path ?: "")
binaryState != null -> File(binaryState!!.cacheUri.path ?: "")
else -> {
println("File download error - no state object exists")
showAlert("File download error - no state object exists")
null
}
}
cachedFile?.let{
contentResolver.openFileDescriptor(uri, "w")?.use { fileDescriptor ->
FileOutputStream(fileDescriptor.fileDescriptor).use { destOutput ->
val sourceChannel = FileInputStream(cachedFile).channel
val destChannel = destOutput.channel
sourceChannel.transferTo(0, sourceChannel.size(), destChannel)
sourceChannel.close()
destChannel.close()
cachedFile.deleteOnExit()
if(binaryState != null){
startActivity(Intent(DownloadManager.ACTION_VIEW_DOWNLOADS))
}else{
Snackbar.make(binding.root, "File saved to device", Snackbar.LENGTH_SHORT).show()
}
}
}
}
}
imageState = null
audioState = null
binaryState = null
}
}
private fun loadingView(visible: Boolean) = runOnUiThread {
binding.progressBar.visibleRetainingSpace(visible)
if(visible) binding.appBar.setExpanded(true)
}
override fun onBackPressed() {
if(model.canGoBack()){
model.goBack{ state ->
/*
Passing the callback here so we can eventually add a mechanism to restore scroll position
*/
handleState(state)
}
}else{
println("Ariane history is empty - exiting")
super.onBackPressed()
cacheDir.deleteRecursively()
}
}
}

View File

@ -1,53 +0,0 @@
package oppen.ariane.ui
import android.net.Uri
import androidx.lifecycle.ViewModel
import oppen.ariane.io.gemini.Datasource
import oppen.ariane.io.GemState
import oppen.ariane.io.database.ArianeDatabase
import oppen.ariane.io.database.bookmarks.BookmarksDatasource
import java.net.URI
class GemViewModel: ViewModel() {
private lateinit var gemini: Datasource
private lateinit var db: ArianeDatabase
private var onState: (state: GemState) -> Unit = {}
fun initialise(home: String, gemini: Datasource, db: ArianeDatabase, onState: (state: GemState) -> Unit){
this.gemini = gemini
this.db = db
this.onState = onState
request(home)
}
fun request(address: String) {
request(URI.create(address))
}
fun request(uri: URI){
gemini.request(uri){ state ->
onState(state)
}
}
fun requestBinaryDownload(uri: URI) {
gemini.request(uri, true){ state ->
onState(state)
}
}
//todo - same action as above... refactor
fun requestInlineImage(uri: URI, onImageReady: (cacheUri: Uri?) -> Unit){
gemini.request(uri){ state ->
when (state) {
is GemState.ResponseImage -> onImageReady(state.cacheUri)
else -> onState(state)
}
}
}
fun canGoBack(): Boolean = gemini.canGoBack()
fun goBack(onGoBack: (state: GemState) -> Unit) = gemini.goBack(onGoBack)
}

View File

@ -1,188 +0,0 @@
package oppen.ariane.ui
import android.annotation.SuppressLint
import android.net.Uri
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.gemtext_code_block.view.*
import kotlinx.android.synthetic.main.gemtext_image_link.view.*
import kotlinx.android.synthetic.main.gemtext_link.view.gemtext_text_link
import kotlinx.android.synthetic.main.gemtext_text.view.gemtext_text_textview
import oppen.ariane.R
import oppen.endsWithImage
import oppen.visible
import java.net.URI
class GemtextAdapter(val onLink: (adapter: GemtextAdapter, link: URI, longTap: Boolean, adapterPosition: Int, view: View?) -> Unit): RecyclerView.Adapter<GemtextAdapter.ViewHolder>() {
var lines = mutableListOf<String>()
var inlineImages = HashMap<Int, Uri>()
private val typeText = 0
private val typeH1 = 1
private val typeH2 = 2
private val typeH3 = 3
private val typeListItem = 4
private val typeImageLink = 5
private val typeLink = 6
private val typeCodeBlock = 7
private val typeQuote = 8
sealed class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
class Text(itemView: View): ViewHolder(itemView)
class H1(itemView: View): ViewHolder(itemView)
class H2(itemView: View): ViewHolder(itemView)
class H3(itemView: View): ViewHolder(itemView)
class ListItem(itemView: View): ViewHolder(itemView)
class ImageLink(itemView: View): ViewHolder(itemView)
class Link(itemView: View): ViewHolder(itemView)
class Code(itemView: View): ViewHolder(itemView)
class Quote(itemView: View): ViewHolder(itemView)
}
fun render(lines: List<String>){
this.inlineImages.clear()
this.lines.clear()
this.lines.addAll(lines)
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return when(viewType){
typeText -> ViewHolder.Text(LayoutInflater.from(parent.context).inflate(R.layout.gemtext_text, parent, false))
typeH1 -> ViewHolder.H1(LayoutInflater.from(parent.context).inflate(R.layout.gemtext_h1, parent, false))
typeH2 -> ViewHolder.H2(LayoutInflater.from(parent.context).inflate(R.layout.gemtext_h2, parent, false))
typeH3 -> ViewHolder.H3(LayoutInflater.from(parent.context).inflate(R.layout.gemtext_h3, parent, false))
typeListItem -> ViewHolder.ListItem(LayoutInflater.from(parent.context).inflate(R.layout.gemtext_text, parent, false))
typeImageLink -> ViewHolder.ImageLink(LayoutInflater.from(parent.context).inflate(R.layout.gemtext_image_link, parent, false))
typeLink -> ViewHolder.Link(LayoutInflater.from(parent.context).inflate(R.layout.gemtext_link, parent, false))
typeCodeBlock-> ViewHolder.Code(LayoutInflater.from(parent.context).inflate(R.layout.gemtext_code_block, parent, false))
typeQuote -> ViewHolder.Quote(LayoutInflater.from(parent.context).inflate(R.layout.gemtext_quote, parent, false))
else -> ViewHolder.Text(LayoutInflater.from(parent.context).inflate(R.layout.gemtext_text, parent, false))
}
}
override fun getItemViewType(position: Int): Int {
val line = lines[position]
return when {
line.startsWith("```") -> typeCodeBlock
line.startsWith("###") -> typeH3
line.startsWith("##") -> typeH2
line.startsWith("#") -> typeH1
line.startsWith("*") -> typeListItem
line.startsWith("=>") && getLink(line).endsWithImage() -> typeImageLink
line.startsWith("=>") -> typeLink
line.startsWith(">") -> typeQuote
else -> typeText
}
}
override fun getItemCount(): Int = lines.size
@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val line = lines[position]
when(holder){
is ViewHolder.Text -> holder.itemView.gemtext_text_textview.text = line
is ViewHolder.Code-> holder.itemView.gemtext_text_monospace_textview.text = line.substring(3)
is ViewHolder.Quote-> holder.itemView.gemtext_text_monospace_textview.text = line.substring(1).trim()
is ViewHolder.H1 -> {
when {
line.length > 2 -> holder.itemView.gemtext_text_textview.text = line.substring(2).trim()
else -> holder.itemView.gemtext_text_textview.text = ""
}
}
is ViewHolder.H2 -> {
when {
line.length > 3 -> holder.itemView.gemtext_text_textview.text = line.substring(3).trim()
else -> holder.itemView.gemtext_text_textview.text = ""
}
}
is ViewHolder.H3 -> {
when {
line.length > 4 -> holder.itemView.gemtext_text_textview.text = line.substring(4).trim()
else -> holder.itemView.gemtext_text_textview.text = ""
}
}
is ViewHolder.ListItem -> holder.itemView.gemtext_text_textview.text = "${line.substring(1)}".trim()
is ViewHolder.Link -> {
val linkParts = line.substring(2).trim().split("\\s+".toRegex(), 2)
var linkName = linkParts[0]
if(linkParts.size > 1) {
linkName = linkParts[1]
}
val displayText = linkName
holder.itemView.gemtext_text_link.text = displayText
holder.itemView.gemtext_text_link.paint.isUnderlineText = true
holder.itemView.gemtext_text_link.setOnClickListener {
val uri = getUri(lines[holder.adapterPosition])
println("User clicked link: $uri")
onLink(this, uri, false, holder.adapterPosition, null)
}
holder.itemView.gemtext_text_link.setOnLongClickListener {view ->
val uri = getUri(lines[holder.adapterPosition])
println("User long-clicked link: $uri")
onLink(this, uri, true, holder.adapterPosition, view)
true
}
}
is ViewHolder.ImageLink -> {
//todo - extract, largely duplicate of above
val linkParts = line.substring(2).trim().split("\\s+".toRegex(), 2)
var linkName = linkParts[0]
if(linkParts.size > 1) {
linkName = linkParts[1]
}
val displayText = linkName
holder.itemView.gemtext_text_link.text = displayText
holder.itemView.gemtext_text_link.paint.isUnderlineText = true
holder.itemView.gemtext_text_link.setOnClickListener {
val uri = getUri(lines[holder.adapterPosition])
println("User clicked link: $uri")
onLink(this, uri, false, holder.adapterPosition, null)
}
holder.itemView.gemtext_text_link.setOnLongClickListener {view ->
val uri = getUri(lines[holder.adapterPosition])
println("User long-clicked link: $uri")
onLink(this, uri, true, holder.adapterPosition, view)
true
}
if(inlineImages.containsKey(position)){
holder.itemView.gemtext_inline_image.visible(true)
holder.itemView.gemtext_inline_image.setImageURI(inlineImages[position])
}else{
holder.itemView.gemtext_inline_image.visible(false)
}
}
}
}
private fun getLink(line: String): String{
val linkParts = line.substring(2).trim().split("\\s+".toRegex(), 2)
return linkParts[0]
}
private fun getUri(linkLine: String): URI{
val linkParts = linkLine.substring(2).trim().split("\\s+".toRegex(), 2)
return URI.create(linkParts.first())
}
fun inferTitle(): String? {
lines.forEach { line ->
if(line.startsWith("#")) return line.replace("#", "").trim()
}
return null
}
fun loadImage(position: Int, cacheUri: Uri){
inlineImages[position] = cacheUri
notifyItemChanged(position)
}
}

View File

@ -1,24 +0,0 @@
package oppen.ariane.ui
import android.content.Intent
import android.os.Build
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
class ProcessTextActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val processText = when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && intent.hasExtra(Intent.EXTRA_PROCESS_TEXT) -> intent.getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT).toString()
else -> null
}
Intent(this, GemActivity::class.java).run {
putExtra("process_text", processText)
startActivity(this)
finish()
}
}
}

View File

@ -1,95 +0,0 @@
package oppen.ariane.ui.audio_player
import android.content.Context
import android.media.MediaMetadataRetriever
import android.media.MediaPlayer
import android.view.MenuInflater
import androidx.appcompat.widget.PopupMenu
import androidx.core.view.MenuCompat
import oppen.ariane.R
import oppen.ariane.databinding.ActivityGemBinding
import oppen.ariane.io.GemState
import oppen.visible
object AudioPlayer {
fun play(context: Context,
binding: ActivityGemBinding,
mediaPlayer: MediaPlayer,
state: GemState.ResponseAudio,
onSaveAudio: (state: GemState.ResponseAudio) -> Unit){
val metadataRetriever = MediaMetadataRetriever()
metadataRetriever.setDataSource(context, state.cacheUri)
val artist = metadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST)
val trackName = metadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE)
binding.audioTitle.text = "$trackName - $artist"
mediaPlayer.reset()
mediaPlayer.setDataSource(context, state.cacheUri)
mediaPlayer.prepare()
binding.audioPlayButton.setImageResource(R.drawable.vector_pause)
mediaPlayer.setOnCompletionListener { _ ->
binding.audioPlayButton.setImageResource(R.drawable.vector_play)
}
binding.audioPlayButton.setOnClickListener {
if(mediaPlayer.isPlaying){
binding.audioPlayButton.setImageResource(R.drawable.vector_play)
mediaPlayer.pause()
}else{
binding.audioPlayButton.setImageResource(R.drawable.vector_pause)
mediaPlayer.start()
}
}
mediaPlayer.setOnInfoListener { _, what, _ ->
when(what){
MediaPlayer.MEDIA_INFO_UNKNOWN -> println("MEDIA_INFO_UNKNOWN")
MediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING-> println("MEDIA_INFO_VIDEO_TRACK_LAGGING")
MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START-> println("MEDIA_INFO_VIDEO_RENDERING_START")
MediaPlayer.MEDIA_INFO_BUFFERING_START-> println("MEDIA_INFO_BUFFERING_START")
MediaPlayer.MEDIA_INFO_BUFFERING_END-> println("MEDIA_INFO_BUFFERING_END")
MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING-> println("MEDIA_INFO_BAD_INTERLEAVING")
MediaPlayer.MEDIA_INFO_NOT_SEEKABLE-> println("MEDIA_INFO_NOT_SEEKABLE")
MediaPlayer.MEDIA_INFO_METADATA_UPDATE-> println("MEDIA_INFO_METADATA_UPDATE")
MediaPlayer.MEDIA_INFO_UNSUPPORTED_SUBTITLE-> println("MEDIA_INFO_UNSUPPORTED_SUBTITLE")
MediaPlayer.MEDIA_INFO_SUBTITLE_TIMED_OUT-> println("MEDIA_INFO_SUBTITLE_TIMED_OUT")
}
true
}
mediaPlayer.setOnErrorListener{ _, i: Int, i1: Int ->
println("Error Listener.... $i, $i1")
true
}
binding.audioPlayer.visible(true)
mediaPlayer.start()
binding.audioOverflow.setOnClickListener {
val popup = PopupMenu(context, binding.audioOverflow)
val inflater: MenuInflater = popup.menuInflater
inflater.inflate(R.menu.audio_overflow, popup.menu)
popup.setOnMenuItemClickListener { menuItem ->
when(menuItem.itemId){
R.id.audio_overflow_save_file -> {
onSaveAudio(state)
}
R.id.audio_overflow_dismiss -> {
mediaPlayer.stop()
mediaPlayer.release()
binding.audioPlayer.visible(false)
}
}
true
}
MenuCompat.setGroupDividerEnabled(popup.menu, true)
popup.show()
}
}
}

View File

@ -1,83 +0,0 @@
package oppen.ariane.ui.bookmarks
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.view.View
import androidx.appcompat.app.AppCompatDialog
import kotlinx.android.synthetic.main.fragment_bookmark_dialog.view.*
import oppen.ariane.R
import oppen.ariane.io.database.bookmarks.BookmarkEntry
import oppen.ariane.io.database.bookmarks.BookmarksDatasource
import java.net.URI
class BookmarkDialog(
context: Context,
private val mode: Int,
private val bookmarkDatasource: BookmarksDatasource?,
val uri: String,
val name: String,
onDismiss: (label: String?, uri: String?) -> Unit) : AppCompatDialog(context, R.style.FSDialog) {
companion object{
const val mode_new = 0
const val mode_edit = 1
}
init {
val view = View.inflate(context, R.layout.fragment_bookmark_dialog, null)
setContentView(view)
view.bookmark_toolbar.setNavigationIcon(R.drawable.vector_close)
view.bookmark_toolbar.setNavigationOnClickListener {
onDismiss(null, null)
dismiss()
}
view.bookmark_name.setText(name)
view.bookmark_uri.setText(uri)
view.bookmark_toolbar.inflateMenu(R.menu.add_bookmark)
view.bookmark_toolbar.setOnMenuItemClickListener {menuItem ->
if(menuItem.itemId == R.id.menu_action_save_bookmark){
if(mode == mode_new) {
//Determine index:
//todo - this is expensive, just get last item, limit1?
bookmarkDatasource?.get { allBookmarks ->
val index = when {
allBookmarks.isEmpty() -> 0
else -> allBookmarks.last().index + 1
}
bookmarkDatasource.add(
BookmarkEntry(
uid = -1,
label = view.bookmark_name.text.toString(),
uri = URI.create(view.bookmark_uri.text.toString()),
index = index
)
) {
Handler(Looper.getMainLooper()).post {
onDismiss(null, null)
dismiss()
}
}
}
}else if(mode == mode_edit){
onDismiss(
view.bookmark_name.text.toString(),
view.bookmark_uri.text.toString())
dismiss()
}
}
true
}
}
}

View File

@ -1,69 +0,0 @@
package oppen.ariane.ui.bookmarks
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.bookmark.view.*
import oppen.ariane.R
import oppen.ariane.io.database.bookmarks.BookmarkEntry
import oppen.visible
class BookmarksAdapter(val onBookmark: (bookmarkEntry: BookmarkEntry) -> Unit, val onOverflow: (view: View, bookmarkEntry: BookmarkEntry, isFirst: Boolean, isLast: Boolean) -> Unit): RecyclerView.Adapter<BookmarksAdapter.ViewHolder>() {
val bookmarks = mutableListOf<BookmarkEntry>()
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
fun update(bookmarkEntries: List<BookmarkEntry>){
this.bookmarks.clear()
this.bookmarks.addAll(bookmarkEntries)
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(
LayoutInflater.from(parent.context).inflate(R.layout.bookmark, parent, false)
)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val bookmark = bookmarks[position]
if(bookmark.visible) {
holder.itemView.visible(true)
holder.itemView.bookmark_name.text = bookmark.label
holder.itemView.bookmark_uri.text = bookmark.uri.toString()
holder.itemView.bookmark_layout.setOnClickListener {
onBookmark(bookmarks[holder.adapterPosition])
}
holder.itemView.bookmark_overflow.setOnClickListener { view ->
val isFirst = (holder.adapterPosition == 0)
val isLast = (holder.adapterPosition == bookmarks.size - 1)
onOverflow(view, bookmarks[holder.adapterPosition], isFirst, isLast)
}
}else{
holder.itemView.visible(false)
}
}
override fun getItemCount(): Int = bookmarks.size
fun hide(bookmarkEntry: BookmarkEntry) {
bookmarkEntry.visible = false
notifyItemChanged(bookmarks.indexOf(bookmarkEntry))
}
fun show(bookmarkEntry: BookmarkEntry) {
bookmarkEntry.visible = true
notifyItemChanged(bookmarks.indexOf(bookmarkEntry))
}
fun remove(bookmarkEntry: BookmarkEntry){
val index = bookmarks.indexOf(bookmarkEntry)
bookmarks.remove(bookmarkEntry)
notifyItemRemoved(index)
}
}

View File

@ -1,138 +0,0 @@
package oppen.ariane.ui.bookmarks
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.view.View
import androidx.appcompat.app.AppCompatDialog
import androidx.appcompat.widget.PopupMenu
import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.snackbar.BaseTransientBottomBar
import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.dialog_bookmarks.view.*
import oppen.ariane.R
import oppen.ariane.io.database.bookmarks.BookmarkEntry
import oppen.ariane.io.database.bookmarks.BookmarksDatasource
import oppen.visible
class BookmarksDialog(
context: Context,
private val bookmarkDatasource: BookmarksDatasource,
onBookmark: (bookmarkEntry: BookmarkEntry) -> Unit): AppCompatDialog(context, R.style.FSDialog) {
var bookmarksAdapter: BookmarksAdapter
var view: View = View.inflate(context, R.layout.dialog_bookmarks, null)
init {
setContentView(view)
view.bookmarks_toolbar.setNavigationIcon(R.drawable.vector_close)
view.bookmarks_toolbar.setNavigationOnClickListener {
dismiss()
}
//None as yet
view.bookmarks_toolbar.inflateMenu(R.menu.add_bookmarks)
view.bookmarks_toolbar.setOnMenuItemClickListener {_ ->
true
}
view.bookmarks_recycler.layoutManager = LinearLayoutManager(context)
bookmarksAdapter = BookmarksAdapter({ bookmark ->
//onBookmark
onBookmark(bookmark)
dismiss()
}){ view, bookmark, isFirst, isLast ->
//onOverflow
val bookmarkOverflow = PopupMenu(context, view)
bookmarkOverflow.inflate(R.menu.menu_bookmark)
if(isFirst) bookmarkOverflow.menu.removeItem(R.id.menu_bookmark_move_up)
if(isLast) bookmarkOverflow.menu.removeItem(R.id.menu_bookmark_move_down)
bookmarkOverflow.setOnMenuItemClickListener { menuItem ->
when(menuItem.itemId){
R.id.menu_bookmark_edit -> edit(bookmark)
R.id.menu_bookmark_delete -> delete(bookmark)
R.id.menu_bookmark_move_up -> moveUp(bookmark)
R.id.menu_bookmark_move_down-> moveDown(bookmark)
}
true
}
bookmarkOverflow.show()
}
view.bookmarks_recycler.adapter = bookmarksAdapter
bookmarkDatasource.get { bookmarks ->
Handler(Looper.getMainLooper()).post {
when {
bookmarks.isEmpty() -> view.bookmarks_empty_layout.visible(true)
else -> bookmarksAdapter.update(bookmarks)
}
}
}
}
private fun edit(bookmarkEntry: BookmarkEntry){
BookmarkDialog(context, BookmarkDialog.mode_edit, null, bookmarkEntry.uri.toString(), bookmarkEntry.label){ label, uri ->
bookmarkDatasource.update(bookmarkEntry, label, uri){
bookmarkDatasource.get {bookmarks ->
Handler(Looper.getMainLooper()).post {
bookmarksAdapter.update(bookmarks)
}
}
}
}.show()
}
/**
*
* Bookmark isn't actually deleted from the DB until the Snackbar disappears. Which is nice.
*
*/
private fun delete(bookmarkEntry: BookmarkEntry){
//OnDelete
bookmarksAdapter.hide(bookmarkEntry)
Snackbar.make(view, "Deleted ${bookmarkEntry.label}", Snackbar.LENGTH_SHORT).addCallback(object: Snackbar.Callback() {
override fun onDismissed(transientBottomBar: Snackbar?, event: Int) = when (event) {
BaseTransientBottomBar.BaseCallback.DISMISS_EVENT_ACTION -> bookmarksAdapter.show(bookmarkEntry)
else -> bookmarkDatasource.delete(bookmarkEntry){
Handler(Looper.getMainLooper()).post {
bookmarksAdapter.remove(bookmarkEntry)
}
}
}
}).setAction("Undo"){
//Action listener unused
}.show()
}
private fun moveUp(bookmarkEntry: BookmarkEntry){
bookmarkDatasource.moveUp(bookmarkEntry){
bookmarkDatasource.get { bookmarks ->
Handler(Looper.getMainLooper()).post {
bookmarksAdapter.update(bookmarks)
}
}
}
}
private fun moveDown(bookmarkEntry: BookmarkEntry){
bookmarkDatasource.moveDown(bookmarkEntry){
bookmarkDatasource.get { bookmarks ->
Handler(Looper.getMainLooper()).post {
bookmarksAdapter.update(bookmarks)
}
}
}
}
}

View File

@ -1,62 +0,0 @@
package oppen.ariane.ui.content_image
import android.content.Context
import android.graphics.Bitmap
import android.net.Uri
import android.view.MenuInflater
import android.view.View
import androidx.appcompat.app.AppCompatDialog
import androidx.appcompat.widget.PopupMenu
import kotlinx.android.synthetic.main.dialog_content_image.view.*
import oppen.ariane.R
import oppen.ariane.io.GemState
import java.io.FileOutputStream
object ImageDialog {
fun show(context: Context, state: GemState.ResponseImage, onDownloadRequest: (state: GemState.ResponseImage) -> Unit){
val dialog = AppCompatDialog(context, R.style.AppTheme)
val view = View.inflate(context, R.layout.dialog_content_image, null)
dialog.setContentView(view)
view.image_view.setImageURI(state.cacheUri)
view.close_image_content_dialog.setOnClickListener {
dialog.dismiss()
}
view.image_overflow.setOnClickListener {
val overflowMenu = PopupMenu(context, view.image_overflow)
val inflater: MenuInflater = overflowMenu.menuInflater
inflater.inflate(R.menu.image_overflow_menu, overflowMenu.menu)
overflowMenu.setOnMenuItemClickListener { menuItem ->
if(menuItem.itemId == R.id.image_overflow_save_image){
onDownloadRequest(state)
}
true
}
overflowMenu.show()
}
dialog.show()
}
/**
*
* Save bitmap using Storage Access Framework Uri
* @param bitmap
* @param uri - must be a SAF Uri
* @param onComplete
*/
fun publicExport(context: Context, bitmap: Bitmap?, uri: Uri, onComplete: (uri: Uri) -> Unit) {
context.contentResolver.openFileDescriptor(uri, "w")?.use {
FileOutputStream(it.fileDescriptor).use { outputStream ->
bitmap?.compress(Bitmap.CompressFormat.JPEG, 90, outputStream)
}
bitmap?.recycle()
onComplete(uri)
}
}
}

View File

@ -1,306 +0,0 @@
package oppen.ariane.ui.content_image;
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
/**
*
* From SO: https://stackoverflow.com/a/54474590/7641428
*
* todo - Rewrite in Kotlin at some point, possibly, maybe, never
*
*/
public class TouchImageView extends androidx.appcompat.widget.AppCompatImageView implements GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener {
Matrix matrix;
// We can be in one of these 3 states
static final int NONE = 0;
static final int DRAG = 1;
static final int ZOOM = 2;
int mode = NONE;
// Remember some things for zooming
PointF last = new PointF();
PointF start = new PointF();
float minScale = 0.9f;
float maxScale = 3f;
float[] m;
int viewWidth, viewHeight;
static final int CLICK = 3;
float saveScale = 1f;
protected float origWidth, origHeight;
int oldMeasuredWidth, oldMeasuredHeight;
ScaleGestureDetector mScaleDetector;
Context context;
public TouchImageView(Context context) {
super(context);
sharedConstructing(context);
}
public TouchImageView(Context context, AttributeSet attrs) {
super(context, attrs);
sharedConstructing(context);
}
GestureDetector mGestureDetector;
private void sharedConstructing(Context context) {
super.setClickable(true);
this.context = context;
mGestureDetector = new GestureDetector(context, this);
mGestureDetector.setOnDoubleTapListener(this);
mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
matrix = new Matrix();
m = new float[9];
setImageMatrix(matrix);
setScaleType(ScaleType.MATRIX);
setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
mScaleDetector.onTouchEvent(event);
mGestureDetector.onTouchEvent(event);
PointF curr = new PointF(event.getX(), event.getY());
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
last.set(curr);
start.set(last);
mode = DRAG;
break;
case MotionEvent.ACTION_MOVE:
if (mode == DRAG) {
float deltaX = curr.x - last.x;
float deltaY = curr.y - last.y;
float fixTransX = getFixDragTrans(deltaX, viewWidth,
origWidth * saveScale);
float fixTransY = getFixDragTrans(deltaY, viewHeight,
origHeight * saveScale);
matrix.postTranslate(fixTransX, fixTransY);
fixTrans();
last.set(curr.x, curr.y);
}
break;
case MotionEvent.ACTION_UP:
mode = NONE;
int xDiff = (int) Math.abs(curr.x - start.x);
int yDiff = (int) Math.abs(curr.y - start.y);
if (xDiff < CLICK && yDiff < CLICK)
performClick();
break;
case MotionEvent.ACTION_POINTER_UP:
mode = NONE;
break;
}
setImageMatrix(matrix);
invalidate();
return true; // indicate event was handled
}
});
invalidate();
}
public void setMaxZoom(float x) {
maxScale = x;
}
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
return false;
}
public void reset(){
saveScale = 1f;
fixTrans();
}
@Override
public boolean onDoubleTap(MotionEvent e) {
// Double tap is detected
float origScale = saveScale;
float mScaleFactor;
if (saveScale == maxScale) {
saveScale = minScale;
mScaleFactor = minScale / origScale;
} else {
saveScale = maxScale;
mScaleFactor = maxScale / origScale;
}
matrix.postScale(mScaleFactor, mScaleFactor, viewWidth / 2f, viewHeight / 2f);
fixTrans();
return false;
}
@Override
public boolean onDoubleTapEvent(MotionEvent e) {
return false;
}
@Override
public boolean onDown(MotionEvent e) {
return false;
}
@Override
public void onShowPress(MotionEvent e) {
}
@Override
public boolean onSingleTapUp(MotionEvent e) {
return false;
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
return false;
}
@Override
public void onLongPress(MotionEvent e) {
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
return false;
}
private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
@Override
public boolean onScaleBegin(ScaleGestureDetector detector) {
mode = ZOOM;
return true;
}
@Override
public boolean onScale(ScaleGestureDetector detector) {
float mScaleFactor = detector.getScaleFactor();
float origScale = saveScale;
saveScale *= mScaleFactor;
if (saveScale > maxScale) {
saveScale = maxScale;
mScaleFactor = maxScale / origScale;
} else if (saveScale < minScale) {
saveScale = minScale;
mScaleFactor = minScale / origScale;
}
if (origWidth * saveScale <= viewWidth || origHeight * saveScale <= viewHeight) {
matrix.postScale(mScaleFactor, mScaleFactor, viewWidth / 2f, viewHeight / 2f);
}else {
matrix.postScale(mScaleFactor, mScaleFactor, detector.getFocusX(), detector.getFocusY());
}
fixTrans();
return true;
}
}
void fixTrans() {
matrix.getValues(m);
float transX = m[Matrix.MTRANS_X];
float transY = m[Matrix.MTRANS_Y];
float fixTransX = getFixTrans(transX, viewWidth, origWidth * saveScale);
float fixTransY = getFixTrans(transY, viewHeight, origHeight * saveScale);
if (fixTransX != 0 || fixTransY != 0) matrix.postTranslate(fixTransX, fixTransY);
}
float getFixTrans(float trans, float viewSize, float contentSize) {
float minTrans, maxTrans;
if (contentSize <= viewSize) {
minTrans = 0;
maxTrans = viewSize - contentSize;
} else {
minTrans = viewSize - contentSize;
maxTrans = 0;
}
if (trans < minTrans) return -trans + minTrans;
if (trans > maxTrans) return -trans + maxTrans;
return 0;
}
float getFixDragTrans(float delta, float viewSize, float contentSize) {
if (contentSize <= viewSize) {
return 0;
}
return delta;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
viewWidth = MeasureSpec.getSize(widthMeasureSpec);
viewHeight = MeasureSpec.getSize(heightMeasureSpec);
//
// Rescales image on rotation
//
if (oldMeasuredHeight == viewWidth && oldMeasuredHeight == viewHeight || viewWidth == 0 || viewHeight == 0) return;
oldMeasuredHeight = viewHeight;
oldMeasuredWidth = viewWidth;
if (saveScale == 1) {
// Fit to screen.
float scale;
Drawable drawable = getDrawable();
if (drawable == null || drawable.getIntrinsicWidth() == 0 || drawable.getIntrinsicHeight() == 0) return;
int bmWidth = drawable.getIntrinsicWidth();
int bmHeight = drawable.getIntrinsicHeight();
Log.d("bmSize", "bmWidth: " + bmWidth + " bmHeight : " + bmHeight);
float scaleX = (float) viewWidth / (float) bmWidth;
float scaleY = (float) viewHeight / (float) bmHeight;
scale = Math.min(scaleX, scaleY);
matrix.setScale(scale, scale);
// Center the image
float redundantYSpace = (float) viewHeight - (scale * (float) bmHeight);
float redundantXSpace = (float) viewWidth - (scale * (float) bmWidth);
redundantYSpace /= (float) 2;
redundantXSpace /= (float) 2;
matrix.postTranslate(redundantXSpace, redundantYSpace);
origWidth = viewWidth - 2 * redundantXSpace;
origHeight = viewHeight - 2 * redundantYSpace;
setImageMatrix(matrix);
}
fixTrans();
}
}

View File

@ -1,27 +0,0 @@
package oppen.ariane.ui.content_text
import android.content.Context
import android.view.View
import androidx.appcompat.app.AppCompatDialog
import kotlinx.android.synthetic.main.dialog_content_text.view.*
import oppen.ariane.R
import oppen.ariane.io.GemState
object TextDialog {
fun show(context: Context, state: GemState.ResponseText){
val dialog = AppCompatDialog(context, R.style.AppTheme)
val view = View.inflate(context, R.layout.dialog_content_text, null)
dialog.setContentView(view)
view.text_content.text = state.content
view.close_text_content_dialog.setOnClickListener {
dialog.dismiss()
}
dialog.show()
}
}

View File

@ -1,34 +0,0 @@
package oppen.ariane.ui.modals_menus
import android.view.MenuInflater
import android.view.View
import androidx.appcompat.widget.PopupMenu
import oppen.ariane.R
import oppen.endsWithImage
import oppen.isWeb
import java.net.URI
object LinkPopup {
fun show(view: View?, uri: URI, onMenuOption: (menuId: Int) -> Unit){
if(view != null) {
val popup = PopupMenu(view.context, view)
val inflater: MenuInflater = popup.menuInflater
val uriStr = uri.toString()
when {
uriStr.endsWithImage() && !uriStr.isWeb() -> inflater.inflate(R.menu.image_link_menu, popup.menu)
else -> inflater.inflate(R.menu.link_menu, popup.menu)
}
popup.setOnMenuItemClickListener { menuItem ->
onMenuOption(menuItem.itemId)
true
}
popup.show()
}
}
}

View File

@ -1,83 +0,0 @@
package oppen.ariane.ui.modals_menus.about
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Handler
import android.os.Looper
import android.view.View
import androidx.appcompat.app.AppCompatDialog
import androidx.appcompat.widget.AppCompatTextView
import kotlinx.android.synthetic.main.dialog_about.view.*
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import oppen.ariane.BuildConfig
import oppen.ariane.R
import java.lang.StringBuilder
import java.security.SecureRandom
import javax.net.ssl.SSLContext
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
object AboutDialog {
fun show(context: Context){
val dialog = AppCompatDialog(context, R.style.AppTheme)
val view = View.inflate(context, R.layout.dialog_about, null)
dialog.setContentView(view)
view.close_tab_dialog.setOnClickListener {
dialog.dismiss()
}
view.version_label.text = BuildConfig.VERSION_NAME
view.gnu_license_button.setOnClickListener {
context.startActivity(Intent(Intent.ACTION_VIEW).apply {
data = Uri.parse("https://www.gnu.org/licenses/gpl-3.0.html")
})
}
view.oppenlab_button.setOnClickListener {
context.startActivity(Intent(Intent.ACTION_VIEW).apply {
data = Uri.parse("https://oppenlab.net")
})
}
buildTLSInfo(view.tls_info)
dialog.show()
}
private fun buildTLSInfo(tlsInfo: AppCompatTextView?) {
GlobalScope.launch {
val sb = StringBuilder()
val sslContext = SSLContext.getInstance("TLS")
sslContext.init(null, null, SecureRandom())
val factory: SSLSocketFactory = sslContext.socketFactory
val socket = factory.createSocket() as SSLSocket
sb.append("\n")
sb.append("Supported TLS protocols on this device:\n\n")
socket.supportedProtocols.forEach { protocol ->
sb.append("$protocol \n")
}
sb.append("\n\n")
sb.append("Supported cipher suites on this device:\n\n")
val allCipherSuites = factory.supportedCipherSuites
allCipherSuites.forEach { cipherSuite ->
sb.append("$cipherSuite \n")
}
sb.append("\n")
Handler(Looper.getMainLooper()).post{
tlsInfo?.text = sb.toString()
}
}
}
}

View File

@ -1,30 +0,0 @@
package oppen.ariane.ui.modals_menus.history
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.row_history.view.*
import oppen.delay
import oppen.ariane.R
import oppen.ariane.io.database.history.HistoryEntry
class HistoryAdapter(val history: List<HistoryEntry>, val onClick:(entry: HistoryEntry) -> Unit): RecyclerView.Adapter<HistoryAdapter.ViewHolder>() {
class ViewHolder(view: View): RecyclerView.ViewHolder(view)
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.row_history, parent, false))
}
override fun getItemCount(): Int = history.size
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.itemView.history_address.text = history[position].uri.toString()
holder.itemView.history_row.setOnClickListener {
delay(500){
onClick(history[holder.adapterPosition])
}
}
}
}

View File

@ -1,64 +0,0 @@
package oppen.ariane.ui.modals_menus.history
import android.content.Context
import android.os.Handler
import android.os.Looper
import android.view.MenuInflater
import android.view.View
import android.widget.Toast
import androidx.appcompat.app.AppCompatDialog
import androidx.appcompat.widget.PopupMenu
import androidx.core.view.MenuCompat
import androidx.recyclerview.widget.LinearLayoutManager
import kotlinx.android.synthetic.main.dialog_about.view.close_tab_dialog
import kotlinx.android.synthetic.main.dialog_history.view.*
import oppen.ariane.R
import oppen.ariane.io.database.history.ArianeHistory
import oppen.ariane.io.gemini.RuntimeCache
object HistoryDialog {
fun show(context: Context, history: ArianeHistory, onHistoryItem: (address: String) -> Unit){
val dialog = AppCompatDialog(context, R.style.AppTheme)
val view = View.inflate(context, R.layout.dialog_history, null)
dialog.setContentView(view)
view.close_tab_dialog.setOnClickListener {
dialog.dismiss()
}
view.history_overflow.setOnClickListener {
val popup = PopupMenu(view.context, view.history_overflow)
val inflater: MenuInflater = popup.menuInflater
inflater.inflate(R.menu.history_overflow_menu, popup.menu)
popup.setOnMenuItemClickListener { menuItem ->
if(menuItem.itemId == R.id.history_overflow_clear_history){
history.clear {
dialog.dismiss()
Toast.makeText(context, "History cleared", Toast.LENGTH_SHORT).show()
}
}else if(menuItem.itemId == R.id.history_overflow_clear_runtime_cache){
RuntimeCache.clear()
dialog.dismiss()
Toast.makeText(context, "Runtime cache cleared", Toast.LENGTH_SHORT).show()
}
true
}
MenuCompat.setGroupDividerEnabled(popup.menu, true)
popup.show()
}
view.history_recycler.layoutManager = LinearLayoutManager(context)
history.get { history ->
Handler(Looper.getMainLooper()).post {
view.history_recycler.adapter = HistoryAdapter(history) { entry ->
onHistoryItem(entry.uri.toString())
dialog.dismiss()
}
dialog.show()
}
}
}
}

View File

@ -1,33 +0,0 @@
package oppen.ariane.ui.modals_menus.input
import android.content.Context
import android.view.View
import androidx.appcompat.app.AppCompatDialog
import kotlinx.android.synthetic.main.dialog_input_query.view.*
import oppen.ariane.R
import oppen.ariane.io.GemState
import java.net.URLEncoder
object InputDialog {
fun show(context: Context, state: GemState.ResponseInput, onQuery: (queryAddress: String) -> Unit) {
val dialog = AppCompatDialog(context, R.style.AppTheme)
val view = View.inflate(context, R.layout.dialog_input_query, null)
dialog.setContentView(view)
view.close_input_query_dialog.setOnClickListener {
dialog.dismiss()
}
view.query_text.text = state.header.meta
view.query_submit_button.setOnClickListener {
val encoded = URLEncoder.encode(view.query_input.text.toString(), "UTF-8")
onQuery("${state.uri}?$encoded")
dialog.dismiss()
}
dialog.show()
}
}

View File

@ -1,64 +0,0 @@
package oppen.ariane.ui.modals_menus.overflow
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.text.SpannableStringBuilder
import android.text.style.ImageSpan
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import androidx.appcompat.widget.PopupMenu
import androidx.core.view.MenuCompat
import oppen.ariane.R
object OverflowPopup {
fun show(view: View?, onMenuOption: (menuId: Int) -> Unit){
if(view != null) {
val popup = PopupMenu(view.context, view)
val inflater: MenuInflater = popup.menuInflater
inflater.inflate(R.menu.overflow_menu, popup.menu)
popup.setOnMenuItemClickListener { menuItem ->
onMenuOption(menuItem.itemId)
true
}
MenuCompat.setGroupDividerEnabled(popup.menu, true)
//insertMenuItemIcons(view.context, popup)
popup.show()
}
}
fun insertMenuItemIcons(context: Context, popupMenu: PopupMenu) {
val menu: Menu = popupMenu.menu
if (hasIcon(menu)) {
for (i in 0 until menu.size()) {
insertMenuItemIcon(context, menu.getItem(i))
}
}
}
private fun hasIcon(menu: Menu): Boolean {
for (i in 0 until menu.size()) {
if (menu.getItem(i).icon != null) return true
}
return false
}
/**
* Converts the given MenuItem's title into a Spannable containing both its icon and title.
*/
private fun insertMenuItemIcon(context: Context, menuItem: MenuItem) {
val icon: Drawable = menuItem.icon
val iconSize = context.resources.getDimensionPixelSize(R.dimen.menu_item_icon_size)
icon.setBounds(0, 0, iconSize, iconSize)
icon.setTint(Color.WHITE)
val imageSpan = ImageSpan(icon)
val ssb = SpannableStringBuilder(" " + menuItem.title)
ssb.setSpan(imageSpan, 1, 2, 0)
menuItem.title = ssb
menuItem.icon = null
}
}

View File

@ -1,37 +0,0 @@
package oppen.ariane.ui.modals_menus.set_home
import android.content.Context
import android.view.View
import androidx.appcompat.app.AppCompatDialog
import kotlinx.android.synthetic.main.dialog_set_home.view.*
import oppen.ariane.R
object SetHomeDialog {
fun show(context: Context, currentAddress: String, onUpdate: () -> Unit){
val prefs = context.getSharedPreferences("oppen.tva.ui.dialogs.set_home", Context.MODE_PRIVATE)
val home = prefs.getString("home", "")
val dialog = AppCompatDialog(context, R.style.DayNightDialog)
val view = View.inflate(context, R.layout.dialog_set_home, null)
view.home_edit_text.setText(home)
view.set_home_button.setOnClickListener {
prefs.edit().putString("home", view.home_edit_text.text.toString()).apply()
onUpdate()
dialog.dismiss()
}
view.use_current_button.setOnClickListener {
view.home_edit_text.setText(currentAddress)
}
dialog.setTitle("Set home capsule")
dialog.setContentView(view)
dialog.show()
}
}

View File

@ -1,24 +0,0 @@
package oppen.ariane.ui.settings
import android.os.Bundle
import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
import oppen.ariane.R
class SettingsActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_settings)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setHomeAsUpIndicator(R.drawable.vector_close)
supportFragmentManager.beginTransaction().replace(R.id.settings_container, SettingsFragment()).commit()
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
finish()
return super.onOptionsItemSelected(item)
}
}

View File

@ -1,215 +0,0 @@
package oppen.ariane.ui.settings
import android.content.SharedPreferences
import android.os.Bundle
import android.text.Spannable
import android.text.SpannableString
import android.text.style.ForegroundColorSpan
import android.view.inputmethod.EditorInfo
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.content.ContextCompat
import androidx.preference.*
import oppen.ariane.Ariane
import java.security.SecureRandom
import java.util.*
import javax.net.ssl.SSLContext
import javax.net.ssl.SSLSocket
import javax.net.ssl.SSLSocketFactory
class SettingsFragment: PreferenceFragmentCompat(), Preference.OnPreferenceChangeListener {
lateinit var prefs: SharedPreferences
lateinit var protocols: Array<String>
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
prefs = preferenceManager.sharedPreferences
val context = preferenceManager.context
val screen = preferenceManager.createPreferenceScreen(context)
/**
* Ariane App Settings
*/
val appCategory = PreferenceCategory(context)
appCategory.key = "app_category"
appCategory.title = "Configure Ariane"
screen.addPreference(appCategory)
//Home
val homePreference = EditTextPreference(context)
homePreference.title = "Home Capsule"
homePreference.key = "home_capsule"
val homecapsule = preferenceManager.sharedPreferences.getString("home_capsule", Ariane.DEFAULT_HOME_CAPSULE)
homePreference.summary = homecapsule
homePreference.positiveButtonText = getThemedSpan("Update")
homePreference.negativeButtonText = getThemedSpan("Cancel")
homePreference.title = getThemedSpan("Home Capsule")
homePreference.setOnPreferenceChangeListener { _, newValue ->
homePreference.summary = newValue.toString()
true
}
homePreference.setOnBindEditTextListener{ editText ->
editText.imeOptions = EditorInfo.IME_ACTION_DONE
editText.setSelection(editText.text.toString().length)//Set caret position to end
}
appCategory.addPreference(homePreference)
/**
* Day/Night Theme
*/
val themeCategory = PreferenceCategory(context)
themeCategory.key = "theme_category"
themeCategory.title = "Theme"
appCategory.addPreference(themeCategory)
val themeFollowSystemPreference = SwitchPreferenceCompat(context)
themeFollowSystemPreference.key = "theme_FollowSystem"
themeFollowSystemPreference.title = "System Default"
themeFollowSystemPreference.onPreferenceChangeListener = this
themeCategory.addPreference(themeFollowSystemPreference)
val themeLightPreference = SwitchPreferenceCompat(context)
themeLightPreference.key = "theme_Light"
themeLightPreference.title = "Light"
themeLightPreference.onPreferenceChangeListener = this
themeCategory.addPreference(themeLightPreference)
val themeDarkPreference = SwitchPreferenceCompat(context)
themeDarkPreference.key = "theme_Dark"
themeDarkPreference.title = "Dark"
themeDarkPreference.onPreferenceChangeListener = this
themeCategory.addPreference(themeDarkPreference)
val isThemePrefSet =
prefs.getBoolean("theme_FollowSystem", false) ||
prefs.getBoolean("theme_Light", false) ||
prefs.getBoolean("theme_Dark", false)
if(!isThemePrefSet) themeFollowSystemPreference.isChecked = true
/**
* TLS Settings
*/
val tlsCategory = PreferenceCategory(context)
tlsCategory.key = "tls_category"
tlsCategory.title = "TLS Config"
screen.addPreference(tlsCategory)
val tlsDefaultPreference = SwitchPreferenceCompat(context)
tlsDefaultPreference.key = "tls_Default"
tlsDefaultPreference.title = "TLS Default"
tlsDefaultPreference.onPreferenceChangeListener = this
tlsCategory.addPreference(tlsDefaultPreference)
val tlsAllSupportedPreference = SwitchPreferenceCompat(context)
tlsAllSupportedPreference.key = "tls_All_Supported"
tlsAllSupportedPreference.title = "TLS Enable all supported"
tlsAllSupportedPreference.onPreferenceChangeListener = this
tlsCategory.addPreference(tlsAllSupportedPreference)
val sslContext = SSLContext.getInstance("TLS")
sslContext.init(null, null, SecureRandom())
val factory: SSLSocketFactory = sslContext.socketFactory
val socket = factory.createSocket() as SSLSocket
protocols = socket.supportedProtocols
protocols.forEach { protocol ->
val tlsPreference = SwitchPreferenceCompat(context)
tlsPreference.key = "tls_${protocol.toLowerCase(Locale.getDefault())}"
tlsPreference.title = protocol
tlsPreference.onPreferenceChangeListener = this
tlsCategory.addPreference(tlsPreference)
}
preferenceScreen = screen
}
override fun onPreferenceChange(preference: Preference?, newValue: Any?): Boolean {
if(preference == null) return false
if(preference.key.startsWith("tls")){
tlsChangeListener(preference, newValue)
return true
}
if(preference.key.startsWith("theme")){
when(preference.key){
"theme_FollowSystem" -> {
preferenceScreen.findPreference<SwitchPreferenceCompat>("theme_Light")?.isChecked = false
preferenceScreen.findPreference<SwitchPreferenceCompat>("theme_Dark")?.isChecked = false
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
}
"theme_Light" -> {
preferenceScreen.findPreference<SwitchPreferenceCompat>("theme_FollowSystem")?.isChecked = false
preferenceScreen.findPreference<SwitchPreferenceCompat>("theme_Dark")?.isChecked = false
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
}
"theme_Dark" -> {
preferenceScreen.findPreference<SwitchPreferenceCompat>("theme_FollowSystem")?.isChecked = false
preferenceScreen.findPreference<SwitchPreferenceCompat>("theme_Light")?.isChecked = false
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
}
}
return true
}
return false
}
private fun tlsChangeListener(
preference: Preference?,
newValue: Any?
) {
if (preference is SwitchPreferenceCompat && newValue is Boolean && newValue == true) {
preference.key?.let { key ->
when {
key.startsWith("tls_") -> {
if (key != "tls_Default") {
val default = preferenceScreen.findPreference<SwitchPreferenceCompat>("tls_Default")
default?.isChecked = false
}
if (key != "tls_All_Supported") {
val all = preferenceScreen.findPreference<SwitchPreferenceCompat>("tls_All_Supported")
all?.isChecked = false
}
protocols.forEach { protocol ->
val tlsSwitchKey = "tls_${protocol.toLowerCase(Locale.getDefault())}"
if (tlsSwitchKey != key) {
val otherTLSSwitch =
preferenceScreen.findPreference<SwitchPreferenceCompat>(
tlsSwitchKey
)
otherTLSSwitch?.isChecked = false
}
}
}
}
}
when (preference.key) {
"tls_Default" -> setTLSProtocol("TLS")
"tls_All_Supported" -> setTLSProtocol("TLS_ALL")
else -> {
val prefTitle = preference.title.toString()
setTLSProtocol(prefTitle)
}
}
}
}
private fun setTLSProtocol(protocol: String) = preferenceManager.sharedPreferences.edit().putString("tls_protocol", protocol).apply()
/**
* Unfortunately it doesn't look like EditTextPreference supports Day/Night theme
* or else is otherwise broken - OR I'M MISSING SOMETHING.
* Use Spannable to set a suitable text colour for the dialog buttons
*/
private fun getThemedSpan(text: String): Spannable{
val textSpan = SpannableString(text)
textSpan.setSpan(ForegroundColorSpan(ContextCompat.getColor(requireContext(), oppen.ariane.R.color.themed_text)), 0, text.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
return textSpan
}
}

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="1000"
/>

View File

@ -1,21 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="50dp"
android:height="50dp"
android:viewportWidth="50"
android:viewportHeight="50">
<path
android:pathData="M25,25m-25,0a25,25 0,1 1,50 0a25,25 0,1 1,-50 0"
android:fillColor="#1D1D1D"/>
<path
android:pathData="M24.9301,16.7963C24.9301,12.3185 22.2502,9.6044 18.6269,9.6044C14.99,9.6044 12.3169,12.3185 12.3169,16.7963C12.3169,21.2673 14.99,23.9882 18.6269,23.9882C22.2502,23.9882 24.9301,21.2742 24.9301,16.7963ZM22.8382,16.7963C22.8382,20.2077 21.0334,22.0604 18.6269,22.0604C16.2137,22.0604 14.4157,20.2077 14.4157,16.7963C14.4157,13.3849 16.2137,11.5323 18.6269,11.5323C21.0334,11.5323 22.8382,13.3849 22.8382,16.7963ZM16.617,8.1482C17.3007,8.1482 17.8203,7.5945 17.8203,6.9587C17.8203,6.2819 17.3007,5.7623 16.617,5.7623C15.9744,5.7623 15.407,6.2819 15.407,6.9587C15.407,7.5945 15.9744,8.1482 16.617,8.1482ZM20.6369,8.1482C21.3205,8.1482 21.8401,7.5945 21.8401,6.9587C21.8401,6.2819 21.3205,5.7623 20.6369,5.7623C19.9942,5.7623 19.4268,6.2819 19.4268,6.9587C19.4268,7.5945 19.9942,8.1482 20.6369,8.1482Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M29.0077,23.7968H37.4643V21.9783H31.1202V9.7958H29.0077V23.7968Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M14.4856,40.6417L15.7708,36.9364H21.24L22.5184,40.6417H24.7607L19.7223,26.6407H17.2817L12.2433,40.6417H14.4856ZM16.3861,35.1589L18.4507,29.1839H18.5601L20.6247,35.1589H16.3861Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M28.7612,40.6417H34.1278C37.3819,40.6417 38.8518,39.0215 38.8518,36.8749C38.8518,34.7077 37.3341,33.484 35.9463,33.4088V33.2721C37.2315,32.9439 38.3048,32.0689 38.3048,30.3187C38.3048,28.2473 36.8692,26.6407 33.8885,26.6407H28.7612V40.6417ZM30.8737,38.8301V34.3454H33.9979C35.6933,34.3454 36.753,35.4392 36.753,36.7723C36.753,37.9482 35.9531,38.8301 33.9227,38.8301H30.8737ZM30.8737,32.6978V28.4387H33.7586C35.4335,28.4387 36.2334,29.3206 36.2334,30.4828C36.2334,31.8364 35.1259,32.6978 33.7039,32.6978H30.8737Z"
android:fillColor="#ffffff"/>
</vector>

View File

@ -1,11 +0,0 @@
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetBottom="0dp"
android:insetLeft="0dp"
android:insetRight="0dp"
android:insetTop="0dp">
<shape
android:shape="rectangle" android:tint="@color/address_background">
<stroke android:color="?attr/colorControlNormal" android:width="1dp" />
<corners android:radius="22dp" />
</shape>
</inset>

View File

@ -1,11 +0,0 @@
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetBottom="3dp"
android:insetLeft="3dp"
android:insetRight="3dp"
android:insetTop="3dp">
<shape
android:shape="rectangle">
<stroke android:color="?attr/colorControlNormal" android:width="1dp" />
<corners android:radius="5dp" />
</shape>
</inset>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
</vector>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M17,3H7c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3V5c0,-1.1 -0.9,-2 -2,-2z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19,18l2,1V3c0,-1.1 -0.9,-2 -2,-2H8.99C7.89,1 7,1.9 7,3h10c1.1,0 2,0.9 2,2v13zM15,5H5c-1.1,0 -2,0.9 -2,2v16l7,-3 7,3V7c0,-1.1 -0.9,-2 -2,-2z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2C6.47,2 2,6.47 2,12s4.47,10 10,10 10,-4.47 10,-10S17.53,2 12,2zM17,15.59L15.59,17 12,13.41 8.41,17 7,15.59 10.59,12 7,8.41 8.41,7 12,10.59 15.59,7 17,8.41 13.41,12 17,15.59z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M10,19v-5h4v5c0,0.55 0.45,1 1,1h3c0.55,0 1,-0.45 1,-1v-7h1.7c0.46,0 0.68,-0.57 0.33,-0.87L12.67,3.6c-0.38,-0.34 -0.96,-0.34 -1.34,0l-8.36,7.53c-0.34,0.3 -0.13,0.87 0.33,0.87H5v7c0,0.55 0.45,1 1,1h3c0.55,0 1,-0.45 1,-1z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M3.9,12c0,-1.71 1.39,-3.1 3.1,-3.1h4L11,7L7,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5h4v-1.9L7,15.1c-1.71,0 -3.1,-1.39 -3.1,-3.1zM8,13h8v-2L8,11v2zM17,7h-4v1.9h4c1.71,0 3.1,1.39 3.1,3.1s-1.39,3.1 -3.1,3.1h-4L13,17h4c2.76,0 5,-2.24 5,-5s-2.24,-5 -5,-5z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M6,19h4L10,5L6,5v14zM14,5v14h4L18,5h-4z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M8,5v14l11,-7z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M19,12v7L5,19v-7L3,12v7c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2v-7h-2zM13,12.67l2.59,-2.58L17,11.5l-5,5 -5,-5 1.41,-1.41L11,12.67L11,3h2z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
</vector>

View File

@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/>
</vector>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
<font
android:fontStyle="normal"
android:fontWeight="400"
android:font="@font/deja_vu_sans_mono" />
</font-family>

View File

@ -1,161 +0,0 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable name="viewmodel" type="oppen.ariane.ui.GemViewModel" />
</data>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root_coord"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".ui.GemActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/header_background"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimaryDark"
app:layout_scrollFlags="scroll|enterAlways"
app:toolbarId="@+id/toolbar">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/default_margin">
<RelativeLayout android:id="@+id/address_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/default_margin">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/home"
android:layout_width="@dimen/button_size"
android:layout_height="@dimen/button_size"
android:layout_centerVertical="true"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_home" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/address_edit"
android:background="@drawable/drawable_filled_rounded_rect"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:layout_toEndOf="@+id/home"
android:layout_toStartOf="@+id/more"
android:inputType="textNoSuggestions|textUri"
android:singleLine="true"
android:textSize="12sp"
android:imeOptions="actionGo"
android:hint="@string/main_input_hint" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/more"
android:layout_width="@dimen/button_size"
android:layout_height="@dimen/button_size"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_overflow" />
</RelativeLayout>
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:indeterminateTint="@color/stroke"
style="?android:attr/progressBarStyleHorizontal"
android:layout_below="@+id/address_bar"
android:indeterminate="true" />
<RelativeLayout
android:id="@+id/audio_player"
android:layout_width="match_parent"
android:layout_height="@dimen/bar_height"
android:layout_below="@+id/progress_bar"
android:background="@color/player_background"
android:paddingLeft="@dimen/default_margin"
android:paddingRight="@dimen/default_margin"
android:visibility="gone">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/audio_play_button"
android:layout_width="@dimen/button_size"
android:layout_height="@dimen/button_size"
android:layout_centerVertical="true"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:padding="@dimen/button_margin"
android:src="@drawable/vector_play" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/audio_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/audio_overflow"
android:paddingLeft="@dimen/default_margin"
android:ellipsize="marquee"
android:text="Aphex Twin - Flim"
android:layout_toRightOf="@+id/audio_play_button" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/audio_overflow"
android:layout_width="@dimen/button_size"
android:layout_height="@dimen/button_size"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:padding="@dimen/button_margin"
android:src="@drawable/vector_overflow" />
</RelativeLayout>
</RelativeLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/pull_to_refresh"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/gemtext_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:scrollbars="vertical"
android:scrollbarStyle="outsideOverlay"
android:paddingTop="@dimen/screen_margin"
android:paddingBottom="@dimen/screen_margin"
/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/settings_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
</RelativeLayout>

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/bookmark_layout"
android:clickable="true"
android:focusable="true"
android:padding="@dimen/default_margin_big"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/bookmark_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="My Homepage"
android:layout_toLeftOf="@+id/bookmark_overflow"
android:textColor="@color/vibrant_stroke"
android:textSize="@dimen/text_large" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/bookmark_uri"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="gemini://myhomepage.gmi"
android:textSize="@dimen/text_small"
android:layout_toLeftOf="@+id/bookmark_overflow"
android:layout_below="@+id/bookmark_name"/>
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/bookmark_overflow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/vector_overflow" />
</RelativeLayout>

View File

@ -1,143 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/default_margin">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/close_tab_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_close" />
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/header">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/default_margin_big"
android:paddingRight="@dimen/default_margin_big"
android:paddingBottom="@dimen/default_margin_big"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginTop="@dimen/default_margin_big"
android:src="@drawable/vector_olab"/>
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginStart="@dimen/default_margin"
android:layout_marginTop="@dimen/default_margin_big"
android:src="@drawable/vector_app_icon" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/default_margin_big"
android:textColor="@color/stroke"
android:text="@string/about_body"/>
<TextView
android:id="@+id/version_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/stroke"
tools:text="1.0.0 alpha delta"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/default_margin"
android:textColor="@color/stroke"
android:text="@string/copyright"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/oppenlab_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Öppenlab.net"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="@dimen/default_margin"
android:layout_marginBottom="@dimen/default_margin"
android:alpha="0.5"
android:background="?attr/colorOnSurface" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/default_margin"
android:textColor="@color/stroke"
android:text="@string/about_lic"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/gnu_license_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/gnu_link"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/default_margin"
android:layout_marginTop="@dimen/default_margin"
android:alpha="0.5"
android:background="?attr/colorOnSurface" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/default_margin"
android:textColor="@color/stroke"
android:text="@string/about_deja_vu_sans"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/default_margin"
android:layout_marginTop="@dimen/default_margin"
android:alpha="0.5"
android:background="?attr/colorOnSurface" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tls_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="12sp"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>

View File

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.appcompat.widget.Toolbar
android:id="@+id/bookmarks_toolbar"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/default_margin"
android:layout_height="@dimen/bar_height"
app:title="Bookmarks"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/bookmarks_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/bookmarks_toolbar"/>
<RelativeLayout
android:id="@+id/bookmarks_empty_layout"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerInParent="true"
android:paddingBottom="60dp"
android:gravity="center_horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/vector_bookmarks"
/>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="You don't have any bookmarks yet"
android:paddingTop="@dimen/default_margin_big"/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>

View File

@ -1,43 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<oppen.ariane.ui.content_image.TouchImageView
android:id="@+id/image_view"
android:scaleType="centerInside"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
/>
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/default_margin">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/close_image_content_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_close" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/image_overflow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_overflow" />
</RelativeLayout>
</RelativeLayout>

View File

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/default_margin">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/close_text_content_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_close" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/history_overflow"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_overflow" />
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/default_margin"
android:layout_below="@+id/header">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/text_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/default_text_size"
android:textIsSelectable="true"/>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>

View File

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/default_margin">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/close_tab_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_close" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/history_overflow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_overflow" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/history_recycler"
android:layout_below="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>

View File

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/default_margin">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/close_input_query_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_close" />
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/header">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/default_margin_big"
android:paddingRight="@dimen/default_margin_big"
android:paddingBottom="@dimen/default_margin_big"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/query_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/default_margin"
tools:text="Type your query"/>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/query_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/default_margin"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/query_submit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/submit"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>

View File

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:padding="@dimen/default_margin">
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/home_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/set_home_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="Update"
android:layout_below="@+id/home_edit_text"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/use_current_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/set_home_button"
android:text="Use current"
android:layout_below="@+id/home_edit_text"/>
</RelativeLayout>

View File

@ -1,43 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/default_margin"
android:paddingBottom="@dimen/default_margin">
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/close_tab_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_close" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/tab_dialog_overflow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:visibility="gone"
android:layout_margin="@dimen/button_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/vector_overflow" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/tab_dialog_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/header" />
</RelativeLayout>

View File

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.appcompat.widget.Toolbar
android:id="@+id/bookmark_toolbar"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/default_margin"
android:layout_height="@dimen/bar_height"
app:title="Add Bookmark"/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/bookmark_toolbar"
android:padding="@dimen/default_margin_big"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/bookmark_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:lines="1"
android:maxLines="1"/>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/gemini_uri" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/bookmark_uri"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textUri"
android:lines="1"
android:maxLines="1"/>
</androidx.appcompat.widget.LinearLayoutCompat>
</RelativeLayout>

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/screen_margin"
android:layout_marginRight="@dimen/screen_margin"
android:layout_marginTop="@dimen/default_margin"
android:layout_marginBottom="@dimen/default_margin">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/gemtext_text_monospace_textview"
android:textSize="@dimen/code_text_size"
app:lineHeight="@dimen/code_text_size"
app:fontFamily="@font/code_font"
android:fontFamily="@font/code_font"
android:typeface="monospace"
android:textColor="@color/stroke"
android:textIsSelectable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/default_margin"
android:paddingRight="@dimen/default_margin"
android:paddingTop="@dimen/default_margin"
android:paddingBottom="@dimen/default_margin"
android:isScrollContainer="true"
android:overScrollMode="ifContentScrolls"
android:scrollHorizontally="true"
android:scrollbarStyle="insideOverlay"
android:scrollbars="vertical|horizontal"/>
</HorizontalScrollView>

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.AppCompatTextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gemtext_text_textview"
android:textSize="@dimen/h1_text_size"
android:textColor="@color/stroke"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:layout_marginLeft="@dimen/screen_margin"
android:layout_marginRight="@dimen/screen_margin"
android:layout_marginTop="@dimen/default_margin"
android:layout_marginBottom="@dimen/default_margin" />

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.AppCompatTextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gemtext_text_textview"
android:textSize="@dimen/h2_text_size"
android:textColor="@color/stroke"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:layout_marginLeft="@dimen/screen_margin"
android:layout_marginRight="@dimen/screen_margin"
android:layout_marginTop="@dimen/default_margin"
android:layout_marginBottom="@dimen/default_margin" />

Some files were not shown because too many files have changed in this diff Show More