initial code commit
884
COPYING.txt
Normal file
@@ -0,0 +1,884 @@
|
||||
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>.
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
The Material Design icons are Copyright (c) Google Inc., licensed
|
||||
under the Apache License Version 2.0.
|
||||
|
||||
This app uses gradle and the gradle wrapper, Copyright Gradle Inc,
|
||||
licensed under the Apache License Version 2.0.
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
50
README.md
Normal file
@@ -0,0 +1,50 @@
|
||||
Tiny 24h Weather Forecast Germany
|
||||
=================================
|
||||
|
||||
An android app with a widget that presents a 24 hours weather forecast based on the open data of the Deutscher Wetterdienst (DWD).
|
||||
|
||||
How to get the app
|
||||
------------------
|
||||
|
||||
This app is currently in a heavy alpha state, current builds are not available yet - but this will shortly change.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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.
|
||||
|
||||
Tiny 24h Weather Forecast Germany 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 Imagepipe. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Credits
|
||||
-------
|
||||
|
||||
The Material Design icons are Copyright (c) by Google Inc., licensed
|
||||
under the Apache License Version 2.0.
|
||||
|
||||
This app uses gradle and the gradle wrapper, Copyright by Gradle Inc,
|
||||
licensed under the Apache 2.0 license.
|
||||
|
||||
Weather data: Deutscher Wetterdienst, own elements added, some data
|
||||
averaged over individual values.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Please leave comments, bug reports, issues and feature requests at
|
||||
the app repository at codeberg.org:
|
||||
|
||||
https://codeberg.org/Starfish/TinyWeatherForecastGermany
|
||||
|
||||
Alternatively, for suggestions and bug reports, you can contact me
|
||||
by email: pawel (at) kaffeemitkoffein.de
|
45
app/build.gradle
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
|
||||
|
||||
defaultConfig {
|
||||
applicationId "de.kaffeemitkoffein.tiny24hweatherforecastgermany"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
}
|
69
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.kaffeemitkoffein.tinyweatherforecastgermany">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme">
|
||||
<activity android:name="de.kaffeemitkoffein.tinyweatherforecastgermany.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="de.kaffeemitkoffein.tinyweatherforecastgermany.Settings"
|
||||
android:label="@string/title_activity_settings">
|
||||
</activity>
|
||||
<activity
|
||||
android:name="de.kaffeemitkoffein.tinyweatherforecastgermany.LicenseInfo"
|
||||
android:label="@string/app_name">
|
||||
</activity>
|
||||
|
||||
<provider android:authorities="de.kaffeemitkoffein.tinyweatherforecastgermany.weather"
|
||||
android:name="de.kaffeemitkoffein.tinyweatherforecastgermany.WeatherForecastContentProvider"
|
||||
android:grantUriPermissions="false"
|
||||
android:enabled="true"
|
||||
android:exported="false"
|
||||
android:multiprocess="false"
|
||||
android:syncable="false"/>
|
||||
|
||||
<receiver
|
||||
android:name="de.kaffeemitkoffein.tinyweatherforecastgermany.ClassicWidget"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/classicwidget_description">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/classicwidget">
|
||||
</meta-data>
|
||||
</receiver>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
@@ -0,0 +1,221 @@
|
||||
/**
|
||||
* This file is part of Tiny24hWeatherForecastGermany.
|
||||
*
|
||||
* Copyright (c) 2020 Pawel Dube
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.kaffeemitkoffein.tinyweatherforecastgermany;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProvider;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class ClassicWidget extends AppWidgetProvider {
|
||||
|
||||
public static final String WIDGET_CUSTOM_REFRESH_ACTION = "de.kaffeemitkoffein.feinstaubwidget.WIDGET_CUSTOM_ACTION_REFRESH";
|
||||
|
||||
/**
|
||||
* This is called when the widget gets enabled.
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onEnabled(Context c){
|
||||
super.onEnabled(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisabled(Context c){
|
||||
super.onDisabled(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleted(Context c, int[] ints){
|
||||
super.onDisabled(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAppWidgetOptionsChanged(Context c, AppWidgetManager awm, int appWidgetID, Bundle newOptions){
|
||||
Log.v("WIDGET","onAppWidgetOptionsChanged");
|
||||
int[] idarray = new int[appWidgetID];
|
||||
updateWidgetDisplay(c,awm,idarray);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(Context c, AppWidgetManager awm, int[] widget_instances){
|
||||
// get settings and time values
|
||||
WeatherSettings weatherSettings = new WeatherSettings(c);
|
||||
long update_hours = weatherSettings.getUpdateInterval();
|
||||
long time = Calendar.getInstance().getTimeInMillis();
|
||||
// 3 600 000 millisecs = 1 hour
|
||||
WeatherForecastContentProvider weatherForecastContentProvider = new WeatherForecastContentProvider();
|
||||
WeatherCard weatherCard = weatherForecastContentProvider.readWeatherForecast(c);
|
||||
if (weatherCard != null){
|
||||
if (time >= ((update_hours*3600000) + weatherCard.polling_time)) {
|
||||
// trigger a data update
|
||||
launchWeatherDataUpdate(c,awm,widget_instances);
|
||||
} else {
|
||||
// simply refresh display with present data
|
||||
updateWidgetDisplay(c,awm,widget_instances);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This overrides the onReceive method to filter the call to simply update the display of the widgets. The
|
||||
* broadcast is sent by the DataFetcher after a successful data update from the api.
|
||||
*
|
||||
* @param c
|
||||
* @param i
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onReceive(Context c, Intent i){
|
||||
super.onReceive(c, i);
|
||||
if (i != null){
|
||||
String action = i.getAction();
|
||||
if (action.equals(WIDGET_CUSTOM_REFRESH_ACTION)){
|
||||
widgetRefreshAction(c,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the display of the wigdgets.
|
||||
* @param c
|
||||
* @param awm
|
||||
* @param widget_instances
|
||||
*/
|
||||
|
||||
public void updateWidgetDisplay(Context c, AppWidgetManager awm, int[] widget_instances){
|
||||
Log.v("WIDGET","UpdateWidgetDisplay");
|
||||
WeatherForecastContentProvider weatherForecastContentProvider = new WeatherForecastContentProvider();
|
||||
WeatherCard weatherCard = weatherForecastContentProvider.readWeatherForecast(c);
|
||||
WeatherSettings weatherSettings = new WeatherSettings(c);
|
||||
if (weatherCard != null) {
|
||||
WeatherCodeContract weatherCodeContract = new WeatherCodeContract(weatherCard,WeatherCodeContract.WEATHER_TODAY);
|
||||
int weathercondition = weatherCodeContract.getWeatherCondition();
|
||||
for (int i=0; i<widget_instances.length; i++){
|
||||
// sets up a pending intent to launch main activity when the widget is touched.
|
||||
Intent intent = new Intent(c,MainActivity.class);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(c,0,intent,0);
|
||||
RemoteViews remoteViews = new RemoteViews(c.getPackageName(),R.layout.classicwidget_layout);
|
||||
remoteViews.setOnClickPendingIntent(R.id.classicwidget_maincontainer,pendingIntent);
|
||||
remoteViews.setTextViewText(R.id.classicwidget_locationtext,weatherCard.klimagebiet);
|
||||
remoteViews.setTextViewText(R.id.classicwidget_weatherconditiontext,weatherCodeContract.getWeatherConditionText(c,weathercondition));
|
||||
remoteViews.setImageViewResource(R.id.classicwidget_weatherconditionicon,weatherCodeContract.getWeatherConditionDrawableResource(weathercondition));
|
||||
remoteViews.setTextViewText(R.id.classicwidget_temperature,String.valueOf(weatherCard.getCurrentTemp())+"°");
|
||||
remoteViews.setTextViewText(R.id.classicwidget_temperature_highlow,String.valueOf(weatherCard.todaysLow())+ "° | "+String.valueOf(weatherCard.todaysHigh())+"°");
|
||||
remoteViews.setTextViewText(R.id.classicwidget_wind,weatherCard.getCurrentWind()+" ("+ weatherCard.getCurrentFlurries()+") km/h");
|
||||
int opacity = Integer.parseInt(weatherSettings.widget_opacity);
|
||||
remoteViews.setInt(R.id.classicwidget_maincontainer,"setBackgroundColor",getBackgroundInt(opacity));
|
||||
if (weatherSettings.widget_showdwdnote) {
|
||||
remoteViews.setViewVisibility(R.id.classicwidget_reference_text, View.VISIBLE);
|
||||
} else {
|
||||
remoteViews.setViewVisibility(R.id.classicwidget_reference_text, View.GONE);
|
||||
}
|
||||
awm.updateAppWidget(widget_instances[i],remoteViews);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void widgetRefreshAction(Context c, Intent i){
|
||||
AppWidgetManager awm = AppWidgetManager.getInstance(c);
|
||||
int[] wi = awm.getAppWidgetIds(new ComponentName(c,this.getClass().getName()));
|
||||
if (wi.length>0){
|
||||
updateWidgetDisplay(c,awm,wi);
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshWidgetDisplays(Context c){
|
||||
Intent widget_small = new Intent(c,ClassicWidget.class);
|
||||
widget_small.setAction(WIDGET_CUSTOM_REFRESH_ACTION);
|
||||
c.sendBroadcast(widget_small);
|
||||
}
|
||||
|
||||
private void launchWeatherDataUpdate(Context c, AppWidgetManager awm, int[] widget_instances){
|
||||
// read stations list from resources
|
||||
StationsArrayList stationsArrayList = new StationsArrayList(c);
|
||||
// get position of station in arraylist; station is retrieved from settings.
|
||||
int position = stationsArrayList.getSetStationPositionByName(c);
|
||||
// gets station instance
|
||||
Station station = stationsArrayList.stations.get(position);
|
||||
// determines web urls of api
|
||||
URL stationURLs[] = station.getAbsoluteWebURLArray();
|
||||
// Launches an async task for update. The async task will call the widget update if everything
|
||||
// went well and new data is present.
|
||||
DataFetcher dataFetcher = new DataFetcher(c,awm,widget_instances);
|
||||
dataFetcher.execute(stationURLs);
|
||||
}
|
||||
|
||||
public class DataFetcher extends WeatherForecastReader {
|
||||
AppWidgetManager awm_instance = null;
|
||||
int[] appwidget_ids;
|
||||
Context context;
|
||||
|
||||
public DataFetcher(Context c, AppWidgetManager awm, int[] ids){
|
||||
super(c);
|
||||
this.context = c;
|
||||
this.awm_instance = awm;
|
||||
this.appwidget_ids = ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* The onPositiveResult routine is called when the API request of new data was
|
||||
* successful. It triggers a refresh of the display of all widgets.
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onPositiveResult(){
|
||||
refreshWidgetDisplays(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* The onNegativeResult routine generates a runnable that is delayed for WIDGET_CONN_RETRY_DELAY milliseconds.
|
||||
* Then, the widget retries to get data.
|
||||
*
|
||||
* Caution: due to typical garbage collection behaviour of the OS, this post-delayed task is at
|
||||
* risk being garbage-collected at any time and therefore may never be called at all.
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onNegativeResult(){
|
||||
// nothing to do here, as update simply failed. We can ignore this.
|
||||
}
|
||||
}
|
||||
|
||||
private int getBackgroundInt(int alpha){
|
||||
String hex_string = Integer.toHexString(Math.round((float)alpha * (float)2.55));
|
||||
if (hex_string.length()<2)
|
||||
{
|
||||
hex_string = "0" + hex_string;
|
||||
}
|
||||
hex_string = hex_string+"101010";
|
||||
return Color.parseColor("#"+hex_string);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* This file is part of Tiny24hWeatherForecastGermany.
|
||||
*
|
||||
* Copyright (c) 2020 Pawel Dube
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.kaffeemitkoffein.tinyweatherforecastgermany;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class ForecastAdapter extends BaseAdapter {
|
||||
|
||||
private WeatherCard weatherCard;
|
||||
private Context context;
|
||||
LayoutInflater layoutInflater;
|
||||
|
||||
public ForecastAdapter(Context context, WeatherCard weatherCard){
|
||||
this.context = context;
|
||||
this.weatherCard = weatherCard;
|
||||
layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
view = this.layoutInflater.inflate(R.layout.forecastitem,viewGroup,false);
|
||||
// now fill the item with content
|
||||
TextView textView_weathercondition = (TextView) view.findViewById(R.id.fcitem_weatherconditiontext);
|
||||
WeatherCodeContract weatherCodeContract = new WeatherCodeContract(this.weatherCard,i,i);
|
||||
int weathercondition = weatherCodeContract.getWeatherCondition();
|
||||
// heading
|
||||
TextView textView_heading = (TextView) view.findViewById(R.id.fcitem_heading);
|
||||
textView_heading.setText(weatherCard.uhrzeit[i]+":00");
|
||||
// left column
|
||||
textView_weathercondition.setText(weatherCodeContract.getWeatherConditionText(context,weathercondition));
|
||||
TextView textView_clouds = (TextView) view.findViewById(R.id.fcitem_clouds);
|
||||
textView_clouds.setText(context.getResources().getString(R.string.clouds)+" "+weatherCard.bewoelkung[i]+" ("+weatherCard.bewoelkung_min[i]+" - "+weatherCard.bewoelkung_max[i]+")");
|
||||
TextView textView_rain = (TextView) view.findViewById(R.id.fcitem_rain);
|
||||
textView_rain.setText(context.getResources().getString(R.string.rain)+" "+weatherCard.getNumbers(weatherCard.niederschlag[i])+" ("+weatherCard.getNumbers(weatherCard.niederschlag_min[i])+" - "+weatherCard.getNumbers(weatherCard.niederschlag_max[i])+")");
|
||||
// weather icon
|
||||
ImageView weather_icon = (ImageView) view.findViewById(R.id.fcitem_weatherconditionicon);
|
||||
weather_icon.setImageDrawable(weatherCodeContract.getWeatherConditionDrawable(context,weathercondition));
|
||||
// right column
|
||||
TextView textView_temp = (TextView) view.findViewById(R.id.fcitem_temperature);
|
||||
textView_temp.setText(weatherCard.lufttemperatur[i]+"°");
|
||||
TextView textView_highlow = (TextView) view.findViewById(R.id.fcitem_temperature_highlow);
|
||||
textView_highlow.setText(weatherCard.lufttemperatur_min[i]+"° | "+weatherCard.lufttemperatur_max[i]+"°");
|
||||
TextView textView_wind = (TextView) view.findViewById(R.id.fcitem_wind);
|
||||
textView_wind.setText(weatherCard.wind[i]+" ("+weatherCard.boeen[i]+") km/h");
|
||||
return view;
|
||||
}
|
||||
}
|
@@ -0,0 +1,76 @@
|
||||
package de.kaffeemitkoffein.tinyweatherforecastgermany;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
import android.content.Intent;
|
||||
/**
|
||||
* This file is part of Tiny24hWeatherForecastGermany.
|
||||
*
|
||||
* Copyright (c) 2020 Pawel Dube
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
|
||||
public class LicenseInfo extends Activity implements View.OnClickListener {
|
||||
private Button button_back;
|
||||
public static final String DATA_TITLE="DATA_TITLE";
|
||||
public static final String DATA_TEXTRESOURCE="DATA_TEXTRESOURCE";
|
||||
public static final String DATA_BUTTONTEXT="DATA_BUTTONTEXT";
|
||||
|
||||
@Override
|
||||
protected void onCreate (Bundle bundle){
|
||||
super.onCreate(bundle);
|
||||
displayInfo();
|
||||
}
|
||||
|
||||
private void displayInfo(){
|
||||
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.licenseinfo);
|
||||
TextView title = (TextView) findViewById(R.id.infoTitle);
|
||||
TextView textview = (TextView) findViewById(R.id.infoTextView);
|
||||
button_back = (Button) findViewById(R.id.info_button_back);
|
||||
Intent intent = getIntent();
|
||||
title.setText(intent.getExtras().getString(DATA_TITLE,""));
|
||||
button_back.setText(intent.getExtras().getString(DATA_BUTTONTEXT,""));
|
||||
button_back.setOnClickListener(this);
|
||||
String textfile = intent.getExtras().getString(DATA_TEXTRESOURCE,"");
|
||||
InputStream inputStream = getResources().openRawResource(getResources().getIdentifier(textfile,"raw",getApplicationContext().getPackageName()));
|
||||
try {
|
||||
int size = inputStream.available();
|
||||
byte[] textdata = new byte[size];
|
||||
inputStream.read(textdata);
|
||||
inputStream.close();
|
||||
String text = new String(textdata);
|
||||
textview.setText(text);
|
||||
} catch (IOException e) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view){
|
||||
if (view==button_back){
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,309 @@
|
||||
/**
|
||||
* This file is part of Tiny24hWeatherForecastGermany.
|
||||
*
|
||||
* Copyright (c) 2020 Pawel Dube
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.kaffeemitkoffein.tinyweatherforecastgermany;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.app.*;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.*;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
public class MainActivity extends Activity implements AdapterView.OnItemSelectedListener {
|
||||
|
||||
private ArrayList<String> stationNames = new ArrayList<String>();
|
||||
private StationsArrayList stationsArrayList;
|
||||
int spinner_initial_position;
|
||||
SharedPreferences.OnSharedPreferenceChangeListener preferenceChangeListener;
|
||||
private Dialog aboutDialog;
|
||||
|
||||
@Override
|
||||
protected void onPause(){
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume(){
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
final WeatherSettings weatherSettings = new WeatherSettings(this);
|
||||
if (weatherSettings.is_weatherprovider) {
|
||||
TextView infotext = (TextView) findViewById(R.id.main_selectstation_text);
|
||||
infotext.setText(R.string.main_isprovider);
|
||||
}
|
||||
final Context context = getApplicationContext();
|
||||
preferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
|
||||
// update widgets
|
||||
Intent intent = new Intent(context,ClassicWidget.class);
|
||||
intent.setAction(ClassicWidget.WIDGET_CUSTOM_REFRESH_ACTION);
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
};
|
||||
weatherSettings.sharedPreferences.registerOnSharedPreferenceChangeListener(preferenceChangeListener);
|
||||
stationsArrayList = new StationsArrayList(this);
|
||||
stationNames = stationsArrayList.getStringArrayListOfNames();
|
||||
Spinner stationsSpinner = (Spinner) findViewById(R.id.stations_spinner);
|
||||
stationsSpinner.setOnItemSelectedListener(this);
|
||||
ArrayAdapter<String> stationAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,stationNames);
|
||||
stationAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
stationsSpinner.setAdapter(stationAdapter);
|
||||
spinner_initial_position = getPositionInStationNames(weatherSettings.station);
|
||||
if (spinner_initial_position != -1){
|
||||
stationsSpinner.setSelection(spinner_initial_position);
|
||||
}
|
||||
WeatherCard weatherCard = new WeatherForecastContentProvider().readWeatherForecast(getApplicationContext());
|
||||
// get new data from api or display present data.
|
||||
if (weatherCard != null){
|
||||
if (UpdateChecker.eligibleForForecastUpdate(getApplicationContext())){
|
||||
getWeatherForecast();
|
||||
} else {
|
||||
displayWeatherForecast(weatherCard);
|
||||
}
|
||||
} else {
|
||||
getWeatherForecast();
|
||||
}
|
||||
}
|
||||
|
||||
private int getPositionInStationNames(String s){
|
||||
for (int i = 0; i<stationNames.size();i++){
|
||||
if (s.equals(stationNames.get(i))){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void Log(String s){
|
||||
Log.v("ID",s);
|
||||
}
|
||||
|
||||
public void displayWeatherForecast(WeatherCard weatherCard){
|
||||
// listview
|
||||
ListView weatherList = (ListView) findViewById(R.id.main_listview);
|
||||
ForecastAdapter forecastAdapter = new ForecastAdapter(getApplicationContext(),weatherCard);
|
||||
weatherList.setAdapter(forecastAdapter);
|
||||
// Upate the widgets, so that everything displays the same
|
||||
Intent intent = new Intent(this,ClassicWidget.class);
|
||||
intent.setAction(ClassicWidget.WIDGET_CUSTOM_REFRESH_ACTION);
|
||||
sendBroadcast(intent);
|
||||
// Logs
|
||||
Log("***************************");
|
||||
Log("Ausgegeben am "+weatherCard.ausgegeben_am);
|
||||
Log("Ausgegeben von "+weatherCard.ausgegeben_von);
|
||||
Log("Code1: "+weatherCard.fdat);
|
||||
Log("Code2: "+weatherCard.ortscode);
|
||||
Log("Klimagebiet: "+weatherCard.klimagebiet);
|
||||
Log("Zeitstempel: "+weatherCard.zeitstempel);
|
||||
String s="";
|
||||
for (int i=0; i<9; i++){
|
||||
s = s + weatherCard.uhrzeit[i]+" ";
|
||||
}
|
||||
Log("Uhrzeit : "+s);
|
||||
s="";
|
||||
for (int i=0; i<9; i++){
|
||||
s = s + weatherCard.bewoelkung_max[i]+" ";
|
||||
}
|
||||
Log("Bewoelkung (max) : "+s);
|
||||
s="";
|
||||
for (int i=0; i<9; i++){
|
||||
s = s + weatherCard.bewoelkung[i]+" ";
|
||||
}
|
||||
Log("Bewoelkung : "+s);
|
||||
s="";
|
||||
for (int i=0; i<9; i++){
|
||||
s = s + weatherCard.bewoelkung_min[i]+" ";
|
||||
}
|
||||
Log("Bewoelkung (min) : "+s);
|
||||
s="";
|
||||
for (int i=0; i<9; i++){
|
||||
s = s + weatherCard.niederschlag_max[i]+" ";
|
||||
}
|
||||
Log("Niederschlag (max) : "+s);
|
||||
s="";
|
||||
for (int i=0; i<9; i++){
|
||||
s = s + weatherCard.niederschlag[i]+" ";
|
||||
}
|
||||
Log("Niederschlag : "+s);
|
||||
s="";
|
||||
for (int i=0; i<9; i++){
|
||||
s = s + weatherCard.niederschlag_min[i]+" ";
|
||||
}
|
||||
Log("Niederschlag (min) : "+s);
|
||||
s="";
|
||||
for (int i=0; i<9; i++){
|
||||
s = s + weatherCard.lufttemperatur_max[i]+" ";
|
||||
}
|
||||
Log("Temperatur (max) : "+s);
|
||||
s="";
|
||||
for (int i=0; i<9; i++){
|
||||
s = s + weatherCard.lufttemperatur[i]+" ";
|
||||
}
|
||||
Log("Temperatur : "+s);
|
||||
s="";
|
||||
for (int i=0; i<9; i++){
|
||||
s = s + weatherCard.lufttemperatur_min[i]+" ";
|
||||
}
|
||||
Log("Temperatur (min) : "+s);
|
||||
s="";
|
||||
for (int i=0; i<9; i++){
|
||||
s = s + weatherCard.wind[i]+" ";
|
||||
}
|
||||
Log("Wind : "+s);
|
||||
s="";
|
||||
for (int i=0; i<9; i++){
|
||||
s = s + weatherCard.boeen[i]+" ";
|
||||
}
|
||||
Log("Boeen : "+s);
|
||||
Log("***************************");
|
||||
// Test
|
||||
WeatherCodeContract weatherCodeContractNow = new WeatherCodeContract(weatherCard,0);
|
||||
Log("Today: "+weatherCodeContractNow.getWeatherCondition());
|
||||
WeatherCodeContract weatherCodeContractTomorrow = new WeatherCodeContract(weatherCard,0);
|
||||
Log("Tomorrow: "+weatherCodeContractTomorrow.getWeatherCondition());
|
||||
}
|
||||
|
||||
public void displayWeatherForecast(){
|
||||
WeatherForecastContentProvider weatherForecastContentProvider = new WeatherForecastContentProvider();
|
||||
WeatherCard weatherCard = weatherForecastContentProvider.readWeatherForecast(this);
|
||||
displayWeatherForecast(weatherCard);
|
||||
}
|
||||
|
||||
|
||||
public void getWeatherForecast(){
|
||||
Log("GETTING WEATHER FORCAST ****");
|
||||
int position = stationsArrayList.getSetStationPositionByName(getApplicationContext());
|
||||
Station station = stationsArrayList.stations.get(position);
|
||||
URL stationURLs[] = station.getAbsoluteWebURLArray();
|
||||
final WeatherCard weatherCardArray[] = {new WeatherCard()};
|
||||
final Context context = this;
|
||||
WeatherForecastReader weatherForecastReader = new WeatherForecastReader(getApplicationContext()){
|
||||
@Override
|
||||
public void onPositiveResult(WeatherCard wc){
|
||||
displayWeatherForecast(wc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegativeResult(){
|
||||
Log("*** GETTING FROM WEB FAILED.");
|
||||
}
|
||||
|
||||
};
|
||||
weatherForecastReader.execute(stationURLs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int pos, long l) {
|
||||
Log.v("ID","RESPONSE DETECTED");
|
||||
WeatherSettings weatherSettings = new WeatherSettings(getApplicationContext());
|
||||
if (!weatherSettings.is_weatherprovider){
|
||||
// save options & get data if new item is different from previous station.
|
||||
if (!weatherSettings.station.equals(stationNames.get(pos))){
|
||||
weatherSettings.station = stationNames.get(pos);
|
||||
weatherSettings.savePreferences();
|
||||
Toast.makeText(getApplicationContext(),getApplicationContext().getResources().getText(R.string.new_station)+" "+stationNames.get(pos),Toast.LENGTH_LONG).show();
|
||||
getWeatherForecast();
|
||||
} else {
|
||||
// do nothing, as new station is old station.
|
||||
}
|
||||
} else {
|
||||
// if this app is the registered lineageos weather provider service, set spinner back to the weather
|
||||
// location set by the system.
|
||||
Spinner stationsSpinner = (Spinner) findViewById(R.id.stations_spinner);
|
||||
stationsSpinner.setSelection(spinner_initial_position);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
// nothing to do here.
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu){
|
||||
MenuInflater mi = getMenuInflater();
|
||||
mi.inflate(R.menu.main_activity,menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem mi){
|
||||
int item_id = mi.getItemId();
|
||||
if (item_id == R.id.menu_refresh){
|
||||
getWeatherForecast();
|
||||
return true;
|
||||
}
|
||||
if (item_id == R.id.menu_settings) {
|
||||
Intent i = new Intent(this, Settings.class);
|
||||
startActivity(i);
|
||||
return true;
|
||||
}
|
||||
if (item_id==R.id.menu_license) {
|
||||
Intent i = new Intent(this, LicenseInfo.class);
|
||||
i.putExtra(LicenseInfo.DATA_TITLE, getResources().getString(R.string.license_title));
|
||||
i.putExtra(LicenseInfo.DATA_TEXTRESOURCE, "license");
|
||||
i.putExtra(LicenseInfo.DATA_BUTTONTEXT,getResources().getString(R.string.button_continue));
|
||||
startActivity(i);
|
||||
return true;
|
||||
}
|
||||
if (item_id == R.id.menu_about) {
|
||||
showAboutDialog();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(mi);
|
||||
}
|
||||
|
||||
public void showAboutDialog(){
|
||||
aboutDialog = new Dialog(this);
|
||||
aboutDialog.setContentView(R.layout.aboutdialog);
|
||||
aboutDialog.setTitle(getResources().getString(R.string.app_name));
|
||||
aboutDialog.setCancelable(true);
|
||||
String versioning = BuildConfig.VERSION_NAME + " (build "+BuildConfig.VERSION_CODE+")";
|
||||
Button contbutton = (Button) aboutDialog.findViewById(R.id.about_button);
|
||||
contbutton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v){
|
||||
aboutDialog.dismiss();
|
||||
}
|
||||
});
|
||||
aboutDialog.show();
|
||||
TextView textView = (TextView) aboutDialog.findViewById(R.id.about_textview);
|
||||
textView.setText(getApplicationContext().getResources().getString(R.raw.license));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* This file is part of Tiny24hWeatherForecastGermany.
|
||||
*
|
||||
* Copyright (c) 2020 Pawel Dube
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.kaffeemitkoffein.tinyweatherforecastgermany;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
public class Settings extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener{
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle){
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
updateValuesDisplay();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume(){
|
||||
super.onResume();
|
||||
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause(){
|
||||
super.onPause();
|
||||
getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
private void updateValuesDisplay(){
|
||||
SharedPreferences sp= PreferenceManager.getDefaultSharedPreferences(this);
|
||||
Preference p;
|
||||
}
|
||||
|
||||
public void onSharedPreferenceChanged(SharedPreferences sp, String id){
|
||||
updateValuesDisplay();
|
||||
}
|
||||
}
|
@@ -0,0 +1,131 @@
|
||||
/**
|
||||
* This file is part of Tiny24hWeatherForecastGermany.
|
||||
*
|
||||
* Copyright (c) 2020 Pawel Dube
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.kaffeemitkoffein.tinyweatherforecastgermany;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.net.URL;
|
||||
import java.util.Comparator;
|
||||
|
||||
public class Station implements Comparator<Station> {
|
||||
private String name;
|
||||
private String code1;
|
||||
private String code2;
|
||||
|
||||
public final static String BASICWEBURL="https://opendata.dwd.de/weather/text_forecasts/tables/";
|
||||
|
||||
public Station() {
|
||||
this.name = "";
|
||||
this.code1 = "";
|
||||
this.code2 = "";
|
||||
}
|
||||
|
||||
public Station(String code1, String code2, String name) {
|
||||
this.name = name;
|
||||
this.code1 = code1;
|
||||
this.code2 = code2;
|
||||
}
|
||||
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setCode1(String code1){
|
||||
this.code1 = code1;
|
||||
}
|
||||
|
||||
public void setCode2(String code1){
|
||||
this.code2 = code2;
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getCode1(){
|
||||
return this.code1;
|
||||
}
|
||||
|
||||
public String getCode2(){
|
||||
return this.code2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an arraylist of strings that hold all the possible forecast web urls, starting with the most recent possibility.
|
||||
* Does not roll back to the previous day, assuming that there will be a forecast made at 00:00 at least.
|
||||
* @return
|
||||
*/
|
||||
|
||||
public ArrayList<String> getAbsoluteWebURLStringArrayList(){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
String day_of_month = String.valueOf(calendar.get(Calendar.DAY_OF_MONTH));
|
||||
if (day_of_month.length()<2) {
|
||||
day_of_month = "0" + day_of_month;
|
||||
}
|
||||
int hour = calendar.get(Calendar.HOUR_OF_DAY);
|
||||
ArrayList<String> hourlist = new ArrayList<String>();
|
||||
while (hour>=0){
|
||||
String hour_string = String.valueOf(hour);
|
||||
if (hour_string.length()<2){
|
||||
hour_string = "0" + hour_string;
|
||||
}
|
||||
hourlist.add(this.BASICWEBURL+this.code1+"_"+this.code2+"_"+day_of_month+hour_string+"00");
|
||||
hour--;
|
||||
}
|
||||
return hourlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an arraylist of Urls that hold all the possible forecast web urls, starting with the most recent possibility.
|
||||
* Does not roll back to the previous day, assuming that there will be a forecast made at 00:00 at least.
|
||||
* @return
|
||||
*/
|
||||
|
||||
public ArrayList<URL> getAbsoluteWebURLArrayList(){
|
||||
ArrayList<String> url_strings = new ArrayList<String>();
|
||||
ArrayList<URL> urls = new ArrayList<URL>();
|
||||
url_strings = getAbsoluteWebURLStringArrayList();
|
||||
for (int i=0; i<url_strings.size(); i++){
|
||||
try {
|
||||
URL u = new URL(url_strings.get(i));
|
||||
urls.add(u);
|
||||
} catch (MalformedURLException e){
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
|
||||
public URL[] getAbsoluteWebURLArray(){
|
||||
ArrayList<URL> url_list = getAbsoluteWebURLArrayList();
|
||||
URL url_array[] = new URL[24];
|
||||
for (int i=0; i<url_list.size(); i++){
|
||||
url_array[i]=url_list.get(i);
|
||||
}
|
||||
return url_array;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compare(Station s1, Station s2) {
|
||||
return s1.getName().compareTo(s2.getName());
|
||||
}
|
||||
}
|
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* This file is part of Tiny24hWeatherForecastGermany.
|
||||
*
|
||||
* Copyright (c) 2020 Pawel Dube
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.kaffeemitkoffein.tinyweatherforecastgermany;
|
||||
|
||||
import android.content.Context;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
public class StationListReader {
|
||||
|
||||
private final String STATIONSRESOURCE="stations.txt";
|
||||
private Context context;
|
||||
|
||||
public StationListReader(Context context){
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
private String getStationsStringFromResource(){
|
||||
// InputStream inputStream = context.getResources().openRawResource(context.getResources().getIdentifier(STATIONSRESOURCE,"raw",context.getApplicationContext().getPackageName()));
|
||||
InputStream inputStream = context.getResources().openRawResource(R.raw.stations);
|
||||
try {
|
||||
int size = inputStream.available();
|
||||
byte[] textdata = new byte[size];
|
||||
inputStream.read(textdata);
|
||||
inputStream.close();
|
||||
String text = new String(textdata);
|
||||
return text;
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<Station> getStations(){
|
||||
ArrayList<Station> stations = new ArrayList<Station>();
|
||||
String s = getStationsStringFromResource();
|
||||
while (s.length()>0){
|
||||
// cut out the station separated by ";"
|
||||
int pos = s.indexOf(";");
|
||||
if (pos != -1){
|
||||
// Log.v("ID:","Trying to string: "+pos);
|
||||
String station_string = s.substring(0,pos);
|
||||
// cut away this station from the main string
|
||||
s = s.substring(pos+1);
|
||||
// cut out code1 that ends with the 1st ":"
|
||||
int station_pos1 = station_string.indexOf(":");
|
||||
String code1 = station_string.substring(0,station_pos1);
|
||||
station_string = station_string.substring(station_pos1+1);
|
||||
// cut out code2 that ends with the 2nd ":"
|
||||
int station_pos2 = station_string.indexOf(":");
|
||||
String code2 = station_string.substring(0,station_pos2);
|
||||
// cut out the station name. This is what remains after the 2nd ":".
|
||||
String name = station_string.substring(station_pos2+1);
|
||||
Station station = new Station(code1,code2,name);
|
||||
stations.add(station);
|
||||
// Log.v("ID:",station.getCode1()+"|"+station.getCode2()+"|"+station.getName());
|
||||
} else {
|
||||
// failsafe if source file is broken or chars occur after last item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Collections.sort(stations, new Station());
|
||||
return stations;
|
||||
}
|
||||
|
||||
public ArrayList<String> getStationNames(){
|
||||
ArrayList<Station> stations = getStations();
|
||||
ArrayList<String> names = new ArrayList<String>();
|
||||
for (int i=0; i<stations.size(); i++){
|
||||
Station station = stations.get(i);
|
||||
names.add(station.getName());
|
||||
}
|
||||
return names;
|
||||
}
|
||||
}
|
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* This file is part of Tiny24hWeatherForecastGermany.
|
||||
*
|
||||
* Copyright (c) 2020 Pawel Dube
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.kaffeemitkoffein.tinyweatherforecastgermany;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class StationsArrayList {
|
||||
|
||||
public ArrayList<Station> stations = new ArrayList<Station>();
|
||||
private Context context;
|
||||
|
||||
/**
|
||||
* Public constructor. Needs the context.
|
||||
* @param context
|
||||
*/
|
||||
|
||||
public StationsArrayList(Context context){
|
||||
this.context = context;
|
||||
StationListReader stationListReader = new StationListReader(context);
|
||||
stations = stationListReader.getStations();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the position of a specific station by name. Returns position or -1 if the station name does
|
||||
* not exist in the stations list.
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
|
||||
public int getStationPositionByName(String name){
|
||||
for (int i=0; i<stations.size(); i++){
|
||||
if (stations.get(i).getName().equals(name)){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the position of the set up station.
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
|
||||
public int getSetStationPositionByName(Context context){
|
||||
WeatherSettings weatherSettings = new WeatherSettings(context);
|
||||
return getStationPositionByName(weatherSettings.station);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an arraylist of the station names in the same order like in this class.
|
||||
* @return
|
||||
*/
|
||||
|
||||
public ArrayList<String> getStringArrayListOfNames(){
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
for (int i=0; i<stations.size(); i++){
|
||||
result.add(stations.get(i).getName());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* This file is part of Tiny24hWeatherForecastGermany.
|
||||
*
|
||||
* Copyright (c) 2020 Pawel Dube
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.kaffeemitkoffein.tinyweatherforecastgermany;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
public class UpdateChecker {
|
||||
|
||||
public UpdateChecker(){
|
||||
// nothing to do here.
|
||||
}
|
||||
|
||||
public static boolean eligibleForForecastUpdate(Context c) {
|
||||
// get settings and time values
|
||||
WeatherSettings weatherSettings = new WeatherSettings(c);
|
||||
long update_hours = weatherSettings.getUpdateInterval();
|
||||
long time = Calendar.getInstance().getTimeInMillis();
|
||||
// 3 600 000 millisecs = 1 hour
|
||||
WeatherForecastContentProvider weatherForecastContentProvider = new WeatherForecastContentProvider();
|
||||
WeatherCard weatherCard = weatherForecastContentProvider.readWeatherForecast(c);
|
||||
if (weatherCard != null) {
|
||||
if (time >= ((update_hours * 3600000) + weatherCard.polling_time)) {
|
||||
// update data because data too old
|
||||
return true;
|
||||
} else {
|
||||
// no update necessary
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// update because no data present
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,468 @@
|
||||
/**
|
||||
* This file is part of Tiny24hWeatherForecastGermany.
|
||||
*
|
||||
* Copyright (c) 2020 Pawel Dube
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.kaffeemitkoffein.tinyweatherforecastgermany;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Matrix;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WeatherCard {
|
||||
|
||||
public String fdat; // e.g. FDAT84
|
||||
public String ortscode; // e.g. JJPD
|
||||
public String zeitstempel; // e.g. 150500
|
||||
public String klimagebiet; // e.g. Niederlausitz
|
||||
public String ausgegeben_am; // e.g. Sonntag, den 15.03.2020 um 07:15 Uhr
|
||||
public String ausgegeben_von; // e.g. Deutscher Wetterdienst
|
||||
public String[] uhrzeit; // e.g. 10
|
||||
public String[] bewoelkung;
|
||||
public String[] bewoelkung_max;
|
||||
public String[] bewoelkung_min;
|
||||
public String[] niederschlag;
|
||||
public String[] niederschlag_max;
|
||||
public String[] niederschlag_min;
|
||||
public String[] lufttemperatur;
|
||||
public String[] lufttemperatur_max;
|
||||
public String[] lufttemperatur_min;
|
||||
public String[] wind;
|
||||
public String[] boeen;
|
||||
public long polling_time;
|
||||
|
||||
public WeatherCard(){
|
||||
initEmptyClassValues();
|
||||
}
|
||||
|
||||
public WeatherCard(ArrayList<String> weatherText){
|
||||
/**
|
||||
* Known abbrevations:
|
||||
* R = Regen
|
||||
* SR= Schneeregen
|
||||
* S = Schnee
|
||||
*/
|
||||
if (weatherText==null){
|
||||
initEmptyClassValues();
|
||||
} else
|
||||
if (weatherText.size()<26){
|
||||
initEmptyClassValues();
|
||||
} else {
|
||||
String s;
|
||||
// get filename elements
|
||||
s = weatherText.get(0);
|
||||
this.fdat = s.substring(0,5);
|
||||
Log.v("WEATHERCARD","fdat:"+this.fdat+"<");
|
||||
this.ortscode = s.substring(7,11);
|
||||
Log.v("WEATHERCARD","fdat:"+this.ortscode+"<");
|
||||
this.zeitstempel = s.substring(12,18);
|
||||
Log.v("WEATHERCARD","fdat:"+this.zeitstempel+"<");
|
||||
// get weather area in readable text
|
||||
s = weatherText.get(3);
|
||||
this.klimagebiet = truncateSpaces( s.substring(15) );
|
||||
Log.v("WEATHERCARD","Klimagebiet:"+this.klimagebiet+"<");
|
||||
if (this.klimagebiet.contains("Hoehen")){
|
||||
int hp = this.klimagebiet.indexOf("Hoehen");
|
||||
this.klimagebiet = this.klimagebiet.substring(0,hp-1);
|
||||
this.klimagebiet = this.klimagebiet.trim();
|
||||
}
|
||||
s = weatherText.get(4);
|
||||
this.ausgegeben_am = truncateSpaces( s.substring(15) );
|
||||
Log.v("WEATHERCARD","am :"+this.ausgegeben_am+"<");
|
||||
s = weatherText.get(5);
|
||||
this.ausgegeben_von = truncateSpaces( s.substring(15) );
|
||||
Log.v("WEATHERCARD","von :"+this.ausgegeben_von+"<");
|
||||
s = weatherText.get(7);
|
||||
Log.v("WEATHERCARD","Timeline String:"+s);
|
||||
this.uhrzeit = getValuesFromLine(15,weatherText.get(7),2);
|
||||
|
||||
this.bewoelkung_max = getValuesFromLine(16,weatherText.get(9),1);
|
||||
this.bewoelkung = getValuesFromLine(16,weatherText.get(10),1);
|
||||
this.bewoelkung_min = getValuesFromLine(16,weatherText.get(11),1);
|
||||
|
||||
this.niederschlag_max = getValuesFromLine(14,weatherText.get(13),3);
|
||||
this.niederschlag = getValuesFromLine(14,weatherText.get(14),3);
|
||||
this.niederschlag_min = getValuesFromLine(14,weatherText.get(15),3);
|
||||
|
||||
this.lufttemperatur_max = getValuesFromLine(14,weatherText.get(18),3);
|
||||
this.lufttemperatur = getValuesFromLine(14,weatherText.get(19),3);
|
||||
|
||||
Log.v("WEATHERCARD","Temp min line:"+weatherText.get(20));
|
||||
this.lufttemperatur_min = getValuesFromLine(14,weatherText.get(20),3);
|
||||
for (int i=0; i<9; i++){
|
||||
Log.v("WEATHERCARD", "Value "+i+"=>"+this.lufttemperatur_min[i]);
|
||||
}
|
||||
this.wind = getValuesFromLine(13,weatherText.get(22),4);
|
||||
this.boeen = getValuesFromLine(14,weatherText.get(23),3);
|
||||
}
|
||||
}
|
||||
|
||||
public WeatherCard(Context context, String filename){
|
||||
File file = new File(context.getExternalFilesDir(null)+"/"+filename);
|
||||
FileInputStream fileInputStream;
|
||||
String line;
|
||||
ArrayList<String> file_content = new ArrayList<String>();
|
||||
try {
|
||||
fileInputStream = new FileInputStream(file);
|
||||
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream);
|
||||
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
|
||||
line=bufferedReader.readLine();
|
||||
while (line != null) {
|
||||
file_content.add(line);
|
||||
try {
|
||||
line = bufferedReader.readLine();
|
||||
} catch (Exception IOException) {
|
||||
line = null;
|
||||
}
|
||||
}
|
||||
} catch (Exception IOException){
|
||||
initEmptyClassValues();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isValidDataChar(char c){
|
||||
String s = String.valueOf(c);
|
||||
if (s.equals("0") || s.equals("1") ||s.equals("2") ||s.equals("3") ||s.equals("4") ||s.equals("5") ||s.equals("6") ||s.equals("7") ||s.equals("8") ||s.equals("9") ||
|
||||
s.equals("S") ||s.equals("W") ||s.equals("O") ||s.equals("N") || s.equals("C")|| s.equals("R")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isNumber(char c){
|
||||
String s = String.valueOf(c);
|
||||
if (s.equals("0") || s.equals("1") ||s.equals("2") ||s.equals("3") ||s.equals("4") ||s.equals("5") ||s.equals("6") ||s.equals("7") ||s.equals("8") ||s.equals("9")){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String truncateSpaces(String s){
|
||||
/**
|
||||
String s = s1;
|
||||
Log.v("STR","Value>"+s+"<");
|
||||
if (s==null){
|
||||
return s;
|
||||
}
|
||||
if (s.length()==0){
|
||||
return s;
|
||||
}
|
||||
while (!isValidDataChar(s.charAt(0))) {
|
||||
s = s.substring(1);
|
||||
}
|
||||
Log.v("STR","Resul>"+s+"<");
|
||||
**/
|
||||
return s.trim();
|
||||
}
|
||||
|
||||
private String[] getValuesFromLine(int start, String line, int value_width){
|
||||
String[] results = new String[9];
|
||||
for (int i=0; i<9; i++){
|
||||
results[i]=line.substring(start + i*7, start + i*7 + value_width).trim();
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private void initEmptyClassValues(){
|
||||
fdat = "";
|
||||
ortscode = "";
|
||||
zeitstempel = "";
|
||||
klimagebiet = "";
|
||||
ausgegeben_am = "";
|
||||
ausgegeben_von = "";
|
||||
uhrzeit = new String[9];
|
||||
bewoelkung = new String[9];
|
||||
bewoelkung_max = new String[9];
|
||||
bewoelkung_min = new String[9];
|
||||
niederschlag = new String[9];
|
||||
niederschlag_max = new String[9];
|
||||
niederschlag_min = new String[9];
|
||||
lufttemperatur = new String[9];
|
||||
lufttemperatur_max = new String[9];
|
||||
lufttemperatur_min = new String[9];
|
||||
wind = new String[9];
|
||||
boeen = new String[9];
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return this.klimagebiet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current temperature.
|
||||
* @return
|
||||
*/
|
||||
|
||||
public double getCurrentTemp(){
|
||||
int i = Integer.parseInt(this.lufttemperatur[0]);
|
||||
double d = i;
|
||||
return d;
|
||||
}
|
||||
|
||||
public String getNumbers(String s){
|
||||
// elimate non-number chars from the beginning of s
|
||||
while (!isNumber(s.charAt(0))){
|
||||
s = s.substring(1);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
public int[] getIntArray(String[] s){
|
||||
// elimate non-number chars from the beginning of s
|
||||
for (int i=0; i<s.length; i++){
|
||||
while (!isNumber(s[i].charAt(0))){
|
||||
s[i] = s[i].substring(1);
|
||||
}
|
||||
}
|
||||
// convert to int
|
||||
int[] result = new int[9];
|
||||
for (int i=0; i<s.length; i++){
|
||||
result[i] = Integer.parseInt(s[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int[] getIntArray(String[] s, int start, int stop){
|
||||
// elimate non-number chars from the beginning of s
|
||||
for (int i=0; i<s.length; i++){
|
||||
while (!isNumber(s[i].charAt(0))){
|
||||
s[i] = s[i].substring(1);
|
||||
}
|
||||
}
|
||||
// convert to int
|
||||
int[] result = new int[9];
|
||||
for (int i=start; (i<s.length) && (i<=stop); i++){
|
||||
result[i] = Integer.parseInt(s[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the position in the arrays which is the last forecast for the current day.
|
||||
* @return
|
||||
*/
|
||||
|
||||
public int getEndOfTodayPos(){
|
||||
int[] times = getIntArray(this.uhrzeit);
|
||||
int time = times[0];
|
||||
int i = 1;
|
||||
while ((i<9) && (times[i]>time)){
|
||||
i++;
|
||||
}
|
||||
// go one back so i will be the last record of the current day
|
||||
i--;
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns highest temperture of the next 24h.
|
||||
* @return
|
||||
*/
|
||||
|
||||
public double todaysHigh(){
|
||||
int[] tempmax = getIntArray(this.lufttemperatur_max);
|
||||
int result = tempmax[0];
|
||||
for (int i=1; i<getEndOfTodayPos(); i++){
|
||||
if (tempmax[i]>result){
|
||||
result = tempmax[i];
|
||||
}
|
||||
}
|
||||
double d = result;
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the lowest temperture of the next 24h.
|
||||
* @return
|
||||
*/
|
||||
|
||||
public double todaysLow(){
|
||||
int[] tempmin = getIntArray(this.lufttemperatur_min);
|
||||
int result = tempmin[0];
|
||||
for (int i=1; i<getEndOfTodayPos(); i++){
|
||||
if (tempmin[i]<result){
|
||||
result = tempmin[i];
|
||||
}
|
||||
}
|
||||
double d = result;
|
||||
return d;
|
||||
}
|
||||
|
||||
public double tomorrowLow(){
|
||||
int[] tempmin = getIntArray(this.lufttemperatur_min);
|
||||
int result = tempmin[getEndOfTodayPos()];
|
||||
for (int i=getEndOfTodayPos(); i<9; i++){
|
||||
if (tempmin[i]<result){
|
||||
result = tempmin[i];
|
||||
}
|
||||
}
|
||||
double d = result;
|
||||
return d;
|
||||
}
|
||||
|
||||
public double tomorrowHigh(){
|
||||
int[] tempmax = getIntArray(this.lufttemperatur_max);
|
||||
int result = tempmax[getEndOfTodayPos()];
|
||||
for (int i=getEndOfTodayPos(); i<9; i++){
|
||||
if (tempmax[i]>result){
|
||||
result = tempmax[i];
|
||||
}
|
||||
}
|
||||
double d = result;
|
||||
return d;
|
||||
}
|
||||
|
||||
public String getWindDir(String s){
|
||||
Character c = s.charAt(1);
|
||||
String result = "";
|
||||
if (Character.isDigit(s.charAt(1))) {
|
||||
// one char wind code
|
||||
result = String.valueOf(s.charAt(0));
|
||||
} else {
|
||||
// two char wind code
|
||||
result = s.substring(0,1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public double windDirection(int pos){
|
||||
String windstring = getWindDir(wind[pos]);
|
||||
Log.v("ID:","WIND IS: "+windstring);
|
||||
int i = 0;
|
||||
switch (windstring){
|
||||
case "N": i=0; break;
|
||||
case "NO": i=45; break;
|
||||
case "O": i=90; break;
|
||||
case "SO": i=135; break;
|
||||
case "S": i=180; break;
|
||||
case "SW": i=225; break;
|
||||
case "W": i=270; break;
|
||||
case "NW": i=315; break;
|
||||
}
|
||||
double d = i;
|
||||
return d;
|
||||
}
|
||||
|
||||
public String getWindSpeed(String s){
|
||||
Character c = s.charAt(1);
|
||||
String result = "";
|
||||
if (Character.isDigit(s.charAt(1))) {
|
||||
// one char wind code
|
||||
result = s.substring(1);
|
||||
} else {
|
||||
// two char wind code
|
||||
result = s.substring(2);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public double windSpeed(int pos){
|
||||
String s = getWindSpeed(wind[pos]);
|
||||
int i = Integer.parseInt(s);
|
||||
double d = i;
|
||||
return d;
|
||||
}
|
||||
|
||||
public String getCurrentFlurries(){
|
||||
return boeen[0];
|
||||
}
|
||||
|
||||
public String getCurrentWind(){
|
||||
return wind[0];
|
||||
}
|
||||
|
||||
public String getTodaysFlurries(){
|
||||
int[] flurries = getIntArray(this.boeen);
|
||||
int result = flurries[0];
|
||||
for (int i=1; i<getEndOfTodayPos(); i++){
|
||||
if (flurries[i]>result){
|
||||
result = flurries[i];
|
||||
}
|
||||
}
|
||||
return String.valueOf(result);
|
||||
}
|
||||
|
||||
public String getTodaysWind(){
|
||||
int[] wind = getIntArray(this.wind);
|
||||
int result = 0;
|
||||
for (int i=1; i<getEndOfTodayPos(); i++){
|
||||
result = result + wind[i];
|
||||
}
|
||||
if (getEndOfTodayPos()<1){
|
||||
return String.valueOf(wind[0]);
|
||||
} else {
|
||||
result = result/(getEndOfTodayPos()-1);
|
||||
return String.valueOf(result);
|
||||
}
|
||||
}
|
||||
|
||||
public Bitmap getArrowBitmap(Context context, float degrees){
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(),R.drawable.arrow);
|
||||
if (bitmap != null){
|
||||
Matrix m = new Matrix();
|
||||
m.postRotate(degrees);
|
||||
return Bitmap.createBitmap(bitmap,0,0,bitmap.getWidth(),bitmap.getHeight(),m,false);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Bitmap getCurrentArrow(Context context){
|
||||
int degrees = 0;
|
||||
// no wind direction given, no wind.
|
||||
if (wind[0].length()<2) {
|
||||
return null;
|
||||
}
|
||||
String first_char = String.valueOf(wind[0].charAt(0));
|
||||
String first_two_chars = String.valueOf(wind[0].charAt(0)+wind[0].charAt(1));
|
||||
if (first_char.equals("N")){
|
||||
degrees = 0;
|
||||
}
|
||||
if (first_char.equals("O")){
|
||||
degrees = 90;
|
||||
}
|
||||
if (first_char.equals("S")){
|
||||
degrees = 180;
|
||||
}
|
||||
if (first_char.equals("W")){
|
||||
degrees = 270;
|
||||
}
|
||||
if (first_two_chars.equals("NO")){
|
||||
degrees = 45;
|
||||
}
|
||||
if (first_two_chars.equals("SO")){
|
||||
degrees = 135;
|
||||
}
|
||||
if (first_two_chars.equals("NO")){
|
||||
degrees = 225;
|
||||
}
|
||||
if (first_two_chars.equals("NO")){
|
||||
degrees = 315;
|
||||
}
|
||||
return getArrowBitmap(context,degrees);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,795 @@
|
||||
/**
|
||||
* This file is part of Tiny24hWeatherForecastGermany.
|
||||
*
|
||||
* Copyright (c) 2020 Pawel Dube
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.kaffeemitkoffein.tinyweatherforecastgermany;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
public class WeatherCodeContract {
|
||||
|
||||
private WeatherCard weatherCard;
|
||||
private int start;
|
||||
private int stop;
|
||||
|
||||
public final static int WEATHER_TODAY = 0;
|
||||
public final static int WEATHER_TOMORROW = 1;
|
||||
public final static int WEATHER_24H = 2;
|
||||
|
||||
public final static int BLUSTERY = 22;
|
||||
public final static int CLEAR_NIGHT = 30;
|
||||
public final static int CLOUDY = 25;
|
||||
public final static int COLD = 24;
|
||||
public final static int DRIZZLE = 9;
|
||||
public final static int FAIR_DAY = 33;
|
||||
public final static int FAIR_NIGHT = 32;
|
||||
public final static int FREEZING_DRIZZLE = 8;
|
||||
public final static int FREEZING_RAIN = 10;
|
||||
public final static int HEAVY_SNOW = 39;
|
||||
public final static int HOT = 35;
|
||||
public final static int HURRICANE = 2;
|
||||
public final static int LIGHT_SNOW_SHOWERS = 13;
|
||||
public final static int MIXED_RAIN_AND_SNOW = 5;
|
||||
public final static int MOSTLY_CLOUDY_DAY = 27;
|
||||
public final static int MOSTLY_CLOUDY_NIGHT = 26;
|
||||
public final static int NOT_AVAILABLE = 3200;
|
||||
public final static int PARTLY_CLOUDY_DAY = 29;
|
||||
public final static int PARTLY_CLOUDY_NIGHT = 28;
|
||||
public final static int SCATTERED_SHOWERS = 38;
|
||||
public final static int SCATTERED_SNOW_SHOWERS = 40;
|
||||
public final static int SHOWERS = 11;
|
||||
public final static int SNOW = 15;
|
||||
public final static int SNOW_FLURRIES = 12;
|
||||
public final static int SNOW_SHOWERS = 43;
|
||||
public final static int SUNNY = 31;
|
||||
public final static int WINDY = 23;
|
||||
|
||||
public final static int PARTLY_CLOUDY_DAY_SCATTERED_SHOWERS_LIGHT = 50;
|
||||
public final static int PARTLY_CLOUDY_NIGHT_SCATTERED_SHOWERS_LIGHT = 51;
|
||||
public final static int PARTLY_CLOUDY_DAY_SCATTERED_SNOW_SHOWERS_LIGHT = 52;
|
||||
public final static int PARTLY_CLOUDY_NIGHT_SCATTERED_SNOW_SHOWERS_LIGHT = 53;
|
||||
|
||||
public final int PARTLY_CLOUDY_DAY_SCATTERED_SHOWERS = 54;
|
||||
public final int PARTLY_CLOUDY_NIGHT_SCATTERED_SHOWERS = 55;
|
||||
public final int PARTLY_CLOUDY_DAY_SCATTERED_SNOW_SHOWERS = 56;
|
||||
public final int PARTLY_CLOUDY_NIGHT_SCATTERED_SNOW_SHOWERS = 57;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor defines first and last element that is considered.
|
||||
* @param weatherCard
|
||||
* @param start
|
||||
* @param stop
|
||||
*/
|
||||
|
||||
public WeatherCodeContract(WeatherCard weatherCard, int start, int stop){
|
||||
this.weatherCard = weatherCard;
|
||||
this.start = start;
|
||||
this.stop = stop;
|
||||
}
|
||||
|
||||
public WeatherCodeContract(WeatherCard weatherCard, int period){
|
||||
this.weatherCard = weatherCard;
|
||||
int delimeter = weatherCard.getEndOfTodayPos();
|
||||
if (period==WEATHER_TODAY){
|
||||
this.start = 0;
|
||||
this.stop = delimeter;
|
||||
} else
|
||||
if (period == WEATHER_TOMORROW){
|
||||
this.start = delimeter;
|
||||
this.stop = 8;
|
||||
} else {
|
||||
this.start = 0;
|
||||
this.stop = 8;
|
||||
}
|
||||
}
|
||||
|
||||
private int getAvaerage(int[] intarray){
|
||||
int elements = stop - start + 1;
|
||||
int sum = 0;
|
||||
for (int i=start; i<=stop; i++){
|
||||
sum = sum + intarray[i];
|
||||
}
|
||||
return sum / elements;
|
||||
}
|
||||
|
||||
private boolean isDaytime_old(){
|
||||
// daytime = 6:00 - 18:00
|
||||
// result is polled based on if more forecasts go into the day or night period.
|
||||
int dayForecasts = 0;
|
||||
int nightForecasts = 0;
|
||||
int[] hours = weatherCard.getIntArray(weatherCard.uhrzeit,start,stop);
|
||||
for (int i=start; i<=stop; i++){
|
||||
if ((hours[i]>6) && (hours[i]<19)){
|
||||
dayForecasts++;
|
||||
} else {
|
||||
nightForecasts++;
|
||||
}
|
||||
}
|
||||
if (nightForecasts>dayForecasts){
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDaytime(){
|
||||
// daytime = 6:00 - 18:00
|
||||
// result is taken from first entry
|
||||
|
||||
int[] hours = weatherCard.getIntArray(weatherCard.uhrzeit,start,stop);
|
||||
if ((hours[start]>6) && (hours[start]<19)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// clear sky = clouds<2 at any time
|
||||
|
||||
private boolean isSunny(){
|
||||
int[] bewoelkung = weatherCard.getIntArray(weatherCard.bewoelkung);
|
||||
boolean result = false;
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if (bewoelkung[i]>1){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// fair = no rain, clouds < 4
|
||||
|
||||
private boolean isFair(){
|
||||
int clouds = getAvaerage(weatherCard.getIntArray(weatherCard.bewoelkung));
|
||||
if ((noRain()) && (clouds<4)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// CLOUDY = clouds in average > 7
|
||||
|
||||
private boolean isCloudy(){
|
||||
int clouds = getAvaerage(weatherCard.getIntArray(weatherCard.bewoelkung));
|
||||
if (clouds>7){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// PARTLY CLOUDY = clouds > 3 and < 7
|
||||
|
||||
private boolean isPartlyCloudy(){
|
||||
int clouds = getAvaerage(weatherCard.getIntArray(weatherCard.bewoelkung));
|
||||
if ((clouds>3) && (clouds<7)){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// MOSTLY CLOUDY = clouds = 7
|
||||
|
||||
private boolean isMostlyCloudy(){
|
||||
int clouds = getAvaerage(weatherCard.getIntArray(weatherCard.bewoelkung));
|
||||
if (clouds == 7) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isRain(){
|
||||
int[] rain = weatherCard.getIntArray(weatherCard.niederschlag);
|
||||
boolean result = false;
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if (rain[i] > 0) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// RAIN = rain > 1 at any time
|
||||
|
||||
private boolean isShowers(){
|
||||
int[] rain = weatherCard.getIntArray(weatherCard.niederschlag);
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if (rain[i]>1){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// drizzle = rain 1-2 occurs at all times
|
||||
|
||||
private boolean isDrizzle(){
|
||||
int[] rain = weatherCard.getIntArray(weatherCard.niederschlag);
|
||||
boolean result = true;
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if (!((rain[i] > 0) && (rain[i] < 3))) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// SCATTERED SHOWERS = less than 50% of time points with rain
|
||||
// in case of only one item, the logic is different:
|
||||
// min showers = 0 , max showers > 0
|
||||
|
||||
private boolean isScatteredShowers(){
|
||||
int[] rain = weatherCard.getIntArray(weatherCard.niederschlag);
|
||||
int[] min_rain = weatherCard.getIntArray(weatherCard.niederschlag_min);
|
||||
int[] max_rain = weatherCard.getIntArray(weatherCard.niederschlag_max);
|
||||
// this is the logic for analyzing more than one item
|
||||
if (start == stop){
|
||||
int counter = 0;
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if (rain[i]>0){
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
if (counter==0) {
|
||||
return false;
|
||||
}
|
||||
double result = (stop-start)/counter;
|
||||
if (result<0.5){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
// this is the logic for one item
|
||||
if ((min_rain[start] == 0) && (max_rain[start]>0)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PARTLY_CLOUDY_AND_SCATTERED_SHOWERS = partly cloudy (clouds average < 7) and scattered showers
|
||||
|
||||
private boolean isPartlyCloudyAndScatteredShowers(){
|
||||
int clouds = getAvaerage(weatherCard.getIntArray(weatherCard.bewoelkung));
|
||||
if ((isScatteredShowers()) && (isPartlyCloudy())){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// light rain = rain > 0 at least at on time point & max_rain<3 at all times
|
||||
|
||||
private boolean lightRain(){
|
||||
int[] rain = weatherCard.getIntArray(weatherCard.niederschlag);
|
||||
int[] min_rain = weatherCard.getIntArray(weatherCard.niederschlag_min);
|
||||
int[] max_rain = weatherCard.getIntArray(weatherCard.niederschlag_max);
|
||||
boolean no_rain = true;
|
||||
boolean light_rain = true;
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if (rain[i]>0){
|
||||
no_rain = false;
|
||||
}
|
||||
if (max_rain[i]>2){
|
||||
light_rain = false;
|
||||
}
|
||||
}
|
||||
if ((!no_rain) && (light_rain)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// IS PARTLY CLOUDY LIGHT SCATTERED SHOWERS = isPartlyCloudyAndScatteredShowers + drizzle
|
||||
|
||||
private boolean isPartlyCloudyAndScatteredShowersLight(){
|
||||
if (isPartlyCloudyAndScatteredShowers() && lightRain()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// no rain
|
||||
|
||||
private boolean noRain(){
|
||||
int[] rain = weatherCard.getIntArray(weatherCard.niederschlag);
|
||||
boolean result = true;
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if (rain[i] > 0) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// has snow?
|
||||
|
||||
private boolean isSnow() {
|
||||
boolean s = false;
|
||||
for (int i = start; i <= stop; i++) {
|
||||
if ((weatherCard.niederschlag[i].contains("S"))) {
|
||||
s = true;
|
||||
}
|
||||
}
|
||||
if (s && onlySnow()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// onlySnow = rain > 0 at any time, snow at any time, no rain at all times
|
||||
|
||||
private boolean onlySnow(){
|
||||
int[] rain = weatherCard.getIntArray(weatherCard.niederschlag);
|
||||
boolean has_rain = false;
|
||||
boolean has_snow = false;
|
||||
boolean has_perception = false;
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if ((weatherCard.niederschlag[i].contains("R"))) {
|
||||
has_rain = true;
|
||||
}
|
||||
if ((weatherCard.niederschlag[i].contains("S"))) {
|
||||
has_snow = true;
|
||||
}
|
||||
if (rain[i]>0){
|
||||
has_perception = true;
|
||||
}
|
||||
}
|
||||
if ((has_perception) && (has_snow) && (!has_rain)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// SNOW SHOWERS = isSnow & R > 4
|
||||
|
||||
private boolean isSnowShowers() {
|
||||
int rain = getAvaerage(weatherCard.getIntArray(weatherCard.niederschlag));
|
||||
if ((rain>4) && (onlySnow())){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// LIGHT SNOW SHOWERS is light rain + only snow
|
||||
// has to be set before heavy snow!
|
||||
|
||||
private boolean isLightSnow(){
|
||||
if (lightRain() && onlySnow()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// HEAVY SNOW = only snow + average snow > 5
|
||||
|
||||
private boolean isHeavySnow(){
|
||||
int snow = getAvaerage(weatherCard.getIntArray(weatherCard.niederschlag));
|
||||
if (onlySnow() && snow >5){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// MIXED RAIN AND SNOW = R or S is present
|
||||
|
||||
private boolean isMixedSnowAndRain(){
|
||||
boolean s = false;
|
||||
boolean r = false;
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if ((weatherCard.niederschlag[i].contains("S"))) {
|
||||
s = true;
|
||||
}
|
||||
if ((weatherCard.niederschlag[i].contains("R"))) {
|
||||
r = true;
|
||||
}
|
||||
}
|
||||
if (r && s) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// SCATTERERED SNOW SHOWERS = scattered rain + S
|
||||
|
||||
private boolean isScatteredSnowShowers(){
|
||||
if ((isScatteredShowers()) && onlySnow()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// PARTLY_CLOUDY_AND_SCATTERED_SHOWERS = partly cloudy (clouds average < 7) and scattered snow showers
|
||||
|
||||
private boolean isPartlyCloudyAndScatteredSnowShowers(){
|
||||
int clouds = getAvaerage(weatherCard.getIntArray(weatherCard.bewoelkung));
|
||||
if ((isScatteredSnowShowers()) && (clouds<7)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// LIGHT SCATTERED SHOWERS = isPartlyCloudyAndScatteredShowers + drizzle
|
||||
|
||||
private boolean isPartlyCloudyAndScatteredSnowShowersLight(){
|
||||
if (isPartlyCloudyAndScatteredSnowShowers() && lightRain()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// FREEZING DRIZZLE = at all times: temperature <= 0, rain, and rain < 3
|
||||
// this is a restrictive definition, should rarely appear as whole day result in widget
|
||||
|
||||
private boolean isFreezingDrizzle(){
|
||||
int[] temp= weatherCard.getIntArray(weatherCard.lufttemperatur);
|
||||
int[] rain = weatherCard.getIntArray(weatherCard.niederschlag);
|
||||
boolean result = true;
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if (!((weatherCard.niederschlag[i].contains("R")) && (rain[i]<3) && temp[i]<1)){
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// FREEZING RAIN = at all times: temperature <= 0, rain, and rain > 2
|
||||
|
||||
private boolean isFreezingRain(){
|
||||
int[] temp = weatherCard.getIntArray(weatherCard.lufttemperatur);
|
||||
int[] rain = weatherCard.getIntArray(weatherCard.niederschlag);
|
||||
boolean result = true;
|
||||
Log.v("BOUNDS: ",start+"|"+stop);
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if (!((weatherCard.niederschlag[i].contains("R")) && (rain[i]>2) && temp[i]<1)){
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// COLD = temp in average below 0° or lowest average below -5°
|
||||
|
||||
private boolean isCold(){
|
||||
int temp = getAvaerage(weatherCard.getIntArray(weatherCard.lufttemperatur));
|
||||
if (temp<0){
|
||||
return true;
|
||||
}
|
||||
int tempmin = getAvaerage(weatherCard.getIntArray(weatherCard.lufttemperatur_min));
|
||||
if (tempmin < -5) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// HOT = at least 2 temperatures above 30°
|
||||
|
||||
private boolean isHot(){
|
||||
int[] temp = weatherCard.getIntArray(weatherCard.lufttemperatur);
|
||||
int counter = 0;
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if (temp[i]>30) {
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
if (counter>1){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// WINDY = wind > 40 km/h
|
||||
|
||||
private boolean isWindy() {
|
||||
int wind = getAvaerage(weatherCard.getIntArray(weatherCard.wind));
|
||||
if (wind>40) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// blustery = wind > 62 km/h at any time
|
||||
|
||||
private boolean isBlustery(){
|
||||
int[] boeen = weatherCard.getIntArray(weatherCard.boeen);
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if (boeen[i]>62){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// snow flurries = snow + isBlustery at the same time
|
||||
|
||||
private boolean isSnowFlurries(){
|
||||
int[] boeen = weatherCard.getIntArray(weatherCard.boeen);
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if ((boeen[i]>62) && (weatherCard.niederschlag[i].contains("S"))){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// HURRICANE = flurries/blusts above 102 km/h at any time
|
||||
|
||||
private boolean isHurricane(){
|
||||
int[] boeen = weatherCard.getIntArray(weatherCard.boeen);
|
||||
for (int i=start; i<=stop; i++) {
|
||||
if (boeen[i] > 102) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getWeatherConditionDrawableResource(int weathercondition){
|
||||
int resource = 0;
|
||||
switch (weathercondition){
|
||||
case BLUSTERY: resource = R.drawable.blustery; break;
|
||||
case CLEAR_NIGHT: resource = R.drawable.clear_night; break;
|
||||
case CLOUDY: resource = R.drawable.cloudy; break;
|
||||
case COLD: resource = R.drawable.cold; break;
|
||||
case DRIZZLE: resource = R.drawable.drizzle; break;
|
||||
case FAIR_DAY: resource = R.drawable.fair_day; break;
|
||||
case FAIR_NIGHT: resource = R.drawable.fair_night; break;
|
||||
case FREEZING_DRIZZLE: resource = R.drawable.freezing_drizzle; break;
|
||||
case FREEZING_RAIN: resource = R.drawable.freezing_rain; break;
|
||||
case HEAVY_SNOW: resource = R.drawable.heavy_snow; break;
|
||||
case HOT: resource = R.drawable.hot; break;
|
||||
case HURRICANE: resource = R.drawable.hurricane; break;
|
||||
case LIGHT_SNOW_SHOWERS: resource = R.drawable.light_snow_showers; break;
|
||||
case MIXED_RAIN_AND_SNOW: resource = R.drawable.mixed_rain_and_snow; break;
|
||||
case MOSTLY_CLOUDY_DAY: resource = R.drawable.mostly_cloudy_day; break;
|
||||
case MOSTLY_CLOUDY_NIGHT: resource = R.drawable.mostly_cloudy_night; break;
|
||||
case NOT_AVAILABLE: resource = 0; break;
|
||||
case PARTLY_CLOUDY_DAY: resource = R.drawable.partly_cloudy_day; break;
|
||||
case PARTLY_CLOUDY_NIGHT: resource = R.drawable.partly_cloudy_night; break;
|
||||
case SCATTERED_SHOWERS: resource = R.drawable.scattered_showers; break;
|
||||
case SCATTERED_SNOW_SHOWERS: resource = R.drawable.scattered_snow_showers; break;
|
||||
case SHOWERS: resource = R.drawable.showers; break;
|
||||
case SNOW: resource = R.drawable.snow; break;
|
||||
case SNOW_FLURRIES: resource = R.drawable.snow_flurries; break;
|
||||
case SNOW_SHOWERS: resource = R.drawable.snow_showers; break;
|
||||
case SUNNY: resource = R.drawable.sunny; break;
|
||||
case WINDY: resource = R.drawable.windy; break;
|
||||
case PARTLY_CLOUDY_DAY_SCATTERED_SHOWERS: resource = R.drawable.partly_cloudy_day_scattered_showers; break;
|
||||
case PARTLY_CLOUDY_NIGHT_SCATTERED_SHOWERS: resource = R.drawable.partly_cloudy_night_scattered_showers; break;
|
||||
case PARTLY_CLOUDY_DAY_SCATTERED_SNOW_SHOWERS: resource = R.drawable.partly_cloudy_day_scattered_snow; break;
|
||||
case PARTLY_CLOUDY_NIGHT_SCATTERED_SNOW_SHOWERS: resource = R.drawable.partly_cloudy_night_scattered_snow; break;
|
||||
case PARTLY_CLOUDY_DAY_SCATTERED_SHOWERS_LIGHT: resource = R.drawable.partly_cloudy_day_scattered_showers_light; break;
|
||||
case PARTLY_CLOUDY_NIGHT_SCATTERED_SHOWERS_LIGHT: resource = R.drawable.partly_cloudy_night_scattered_showers_light; break;
|
||||
case PARTLY_CLOUDY_DAY_SCATTERED_SNOW_SHOWERS_LIGHT: resource = R.drawable.partly_cloudy_day_scattered_snow_light; break;
|
||||
case PARTLY_CLOUDY_NIGHT_SCATTERED_SNOW_SHOWERS_LIGHT: resource = R.drawable.partly_cloudy_night_scattered_snow_light; break;
|
||||
}
|
||||
return resource;
|
||||
}
|
||||
|
||||
public int getWeatherConditionTextResource(int weathercondition){
|
||||
int resource = 0;
|
||||
switch (weathercondition){
|
||||
case BLUSTERY: resource = R.string.weathercode_blustery; break;
|
||||
case CLEAR_NIGHT: resource = R.string.weathercode_clear_night; break;
|
||||
case CLOUDY: resource = R.string.weathercode_cloudy; break;
|
||||
case COLD: resource = R.string.weathercode_cold; break;
|
||||
case DRIZZLE: resource = R.string.weathercode_drizzle; break;
|
||||
case FAIR_DAY: resource = R.string.weathercode_fair_day; break;
|
||||
case FAIR_NIGHT: resource = R.string.weathercode_fair_night; break;
|
||||
case FREEZING_DRIZZLE: resource = R.string.weathercode_freezing_drizzle; break;
|
||||
case FREEZING_RAIN: resource = R.string.weathercode_freezing_rain; break;
|
||||
case HEAVY_SNOW: resource = R.string.weathercode_heavy_snow; break;
|
||||
case HOT: resource = R.string.weathercode_hot; break;
|
||||
case HURRICANE: resource = R.string.weathercode_hurricane; break;
|
||||
case LIGHT_SNOW_SHOWERS: resource = R.string.weathercode_light_snow_showers; break;
|
||||
case MIXED_RAIN_AND_SNOW: resource = R.string.weathercode_mixed_rain_and_snow; break;
|
||||
case MOSTLY_CLOUDY_DAY: resource = R.string.weathercode_mostly_cloudy_day; break;
|
||||
case MOSTLY_CLOUDY_NIGHT: resource = R.string.weathercode_mostly_cloudy_night; break;
|
||||
case NOT_AVAILABLE: resource = R.string.weathercode_not_available; break;
|
||||
case PARTLY_CLOUDY_DAY: resource = R.string.weathercode_partly_cloudy_day; break;
|
||||
case PARTLY_CLOUDY_NIGHT: resource = R.string.weathercode_partly_cloudy_night; break;
|
||||
case SCATTERED_SHOWERS: resource = R.string.weathercode_scattered_showers; break;
|
||||
case SCATTERED_SNOW_SHOWERS: resource = R.string.weathercode_scattered_snow_showers; break;
|
||||
case SHOWERS: resource = R.string.weathercode_showers; break;
|
||||
case SNOW: resource = R.string.weathercode_snow; break;
|
||||
case SNOW_FLURRIES: resource = R.string.weathercode_snow_flurries; break;
|
||||
case SNOW_SHOWERS: resource = R.string.weathercode_snow_showers; break;
|
||||
case SUNNY: resource = R.string.weathercode_sunny; break;
|
||||
case WINDY: resource = R.string.weathercode_windy; break;
|
||||
case PARTLY_CLOUDY_DAY_SCATTERED_SHOWERS_LIGHT: resource = R.string.weathercode_partly_cloudy_day_scattered_showers_light; break;
|
||||
case PARTLY_CLOUDY_NIGHT_SCATTERED_SHOWERS_LIGHT: resource = R.string.weathercode_partly_cloudy_night_scattered_showers_light; break;
|
||||
case PARTLY_CLOUDY_DAY_SCATTERED_SNOW_SHOWERS_LIGHT: resource = R.string.weathercode_partly_cloudy_day_scattered_snow_showers_light; break;
|
||||
case PARTLY_CLOUDY_NIGHT_SCATTERED_SNOW_SHOWERS_LIGHT: resource = R.string.weathercode_partly_cloudy_night_scattered_snow_showers_light; break;
|
||||
}
|
||||
return resource;
|
||||
}
|
||||
|
||||
public String getWeatherConditionText(Context context, int weathercondition){
|
||||
int resource = getWeatherConditionTextResource(weathercondition);
|
||||
String s = context.getResources().getString(resource);
|
||||
return s;
|
||||
}
|
||||
|
||||
public Drawable getWeatherConditionDrawable(Context context, int weathercondition){
|
||||
Drawable drawable;
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
drawable = context.getResources().getDrawable(getWeatherConditionDrawableResource(weathercondition),null);
|
||||
} else {
|
||||
drawable = context.getResources().getDrawable(weathercondition);
|
||||
}
|
||||
return drawable;
|
||||
}
|
||||
|
||||
public int getWeatherCondition(){
|
||||
int weatherCondition = NOT_AVAILABLE;
|
||||
// *** BASIC WEATHER CONDITIONS ***
|
||||
// FAIR
|
||||
if (isFair()){
|
||||
if (isDaytime()){
|
||||
weatherCondition = FAIR_DAY;
|
||||
} else {
|
||||
weatherCondition = FAIR_NIGHT;
|
||||
}
|
||||
}
|
||||
// SUNNY
|
||||
if (isSunny()){
|
||||
if (isDaytime()){
|
||||
weatherCondition = SUNNY;
|
||||
} else {
|
||||
weatherCondition = CLEAR_NIGHT;
|
||||
}
|
||||
}
|
||||
// CLOUDY
|
||||
if (isCloudy()){
|
||||
weatherCondition = CLOUDY;
|
||||
}
|
||||
// PARTLY CLOUDY
|
||||
if (isPartlyCloudy()){
|
||||
if (isDaytime()){
|
||||
weatherCondition = PARTLY_CLOUDY_DAY;
|
||||
} else {
|
||||
weatherCondition = PARTLY_CLOUDY_NIGHT;
|
||||
}
|
||||
}
|
||||
// MOSTLY CLOUDY
|
||||
if (isMostlyCloudy()){
|
||||
if (isDaytime()){
|
||||
weatherCondition = MOSTLY_CLOUDY_DAY;
|
||||
} else {
|
||||
weatherCondition = MOSTLY_CLOUDY_NIGHT;
|
||||
}
|
||||
}
|
||||
// *** RAIN CONDITIONS ***
|
||||
// they have to follow the basic weather conditions, must precede snow conditions
|
||||
// SHOWERS
|
||||
if (isShowers()){
|
||||
weatherCondition = SHOWERS;
|
||||
}
|
||||
// DRIZZLE
|
||||
if (isDrizzle()){
|
||||
weatherCondition = DRIZZLE;
|
||||
}
|
||||
// SCATTERED SHOWERS
|
||||
if (isScatteredShowers()){
|
||||
weatherCondition = SCATTERED_SHOWERS;
|
||||
}
|
||||
// PARTLY CLOUDY, SCATTERED SHOWERS
|
||||
if (isPartlyCloudyAndScatteredShowers()){
|
||||
if (isDaytime()){
|
||||
weatherCondition = PARTLY_CLOUDY_DAY_SCATTERED_SHOWERS;
|
||||
} else {
|
||||
weatherCondition = PARTLY_CLOUDY_NIGHT_SCATTERED_SHOWERS;
|
||||
}
|
||||
}
|
||||
// PARTLY CLOUDY, LIGHT SCATTERED SHOWERS
|
||||
// has to come after partly cloudy, scattered showers as this is more specific
|
||||
if (isPartlyCloudyAndScatteredShowersLight()){
|
||||
if (isDaytime()){
|
||||
weatherCondition = PARTLY_CLOUDY_DAY_SCATTERED_SHOWERS_LIGHT;
|
||||
} else {
|
||||
weatherCondition = PARTLY_CLOUDY_NIGHT_SCATTERED_SHOWERS_LIGHT;
|
||||
}
|
||||
}
|
||||
// *** SNOW CONDITIONS ***
|
||||
// they have to follow the rain conditions
|
||||
// SNOW
|
||||
if (isSnow()){
|
||||
weatherCondition = SNOW;
|
||||
}
|
||||
// SNOW SHOWERS
|
||||
if (isSnowShowers()){
|
||||
weatherCondition = SNOW_SHOWERS;
|
||||
}
|
||||
// MIXED RAIN & SNOW
|
||||
if (isMixedSnowAndRain()){
|
||||
weatherCondition = MIXED_RAIN_AND_SNOW;
|
||||
}
|
||||
// LIGHT SNOW
|
||||
if (isLightSnow()) {
|
||||
weatherCondition = LIGHT_SNOW_SHOWERS;
|
||||
}
|
||||
// HEAVY SNOW
|
||||
if (isHeavySnow()){
|
||||
weatherCondition = HEAVY_SNOW;
|
||||
}
|
||||
// SCATTERED SNOW SHOWERS, must be later than scattered showers
|
||||
if (isScatteredSnowShowers()){
|
||||
weatherCondition = SCATTERED_SNOW_SHOWERS;
|
||||
}
|
||||
// PARTLY CLOUDY, SCATTERED SNOW SHOWERS
|
||||
if (isPartlyCloudyAndScatteredSnowShowers()){
|
||||
if (isDaytime()){
|
||||
weatherCondition = PARTLY_CLOUDY_DAY_SCATTERED_SNOW_SHOWERS;
|
||||
} else {
|
||||
weatherCondition = PARTLY_CLOUDY_NIGHT_SCATTERED_SNOW_SHOWERS;
|
||||
}
|
||||
}
|
||||
// PARTLY CLOUDY, LIGHT SCATTERED SNOW SHOWERS
|
||||
// has to come after partly cloudy, scattered snow showers as this is more specific
|
||||
if (isPartlyCloudyAndScatteredSnowShowersLight()){
|
||||
if (isDaytime()){
|
||||
weatherCondition = PARTLY_CLOUDY_DAY_SCATTERED_SNOW_SHOWERS_LIGHT;
|
||||
} else {
|
||||
weatherCondition = PARTLY_CLOUDY_NIGHT_SCATTERED_SNOW_SHOWERS_LIGHT;
|
||||
}
|
||||
}
|
||||
// FREEZING DRIZZLE
|
||||
if (isFreezingDrizzle()){
|
||||
weatherCondition = FREEZING_DRIZZLE;
|
||||
}
|
||||
// FREEZING RAIN
|
||||
if (isFreezingRain()){
|
||||
weatherCondition = FREEZING_RAIN;
|
||||
}
|
||||
// COLD
|
||||
if (isCold()){
|
||||
weatherCondition = COLD;
|
||||
}
|
||||
//IS HOT
|
||||
if (isHot()) {
|
||||
weatherCondition = HOT;
|
||||
}
|
||||
// *** SPECIAL WIND CONDITIONS ***
|
||||
// WINDY
|
||||
if (isWindy()){
|
||||
weatherCondition = WINDY;
|
||||
}
|
||||
// BLUSTERY
|
||||
if (isBlustery()){
|
||||
weatherCondition = BLUSTERY;
|
||||
}
|
||||
// SNOW FLURRIES has to follow blustery, as more specific
|
||||
if (isSnowFlurries()){
|
||||
weatherCondition = SNOW_FLURRIES;
|
||||
}
|
||||
// HURRICANE
|
||||
if (isHurricane()){
|
||||
weatherCondition = HURRICANE;
|
||||
}
|
||||
return weatherCondition;
|
||||
}
|
||||
}
|
@@ -0,0 +1,230 @@
|
||||
/**
|
||||
* This file is part of Tiny24hWeatherForecastGermany.
|
||||
*
|
||||
* Copyright (c) 2020 Pawel Dube
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.kaffeemitkoffein.tinyweatherforecastgermany;
|
||||
|
||||
import android.content.ContentProvider;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
public class WeatherForecastContentProvider extends ContentProvider {
|
||||
|
||||
static final String AUTHORITY="de.kaffeemitkoffein.tinyweatherforecastgermany.weather";
|
||||
static final String DATASERVICE = "weatherforecast";
|
||||
static final String URL_SENSORDATA = "content://"+AUTHORITY+"/" + DATASERVICE;
|
||||
static final Uri URI_SENSORDATA = Uri.parse(URL_SENSORDATA);
|
||||
|
||||
private WeatherForecastDatabaseHelper weatherForecastDatabaseHelper;
|
||||
private SQLiteDatabase sqLiteDatabase;
|
||||
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
weatherForecastDatabaseHelper = new WeatherForecastDatabaseHelper(getContext().getApplicationContext());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
|
||||
sqLiteDatabase = weatherForecastDatabaseHelper.getReadableDatabase();
|
||||
Cursor c = sqLiteDatabase.query(WeatherForecastDatabaseHelper.TABLE_NAME,projection,selection,selectionArgs,null,null,sortOrder,null);
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType(Uri uri) {
|
||||
return "text/plain";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Uri insert(Uri uri, ContentValues contentValues) {
|
||||
sqLiteDatabase = weatherForecastDatabaseHelper.getWritableDatabase();
|
||||
sqLiteDatabase.enableWriteAheadLogging();
|
||||
sqLiteDatabase.insert(WeatherForecastDatabaseHelper.TABLE_NAME,null,contentValues);
|
||||
return uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Uri uri, String selection, String[] selectionArgs) {
|
||||
int i = 0;
|
||||
sqLiteDatabase = weatherForecastDatabaseHelper.getWritableDatabase();
|
||||
sqLiteDatabase.enableWriteAheadLogging();
|
||||
i = sqLiteDatabase.delete(WeatherForecastDatabaseHelper.TABLE_NAME,selection,selectionArgs);
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(Uri uri, ContentValues contentValues, String selection, String[] selectionArgs) {
|
||||
sqLiteDatabase = weatherForecastDatabaseHelper.getWritableDatabase();
|
||||
sqLiteDatabase.enableWriteAheadLogging();
|
||||
return sqLiteDatabase.update(WeatherForecastDatabaseHelper.TABLE_NAME,contentValues,selection,selectionArgs);
|
||||
}
|
||||
|
||||
public static class WeatherForecastDatabaseHelper extends SQLiteOpenHelper {
|
||||
|
||||
public static final int DATABASE_VERSION = 1;
|
||||
public static final String DATABASE_NAME = "weatherforecast";
|
||||
public static final String TABLE_NAME = "tables";
|
||||
public static final String KEY_id = "id";
|
||||
public static final String KEY_fdat = "fdat";
|
||||
public static final String KEY_ortscode = "ortscode";
|
||||
public static final String KEY_zeitstempel = "zeitstempel";
|
||||
public static final String KEY_klimagebiet = "klimagebiet";
|
||||
public static final String KEY_ausgegeben_am = "ausgegeben_am";
|
||||
public static final String KEY_ausgegeben_von = "ausgegeben_von";
|
||||
public static final String KEY_uhrzeit = "uhrzeit";
|
||||
public static final String KEY_bewoelkung = "bewoelkung";
|
||||
public static final String KEY_bewoelkung_max = "bewoelkung_max";
|
||||
public static final String KEY_bewoelkung_min = "bewoelkung_min";
|
||||
public static final String KEY_niederschlag = "niederschlag";
|
||||
public static final String KEY_niederschlag_max = "niederschlag_max";
|
||||
public static final String KEY_niederschlag_min = "niederschlag_min";
|
||||
public static final String KEY_lufttemperatur = "lufttemperatur";
|
||||
public static final String KEY_lufttemperatur_max = "lufttemperatur_max";
|
||||
public static final String KEY_lufttemperatur_min = "lufttemperatur_min";
|
||||
public static final String KEY_wind = "wind";
|
||||
public static final String KEY_boeen = "boeen";
|
||||
public static final String KEY_timestamp = "timestamp";
|
||||
|
||||
public static final String SQL_COMMAND_CREATE = "CREATE TABLE " + TABLE_NAME + "("
|
||||
+ KEY_id + " INTEGER PRIMARY KEY ASC,"
|
||||
+ KEY_fdat + " TEXT,"
|
||||
+ KEY_ortscode + " TEXT,"
|
||||
+ KEY_zeitstempel + " TEXT,"
|
||||
+ KEY_klimagebiet + " TEXT,"
|
||||
+ KEY_ausgegeben_am + " TEXT,"
|
||||
+ KEY_ausgegeben_von + " TEXT,"
|
||||
+ KEY_uhrzeit + " TEXT,"
|
||||
+ KEY_bewoelkung + " TEXT,"
|
||||
+ KEY_bewoelkung_max + " TEXT,"
|
||||
+ KEY_bewoelkung_min + " TEXT,"
|
||||
+ KEY_niederschlag + " TEXT,"
|
||||
+ KEY_niederschlag_max + " TEXT,"
|
||||
+ KEY_niederschlag_min + " TEXT,"
|
||||
+ KEY_lufttemperatur + " TEXT,"
|
||||
+ KEY_lufttemperatur_max + " TEXT,"
|
||||
+ KEY_lufttemperatur_min + " TEXT,"
|
||||
+ KEY_wind + " TEXT,"
|
||||
+ KEY_boeen + " TEXT,"
|
||||
+ KEY_timestamp + " INTEGER" + ");";
|
||||
|
||||
public static final String SQL_COMMAND_DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
|
||||
|
||||
public WeatherForecastDatabaseHelper(Context c) {
|
||||
super(c, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase sqLiteDatabase) {
|
||||
sqLiteDatabase.execSQL(SQL_COMMAND_CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
|
||||
sqLiteDatabase.execSQL(SQL_COMMAND_DROP_TABLE);
|
||||
onCreate(sqLiteDatabase);
|
||||
}
|
||||
}
|
||||
|
||||
private final static String serial_serparator="_,_";
|
||||
|
||||
private String serializeString(String s[]){
|
||||
return TextUtils.join(serial_serparator,s);
|
||||
}
|
||||
|
||||
private String[] deSerializeString(String s){
|
||||
return TextUtils.split(s,serial_serparator);
|
||||
}
|
||||
|
||||
public ContentValues getContentValuesFromWeatherCard(WeatherCard weatherCard){
|
||||
ContentValues contentValues = new ContentValues();
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_fdat,weatherCard.fdat);
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_ortscode,weatherCard.ortscode);
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_zeitstempel,weatherCard.zeitstempel);
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_klimagebiet,weatherCard.klimagebiet);
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_ausgegeben_am,weatherCard.ausgegeben_am);
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_ausgegeben_von,weatherCard.ausgegeben_von);
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_uhrzeit,serializeString(weatherCard.uhrzeit));
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_bewoelkung,serializeString(weatherCard.bewoelkung));
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_bewoelkung_max,serializeString(weatherCard.bewoelkung_max));
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_bewoelkung_min,serializeString(weatherCard.bewoelkung_min));
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_niederschlag,serializeString(weatherCard.niederschlag));
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_niederschlag_max,serializeString(weatherCard.niederschlag_max));
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_niederschlag_min,serializeString(weatherCard.niederschlag_min));
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_lufttemperatur,serializeString(weatherCard.lufttemperatur));
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_lufttemperatur_max,serializeString(weatherCard.lufttemperatur_max));
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_lufttemperatur_min,serializeString(weatherCard.lufttemperatur_min));
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_wind,serializeString(weatherCard.wind));
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_boeen,serializeString(weatherCard.boeen));
|
||||
contentValues.put(WeatherForecastDatabaseHelper.KEY_timestamp,weatherCard.polling_time);
|
||||
return contentValues;
|
||||
}
|
||||
|
||||
public Uri writeWeatherForecast(Context c,WeatherCard weatherCard){
|
||||
ContentResolver contentResolver = c.getApplicationContext().getContentResolver();
|
||||
contentResolver.delete(WeatherForecastContentProvider.URI_SENSORDATA,null,null);
|
||||
return contentResolver.insert(WeatherForecastContentProvider.URI_SENSORDATA,getContentValuesFromWeatherCard(weatherCard));
|
||||
}
|
||||
|
||||
public WeatherCard readWeatherForecast(Context c){
|
||||
ContentResolver contentResolver = c.getApplicationContext().getContentResolver();
|
||||
Cursor cursor = contentResolver.query(WeatherForecastContentProvider.URI_SENSORDATA,null,null,null,null,null);
|
||||
return getWeatherCardFromCursor(cursor);
|
||||
}
|
||||
|
||||
public WeatherCard getWeatherCardFromCursor(Cursor c){
|
||||
if (c==null){
|
||||
return null;
|
||||
} else {
|
||||
WeatherCard weatherCard = new WeatherCard();
|
||||
if (c.moveToFirst()){
|
||||
weatherCard.fdat = c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_fdat));
|
||||
weatherCard.ortscode = c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_ortscode));
|
||||
weatherCard.zeitstempel = c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_zeitstempel));
|
||||
weatherCard.klimagebiet = c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_klimagebiet));
|
||||
weatherCard.ausgegeben_am = c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_ausgegeben_am));
|
||||
weatherCard.ausgegeben_von = c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_ausgegeben_von));
|
||||
weatherCard.uhrzeit = deSerializeString(c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_uhrzeit)));
|
||||
weatherCard.bewoelkung = deSerializeString(c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_bewoelkung)));
|
||||
weatherCard.bewoelkung_max = deSerializeString(c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_bewoelkung_max)));
|
||||
weatherCard.bewoelkung_min = deSerializeString(c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_bewoelkung_min)));
|
||||
weatherCard.niederschlag = deSerializeString(c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_niederschlag)));
|
||||
weatherCard.niederschlag_max = deSerializeString(c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_niederschlag_max)));
|
||||
weatherCard.niederschlag_min= deSerializeString(c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_niederschlag_min)));
|
||||
weatherCard.lufttemperatur = deSerializeString(c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_lufttemperatur)));
|
||||
weatherCard.lufttemperatur_max = deSerializeString(c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_lufttemperatur_max)));
|
||||
weatherCard.lufttemperatur_min = deSerializeString(c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_lufttemperatur_min)));
|
||||
weatherCard.wind = deSerializeString(c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_wind)));
|
||||
weatherCard.boeen = deSerializeString(c.getString(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_boeen)));
|
||||
weatherCard.polling_time = c.getLong(c.getColumnIndex(WeatherForecastDatabaseHelper.KEY_timestamp));
|
||||
return weatherCard;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,116 @@
|
||||
/**
|
||||
* This file is part of Tiny24hWeatherForecastGermany.
|
||||
*
|
||||
* Copyright (c) 2020 Pawel Dube
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.kaffeemitkoffein.tinyweatherforecastgermany;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class WeatherForecastReader extends AsyncTask<URL,Void, WeatherCard> {
|
||||
|
||||
private Context context;
|
||||
|
||||
public WeatherForecastReader(Context context){
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WeatherCard doInBackground(URL... urls) {
|
||||
Log.v("READER:","STARTING CONNS....");
|
||||
for (int i = 0; i < urls.length; i++) {
|
||||
Boolean pageloaded = false;
|
||||
ArrayList<String> pageContent = new ArrayList<String>();
|
||||
if (urls[i] != null) {
|
||||
Log.v("READER:","Url not null: "+urls[i].toString());
|
||||
try {
|
||||
// HttpsURLConnection httpsURLConnection = (HttpsURLConnection) urls[i].openConnection();
|
||||
//InputStream is = httpsURLConnection.getInputStream();
|
||||
//BufferedReader bufferedReader = new BufferedReader(is);
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urls[i].openStream()));
|
||||
String line = bufferedReader.readLine();
|
||||
while (line != null) {
|
||||
pageContent.add(line);
|
||||
try {
|
||||
line = bufferedReader.readLine();
|
||||
} catch (Exception IOException) {
|
||||
line = null;
|
||||
}
|
||||
}
|
||||
Log.v("READER:", "Seems Https succeeded.");
|
||||
pageloaded = true;
|
||||
} catch (Exception e) {
|
||||
Log.v("READER:","Https failed: "+e);
|
||||
pageloaded = false;
|
||||
}
|
||||
if (pageloaded){
|
||||
return new WeatherCard(pageContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
// when the loop finishes with no previous return, this means that we only got 404 page not found errors but
|
||||
// no weather forecast data at all.
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this routine to define what to do if obtaining data failed.
|
||||
*/
|
||||
|
||||
public void onNegativeResult(){
|
||||
// do nothing at the moment.
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this routine to define what to do if obtaining data succeeded.
|
||||
*
|
||||
* Remember: at this point, the new data is already written to the database and can be
|
||||
* accessed via the CardHandler class.
|
||||
*/
|
||||
|
||||
public void onPositiveResult(){
|
||||
// do nothing at the moment.
|
||||
}
|
||||
|
||||
public void onPositiveResult(WeatherCard weatherCard){
|
||||
onPositiveResult();
|
||||
}
|
||||
|
||||
protected void onPostExecute(WeatherCard weatherCard) {
|
||||
Log.v("READER:","OnPostExecute called.");
|
||||
if (weatherCard == null) {
|
||||
onNegativeResult();
|
||||
} else {
|
||||
// get timestamp
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
weatherCard.polling_time = calendar.getTimeInMillis();
|
||||
// writes the weather data to the database
|
||||
Log.v("READER:","Positive result, writing it to database.");
|
||||
WeatherForecastContentProvider weatherForecastContentProvider = new WeatherForecastContentProvider();
|
||||
weatherForecastContentProvider.writeWeatherForecast(context,weatherCard);
|
||||
onPositiveResult(weatherCard);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* This file is part of Tiny24hWeatherForecastGermany.
|
||||
*
|
||||
* Copyright (c) 2020 Pawel Dube
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.kaffeemitkoffein.tinyweatherforecastgermany;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
public class WeatherSettings {
|
||||
|
||||
public static final String PREF_STATION = "PREF_station";
|
||||
public static final String PREF_UPDATEINTERVAL = "PREF_updateinterval";
|
||||
public static final String PREF_ISWEATHERPROVIDER = "PREF_isregisteredweatherprovider";
|
||||
public static final String PREF_WIDGET_OPACITY = "PREF_widget_opacity";
|
||||
public static final String PREF_WIDGET_SHOWDWDNOTE = "PREF_widget_showdwdnote";
|
||||
|
||||
|
||||
public static final String PREF_STATION_DEFAULT = "Hamburg";
|
||||
public static final String PREF_UPDATEINTERVAL_DEFAULT = "6";
|
||||
public static final String PREF_WIDGET_OPACITY_DEFAULT = "10";
|
||||
public static final boolean PREF_ISWEATHERPROVIDER_DEFAULT = false;
|
||||
public static final boolean PREF_WIDGET_SHOWDWDNOTE_DEFAULT = true;
|
||||
|
||||
public String station = PREF_STATION_DEFAULT;
|
||||
public String updateinterval = PREF_UPDATEINTERVAL_DEFAULT;
|
||||
public boolean is_weatherprovider = PREF_ISWEATHERPROVIDER_DEFAULT;
|
||||
public String widget_opacity = PREF_WIDGET_OPACITY_DEFAULT;
|
||||
public boolean widget_showdwdnote = PREF_WIDGET_SHOWDWDNOTE_DEFAULT;
|
||||
|
||||
private Context context;
|
||||
public SharedPreferences sharedPreferences;
|
||||
|
||||
public WeatherSettings(Context c){
|
||||
this.context = c;
|
||||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(c);
|
||||
readPreferences();
|
||||
}
|
||||
|
||||
public void readPreferences(){
|
||||
this.station = readPreference(PREF_STATION,PREF_STATION_DEFAULT);
|
||||
this.updateinterval = readPreference(PREF_UPDATEINTERVAL,PREF_UPDATEINTERVAL_DEFAULT);
|
||||
this.is_weatherprovider = readPreference(PREF_ISWEATHERPROVIDER,PREF_ISWEATHERPROVIDER_DEFAULT);
|
||||
this.widget_opacity = readPreference(PREF_WIDGET_OPACITY,PREF_WIDGET_OPACITY_DEFAULT);
|
||||
this.widget_showdwdnote = readPreference(PREF_WIDGET_SHOWDWDNOTE,PREF_WIDGET_SHOWDWDNOTE_DEFAULT);
|
||||
}
|
||||
|
||||
public void savePreferences(){
|
||||
applyPreference(PREF_STATION,this.station);
|
||||
applyPreference(PREF_UPDATEINTERVAL,this.updateinterval);
|
||||
applyPreference(PREF_ISWEATHERPROVIDER,this.is_weatherprovider);
|
||||
applyPreference(PREF_WIDGET_OPACITY,this.widget_opacity);
|
||||
applyPreference(PREF_WIDGET_SHOWDWDNOTE,this.widget_showdwdnote);
|
||||
}
|
||||
|
||||
public String readPreference(String p, String d){
|
||||
return sharedPreferences.getString(p,d);
|
||||
}
|
||||
|
||||
public Boolean readPreference(String p, Boolean d){
|
||||
return sharedPreferences.getBoolean(p,d);
|
||||
}
|
||||
|
||||
public int readPreference(String p, int d){
|
||||
return sharedPreferences.getInt(p,d);
|
||||
}
|
||||
|
||||
public void applyPreference(String pref, String value){
|
||||
SharedPreferences.Editor pref_editor = sharedPreferences.edit();
|
||||
pref_editor.putString(pref,value);
|
||||
pref_editor.apply();
|
||||
}
|
||||
|
||||
public void applyPreference(String pref, Boolean value){
|
||||
SharedPreferences.Editor pref_editor = sharedPreferences.edit();
|
||||
pref_editor.putBoolean(pref,value);
|
||||
pref_editor.apply();
|
||||
}
|
||||
|
||||
public void applyPreference(String pref, int value){
|
||||
SharedPreferences.Editor pref_editor = sharedPreferences.edit();
|
||||
pref_editor.putInt(pref,value);
|
||||
pref_editor.apply();
|
||||
}
|
||||
|
||||
public int getUpdateInterval(){
|
||||
int i = Integer.parseInt(this.updateinterval);
|
||||
return i;
|
||||
}
|
||||
|
||||
}
|
BIN
app/src/main/res/drawable/arrow.png
Normal file
After Width: | Height: | Size: 389 B |
BIN
app/src/main/res/drawable/blustery.png
Normal file
After Width: | Height: | Size: 7.9 KiB |
BIN
app/src/main/res/drawable/clear_night.png
Normal file
After Width: | Height: | Size: 9.0 KiB |
BIN
app/src/main/res/drawable/cloudy.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
app/src/main/res/drawable/cold.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
app/src/main/res/drawable/drizzle.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/drawable/fair_day.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/drawable/fair_night.png
Normal file
After Width: | Height: | Size: 8.7 KiB |
BIN
app/src/main/res/drawable/freezing_drizzle.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
app/src/main/res/drawable/freezing_rain.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
app/src/main/res/drawable/heavy_snow.png
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
app/src/main/res/drawable/hot.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
app/src/main/res/drawable/hurricane.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
app/src/main/res/drawable/ic_launcher_background.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
app/src/main/res/drawable/ic_launcher_foreground.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
app/src/main/res/drawable/light_snow_showers.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
app/src/main/res/drawable/mixed_rain_and_snow.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
app/src/main/res/drawable/mostly_cloudy_day.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
app/src/main/res/drawable/mostly_cloudy_night.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/drawable/partly_cloudy_day.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 9.3 KiB |
BIN
app/src/main/res/drawable/partly_cloudy_day_scattered_snow.png
Normal file
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/drawable/partly_cloudy_night.png
Normal file
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 13 KiB |
BIN
app/src/main/res/drawable/partly_cloudy_night_scattered_snow.png
Normal file
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 15 KiB |
BIN
app/src/main/res/drawable/scattered_showers.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/drawable/scattered_snow_showers.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
app/src/main/res/drawable/showers.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
app/src/main/res/drawable/snow.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
app/src/main/res/drawable/snow_flurries.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/drawable/snow_showers.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
app/src/main/res/drawable/sunny.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/drawable/windy.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
76
app/src/main/res/layout/aboutdialog.xml
Normal file
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp">
|
||||
|
||||
<ScrollView
|
||||
android:orientation="vertical"
|
||||
android:scrollbars="vertical"
|
||||
android:scrollbarAlwaysDrawVerticalTrack="true"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/text_container"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/about_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="15dp"
|
||||
android:textColor="@color/textColor"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:text="@string/button_continue"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/about_textview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollHorizontally="false"
|
||||
android:minLines="2"
|
||||
android:singleLine="false"
|
||||
android:ellipsize="none"
|
||||
android:maxLines="3000"
|
||||
android:textSize="@dimen/licence_textsize"
|
||||
android:textColor="@color/textColor"
|
||||
android:gravity="top"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:layout_below="@+id/about_button"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
65
app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/main_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:text="@string/main_selectstation"
|
||||
android:textColor="@color/textColor"
|
||||
android:layout_gravity="left"
|
||||
android:textSize="@dimen/fcmain_textsize_large"
|
||||
android:id="@+id/main_selectstation_text"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dwd_notice"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:textColor="@color/textColorGrey"
|
||||
android:background="@color/colorPrimary"
|
||||
android:textAlignment="center"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="@dimen/fcmain_textsize_medium"
|
||||
android:id="@+id/main_dwd_notice_text"/>
|
||||
|
||||
<Spinner android:id="@+id/stations_spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/main_selectstation_text"/>
|
||||
|
||||
<ListView android:id="@+id/main_listview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:divider="@color/colorPrimaryLight"
|
||||
android:dividerHeight="1dp"
|
||||
android:layout_below="@id/stations_spinner"
|
||||
android:layout_above="@id/main_dwd_notice_text"
|
||||
android:footerDividersEnabled="true"/>
|
||||
|
||||
</RelativeLayout>
|
115
app/src/main/res/layout/classicwidget_layout.xml
Normal file
@@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/classicwidget_maincontainer"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/classicwidget_linearlayout"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:weightSum="3"
|
||||
android:gravity="center"
|
||||
android:layout_above="@+id/classicwidget_reference_text"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout android:id="@+id/classicwidget_leftcontainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView android:id="@+id/classicwidget_locationtext"
|
||||
android:textSize="@dimen/widget_textsize_large"
|
||||
android:textColor="@color/widget_textcolor"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView android:id="@+id/classicwidget_weatherconditiontext"
|
||||
android:textSize="@dimen/widget_textsize_medium"
|
||||
android:textColor="@color/widget_textcolor"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/classicwidget_centercontainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView android:id="@+id/classicwidget_weatherconditionicon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/classicwidget_rightcontainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView android:id="@+id/classicwidget_temperature"
|
||||
android:textSize="@dimen/widget_textsize_large"
|
||||
android:textColor="@color/widget_textcolor"
|
||||
android:layout_gravity="center"
|
||||
android:textAlignment="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView android:id="@+id/classicwidget_temperature_highlow"
|
||||
android:textSize="@dimen/widget_textsize_large"
|
||||
android:textColor="@color/widget_textcolor"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView android:id="@+id/classicwidget_wind"
|
||||
android:textSize="@dimen/widget_textsize_medium"
|
||||
android:textColor="@color/widget_textcolor"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:id="@+id/classicwidget_reference_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="2dp"
|
||||
android:textColor="@color/widget_textcolor"
|
||||
android:textSize="@dimen/widget_textsize_small"
|
||||
android:visibility="visible"
|
||||
android:text="@string/dwd_notice"/>
|
||||
|
||||
</RelativeLayout>
|
119
app/src/main/res/layout/forecastitem.xml
Normal file
@@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/fcitem_maincontainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:padding="3dp">
|
||||
|
||||
<TextView android:id="@+id/fcitem_heading"
|
||||
android:textSize="@dimen/fcmain_textsize_large"
|
||||
android:textColor="@color/widget_textcolor"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textAlignment="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fcitem_linearlayout"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/fcitem_heading"
|
||||
android:weightSum="3"
|
||||
android:gravity="center">
|
||||
|
||||
<LinearLayout android:id="@+id/fcitem_leftcontainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView android:id="@+id/fcitem_weatherconditiontext"
|
||||
android:textSize="@dimen/fcmain_textsize_medium"
|
||||
android:textColor="@color/widget_textcolor"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView android:id="@+id/fcitem_clouds"
|
||||
android:textSize="@dimen/fcmain_textsize_medium"
|
||||
android:textColor="@color/widget_textcolor"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView android:id="@+id/fcitem_rain"
|
||||
android:textSize="@dimen/fcmain_textsize_medium"
|
||||
android:textColor="@color/widget_textcolor"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/fcitem_centercontainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView android:id="@+id/fcitem_weatherconditionicon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/fcitem_rightcontainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView android:id="@+id/fcitem_temperature"
|
||||
android:textSize="@dimen/fcmain_textsize_large"
|
||||
android:textColor="@color/widget_textcolor"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView android:id="@+id/fcitem_temperature_highlow"
|
||||
android:textSize="@dimen/fcmain_textsize_medium"
|
||||
android:textColor="@color/widget_textcolor"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView android:id="@+id/fcitem_wind"
|
||||
android:textSize="@dimen/fcmain_textsize_medium"
|
||||
android:textColor="@color/widget_textcolor"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
85
app/src/main/res/layout/licenseinfo.xml
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:id="@+id/infoTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/textColor"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:text=""/>
|
||||
|
||||
<View android:id="@+id/infoSolidBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:layout_below="@+id/infoTitle"
|
||||
android:background="@color/textColorGrey">
|
||||
</View>
|
||||
|
||||
<LinearLayout android:id="@+id/intoButtonLine"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="3dip"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<Button android:id="@+id/info_button_back"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/fcmain_textsize_medium"
|
||||
android:textColor="@color/textColor"
|
||||
android:text=""/>
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView android:id="@+id/infoScrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fillViewport="true"
|
||||
android:layout_below="@+id/infoSolidBar"
|
||||
android:layout_above="@id/intoButtonLine">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/infoTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollHorizontally="false"
|
||||
android:minLines="2"
|
||||
android:singleLine="false"
|
||||
android:ellipsize="none"
|
||||
android:maxLines="3000"
|
||||
android:textSize="@dimen/licence_textsize"
|
||||
android:textColor="@color/textColor"
|
||||
android:gravity="top"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
/>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</RelativeLayout>
|
49
app/src/main/res/menu/main_activity.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:id="@+id/menu_refresh"
|
||||
android:title="@string/about_button"
|
||||
android:icon="@mipmap/ic_refresh_white_24dp"
|
||||
android:showAsAction="ifRoom"
|
||||
android:orderInCategory="1">
|
||||
</item>
|
||||
<item android:id="@+id/menu_settings"
|
||||
android:title="@string/about_button"
|
||||
android:icon="@mipmap/ic_settings_white_24dp"
|
||||
android:showAsAction="ifRoom"
|
||||
android:orderInCategory="3">
|
||||
</item>
|
||||
<item android:id="@+id/menu_about"
|
||||
android:title="@string/about_button"
|
||||
android:icon="@mipmap/ic_info_outline_white_24dp"
|
||||
android:showAsAction="ifRoom"
|
||||
android:orderInCategory="3">
|
||||
</item>
|
||||
<item android:id="@+id/menu_license"
|
||||
android:title="@string/license_button"
|
||||
android:showAsAction="never"
|
||||
android:orderInCategory="100">
|
||||
</item>
|
||||
|
||||
|
||||
</menu>
|
25
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
BIN
app/src/main/res/mipmap-hdpi/ic_info_outline_white_24dp.png
Normal file
After Width: | Height: | Size: 485 B |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_refresh_white_24dp.png
Normal file
After Width: | Height: | Size: 387 B |
BIN
app/src/main/res/mipmap-hdpi/ic_settings_white_24dp.png
Normal file
After Width: | Height: | Size: 460 B |
BIN
app/src/main/res/mipmap-mdpi/ic_info_outline_white_24dp.png
Normal file
After Width: | Height: | Size: 320 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_refresh_white_24dp.png
Normal file
After Width: | Height: | Size: 254 B |
BIN
app/src/main/res/mipmap-mdpi/ic_settings_white_24dp.png
Normal file
After Width: | Height: | Size: 326 B |
BIN
app/src/main/res/mipmap-xhdpi/ic_info_outline_white_24dp.png
Normal file
After Width: | Height: | Size: 655 B |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 8.0 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_refresh_white_24dp.png
Normal file
After Width: | Height: | Size: 509 B |
BIN
app/src/main/res/mipmap-xhdpi/ic_settings_white_24dp.png
Normal file
After Width: | Height: | Size: 562 B |
BIN
app/src/main/res/mipmap-xxhdpi/ic_info_outline_white_24dp.png
Normal file
After Width: | Height: | Size: 953 B |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_refresh_white_24dp.png
Normal file
After Width: | Height: | Size: 734 B |
BIN
app/src/main/res/mipmap-xxhdpi/ic_settings_white_24dp.png
Normal file
After Width: | Height: | Size: 843 B |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_info_outline_white_24dp.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_refresh_white_24dp.png
Normal file
After Width: | Height: | Size: 967 B |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_settings_white_24dp.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
887
app/src/main/res/raw/license.txt
Normal file
@@ -0,0 +1,887 @@
|
||||
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>.
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
Some of the icons used in this app are (c) by Google Inc. and licensed
|
||||
under the Apache 2.0 license.
|
||||
|
||||
This app uses gradle and the gradle wrapper, Copyright by Gradle Inc,
|
||||
licensed under the Apache 2.0 license.
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
Data basis: Deutscher Wetterdienst, own elements added, some data
|
||||
averaged over individual values.
|
1
app/src/main/res/raw/stations.txt
Normal file
@@ -0,0 +1 @@
|
||||
FDAT01:AFMS:Allgaeuer Alpen;FDAT01:FDMS:Bayerische Alpen;FDAT03:BDMS:Flughafen Augsburg;FDAT03:CFMS:Flughafen Oberpfaffenhofen;FDAT03:JDMS:westliches Alpenvorland;FDAT04:JBMS:westliches Donautal;FDAT05:ADMS:Muenchen;FDAT05:BDMS:Flughafen Muenchen FJS;FDAT05:JDMS:oestliches Alpenvorland;FDAT06:BBMS:Flughafen Straubing-Wallmuehle;FDAT06:CBMS:Regensburg;FDAT06:JBMS:oestliches Donautal;FDAT08:JBMS:Fraenkische Alb;FDAT09:JDSU:Schwaebische Alb;FDAT10:JDSU:Oberschwaben;FDAT11:BDMS:Flughafen Bayreuth;FDAT11:GBMS:Fraenkische Schweiz;FDAT11:JBMS:Mittelfranken;FDAT12:BBSU:Flughafen Stuttgart;FDAT12:EBSU:Kraichgau/Neckartal;FDAT12:GDSU:Hohenloher Ebene;FDAT12:HDSU:Flughafen Schwaebisch-Hall;FDAT12:JBSU:Neckar-Tauber-Ebene;FDAT13:BBMS:Flughafen Nuernberg;FDAT13:JBMS:Unterfranken;FDAT14:DBOF:Odenwald;FDAT14:JBMS:Spessart/Rhoen;FDAT15:BFSU:Flughafen Donaueschingen/Villingen;FDAT15:JBSU:Schwarzwald;FDAT16:BDSU:Flughafen Friedrichshafen;FDAT16:JBSU:Hochrhein-Bodensee;FDAT17:BBOF:Flughafen Zweibruecken;FDAT17:JBOF:Pfaelzer Bergland;FDAT18:BBOF:Flughafen Saarbruecken;FDAT18:JBOF:Saarland;FDAT19:EJOF:Rheinhessen;FDAT19:JBOF:Nahe-Huegelland;FDAT20:BJSU:Flughafen Karlsruhe/Baden-Baden;FDAT20:CJSU:Flughafen Lahr;FDAT20:DJOF:Flughafen Mannheim-City;FDAT20:JBSU:Oberrhein;FDAT21:JJOF:Vorderpfalz;FDAT22:JJOF:Bergstrasse;FDAT23:BJOF:Flughafen Frankfurt;FDAT23:CJOF:Flughafen Egelsbach;FDAT23:JJOF:Rhein-Main-Gebiet;FDAT24:BDOF:Flughafen Hahn;FDAT24:JDOF:Hunsrueck;FDAT25:JJOF:Mosel-/Saartal;FDAT27:JBOF:Vulkan-Eifel;FDAT28:JBEM:Nordeifel und Hohes Venn;FDAT29:JJOF:Mittelrheintal;FDAT30:EBOF:suedlicher Taunus;FDAT30:JBOF:noerdlicher Taunus;FDAT31:JBOF:Lahntal/Mittelhessen;FDAT32:JBOF:Westerwald;FDAT33:CBEM:Sauerland/Rothaargebirge/Sie;FDAT33:DFEM:Flughafen Siegerland;FDAT33:EBEM:Flughafen Paderborn;FDAT33:FJEM:Haarstrang;FDAT33:GBEM:Bergisches Land;FDAT34:BBOF:Flughafen Kassel-Calden;FDAT34:JBOF:Nordhessisches Bergland;FDAT35:JBOF:Vogelsberg/Rhoen;FDAT36:JBEM:suedliches Weserbergland;FDAT37:JBHA:Weser-Leine-Bergland;FDAT38:BBLZ:Brocken/Unterharz;FDAT38:CBLZ:oestliches Harzvorland;FDAT38:JBHA:Oberharz;FDAT39:DBMS:Fichtelgebirge/Frankenwald;FDAT39:JBLZ:Suedthueringen;FDAT40:DDMS:Bayerischer Wald;FDAT40:JDMS:Oberpfaelzer Wald;FDAT41:BFMS:Flughafen Hof-Plauen;FDAT41:JDLZ:Vogtland;FDAT42:JFLZ:Erzgebirge;FDAT43:JBLZ:Region Chemnitz;FDAT44:ADLZ:Lausitzer Bergland;FDAT44:DJLZ:Lausitz;FDAT44:JBLZ:Oberlausitz;FDAT46:BBLZ:Flughafen Altenburg-Nobitz;FDAT46:EJLZ:Elbtal/-niederung;FDAT46:FBLZ:Flughafen Dresden;FDAT46:FJLZ:Dresden;FDAT46:GJLZ:Leipziger Tieflandsbucht;FDAT46:HJLZ:Flughafen Leipzig/Halle;FDAT46:IJLZ:Region Leipzig;FDAT46:JBLZ:Mittelsaechs. Huegelland;FDAT47:DBLZ:Ostthueringen;FDAT47:EJLZ:Region Jena;FDAT47:FBLZ:Burgenland;FDAT47:JDLZ:Thueringer Wald;FDAT48:BBLZ:Flughafen Erfurt;FDAT48:DBLZ:Nordthueringen/Eichsfeld;FDAT48:JBLZ:Thueringer Becken;FDAT49:AJLZ:Region Dessau-Rosslau;FDAT49:EJLZ:Duebener Heide;FDAT49:JJLZ:Mittlere Elbe/Flaeming;FDAT50:AJLZ:Flughafen Magdeburg;FDAT50:BJLZ:Flughafen Cochstedt/Schneidlingen;FDAT50:JJLZ:Magdeburger Boerde;FDAT51:JJLZ:Region Merseburg/Weissenfels;FDAT52:AJHA:FH Braunschweig;FDAT52:BJHA:FH Hannover;FDAT52:JJHA:Hannover-Braunschweig-Gebiet;FDAT53:JBEM:noerdliches Weserbergland;FDAT54:AJEM:Flughafen Muenster/Osnabrueck;FDAT54:BJEM:Ruhrgebiet;FDAT54:DJEM:Westmuensterland;FDAT54:JJEM:Ostmuensterland;FDAT55:AJEM:Koeln-Bonner-Bucht;FDAT55:BJEM:suedl. Niederrhein. Bucht;FDAT55:CJEM:noerdl. Niederrhein. Bucht;FDAT55:DJEM:Flughafen Koeln/Bonn;FDAT55:EJEM:Flughafen Duesseldorf;FDAT56:JJEM:Venn-Vorland;FDAT57:DJEM:Flughafen Moenchengladbach;FDAT57:EJEM:westlicher Niederrhein;FDAT57:FJEM:Flughafen Niederrhein;FDAT57:HJEM:oestlicher Niederrhein;FDAT59:BJHA:FH Bremen;FDAT59:JJHA:Elbe-Weser-Gebiet;FDAT60:BJHA:FH Lemwerder;FDAT60:JJHA:Emsland;FDAT61:AJHA:FH Bremerhaven;FDAT61:BJHA:FH Wilhelmshaven;FDAT61:CJHA:FH Emden;FDAT61:JJHA:Niedersaechsische Kueste;FDAT62:JJHA:Osnabruecker Land;FDAT64:JJHA:Lueneburger Heide;FDAT67:BJHA:FH Hamburg;FDAT67:CJHA:FH Hamburg-Finkenwerder;FDAT67:JJHA:Hamburg;FDAT68:AJHA:FH Westerland/Sylt;FDAT68:JJHA:Schl.-Holst. Westkueste;FDAT69:EJHA:Schl.-Holst. Binnenland Sued;FDAT69:JJHA:Schl.-Holst. Binnenland Nord;FDAT70:BJHA:FH Kiel-Holtenau;FDAT70:CJHA:FH Luebeck-Blankensee;FDAT70:JJHA:Schl.-Holst. Ostseekueste;FDAT71:BJPD:Flughafen Rostock-Laage;FDAT71:JJPD:westliche Ostseekueste;FDAT72:BJPD:Flughafen Heringsdorf;FDAT72:JJPD:oestliche Ostseekueste;FDAT73:JJPD:suedliches Vorpommern;FDAT74:JJPD:Uckermark;FDAT75:BJPD:Flughafen Schwerin-Parchim;FDAT75:JJPD:Mecklenburgische Seenplatte;FDAT77:JJPD:Prignitz;FDAT78:JJPD:Havelland;FDAT82:AJPD:Berlin-Schoenefeld;FDAT82:BJPD:Berlin-Tegel;FDAT82:CJPD:Berlin-Tempelhof;FDAT82:JJPD:Berlin;FDAT83:JJPD:Maerkische Schweiz und Spree;FDAT84:JJPD:Niederlausitz;FDAT85:JJPD:Flaeming;FDAT86:JJLZ:Altmark;FDAT88:JJLZ:Duebener-Dahlener Heide;
|
59
app/src/main/res/values/arrays.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string-array name="updateinterval_text">
|
||||
<item>3 hours</item>
|
||||
<item>6 hours</item>
|
||||
<item>9 hours</item>
|
||||
<item>12 hours</item>
|
||||
</string-array>
|
||||
<string-array name="updateinterval_values">
|
||||
<item>3</item>
|
||||
<item>6</item>
|
||||
<item>9</item>
|
||||
<item>12</item>
|
||||
</string-array>
|
||||
<string-array name="widget_opacity_text">
|
||||
<item>0 (transparent)</item>
|
||||
<item>10 %</item>
|
||||
<item>20 %</item>
|
||||
<item>30 %</item>
|
||||
<item>40 %</item>
|
||||
<item>50 %</item>
|
||||
<item>60 %</item>
|
||||
<item>70 %</item>
|
||||
<item>80 %</item>
|
||||
<item>90 %</item>
|
||||
<item>100 (solid)</item>
|
||||
</string-array>
|
||||
<string-array name="widget_opacity_values">
|
||||
<item>0</item>
|
||||
<item>10</item>
|
||||
<item>20</item>
|
||||
<item>30</item>
|
||||
<item>40</item>
|
||||
<item>50</item>
|
||||
<item>60</item>
|
||||
<item>70</item>
|
||||
<item>80</item>
|
||||
<item>90</item>
|
||||
<item>100</item>
|
||||
</string-array>
|
||||
</resources>
|
33
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<color name="colorPrimary">#202020</color>
|
||||
<color name="colorPrimaryDark">#000000</color>
|
||||
<color name="colorPrimaryLight">#464646</color>
|
||||
<color name="colorAccent">#03DAC5</color>
|
||||
<color name="widget_textcolor">#FFFFFF</color>
|
||||
<color name="textColor">#eeeeee</color>
|
||||
<color name="textColorGrey">#999999</color>
|
||||
|
||||
<color name="background_holo_dark">@color/colorPrimary</color>
|
||||
|
||||
</resources>
|
32
app/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<dimen name="widget_textsize_large">14sp</dimen>
|
||||
<dimen name="widget_textsize_medium">12sp</dimen>
|
||||
<dimen name="widget_textsize_small">7sp</dimen>
|
||||
|
||||
<dimen name="fcmain_textsize_large">18sp</dimen>
|
||||
<dimen name="fcmain_textsize_medium">12sp</dimen>
|
||||
<dimen name="fcmain_textsize_small">7sp</dimen>
|
||||
|
||||
<dimen name="licence_textsize">10sp</dimen>
|
||||
|
||||
</resources>
|
80
app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,80 @@
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="app_name">Tiny Weather Forecast Germany</string>
|
||||
<string name="main_selectstation">Region:</string>
|
||||
<string name="main_isprovider">Please note that this service is registered as the weather provider service in lineageos. You cannot change the weather location here. To change the location, go to the widget settings of the system clock and select the location there.</string>
|
||||
<string name="dwd_notice">Source: Deutscher Wetterdienst, own elements added, some data averaged over individual values. </string>
|
||||
<string name="new_station">Region changed to </string>
|
||||
<string name="license_button">License</string>
|
||||
<string name="about_button">About...</string>
|
||||
<string name="triggerupdate_button">About...</string>
|
||||
<string name="classicwidget_description">Weather widget</string>
|
||||
<string name="weathercode_blustery">Blustery</string>
|
||||
<string name="weathercode_clear_night">Clear night</string>
|
||||
<string name="weathercode_cloudy">Cloudy</string>
|
||||
<string name="weathercode_cold">Cold</string>
|
||||
<string name="weathercode_drizzle">Drizzle</string>
|
||||
<string name="weathercode_fair_day">Fair day</string>
|
||||
<string name="weathercode_fair_night">Fair night</string>
|
||||
<string name="weathercode_freezing_drizzle">Freezing drizzle</string>
|
||||
<string name="weathercode_freezing_rain">Freezing rain</string>
|
||||
<string name="weathercode_heavy_snow">Heavy snow</string>
|
||||
<string name="weathercode_hot">Hot</string>
|
||||
<string name="weathercode_hurricane">Hurricane</string>
|
||||
<string name="weathercode_light_showers">Light showers</string>
|
||||
<string name="weathercode_light_snow_showers">Light snow showers</string>
|
||||
<string name="weathercode_mixed_rain_and_snow">Mixed rain and snow</string>
|
||||
<string name="weathercode_mostly_cloudy_day">Mostly cloudy day</string>
|
||||
<string name="weathercode_mostly_cloudy_night">Mostly cloudy night</string>
|
||||
<string name="weathercode_not_available">Not available</string>
|
||||
<string name="weathercode_partly_cloudy_day">Partly cloudy day</string>
|
||||
<string name="weathercode_partly_cloudy_night">Partly cloudy night</string>
|
||||
<string name="weathercode_scattered_showers">Scattered showers</string>
|
||||
<string name="weathercode_scattered_snow_showers">Scattered snow showers</string>
|
||||
<string name="weathercode_showers">Showers</string>
|
||||
<string name="weathercode_snow_showers">Snow showers</string>
|
||||
<string name="weathercode_snow">Snow</string>
|
||||
<string name="weathercode_snow_flurries">Snow flurries</string>
|
||||
<string name="weathercode_sunny">Sunny</string>
|
||||
<string name="weathercode_windy">Windy</string>
|
||||
<string name="weathercode_partly_cloudy_day_scattered_showers">Partly cloudy, showers</string>
|
||||
<string name="weathercode_partly_cloudy_night_scattered_showers">Partly cloudy, showers</string>
|
||||
<string name="weathercode_partly_cloudy_day_scattered_snow_showers">Partly cloudy, snow showers</string>
|
||||
<string name="weathercode_partly_cloudy_night_scattered_snow_showers">Partly cloudy, snow showers</string>
|
||||
<string name="weathercode_partly_cloudy_day_scattered_showers_light">Partly cloudy, light showers</string>
|
||||
<string name="weathercode_partly_cloudy_night_scattered_showers_light">Partly cloudy, light showers</string>
|
||||
<string name="weathercode_partly_cloudy_day_scattered_snow_showers_light">Partly cloudy, light snow showers</string>
|
||||
<string name="weathercode_partly_cloudy_night_scattered_snow_showers_light">Partly cloudy, light snow showers</string>
|
||||
<string name="title_activity_settings">Settings</string>
|
||||
<string name="clouds">Clouds: </string>
|
||||
<string name="rain">Rain: </string>
|
||||
<string name="preference_category_general">General</string>
|
||||
<string name="preference_category_widget">Widget settigs</string>
|
||||
<string name="preference_updateinterval_title">Update interval</string>
|
||||
<string name="preference_pdateinterval_summary">Select how often the weather data should be updated.</string>
|
||||
<string name="preference_opacity_title">Widget opacity</string>
|
||||
<string name="preference_opacity_summary">Select how transparent the widget is on your home screen.</string>
|
||||
<string name="preference_displaynoteinwidget_title">Diplay DWD note</string>
|
||||
<string name="preference_displaynoteinwidget_summary">Show the data source string.</string>
|
||||
<string name="license_title">Licenses</string>
|
||||
<string name="button_continue">Continue</string>
|
||||
|
||||
</resources>
|
26
app/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="android:Theme.Holo">
|
||||
</style>
|
||||
|
||||
</resources>
|
31
app/src/main/res/xml/classicwidget.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:minWidth="40dp"
|
||||
android:minHeight="40dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:updatePeriodMillis="1800000"
|
||||
android:previewImage="@drawable/sunny"
|
||||
android:initialLayout="@layout/classicwidget_layout"
|
||||
android:layout="@layout/classicwidget_layout"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:widgetCategory="home_screen">
|
||||
</appwidget-provider>
|
58
app/src/main/res/xml/preferences.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<!--
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/preference_category_general">
|
||||
|
||||
<ListPreference
|
||||
android:key="PREF_updateinterval"
|
||||
android:title="@string/preference_updateinterval_title"
|
||||
android:summary="@string/preference_pdateinterval_summary"
|
||||
android:entries="@array/updateinterval_text"
|
||||
android:entryValues="@array/updateinterval_values"
|
||||
android:defaultValue="1"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/preference_category_widget">
|
||||
|
||||
<ListPreference
|
||||
android:key="PREF_widget_opacity"
|
||||
android:title="@string/preference_opacity_title"
|
||||
android:summary="@string/preference_opacity_summary"
|
||||
android:entries="@array/widget_opacity_text"
|
||||
android:entryValues="@array/widget_opacity_values"
|
||||
android:defaultValue="1"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="PREF_widget_showdwdnote"
|
||||
android:title="@string/preference_displaynoteinwidget_title"
|
||||
android:summary="@string/preference_displaynoteinwidget_summary"
|
||||
android:defaultValue="true"/>
|
||||
|
||||
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
|
45
build.gradle
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
This file is part of Tiny24hWeatherForecastGermany.
|
||||
|
||||
Copyright (c) 2020 Pawel Dube
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
**/
|
||||
|
||||
buildscript {
|
||||
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.6.0-rc01'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
20
gradle.properties
Normal file
@@ -0,0 +1,20 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
# android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
# android.enableJetifier=true
|
||||
|
172
gradlew
vendored
Executable file
@@ -0,0 +1,172 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
84
gradlew.bat
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
2
settings.gradle
Normal file
@@ -0,0 +1,2 @@
|
||||
rootProject.name='Tiny 24h Weather Forecast Germany'
|
||||
include ':app'
|