Full Code of mafik/echo for AI

master 007fdf30250a cached
104 files
253.8 KB
60.8k tokens
277 symbols
1 requests
Download .txt
Showing preview only (282K chars total). Download the full file or copy to clipboard to get everything.
Repository: mafik/echo
Branch: master
Commit: 007fdf30250a
Files: 104
Total size: 253.8 KB

Directory structure:
gitextract_ko78r43l/

├── .gitignore
├── LICENSE.txt
├── README.md
├── SaidIt/
│   ├── SaidIt-SaidIt.iml
│   ├── build.gradle
│   ├── libs/
│   │   └── jcaki-1.0-Alpha.jar
│   ├── proguard.cfg
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── assets/
│           │   └── public_key.der
│           ├── java/
│           │   ├── eu/
│           │   │   └── mrogalski/
│           │   │       ├── StringFormat.java
│           │   │       ├── android/
│           │   │       │   ├── TimeFormat.java
│           │   │       │   └── Views.java
│           │   │       └── saidit/
│           │   │           ├── AudioMemory.java
│           │   │           ├── BroadcastReceiver.java
│           │   │           ├── ErrorResponseDialog.java
│           │   │           ├── IntentResult.java
│           │   │           ├── RecordingDoneDialog.java
│           │   │           ├── SaidIt.java
│           │   │           ├── SaidItActivity.java
│           │   │           ├── SaidItFragment.java
│           │   │           ├── SaidItService.java
│           │   │           ├── SettingsActivity.java
│           │   │           ├── ThemedDialog.java
│           │   │           ├── UserInfo.java
│           │   │           └── WorkingDialog.java
│           │   └── simplesound/
│           │       ├── dsp/
│           │       │   ├── Complex.java
│           │       │   ├── DoubleVector.java
│           │       │   ├── DoubleVectorFrameSource.java
│           │       │   ├── DoubleVectorProcessingPipeline.java
│           │       │   ├── DoubleVectorProcessor.java
│           │       │   ├── MutableComplex.java
│           │       │   ├── NormalizedFrameIterator.java
│           │       │   └── WindowerFactory.java
│           │       └── pcm/
│           │           ├── MonoWavFileReader.java
│           │           ├── PcmAudioFormat.java
│           │           ├── PcmAudioHelper.java
│           │           ├── PcmMonoInputStream.java
│           │           ├── PcmMonoOutputStream.java
│           │           ├── RiffHeaderData.java
│           │           ├── WavAudioFormat.java
│           │           └── WavFileWriter.java
│           └── res/
│               ├── anim/
│               │   └── pulse.xml
│               ├── color/
│               │   └── button_text.xml
│               ├── drawable/
│               │   ├── bg_et.xml
│               │   ├── circle_button.xml
│               │   ├── circle_button_normal.xml
│               │   ├── circle_button_pressed.xml
│               │   ├── cling_button_bg.xml
│               │   ├── dashed_line.xml
│               │   ├── dialog_content.xml
│               │   ├── dialog_title.xml
│               │   ├── error_dialog_title.xml
│               │   ├── gold_button.xml
│               │   ├── gold_button_normal.xml
│               │   ├── gold_button_pressed.xml
│               │   ├── gray_button.xml
│               │   ├── gray_button_focused.xml
│               │   ├── gray_button_normal.xml
│               │   ├── gray_button_pressed.xml
│               │   ├── green_button.xml
│               │   ├── green_button_normal.xml
│               │   ├── green_button_pressed.xml
│               │   ├── red_circle_button.xml
│               │   ├── red_circle_button_normal.xml
│               │   ├── red_circle_button_pressed.xml
│               │   ├── top_gray_button.xml
│               │   ├── top_gray_button_normal.xml
│               │   ├── top_gray_button_pressed.xml
│               │   ├── top_green_button.xml
│               │   ├── top_green_button_normal.xml
│               │   ├── top_green_button_pressed.xml
│               │   ├── white_button.xml
│               │   ├── white_button_focused.xml
│               │   ├── white_button_normal.xml
│               │   ├── white_button_pressed.xml
│               │   └── window_background.xml
│               ├── layout/
│               │   ├── activity_background_recorder.xml
│               │   ├── activity_settings.xml
│               │   ├── dialog_save_recording.xml
│               │   ├── fragment_background_recorder.xml
│               │   ├── progress_dialog.xml
│               │   └── recording_done_dialog.xml
│               ├── values/
│               │   ├── colors.xml
│               │   ├── dimens.xml
│               │   ├── paypal.xml
│               │   ├── strings.xml
│               │   └── styles.xml
│               ├── values-land-v19/
│               │   └── bools.xml
│               ├── values-pl/
│               │   └── strings.xml
│               ├── values-sw600dp-land-v19/
│               │   └── bools.xml
│               ├── values-v19/
│               │   └── styles.xml
│               └── xml/
│                   └── path_provider.xml
├── SaidIt.iml
├── build.gradle
├── fastlane/
│   └── metadata/
│       └── android/
│           └── en-US/
│               ├── changelogs/
│               │   └── 15.txt
│               ├── full_description.txt
│               ├── short_description.txt
│               └── title.txt
├── gradle/
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradle

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
# Built application files
*.apk
*.ap_

# Files for the Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# IDEs
.idea/
.vscode/


================================================
FILE: LICENSE.txt
================================================
GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://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 <http://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:

    {project}  Copyright (C) {year}  {fullname}
    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
<http://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
<http://www.gnu.org/philosophy/why-not-lgpl.html>.



================================================
FILE: README.md
================================================
Echo
====

Time travelling recorder for Android.
It is free/libre and gratis software.

Download
---

* [F-Droid](https://f-droid.org/repository/browse/?fdid=eu.mrogalski.saidit)

Architecture
---

**SaidItFragment** the main view of the app.

**SaidItService** manages a high priority thread that records audio. The thread is a state machine that can be accessed by sending it tasks using Android's Handler (`audioHandler`).

**AudioMemory** (not thread-safe) manages the in-memory ring buffer of audio chunks.


================================================
FILE: SaidIt/SaidIt-SaidIt.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="SaidIt" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
  <component name="FacetManager">
    <facet type="android-gradle" name="Android-Gradle">
      <configuration>
        <option name="GRADLE_PROJECT_PATH" value=":SaidIt" />
      </configuration>
    </facet>
    <facet type="android" name="Android">
      <configuration>
        <option name="SELECTED_BUILD_VARIANT" value="debug" />
        <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
        <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugJava" />
        <option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
        <option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
        <option name="ALLOW_USER_CONFIGURATION" value="false" />
        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
        <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
        <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
        <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
      </configuration>
    </facet>
  </component>
  <component name="NewModuleRootManager" inherit-compiler-output="false">
    <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
    <exclude-output />
    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/assets" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
      <excludeFolder url="file://$MODULE_DIR$/build/intermediates" />
      <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
    </content>
    <orderEntry type="jdk" jdkName="Android API 19 Platform" jdkType="Android SDK" />
    <orderEntry type="sourceFolder" forTests="false" />
    <orderEntry type="library" exported="" name="support-v4-19.1.0" level="project" />
    <orderEntry type="library" exported="" name="library-2.4.0" level="project" />
    <orderEntry type="library" exported="" name="additionnal" level="project" />
    <orderEntry type="library" exported="" name="mail" level="project" />
    <orderEntry type="library" exported="" name="jcaki-1.0-Alpha" level="project" />
    <orderEntry type="library" exported="" name="appcompat-v7-19.1.0" level="project" />
    <orderEntry type="library" exported="" name="activation" level="project" />
    <orderEntry type="library" exported="" name="PayPalAndroidSDK" level="project" />
  </component>
</module>



================================================
FILE: SaidIt/build.gradle
================================================
buildscript {
    repositories {
        google()
        mavenCentral()
        maven { url "https://repo.maven.apache.org/maven2" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.10.1'
    }
}
apply plugin: 'com.android.application'

repositories {
        mavenCentral()
        maven { url "https://maven.google.com" }
}

android {
    namespace 'eu.mrogalski.saidit'
    compileSdk 34

    defaultConfig{
        applicationId "eu.mrogalski.saidit"
        minSdk 30
        targetSdk 34
        versionCode 15
        versionName "2.0.0"
    }

    signingConfigs {
        release {
            storeFile file("<relative path>")
            storePassword "<fill in>"
            keyAlias "<fill in>"
            keyPassword "<fill in>"
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFile file('proguard.cfg')
            proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
            signingConfig signingConfigs.release
        }

        debug {
            //signingConfig signingConfigs.release
        }
    }
    lint {
        abortOnError false
    }
    buildFeatures {
        buildConfig true
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: '*.jar')
    implementation 'androidx.appcompat:appcompat:1.6.1'
}


================================================
FILE: SaidIt/proguard.cfg
================================================
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable

-dontwarn java.awt.**
-dontwarn javax.security.**
-dontwarn java.beans.**

-keepattributes *Annotation*

-keep class org.acra.ACRA {
	*;
}

-keep class org.acra.ReportingInteractionMode {
    *;
}

-keepnames class org.acra.sender.HttpSender$** {
    *;
}

-keepnames class org.acra.ReportField {
    *;
}

-keep public class org.acra.ErrorReporter
{
    public void addCustomData(java.lang.String,java.lang.String);
    public void putCustomData(java.lang.String,java.lang.String);
    public void removeCustomData(java.lang.String);
}

-keep public class org.acra.ErrorReporter
{
    public void handleSilentException(java.lang.Throwable);
}

-keep class com.android.vending.billing.**


================================================
FILE: SaidIt/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Basic functionality -->
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />

    <supports-screens
        android:largeScreens="true"
        android:xlargeScreens="true" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:theme="@style/Theme" >
        <activity
            android:name=".SaidItActivity"
            android:label="@string/app_name"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="echoLicense"/>
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="echoCoupon"/>
            </intent-filter>
        </activity>

        <service
            android:name=".SaidItService"
            android:foregroundServiceType="microphone"
            android:enabled="true"
            android:exported="false">
        </service>

        <receiver android:name=".BroadcastReceiver"
            android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

        <activity
            android:name=".SettingsActivity"
            android:parentActivityName=".SaidItActivity" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="SaidItActivity" />
        </activity>

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/path_provider">

            </meta-data>
        </provider>
    </application>

</manifest>


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/StringFormat.java
================================================
package eu.mrogalski;

import java.text.DecimalFormat;

public class StringFormat {
    public static String shortFileSize(long size) {
        if(size <= 0) return "0";
        final String[] units = new String[] { "B", "KB", "MB", "GB", "TB" };
        int digitGroups = (int) (Math.log10(size)/Math.log10(1024));
        return new DecimalFormat("#,##0.#").format(size/Math.pow(1024, digitGroups)) + " " + units[digitGroups];
    }
}


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/android/TimeFormat.java
================================================
package eu.mrogalski.android;

import android.content.res.Resources;

import eu.mrogalski.saidit.R;

public class TimeFormat {
    public static void naturalLanguage(Resources resources, float secondsF, Result outResult) {
        int seconds = (int) Math.floor(secondsF);
        int minutes = seconds / 60;
        seconds %= 60;

        String out = "";

        if(minutes != 0) {
            outResult.count = minutes;
            out += resources.getQuantityString(R.plurals.minute, minutes, minutes);

            if(seconds != 0) {
                out += resources.getString(R.string.minute_second_join);
                out += resources.getQuantityString(R.plurals.second, seconds, seconds);
            }
        } else {
            outResult.count = seconds;
            out += resources.getQuantityString(R.plurals.second, seconds, seconds);
        }

        outResult.text = out + ".";
    }

    public static String shortTimer(float seconds) {
        return String.format("%d:%02d", (int) Math.floor(seconds / 60), (int) Math.floor(seconds % 60));
    }

    public static class Result {
        public String text;
        public int count;
    }
}


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/android/Views.java
================================================
package eu.mrogalski.android;

import android.view.View;
import android.view.ViewGroup;

public class Views {
    public static void search(ViewGroup viewGroup, SearchViewCallback callback) {
        final int cnt = viewGroup.getChildCount();
        for(int i = 0; i < cnt; ++i) {
            final View child = viewGroup.getChildAt(i);
            if(child instanceof ViewGroup) {
                search((ViewGroup) child, callback);
            }
            callback.onView(child, viewGroup);
        }

    }

    public static interface SearchViewCallback {
        public void onView(View view, ViewGroup parent);
    }
}


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/saidit/AudioMemory.java
================================================
package eu.mrogalski.saidit;

import android.os.SystemClock;

import java.io.IOException;
import java.util.LinkedList;

public class AudioMemory {

    private final LinkedList<byte[]> filled = new LinkedList<byte[]>();
    private final LinkedList<byte[]> free = new LinkedList<byte[]>();

    private long fillingStartUptimeMillis;
    private boolean filling = false;
    private boolean currentWasFilled = false;
    private byte[] current = null;
    private int offset = 0;
    static final int CHUNK_SIZE = 1920000; // 20 seconds of 48kHz wav (single channel, 16-bit samples) (1875 kB)

    synchronized public void allocate(long sizeToEnsure) {
        long currentSize = getAllocatedMemorySize();
        while(currentSize < sizeToEnsure) {
            currentSize += CHUNK_SIZE;
            free.addLast(new byte[CHUNK_SIZE]);
        }
        while(!free.isEmpty() && (currentSize - CHUNK_SIZE >= sizeToEnsure)) {
            currentSize -= CHUNK_SIZE;
            free.removeLast();
        }
        while(!filled.isEmpty() && (currentSize - CHUNK_SIZE >= sizeToEnsure)) {
            currentSize -= CHUNK_SIZE;
            filled.removeFirst();
        }
        if((current != null) && (currentSize - CHUNK_SIZE >= sizeToEnsure)) {
            //currentSize -= CHUNK_SIZE;
            current = null;
            offset = 0;
            currentWasFilled = false;
        }
        System.gc();
    }

    synchronized public long getAllocatedMemorySize() {
        return (free.size() + filled.size() + (current == null ? 0 : 1)) * CHUNK_SIZE;
    }

    public interface Consumer {
        public int consume(byte[] array, int offset, int count) throws IOException;
    }

    private int skipAndFeed(int bytesToSkip, byte[] arr, int offset, int length, Consumer consumer)  throws IOException {
        if(bytesToSkip >= length) {
            return length;
        } else if(bytesToSkip > 0) {
            consumer.consume(arr, offset + bytesToSkip, length - bytesToSkip);
            return bytesToSkip;
        }
        consumer.consume(arr, offset, length);
        return 0;
    }

    public void read(int skipBytes, Consumer reader)  throws IOException {
        synchronized (this) {
            if(!filling && current != null && currentWasFilled) {
                skipBytes -= skipAndFeed(skipBytes, current, offset, current.length - offset, reader);
            }
            for(byte[] arr : filled) {
                skipBytes -= skipAndFeed(skipBytes, arr, 0, arr.length, reader);
            }
            if(current != null && offset > 0) {
                skipAndFeed(skipBytes, current, 0, offset, reader);
            }
        }
    }

    public int countFilled() {
        int sum = 0;
        synchronized (this) {
            if(!filling && current != null && currentWasFilled) {
                sum += current.length - offset;
            }
            for(byte[] arr : filled) {
                sum += arr.length;
            }
            if(current != null && offset > 0) {
                sum += offset;
            }
        }
        return sum;
    }

    public void fill(Consumer filler) throws IOException {
        synchronized (this) {
            if(current == null) {
                if(free.isEmpty()) {
                    if(filled.isEmpty()) return;
                    currentWasFilled = true;
                    current = filled.removeFirst();
                } else {
                    currentWasFilled = false;
                    current = free.removeFirst();
                }
                offset = 0;
            }
            filling = true;
            fillingStartUptimeMillis = SystemClock.uptimeMillis();
        }

        final int read = filler.consume(current, offset, current.length - offset);

        synchronized (this) {
            if(offset + read >= current.length) {
                filled.addLast(current);
                current = null;
                offset = 0;
            } else {
                offset += read;
            }
            filling = false;
        }
    }

    public static class Stats {
        public int filled; // taken
        public int total;
        public int estimation;
        public boolean overwriting; // currentWasFilled;
    }

    public synchronized Stats getStats(int fillRate) {
        final Stats stats = new Stats();
        stats.filled = filled.size() * CHUNK_SIZE + (current == null ? 0 : currentWasFilled ? CHUNK_SIZE : offset);
        stats.total = (filled.size() + free.size() + (current == null ? 0 : 1)) * CHUNK_SIZE;
        stats.estimation = (int) (filling ? (SystemClock.uptimeMillis() - fillingStartUptimeMillis) * fillRate / 1000 : 0);
        stats.overwriting = currentWasFilled;
        return stats;
    }

}


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/saidit/BroadcastReceiver.java
================================================
package eu.mrogalski.saidit;

import android.content.Context;
import android.content.Intent;

public class BroadcastReceiver extends android.content.BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
        // Start only if tutorial has been finished
        if (context.getSharedPreferences(SaidIt.PACKAGE_NAME, Context.MODE_PRIVATE).getBoolean("skip_tutorial", false)) {
            context.startService(new Intent(context, SaidItService.class));
        }
    }
}


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/saidit/ErrorResponseDialog.java
================================================
package eu.mrogalski.saidit;

public class ErrorResponseDialog extends ThemedDialog {
    @Override
    int getShadowColorId() {
        return R.color.dark_red;
    }
}


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/saidit/IntentResult.java
================================================
package eu.mrogalski.saidit;
public final class IntentResult {

    private final String contents;
    private final String formatName;
    private final byte[] rawBytes;
    private final Integer orientation;
    private final String errorCorrectionLevel;

    IntentResult() {
        this(null, null, null, null, null);
    }

    IntentResult(String contents,
                 String formatName,
                 byte[] rawBytes,
                 Integer orientation,
                 String errorCorrectionLevel) {
        this.contents = contents;
        this.formatName = formatName;
        this.rawBytes = rawBytes;
        this.orientation = orientation;
        this.errorCorrectionLevel = errorCorrectionLevel;
    }

    /**
     * @return raw content of barcode
     */
    public String getContents() {
        return contents;
    }

    /**
     * @return name of format, like "QR_CODE", "UPC_A". See {@code BarcodeFormat} for more format names.
     */
    public String getFormatName() {
        return formatName;
    }

    /**
     * @return raw bytes of the barcode content, if applicable, or null otherwise
     */
    public byte[] getRawBytes() {
        return rawBytes;
    }

    /**
     * @return rotation of the image, in degrees, which resulted in a successful scan. May be null.
     */
    public Integer getOrientation() {
        return orientation;
    }

    /**
     * @return name of the error correction level used in the barcode, if applicable
     */
    public String getErrorCorrectionLevel() {
        return errorCorrectionLevel;
    }

    @Override
    public String toString() {
        StringBuilder dialogText = new StringBuilder(100);
        dialogText.append("Format: ").append(formatName).append('\n');
        dialogText.append("Contents: ").append(contents).append('\n');
        int rawBytesLength = rawBytes == null ? 0 : rawBytes.length;
        dialogText.append("Raw bytes: (").append(rawBytesLength).append(" bytes)\n");
        dialogText.append("Orientation: ").append(orientation).append('\n');
        dialogText.append("EC level: ").append(errorCorrectionLevel).append('\n');
        return dialogText.toString();
    }

}


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/saidit/RecordingDoneDialog.java
================================================
package eu.mrogalski.saidit;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import androidx.core.content.FileProvider;

import java.io.File;
import java.net.URLConnection;

import eu.mrogalski.StringFormat;
import eu.mrogalski.android.TimeFormat;

public class RecordingDoneDialog extends ThemedDialog {

    private static final String KEY_RUNTIME = "runtime";
    private static final String KEY_FILE = "file";

    private File file;
    private float runtime;
    private final TimeFormat.Result timeFormatResult = new TimeFormat.Result();

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putFloat(KEY_RUNTIME, runtime);
        outState.putString(KEY_FILE, file.getPath());
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if(savedInstanceState != null) {
            if(savedInstanceState.containsKey(KEY_FILE))
                file = new File(savedInstanceState.getString(KEY_FILE));
            if(savedInstanceState.containsKey(KEY_RUNTIME))
                runtime = savedInstanceState.getFloat(KEY_RUNTIME);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        final View root = inflater.inflate(R.layout.recording_done_dialog, container);
        assert root != null;

        fixFonts(root);

        final Activity activity = getActivity();
        assert activity != null;
        final Resources resources = activity.getResources();
        TimeFormat.naturalLanguage(resources, runtime, timeFormatResult);

        ((TextView) root.findViewById(R.id.recording_done_filename)).setText(file.getName());
        ((TextView) root.findViewById(R.id.recording_done_dirname)).setText(file.getParent());
        ((TextView) root.findViewById(R.id.recording_done_runtime)).setText(timeFormatResult.text);
        ((TextView) root.findViewById(R.id.recording_done_size)).setText(StringFormat.shortFileSize(file.length()));

        root.findViewById(R.id.recording_done_open_dir).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                openFolder();
            }
        });

        root.findViewById(R.id.recording_done_send).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent shareIntent = new Intent();
                shareIntent.setAction(Intent.ACTION_SEND);
                Uri fileUri = FileProvider.getUriForFile(activity, BuildConfig.APPLICATION_ID + ".provider", file);
                shareIntent.putExtra(Intent.EXTRA_STREAM, fileUri);
                shareIntent.setType(activity.getContentResolver().getType(fileUri)); // Get MIME type from content resolver
                shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // Grant read permission
                startActivity(Intent.createChooser(shareIntent, "Send to"));

            }
        });

        root.findViewById(R.id.recording_done_play).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setAction(android.content.Intent.ACTION_VIEW);
                Uri fileUri = FileProvider.getUriForFile(activity, BuildConfig.APPLICATION_ID + ".provider", file);
                intent.setDataAndType(fileUri, "audio/*");
                intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // Grant read permission
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
            }
        });

        return root;
    }

    public RecordingDoneDialog setFile(File file) {
        this.file = file;
        return this;
    }

    public RecordingDoneDialog setRuntime(float runtime) {
        this.runtime = runtime;
        return this;
    }

    public void openFolder() {
        File folder = file.getParentFile();
        if (folder.exists() && folder.isDirectory()) {
            Uri uri = Uri.parse(folder.getAbsolutePath());
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(uri, "*/*");
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
        } else {
            Log.e("OpenFolder", "Folder does not exist or is not a directory");
        }
    }


    private static boolean isExternalStorageWritable() {
        String state = Environment.getExternalStorageState();
        return Environment.MEDIA_MOUNTED.equals(state);
    }
}


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/saidit/SaidIt.java
================================================
package eu.mrogalski.saidit;

public class SaidIt {

    static final String PACKAGE_NAME = "eu.mrogalski.saidit";
    static final String AUDIO_MEMORY_ENABLED_KEY = "audio_memory_enabled";
    static final String AUDIO_MEMORY_SIZE_KEY = "audio_memory_size";
    static final String SAMPLE_RATE_KEY = "sample_rate";
    static final String SKU = "unlimited_history";
    static final String BASE64_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlD0FMFGp4AWzjW" +
            "LTsUZgm0soga0mVVNGFj0qoATaoQCE/LamF7yrMCIFm9sEOB1guCEhzdr16sjysrVc2EPRisS83FoJ4K0R8" +
            "XPDP2TrVT2SAeQpTCG27NNH+W86SlGEqQeQhMPMhR+HDTckHv3KBpD8BZEEIbkXPv6SGFqcZub6xzn9r14l" +
            "6ptYIWboKGGBh1i9/nJpdhCMPxuLn/WZnRXGxqGpfNw2xT25/muUDZgRVezy6/5eI+ciMn5H1U0ADBjXvl1" +
            "Py+4ClkR1V1Mfo9lvauB03zM8Fsa3LlIPle5a+wGKsRCLW/rJ/eE/rje6X7x/n+w8J4OiFvVATj0T8QIDAQ" +
            "AB";

}


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/saidit/SaidItActivity.java
================================================
package eu.mrogalski.saidit;

import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.Settings;

import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;

public class SaidItActivity extends Activity {

    private static final int PERMISSION_REQUEST_CODE = 5465;
    private boolean isFragmentSet = false;
    private AlertDialog permissionDeniedDialog;
    private AlertDialog storagePermissionDialog;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_background_recorder);
    }

    @Override
    protected void onStart() {
        super.onStart();
        if(permissionDeniedDialog != null) {
            permissionDeniedDialog.dismiss();
        }
        if(storagePermissionDialog != null) {
            storagePermissionDialog.dismiss();
        }
        requestPermissions();
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        if(permissionDeniedDialog != null) {
            permissionDeniedDialog.dismiss();
        }
        if(storagePermissionDialog != null) {
            storagePermissionDialog.dismiss();
        }
        requestPermissions();
    }

    private void requestPermissions() {
        // Ask for storage permission

        String[] permissions = {Manifest.permission.RECORD_AUDIO, Manifest.permission.FOREGROUND_SERVICE};
        if(Build.VERSION.SDK_INT >= 33) {
            permissions = new String[]{Manifest.permission.RECORD_AUDIO, Manifest.permission.FOREGROUND_SERVICE, Manifest.permission.POST_NOTIFICATIONS};
        }
        ActivityCompat.requestPermissions(this, permissions, PERMISSION_REQUEST_CODE);
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if (requestCode == PERMISSION_REQUEST_CODE) {
            // Check if all permissions are granted
            boolean allPermissionsGranted = true;
            for (int result : grantResults) {
                if (result != PackageManager.PERMISSION_GRANTED) {
                    allPermissionsGranted = false;
                    break;
                }
            }
            if (allPermissionsGranted) {
                // All permissions are granted
                if (Environment.isExternalStorageManager()) {
                    // Permission already granted
                    if(storagePermissionDialog != null) {
                        storagePermissionDialog.dismiss();
                    }
                    showFragment();
                } else {
                    // Request MANAGE_EXTERNAL_STORAGE permission
                    storagePermissionDialog = new AlertDialog.Builder(this)
                            .setTitle(R.string.permission_required)
                            .setMessage(R.string.permission_required_message)
                            .setPositiveButton(R.string.allow, new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    // Open app settings
                                    Intent intent = new Intent();
                                    intent.setAction(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
                                    intent.setData(Uri.fromParts("package", getPackageName(), null));
                                    startActivity(intent);
                                }
                            })
                            .setNegativeButton(R.string.exit, new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    finish();
                                }
                            })
                            .setCancelable(false)
                            .show();
                }
            } else {
                if(permissionDeniedDialog == null || !permissionDeniedDialog.isShowing()) {
                    showPermissionDeniedDialog();
                }
            }
        }
    }

    private void showFragment() {
        if (!isFragmentSet) {
            isFragmentSet = true;
            getFragmentManager().beginTransaction()
                    .replace(R.id.container, new SaidItFragment(), "main-fragment")
                    .commit();
        }
    }
    private void showPermissionDeniedDialog() {
        permissionDeniedDialog = new AlertDialog.Builder(this)
                .setTitle(R.string.permission_required)
                .setMessage(R.string.permission_required_message)
                .setPositiveButton(R.string.allow, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // Open app settings
                        Intent intent = new Intent();
                        intent.setAction(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                        intent.setData(Uri.fromParts("package", getPackageName(), null));
                        startActivity(intent);
                    }
                })
                .setNegativeButton(R.string.exit, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        finish();
                    }
                })
                .setCancelable(false)
                .show();
    }
}

================================================
FILE: SaidIt/src/main/java/eu/mrogalski/saidit/SaidItFragment.java
================================================
package eu.mrogalski.saidit;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.Fragment;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.util.Log;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.core.app.ActivityCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.FileProvider;

import java.io.File;

import eu.mrogalski.android.TimeFormat;
import eu.mrogalski.android.Views;

public class SaidItFragment extends Fragment {

    private static final String TAG = SaidItFragment.class.getSimpleName();
    private static final String YOUR_NOTIFICATION_CHANNEL_ID = "SaidItServiceChannel";
    private Button record_pause_button;
    private Button listenButton;

    ListenButtonClickListener listenButtonClickListener = new ListenButtonClickListener();
    RecordButtonClickListener recordButtonClickListener = new RecordButtonClickListener();

    private boolean isListening = true;
    private boolean isRecording = false;

    private LinearLayout ready_section;
    private Button recordLastFiveMinutesButton;
    private Button recordMaxButton;
    private Button recordLastMinuteButton;
    private Button recordLastThirtyMinuteButton;
    private Button recordLastTwoHrsButton;
    private Button recordLastSixHrsButton;
    private TextView history_limit;
    private TextView history_size;
    private TextView history_size_title;

    private LinearLayout rec_section;
    private TextView rec_indicator;
    private TextView rec_time;

    private ImageButton rate_on_google_play;
    private ImageView heart;

    @Override
    public void onStart() {
        Log.d(TAG, "onStart");
        super.onStart();
        final Activity activity = getActivity();
        assert activity != null;
        activity.bindService(new Intent(activity, SaidItService.class), echoConnection, Context.BIND_AUTO_CREATE);
    }

    @Override
    public void onStop() {
        Log.d(TAG, "onStop");
        super.onStop();
        final Activity activity = getActivity();
        assert activity != null;
        activity.unbindService(echoConnection);
        echo = null;
    }

    class ActivityResult {
        final int requestCode;
        final int resultCode;
        final Intent data;

        ActivityResult(int requestCode, int resultCode, Intent data) {
            this.requestCode = requestCode;
            this.resultCode = resultCode;
            this.data = data;
        }
    }

    private Runnable updater = new Runnable() {
        @Override
        public void run() {
            final View view = getView();
            if (view == null) return;
            if (echo == null) return;
            echo.getState(serviceStateCallback);
        }
    };

    SaidItService echo;
    private ServiceConnection echoConnection = new ServiceConnection() {

        @Override
        public void onServiceConnected(ComponentName className,
                                       IBinder binder) {
            Log.d(TAG, "onServiceConnected");
            SaidItService.BackgroundRecorderBinder typedBinder = (SaidItService.BackgroundRecorderBinder) binder;
            if (echo != null && echo == typedBinder.getService()) {
                Log.d(TAG, "update loop already running, skipping");
                return;
            }
            echo = typedBinder.getService();
            getView().postOnAnimation(updater);
        }

        @Override
        public void onServiceDisconnected(ComponentName arg0) {
            Log.d(TAG, "onServiceDisconnected");
            echo = null;
        }
    };

    public int getStatusBarHeight() {
        int result = 0;
        int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            result = getResources().getDimensionPixelSize(resourceId);
        }
        return result;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View rootView = inflater.inflate(R.layout.fragment_background_recorder, container, false);

        if (rootView == null) return null;

        final Activity activity = getActivity();
        final AssetManager assets = activity.getAssets();
        final Typeface robotoCondensedBold = Typeface.createFromAsset(assets, "RobotoCondensedBold.ttf");
        final Typeface robotoCondensedRegular = Typeface.createFromAsset(assets, "RobotoCondensed-Regular.ttf");
        final float density = activity.getResources().getDisplayMetrics().density;

        Views.search((ViewGroup) rootView, new Views.SearchViewCallback() {
            @Override
            public void onView(View view, ViewGroup parent) {

                if (view instanceof Button) {
                    final Button button = (Button) view;
                    button.setTypeface(robotoCondensedBold);
                    final int shadowColor = button.getShadowColor();
                    button.setShadowLayer(0.01f, 0, density * 2, shadowColor);
                } else if (view instanceof TextView) {

                    final TextView textView = (TextView) view;
                    textView.setTypeface(robotoCondensedRegular);
                }
            }
        });

        history_limit = (TextView) rootView.findViewById(R.id.history_limit);
        history_size = (TextView) rootView.findViewById(R.id.history_size);
        history_size_title = (TextView) rootView.findViewById(R.id.history_size_title);

        history_limit.setTypeface(robotoCondensedBold);
        history_size.setTypeface(robotoCondensedBold);

        listenButton = (Button) rootView.findViewById(R.id.listen_button);
        if (listenButton != null) {
            listenButton.setOnClickListener(listenButtonClickListener);
        }

        final int statusBarHeight = getStatusBarHeight();
        listenButton.setPadding(listenButton.getPaddingLeft(), listenButton.getPaddingTop() + statusBarHeight, listenButton.getPaddingRight(), listenButton.getPaddingBottom());
        final ViewGroup.LayoutParams layoutParams = listenButton.getLayoutParams();
        layoutParams.height += statusBarHeight;
        listenButton.setLayoutParams(layoutParams);


        record_pause_button = (Button) rootView.findViewById(R.id.rec_stop_button);
        record_pause_button.setOnClickListener(recordButtonClickListener);

        recordLastMinuteButton = (Button) rootView.findViewById(R.id.record_last_minute);
        recordLastMinuteButton.setOnClickListener(recordButtonClickListener);
        recordLastMinuteButton.setOnLongClickListener(recordButtonClickListener);

        recordLastFiveMinutesButton = (Button) rootView.findViewById(R.id.record_last_5_minutes);
        recordLastFiveMinutesButton.setOnClickListener(recordButtonClickListener);
        recordLastFiveMinutesButton.setOnLongClickListener(recordButtonClickListener);

        recordLastThirtyMinuteButton = (Button) rootView.findViewById(R.id.record_last_30_minutes);
        recordLastThirtyMinuteButton.setOnClickListener(recordButtonClickListener);
        recordLastThirtyMinuteButton.setOnLongClickListener(recordButtonClickListener);

        recordLastTwoHrsButton = (Button) rootView.findViewById(R.id.record_last_2_hrs);
        recordLastTwoHrsButton.setOnClickListener(recordButtonClickListener);
        recordLastTwoHrsButton.setOnLongClickListener(recordButtonClickListener);

        recordLastSixHrsButton = (Button) rootView.findViewById(R.id.record_last_6_hrs);
        recordLastSixHrsButton.setOnClickListener(recordButtonClickListener);
        recordLastSixHrsButton.setOnLongClickListener(recordButtonClickListener);

        recordMaxButton = (Button) rootView.findViewById(R.id.record_last_max);
        recordMaxButton.setOnClickListener(recordButtonClickListener);
        recordMaxButton.setOnLongClickListener(recordButtonClickListener);

        ready_section = (LinearLayout) rootView.findViewById(R.id.ready_section);
        rec_section = (LinearLayout) rootView.findViewById(R.id.rec_section);
        rec_indicator = (TextView) rootView.findViewById(R.id.rec_indicator);
        rec_time = (TextView) rootView.findViewById(R.id.rec_time);

        rate_on_google_play = (ImageButton) rootView.findViewById(R.id.rate_on_google_play);

        final Animation pulse = AnimationUtils.loadAnimation(activity, R.anim.pulse);
        heart = (ImageView) rootView.findViewById(R.id.heart);
        heart.startAnimation(pulse);

        rate_on_google_play.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                try {
                    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/mafik/echo")));
                } catch (android.content.ActivityNotFoundException anfe) {
                    // ignore
                }
            }
        });

        heart.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                heart.animate().scaleX(10).scaleY(10).alpha(0).setDuration(2000).start();
                Handler handler = new Handler(activity.getMainLooper());
                handler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        // star the app
                        try {
                            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/sponsors/mafik")));
                        } catch (android.content.ActivityNotFoundException anfe) {
                            // ignore
                        }
                    }
                }, 1000);
                handler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        heart.setAlpha(0f);
                        heart.setScaleX(1);
                        heart.setScaleY(1);
                        heart.animate().alpha(1).start();

                    }
                }, 3000);
            }
        });

        rootView.findViewById(R.id.settings_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(activity, SettingsActivity.class));
            }
        });
        serviceStateCallback.state(isListening, isRecording, 0, 0, 0);
        return rootView;
    }

    private SaidItService.StateCallback serviceStateCallback = new SaidItService.StateCallback() {
        @Override
        public void state(final boolean listeningEnabled, final boolean recording, final float memorized, final float totalMemory, final float recorded) {
            final Activity activity = getActivity();
            if (activity == null) return;
            final Resources resources = activity.getResources();
            if ((isRecording != recording) || (isListening != listeningEnabled)) {
                if (recording != isRecording) {
                    isRecording = recording;
                    if (recording) {
                        rec_section.setVisibility(View.VISIBLE);
                    } else {
                        rec_section.setVisibility(View.GONE);
                    }
                }

                if (listeningEnabled != isListening) {
                    isListening = listeningEnabled;
                    if (listeningEnabled) {
                        listenButton.setText(R.string.listening_enabled_disable);
                        listenButton.setBackgroundResource(R.drawable.top_green_button);
                        listenButton.setShadowLayer(0.01f, 0, resources.getDimensionPixelOffset(R.dimen.shadow_offset), resources.getColor(R.color.dark_green));
                    } else {
                        listenButton.setText(R.string.listening_disabled_enable);
                        listenButton.setBackgroundResource(R.drawable.top_gray_button);
                        listenButton.setShadowLayer(0.01f, 0, resources.getDimensionPixelOffset(R.dimen.shadow_offset), 0xff666666);
                    }
                }

                if (listeningEnabled && !recording) {
                    ready_section.setVisibility(View.VISIBLE);
                } else {
                    ready_section.setVisibility(View.GONE);
                }
            }

            TimeFormat.naturalLanguage(resources, totalMemory, timeFormatResult);

            if (!history_limit.getText().equals(timeFormatResult.text)) {
                history_limit.setText(timeFormatResult.text);
            }

            TimeFormat.naturalLanguage(resources, memorized, timeFormatResult);

            if (!history_size.getText().equals(timeFormatResult.text)) {
                history_size_title.setText(resources.getQuantityText(R.plurals.history_size_title, timeFormatResult.count));
                history_size.setText(timeFormatResult.text);
                recordMaxButton.setText(TimeFormat.shortTimer(memorized));
            }

            TimeFormat.naturalLanguage(resources, recorded, timeFormatResult);

            if (!rec_time.getText().equals(timeFormatResult.text)) {
                rec_indicator.setText(resources.getQuantityText(R.plurals.recorded, timeFormatResult.count));
                rec_time.setText(timeFormatResult.text);
            }

            history_size.postOnAnimationDelayed(updater, 100);
        }
    };

    final TimeFormat.Result timeFormatResult = new TimeFormat.Result();


    private class ListenButtonClickListener implements View.OnClickListener {

        @SuppressLint("ValidFragment")
        final WorkingDialog dialog = new WorkingDialog();

        public ListenButtonClickListener() {
            dialog.setDescriptionStringId(R.string.work_preparing_memory);
        }

        @Override
        public void onClick(View v) {
            echo.getState(new SaidItService.StateCallback() {
                @Override
                public void state(final boolean listeningEnabled, boolean recording, float memorized, float totalMemory, float recorded) {
                    if (listeningEnabled) {
                        echo.disableListening();
                    } else {
                        dialog.show(getFragmentManager(), "Preparing memory");

                        new Handler().post(new Runnable() {
                            @Override
                            public void run() {
                                echo.enableListening();
                                echo.getState(new SaidItService.StateCallback() {
                                    @Override
                                    public void state(boolean listeningEnabled, boolean recording, float memorized, float totalMemory, float recorded) {
                                        dialog.dismiss();
                                    }
                                });
                            }
                        });
                    }
                }
            });
        }
    }

    private class RecordButtonClickListener implements View.OnClickListener, View.OnLongClickListener {

        @Override
        public void onClick(final View v) {
            record(v, false);
        }

        @Override
        public boolean onLongClick(final View v) {
            record(v, true);
            return true;
        }

        public void record(final View button, final boolean keepRecording) {
            echo.getState(new SaidItService.StateCallback() {
                @Override
                public void state(final boolean listeningEnabled, final boolean recording, float memorized, float totalMemory, float recorded) {
                    getActivity().runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            if (recording) {
                                echo.stopRecording(new PromptFileReceiver(getActivity()),"");
                            } else {
                                ProgressDialog pd = new ProgressDialog(getActivity());
                                pd.setMessage("Recording...");
                                pd.show();
                                final float seconds = getPrependedSeconds(button);
                                if (keepRecording) {
                                    echo.startRecording(seconds);
                                } else {
                                    //create alert dialog with exittext to name the file
                                    View dialogView = View.inflate(getActivity(), R.layout.dialog_save_recording, null);
                                    EditText fileName = dialogView.findViewById(R.id.recording_name);
                                    new AlertDialog.Builder(getActivity())
                                        .setView(dialogView)
                                        .setPositiveButton("Save", new DialogInterface.OnClickListener() {
                                            @Override
                                            public void onClick(DialogInterface dialog, int which) {
                                                if(fileName.getText().toString().length() > 0){
                                                    echo.dumpRecording(seconds, new PromptFileReceiver(getActivity()),fileName.getText().toString());
                                                } else {
                                                    Toast.makeText(getActivity(), "Please enter a file name", Toast.LENGTH_SHORT).show();
                                                }
                                            }
                                        })
                                        .setNegativeButton("Cancel", null)
                                        .show();
                                    pd.dismiss();
                                }
                            }
                        }
                    });
                }
            });
        }

        float getPrependedSeconds(View button) {
            switch (button.getId()) {
                case R.id.record_last_minute:
                    return 60;
                case R.id.record_last_5_minutes:
                    return 60 * 5;
                case R.id.record_last_30_minutes:
                    return 60 * 30;
                case R.id.record_last_2_hrs:
                    return 60 * 60 * 2;
                case R.id.record_last_6_hrs:
                    return 60 * 60 * 6;
                case R.id.record_last_max:
                    return 60 * 60 * 24 * 365;
            }
            return 0;
        }
    }

    static Notification buildNotificationForFile(Context context, File outFile) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
        Uri fileUri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", outFile);
        intent.setDataAndType(fileUri, "audio/wav");
        intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // Grant read permission to the receiving app

        PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE);

        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, YOUR_NOTIFICATION_CHANNEL_ID)
                .setContentTitle(context.getString(R.string.recording_saved))
                .setContentText(outFile.getName())
                .setSmallIcon(R.drawable.ic_stat_notify_recorded)
                .setTicker(outFile.getName())
                .setContentIntent(pendingIntent)
                .setAutoCancel(true);
        notificationBuilder.setPriority(NotificationCompat.PRIORITY_DEFAULT);
        notificationBuilder.setCategory(NotificationCompat.CATEGORY_MESSAGE);
        return notificationBuilder.build();
    }

    static class NotifyFileReceiver implements SaidItService.WavFileReceiver {

        private Context context;

        public NotifyFileReceiver(Context context) {
            this.context = context;
        }

        @Override
        public void fileReady(final File file, float runtime) {
            NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
            if (ActivityCompat.checkSelfPermission(context, android.Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
                // TODO: Consider calling
                //    ActivityCompat#requestPermissions
                // here to request the missing permissions, and then overriding
                //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
                //                                          int[] grantResults)
                // to handle the case where the user grants the permission. See the documentation
                // for ActivityCompat#requestPermissions for more details.
                return;
            }
            notificationManager.notify(43, buildNotificationForFile(context, file));
        }
    }

    static class PromptFileReceiver implements SaidItService.WavFileReceiver {

        private Activity activity;

        public PromptFileReceiver(Activity activity) {
            this.activity = activity;
        }

        @Override
        public void fileReady(final File file, float runtime) {
            new RecordingDoneDialog()
                    .setFile(file)
                    .setRuntime(runtime)
                    .show(activity.getFragmentManager(), "Recording Done");
        }
    }
}


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/saidit/SaidItService.java
================================================
package eu.mrogalski.saidit;

import android.annotation.SuppressLint;
import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ServiceInfo;
import android.media.AudioFormat;
import android.media.AudioManager;
import android.media.AudioRecord;
import android.media.AudioTrack;
import android.media.MediaRecorder;
import android.os.Binder;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.SystemClock;
import androidx.core.app.NotificationCompat;
import android.text.format.DateUtils;
import android.util.Log;
import android.widget.Toast;

import java.io.File;
import java.io.IOException;

import simplesound.pcm.WavAudioFormat;
import simplesound.pcm.WavFileWriter;
import static eu.mrogalski.saidit.SaidIt.*;

public class SaidItService extends Service {
    static final String TAG = SaidItService.class.getSimpleName();
    private static final int FOREGROUND_NOTIFICATION_ID = 458;
    private static final String YOUR_NOTIFICATION_CHANNEL_ID = "SaidItServiceChannel";

    volatile int SAMPLE_RATE;
    volatile int FILL_RATE;


    File wavFile;
    AudioRecord audioRecord; // used only in the audio thread
    WavFileWriter wavFileWriter; // used only in the audio thread
    final AudioMemory audioMemory = new AudioMemory(); // used only in the audio thread

    HandlerThread audioThread;
    Handler audioHandler; // used to post messages to audio thread

    @Override
    public void onCreate() {

        Log.d(TAG, "Reading native sample rate");

        final SharedPreferences preferences = this.getSharedPreferences(PACKAGE_NAME, MODE_PRIVATE);
        SAMPLE_RATE = preferences.getInt(SAMPLE_RATE_KEY, AudioTrack.getNativeOutputSampleRate (AudioManager.STREAM_MUSIC));
        Log.d(TAG, "Sample rate: " + SAMPLE_RATE);
        FILL_RATE = 2 * SAMPLE_RATE;

        audioThread = new HandlerThread("audioThread", Thread.MAX_PRIORITY);
        audioThread.start();
        audioHandler = new Handler(audioThread.getLooper());

        if(preferences.getBoolean(AUDIO_MEMORY_ENABLED_KEY, true)) {
            innerStartListening();
        }

    }

    @Override
    public void onDestroy() {
        stopRecording(null, "");
        innerStopListening();
        stopForeground(true);
    }

    @Override
    public IBinder onBind(Intent intent) {
        return new BackgroundRecorderBinder();
    }

    @Override
    public boolean onUnbind(Intent intent) {
        return true;
    }

    public void enableListening() {
        getSharedPreferences(PACKAGE_NAME, MODE_PRIVATE)
                .edit().putBoolean(AUDIO_MEMORY_ENABLED_KEY, true).commit();

        innerStartListening();
    }

    public void disableListening() {
        getSharedPreferences(PACKAGE_NAME, MODE_PRIVATE)
                .edit().putBoolean(AUDIO_MEMORY_ENABLED_KEY, false).commit();

        innerStopListening();
    }

    int state;

    static final int STATE_READY = 0;
    static final int STATE_LISTENING = 1;
    static final int STATE_RECORDING = 2;

    private void innerStartListening() {
        switch(state) {
            case STATE_READY:
                break;
            case STATE_LISTENING:
            case STATE_RECORDING:
                return;
        }
        state = STATE_LISTENING;

        Log.d(TAG, "Queueing: START LISTENING");

        startService(new Intent(this, this.getClass()));

        final long memorySize = getSharedPreferences(PACKAGE_NAME, MODE_PRIVATE).getLong(AUDIO_MEMORY_SIZE_KEY, Runtime.getRuntime().maxMemory() / 4);

        audioHandler.post(new Runnable() {
            @SuppressLint("MissingPermission")
            @Override
            public void run() {
                Log.d(TAG, "Executing: START LISTENING");
                Log.d(TAG, "Audio: INITIALIZING AUDIO_RECORD");

                audioRecord = new AudioRecord(
                       MediaRecorder.AudioSource.MIC,
                       SAMPLE_RATE,
                       AudioFormat.CHANNEL_IN_MONO,
                       AudioFormat.ENCODING_PCM_16BIT,
                       AudioMemory.CHUNK_SIZE);

                if(audioRecord.getState() != AudioRecord.STATE_INITIALIZED) {
                    Log.e(TAG, "Audio: INITIALIZATION ERROR - releasing resources");
                    audioRecord.release();
                    audioRecord = null;
                    state = STATE_READY;
                    return;
                }

                Log.d(TAG, "Audio: STARTING AudioRecord");
                audioMemory.allocate(memorySize);

                Log.d(TAG, "Audio: STARTING AudioRecord");
                audioRecord.startRecording();
                audioHandler.post(audioReader);
            }
        });


    }

    private void innerStopListening() {
        switch(state) {
            case STATE_READY:
            case STATE_RECORDING:
                return;
            case STATE_LISTENING:
                break;
        }
        state = STATE_READY;
        Log.d(TAG, "Queueing: STOP LISTENING");

        stopForeground(true);
        stopService(new Intent(this, this.getClass()));

        audioHandler.post(new Runnable() {
            @Override
            public void run() {
                Log.d(TAG, "Executing: STOP LISTENING");
                if(audioRecord != null)
                    audioRecord.release();
                audioHandler.removeCallbacks(audioReader);
                audioMemory.allocate(0);
            }
        });

    }

    public void dumpRecording(final float memorySeconds, final WavFileReceiver wavFileReceiver, String newFileName) {
        if(state != STATE_LISTENING) throw new IllegalStateException("Not listening!");

        audioHandler.post(new Runnable() {
            @Override
            public void run() {
                flushAudioRecord();
                int prependBytes = (int)(memorySeconds * FILL_RATE);
                int bytesAvailable = audioMemory.countFilled();

                int skipBytes = Math.max(0, bytesAvailable - prependBytes);

                int useBytes = bytesAvailable - skipBytes;
                long millis  = System.currentTimeMillis() - 1000 * useBytes / FILL_RATE;
                final int flags = DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_SHOW_DATE;
                final String dateTime = DateUtils.formatDateTime(SaidItService.this, millis, flags);
                String filename = "Echo - " + dateTime + ".wav";
                if(!newFileName.equals("")){
                    filename = newFileName + ".wav";
                }

                File storageDir;
                if(isExternalStorageWritable()){
                    // Use public storage directory for Android 11+ (min SDK 30)
                    storageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC), "Echo");
                }else{
                    storageDir = new File(getFilesDir(), "Echo");
                }

                if(!storageDir.exists()){
                    storageDir.mkdir();
                }
                File file = new File(storageDir, filename);

                // Create the file if it doesn't exist
                if (!file.exists()) {
                    try {
                        if (!file.createNewFile()) {
                            // Handle file creation failure
                            throw new IOException("Failed to create file");
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                        // Handle IOException
                        showToast(getString(R.string.cant_create_file) + file.getAbsolutePath());
                    }
                }
                final WavAudioFormat format = new WavAudioFormat.Builder().sampleRate(SAMPLE_RATE).build();
                try (WavFileWriter writer = new WavFileWriter(format, file)) {
                    try {
                        audioMemory.read(skipBytes, new AudioMemory.Consumer() {
                            @Override
                            public int consume(byte[] array, int offset, int count) throws IOException {
                                writer.write(array, offset, count);
                                return 0;
                            }
                        });
                    } catch (IOException e) {
                        // Handle error during file writing
                        showToast(getString(R.string.error_during_writing_history_into) + file.getAbsolutePath());
                        Log.e(TAG, "Error during writing history into " + file.getAbsolutePath(), e);
                    }
                    if (wavFileReceiver != null) {
                        wavFileReceiver.fileReady(file, writer.getTotalSampleBytesWritten() * getBytesToSeconds());
                    }
                } catch (IOException e) {
                    // Handle error during file creation or closing writer
                    showToast(getString(R.string.cant_create_file) + file.getAbsolutePath());
                    Log.e(TAG, "Can't create file " + file.getAbsolutePath(), e);
                }
            }
        });

    }
    private static boolean isExternalStorageWritable() {
        String state = Environment.getExternalStorageState();
        return Environment.MEDIA_MOUNTED.equals(state);
    }
    private void showToast(String message) {
        Toast.makeText(SaidItService.this, message, Toast.LENGTH_LONG).show();
    }

    public void startRecording(final float prependedMemorySeconds) {
        switch(state) {
            case STATE_READY:
                innerStartListening();
                break;
            case STATE_LISTENING:
                break;
            case STATE_RECORDING:
                return;
        }
        state = STATE_RECORDING;

        audioHandler.post(new Runnable() {
            @Override
            public void run() {
                flushAudioRecord();
                int prependBytes = (int)(prependedMemorySeconds * FILL_RATE);
                int bytesAvailable = audioMemory.countFilled();

                int skipBytes = Math.max(0, bytesAvailable - prependBytes);

                int useBytes = bytesAvailable - skipBytes;
                long millis  = System.currentTimeMillis() - 1000 * useBytes / FILL_RATE;
                final int flags = DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_SHOW_DATE;
                final String dateTime = DateUtils.formatDateTime(SaidItService.this, millis, flags);
                String filename = "Echo - " + dateTime + ".wav";

                File storageDir;
                if(isExternalStorageWritable()){
                    // Use public storage directory for Android 11+ (min SDK 30)
                    storageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC), "Echo");
                }else{
                    storageDir = new File(getFilesDir(), "Echo");
                }
                final String storagePath = storageDir.getAbsolutePath();

                String path = storagePath + "/" + filename;

                wavFile = new File(path);
                try {
                    wavFile.createNewFile();
                } catch (IOException e) {
                    filename = filename.replace(':', '.');
                    path = storagePath + "/" + filename;
                    wavFile = new File(path);
                }
                WavAudioFormat format = new WavAudioFormat.Builder().sampleRate(SAMPLE_RATE).build();
                try {
                    wavFileWriter = new WavFileWriter(format, wavFile);
                } catch (IOException e) {
                    final String errorMessage = getString(R.string.cant_create_file) + path;
                    Toast.makeText(SaidItService.this, errorMessage, Toast.LENGTH_LONG).show();
                    Log.e(TAG, errorMessage, e);
                    return;
                }

                final String finalPath = path;

                if(skipBytes < bytesAvailable) {
                    try {
                        audioMemory.read(skipBytes, new AudioMemory.Consumer() {
                            @Override
                            public int consume(byte[] array, int offset, int count) throws IOException {
                                wavFileWriter.write(array, offset, count);
                                return 0;
                            }
                        });
                    } catch (IOException e) {
                        final String errorMessage = getString(R.string.error_during_writing_history_into) + finalPath;
                        Toast.makeText(SaidItService.this, errorMessage, Toast.LENGTH_LONG).show();
                        Log.e(TAG, errorMessage, e);
                        stopRecording(new SaidItFragment.NotifyFileReceiver(SaidItService.this), "");
                    }
                }
            }
        });

    }

    public long getMemorySize() {
        return audioMemory.getAllocatedMemorySize();
    }

    public void setMemorySize(final long memorySize) {
        final SharedPreferences preferences = this.getSharedPreferences(PACKAGE_NAME, MODE_PRIVATE);
        preferences.edit().putLong(AUDIO_MEMORY_SIZE_KEY, memorySize).commit();

        if(preferences.getBoolean(AUDIO_MEMORY_ENABLED_KEY, true)) {
            audioHandler.post(new Runnable() {
                @Override
                public void run() {
                    audioMemory.allocate(memorySize);
                }
            });
        }
    }

    public int getSamplingRate() {
        return SAMPLE_RATE;
    }

    public void setSampleRate(int sampleRate) {
        switch(state) {
            case STATE_READY:
            case STATE_RECORDING:
                return;
            case STATE_LISTENING:
                break;
        }

        final SharedPreferences preferences = this.getSharedPreferences(PACKAGE_NAME, MODE_PRIVATE);
        preferences.edit().putInt(SAMPLE_RATE_KEY, sampleRate).commit();

        innerStopListening();
        SAMPLE_RATE = sampleRate;
        FILL_RATE = 2 * SAMPLE_RATE;
        innerStartListening();
    }

    public interface WavFileReceiver {
        public void fileReady(File file, float runtime);
    }

    public void stopRecording(final WavFileReceiver wavFileReceiver, String newFileName) {
        switch(state) {
            case STATE_READY:
            case STATE_LISTENING:
                return;
            case STATE_RECORDING:
                break;
        }
        state = STATE_LISTENING;

        audioHandler.post(new Runnable() {
            @Override
            public void run() {
                flushAudioRecord();
                try {
                    wavFileWriter.close();
                } catch (IOException e) {
                    Log.e(TAG, "CLOSING ERROR", e);
                }
                if(wavFileReceiver != null) {
                    wavFileReceiver.fileReady(wavFile, wavFileWriter.getTotalSampleBytesWritten() * getBytesToSeconds());
                }
                wavFileWriter = null;
            }
        });

        final SharedPreferences preferences = this.getSharedPreferences(PACKAGE_NAME, MODE_PRIVATE);
        if(!preferences.getBoolean(AUDIO_MEMORY_ENABLED_KEY, true)) {
            innerStopListening();
        }

        stopForeground(true);
    }

    private void flushAudioRecord() {
        // Only allowed on the audio thread
        assert audioHandler.getLooper() == Looper.myLooper();
        audioHandler.removeCallbacks(audioReader); // remove any delayed callbacks
        audioReader.run();
    }

    final AudioMemory.Consumer filler = new AudioMemory.Consumer() {
        @Override
        public int consume(final byte[] array, final int offset, final int count) throws IOException {
//            Log.d(TAG, "READING " + count + " B");
            final int read = audioRecord.read(array, offset, count, AudioRecord.READ_NON_BLOCKING);
            if (read == AudioRecord.ERROR_BAD_VALUE) {
                Log.e(TAG, "AUDIO RECORD ERROR - BAD VALUE");
                return 0;
            }
            if (read == AudioRecord.ERROR_INVALID_OPERATION) {
                Log.e(TAG, "AUDIO RECORD ERROR - INVALID OPERATION");
                return 0;
            }
            if (read == AudioRecord.ERROR) {
                Log.e(TAG, "AUDIO RECORD ERROR - UNKNOWN ERROR");
                return 0;
            }
            if (wavFileWriter != null && read > 0) {
                wavFileWriter.write(array, offset, read);
            }
            if (read == count) {
                // We've filled the buffer, so let's read again.
                audioHandler.post(audioReader);
            } else {
                // It seems we've read everything!
                //
                // Estimate how long do we have until audioRecord fills up completely and post the callback 1 second before that
                // (but not earlier than half the buffer and no later than 90% of the buffer).
                float bufferSizeInSeconds = audioRecord.getBufferSizeInFrames() / (float)SAMPLE_RATE;
                float delaySeconds = bufferSizeInSeconds - 1;
                delaySeconds = Math.max(delaySeconds, bufferSizeInSeconds * 0.5f);
                delaySeconds = Math.min(delaySeconds, bufferSizeInSeconds * 0.9f);
                audioHandler.postDelayed(audioReader, (long)(delaySeconds * 1000));
            }
            return read;
        }
    };
    final Runnable audioReader = new Runnable() {
        @Override
        public void run() {
            try {
                audioMemory.fill(filler);
            } catch (IOException e) {
                final String errorMessage = getString(R.string.error_during_recording_into) + wavFile.getName();
                Toast.makeText(SaidItService.this, errorMessage, Toast.LENGTH_LONG).show();
                Log.e(TAG, errorMessage, e);
                stopRecording(new SaidItFragment.NotifyFileReceiver(SaidItService.this), "");
            }
        }
    };

    public interface StateCallback {
        public void state(boolean listeningEnabled, boolean recording, float memorized, float totalMemory, float recorded);
    }

    public void getState(final StateCallback stateCallback) {
        final SharedPreferences preferences = this.getSharedPreferences(PACKAGE_NAME, MODE_PRIVATE);
        final boolean listeningEnabled = preferences.getBoolean(AUDIO_MEMORY_ENABLED_KEY, true);
        final boolean recording = (state == STATE_RECORDING);
        final Handler sourceHandler = new Handler();
        // Note that we may not run this for quite a while, if audioReader decides to read a lot of audio!
        audioHandler.post(new Runnable() {
            @Override
            public void run() {
                flushAudioRecord();
                final AudioMemory.Stats stats = audioMemory.getStats(FILL_RATE);
                
                int recorded = 0;
                if(wavFileWriter != null) {
                    recorded += wavFileWriter.getTotalSampleBytesWritten();
                    recorded += stats.estimation;
                }
                final float bytesToSeconds = getBytesToSeconds();
                final int finalRecorded = recorded;
                sourceHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        stateCallback.state(listeningEnabled, recording,
                                (stats.overwriting ? stats.total : stats.filled + stats.estimation) * bytesToSeconds,
                                stats.total * bytesToSeconds,
                                finalRecorded * bytesToSeconds);
                    }
                });
            }
        });
    }

    public float getBytesToSeconds() {
        return 1f / FILL_RATE;
    }

    class BackgroundRecorderBinder extends Binder {
        public SaidItService getService() {
            return SaidItService.this;
        }
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        startForeground(FOREGROUND_NOTIFICATION_ID, buildNotification(), ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE);
        return START_STICKY;
    }

    // Workaround for bug where recent app removal caused service to stop
    @Override
    public void onTaskRemoved(Intent rootIntent) {
        Intent restartServiceIntent = new Intent(getApplicationContext(), this.getClass());
        restartServiceIntent.setPackage(getPackageName());

        PendingIntent restartServicePendingIntent = PendingIntent.getService(this, 1, restartServiceIntent, PendingIntent.FLAG_ONE_SHOT| PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
        AlarmManager alarmService = (AlarmManager) getSystemService(ALARM_SERVICE);
        alarmService.set(
                AlarmManager.ELAPSED_REALTIME,
                SystemClock.elapsedRealtime() + 1000,
                restartServicePendingIntent);
    }

    private Notification buildNotification() {
        Intent intent = new Intent(this, SaidItActivity.class);
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);

        NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, YOUR_NOTIFICATION_CHANNEL_ID)
                .setContentTitle(getString(R.string.recording))
                .setSmallIcon(R.drawable.ic_stat_notify_recording)
                .setTicker(getString(R.string.recording))
                .setContentIntent(pendingIntent)
                .setPriority(NotificationCompat.PRIORITY_DEFAULT)
                .setOngoing(true); // Ensure notification is ongoing

        // Create the notification channel
        NotificationChannel channel = new NotificationChannel(
                YOUR_NOTIFICATION_CHANNEL_ID,
                "Recording Channel",
                NotificationManager.IMPORTANCE_DEFAULT
        );
        NotificationManager notificationManager = getSystemService(NotificationManager.class);
        notificationManager.createNotificationChannel(channel);

        return notificationBuilder.build();
    }

}


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/saidit/SettingsActivity.java
================================================
package eu.mrogalski.saidit;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaCodecInfo;
import android.media.MediaCodecList;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;

import eu.mrogalski.StringFormat;
import eu.mrogalski.android.TimeFormat;
import eu.mrogalski.android.Views;

public class SettingsActivity extends Activity {
    static final String TAG = SettingsActivity.class.getSimpleName();
    private final MemoryOnClickListener memoryClickListener = new MemoryOnClickListener();
    private final QualityOnClickListener qualityClickListener = new QualityOnClickListener();


    final WorkingDialog dialog = new WorkingDialog();

    @Override
    protected void onStart() {
        super.onStart();
        Intent intent = new Intent(this, SaidItService.class);
        bindService(intent, connection, Context.BIND_AUTO_CREATE);
    }

    @Override
    protected void onStop() {
        super.onStop();
        unbindService(connection);
    }

    SaidItService service;
    ServiceConnection connection = new ServiceConnection() {

        @Override
        public void onServiceConnected(ComponentName className,
                                       IBinder binder) {
            SaidItService.BackgroundRecorderBinder typedBinder = (SaidItService.BackgroundRecorderBinder) binder;
            service = typedBinder.getService();
            syncUI();
        }

        @Override
        public void onServiceDisconnected(ComponentName arg0) {
            service = null;
        }
    };

    final TimeFormat.Result timeFormatResult = new TimeFormat.Result();

    private void syncUI() {
        final long maxMemory = Runtime.getRuntime().maxMemory();
        System.out.println("maxMemory = " + maxMemory);
        System.out.println("totalMemory = " + Runtime.getRuntime().totalMemory());

        ((Button) findViewById(R.id.memory_low)).setText(StringFormat.shortFileSize(maxMemory / 4));
        ((Button) findViewById(R.id.memory_medium)).setText(StringFormat.shortFileSize(maxMemory / 2));
//        ((Button) findViewById(R.id.memory_high)).setText(StringFormat.shortFileSize(maxMemory * 3 / 4));
        ((Button) findViewById(R.id.memory_high)).setText(StringFormat.shortFileSize((long) (maxMemory * 0.90)));


        TimeFormat.naturalLanguage(getResources(), service.getBytesToSeconds() * service.getMemorySize(), timeFormatResult);
        ((TextView)findViewById(R.id.history_limit)).setText(timeFormatResult.text);

        highlightButtons();
    }

    void highlightButtons() {
        final long maxMemory = Runtime.getRuntime().maxMemory();

        int button = (int)(service.getMemorySize() / (maxMemory / 4)); // 1 - memory_low; 2 - memory_medium; 3 - memory_high
        highlightButton(R.id.memory_low, R.id.memory_medium, R.id.memory_high, button);

        int samplingRate = service.getSamplingRate();
        if(samplingRate >= 44100) button = 3;
        else if(samplingRate >= 16000) button = 2;
        else button = 1;
        highlightButton(R.id.quality_8kHz, R.id.quality_16kHz, R.id.quality_48kHz, button);
    }

    private void highlightButton(int button1, int button2, int button3, int i) {
        findViewById(button1).setBackgroundResource(1 == i ? R.drawable.green_button : R.drawable.gray_button);
        findViewById(button2).setBackgroundResource(2 == i ? R.drawable.green_button : R.drawable.gray_button);
        findViewById(button3).setBackgroundResource(3 == i ? R.drawable.green_button : R.drawable.gray_button);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        final AssetManager assets = getAssets();
        final Resources resources = getResources();

        final float density = resources.getDisplayMetrics().density;

        final Typeface robotoCondensedBold = Typeface.createFromAsset(assets,"RobotoCondensedBold.ttf");
        final Typeface robotoCondensedRegular = Typeface.createFromAsset(assets, "RobotoCondensed-Regular.ttf");

        final ViewGroup root = (ViewGroup) getLayoutInflater().inflate(R.layout.activity_settings, null);
        Views.search(root, new Views.SearchViewCallback() {
            @Override
            public void onView(View view, ViewGroup parent) {
                if(view instanceof Button) {
                    final Button button = (Button) view;
                    button.setTypeface(robotoCondensedBold);
                } else if(view instanceof TextView) {
                    final String tag = (String) view.getTag();
                    final TextView textView = (TextView) view;
                    if(tag != null) {
                        if(tag.equals("bold")) {
                            textView.setTypeface(robotoCondensedBold);
                        } else {
                            textView.setTypeface(robotoCondensedRegular);
                        }
                    } else {
                        textView.setTypeface(robotoCondensedRegular);
                    }
                }
            }
        });

        root.findViewById(R.id.settings_return).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        final LinearLayout settingsLayout = (LinearLayout) root.findViewById(R.id.settings_layout);

        final FrameLayout myFrameLayout = new FrameLayout(this) {
            @Override
            protected boolean fitSystemWindows(Rect insets) {
                settingsLayout.setPadding(insets.left, insets.top, insets.right, insets.bottom);
                return true;
            }
        };

        myFrameLayout.addView(root);

        root.findViewById(R.id.memory_low).setOnClickListener(memoryClickListener);
        root.findViewById(R.id.memory_medium).setOnClickListener(memoryClickListener);
        root.findViewById(R.id.memory_high).setOnClickListener(memoryClickListener);

        initSampleRateButton(root, R.id.quality_8kHz, 8000, 11025);
        initSampleRateButton(root, R.id.quality_16kHz, 16000, 22050);
        initSampleRateButton(root, R.id.quality_48kHz, 48000, 44100);

        //debugPrintCodecs();

        dialog.setDescriptionStringId(R.string.work_preparing_memory);

        setContentView(myFrameLayout);
    }

    private void debugPrintCodecs() {
        final int codecCount = MediaCodecList.getCodecCount();
        for(int i = 0; i < codecCount; ++i) {
            final MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i);
            if(!info.isEncoder()) continue;
            boolean audioFound = false;
            String types = "";
            final String[] supportedTypes = info.getSupportedTypes();
            for(int j = 0; j < supportedTypes.length; ++j) {
                if(j > 0)
                    types += ", ";
                types += supportedTypes[j];
                if(supportedTypes[j].startsWith("audio")) audioFound = true;
            }
            if(!audioFound) continue;
            Log.d(TAG, "Codec " + i + ": " + info.getName() + " (" + types + ") encoder: " + info.isEncoder());
        }
    }

    private void initSampleRateButton(ViewGroup layout, int buttonId, int primarySampleRate, int secondarySampleRate) {
        Button button = (Button) layout.findViewById(buttonId);
        button.setOnClickListener(qualityClickListener);
        if(testSampleRateValid(primarySampleRate)) {
            button.setText(String.format("%d kHz", primarySampleRate / 1000));
            button.setTag(primarySampleRate);
        } else if(testSampleRateValid(secondarySampleRate)) {
            button.setText(String.format("%d kHz", secondarySampleRate / 1000));
            button.setTag(secondarySampleRate);
        } else {
            button.setVisibility(View.GONE);
        }
    }

    private boolean testSampleRateValid(int sampleRate) {
        final int bufferSize = AudioRecord.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT);
        return bufferSize > 0;
    }

    private class MemoryOnClickListener implements View.OnClickListener {
        @Override
        public void onClick(View v) {
            final long memory = getMultiplier(v) * Runtime.getRuntime().maxMemory() / 4;
            dialog.show(getFragmentManager(), "Preparing memory");

            new Handler().post(new Runnable() {
                @Override
                public void run() {
                    service.setMemorySize(memory);
                    service.getState(new SaidItService.StateCallback() {
                        @Override
                        public void state(boolean listeningEnabled, boolean recording, float memorized, float totalMemory, float recorded) {
                            syncUI();
                            if (dialog.isVisible()) dialog.dismiss();
                        }
                    });
                }
            });
        }

        private int getMultiplier(View button) {
            switch (button.getId()) {
                case R.id.memory_high: return 3;
                case R.id.memory_medium: return 2;
                case R.id.memory_low: return 1;
            }
            return 0;
        }
    }

    private class QualityOnClickListener implements View.OnClickListener {
        @Override
        public void onClick(View v) {
            final int sampleRate = getSampleRate(v);
            dialog.show(getFragmentManager(), "Preparing memory");

            new Handler().post(new Runnable() {
                @Override
                public void run() {
                    service.setSampleRate(sampleRate);
                    service.getState(new SaidItService.StateCallback() {
                        @Override
                        public void state(boolean listeningEnabled, boolean recording, float memorized, float totalMemory, float recorded) {
                            syncUI();
                            if (dialog.isVisible()) dialog.dismiss();
                        }
                    });
                }
            });
        }

        private int getSampleRate(View button) {
            Object tag = button.getTag();
            if(tag instanceof Integer) {
                return ((Integer) tag).intValue();
            }
            return 8000;
        }
    }
}


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/saidit/ThemedDialog.java
================================================
package eu.mrogalski.saidit;

import android.app.Activity;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;

import eu.mrogalski.android.Views;

public class ThemedDialog extends DialogFragment {
    static final String TAG = ThemedDialog.class.getName();

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        final Dialog dialog = super.onCreateDialog(savedInstanceState);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.getWindow().getDecorView().setBackgroundDrawable(null);
        //set dialog width to 90% of screen width
        dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        return dialog;
    }

    protected void fixFonts(View root) {
        final Activity activity = getActivity();
        final Resources resources = activity.getResources();

        final AssetManager assets = activity.getAssets();

        final Typeface robotoCondensedBold = Typeface.createFromAsset(assets,"RobotoCondensedBold.ttf");
        final Typeface robotoCondensedRegular = Typeface.createFromAsset(assets, "RobotoCondensed-Regular.ttf");

        final float density = resources.getDisplayMetrics().density;

        Views.search((ViewGroup) root, new Views.SearchViewCallback() {
            @Override
            public void onView(View view, ViewGroup parent) {
                if (view instanceof Button) {
                    final Button button = (Button) view;
                    button.setTypeface(robotoCondensedRegular);
                } else if (view instanceof TextView) {
                    final String tag = (String) view.getTag();
                    final TextView textView = (TextView) view;
                    if (tag != null) {
                        if (tag.equals("titleBar")) {
                            textView.setTypeface(robotoCondensedBold);
                            textView.setShadowLayer(0.01f, 0, density * 2, resources.getColor(getShadowColorId()));
                        } else if (tag.equals("bold")) {
                            textView.setTypeface(robotoCondensedBold);
                        }
                    } else {
                        textView.setTypeface(robotoCondensedRegular);
                    }
                }
            }
        });
    }

    int getShadowColorId() {
        return R.color.dark_green;
    }
}


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/saidit/UserInfo.java
================================================
package eu.mrogalski.saidit;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.util.Patterns;

import java.util.regex.Pattern;

public class UserInfo {

    public static String getUserPhoneNumber(Context c) {
        final TelephonyManager tMgr = (TelephonyManager)c.getSystemService(Context.TELEPHONY_SERVICE);
        return tMgr.getLine1Number();
    }

    /*
    First - try phone ID
    Second - try user email
    Third - try system ID
     */
    public static String getUserID(Context c) {
        final TelephonyManager tMgr = (TelephonyManager)c.getSystemService(Context.TELEPHONY_SERVICE);
        String id = tMgr.getDeviceId();
        if(id != null) {
            return "device-id:" + id;
        }

        AccountManager accountManager = AccountManager.get(c);
        Account[] accounts = accountManager.getAccountsByType("com.google");
        for (Account a: accounts) {
            if (a.name.contains("@gmail.com")) {
                return "email:" + a.name;
            }
        }

        return "android-id:" + Settings.Secure.getString(c.getContentResolver(), Settings.Secure.ANDROID_ID);
    }

    public static String getUserCountryCode(Context c) {

        final TelephonyManager manager = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE);
        //getNetworkCountryIso
        final String countryLetterCode = manager.getSimCountryIso().toUpperCase();
        String[] rl = c.getResources().getStringArray(R.array.country_codes);
        for (String aRl : rl) {
            String[] g = aRl.split(",");
            if (g[1].trim().equals(countryLetterCode.trim())) {
                return g[0];
            }
        }
        return "";
    }

    public static String getUserEmail(Context c) {
        Pattern emailPattern = Patterns.EMAIL_ADDRESS; // API level 8+
        Account[] accounts = AccountManager.get(c).getAccounts();
        for (Account account : accounts) {
            if (emailPattern.matcher(account.name).matches()) {
                return account.name;
            }
        }
        return "";
    }
}


================================================
FILE: SaidIt/src/main/java/eu/mrogalski/saidit/WorkingDialog.java
================================================
package eu.mrogalski.saidit;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class WorkingDialog extends ThemedDialog {
    private int descriptionStringId = R.string.work_default;

    @Override
    public void onSaveInstanceState( Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putInt(getDescriptionKey(), getDescriptionStringId());
    }

    private String getDescriptionKey() {
        return WorkingDialog.class.getName() + "_description_id";
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if(savedInstanceState != null && savedInstanceState.containsKey(getDescriptionKey())) {
            descriptionStringId = savedInstanceState.getInt(getDescriptionKey());
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        final View root = inflater.inflate(R.layout.progress_dialog, container);

        fixFonts(root);

        setDescriptionOnView(root);

        return root;
    }

    private void setDescriptionOnView(View root) {
        ((TextView) root.findViewById(R.id.progress_description)).setText(getDescriptionStringId());
    }


    public int getDescriptionStringId() {
        return descriptionStringId;
    }

    public void setDescriptionStringId(int descriptionStringId) {
        this.descriptionStringId = descriptionStringId;
        final View root = getView();
        if(root != null) {
            setDescriptionOnView(root);
        }
    }
}


================================================
FILE: SaidIt/src/main/java/simplesound/dsp/Complex.java
================================================
package simplesound.dsp;

public final class Complex {
    
    public final double real;
    public final double imaginary;

    public Complex(double real, double imaginary) {
        this.real = real;
        this.imaginary = imaginary;
    }
}


================================================
FILE: SaidIt/src/main/java/simplesound/dsp/DoubleVector.java
================================================
package simplesound.dsp;

import java.util.Arrays;

/**
 * a vector containing a double numbers.
 */
public class DoubleVector {

    final double[] data;

    public DoubleVector(double[] data) {
        if (data == null)
            throw new IllegalArgumentException("Data cannot be null!");
        this.data = data;
    }

    public int size() {
        return data.length;
    }

    public double[] getData() {
        return data;
    }


    @Override
    public String toString() {
        return Arrays.toString(data);
    }

}


================================================
FILE: SaidIt/src/main/java/simplesound/dsp/DoubleVectorFrameSource.java
================================================
package simplesound.dsp;

import simplesound.pcm.PcmMonoInputStream;

import java.util.Iterator;

public class DoubleVectorFrameSource {

    private final PcmMonoInputStream pmis;
    private final int frameSize;
    private final int shiftAmount;
    private final boolean paddingApplied;

    private DoubleVectorFrameSource(PcmMonoInputStream pmis, int frameSize, int shiftAmount, boolean paddingApplied) {
        this.pmis = pmis;
        this.frameSize = frameSize;
        this.shiftAmount = shiftAmount;
        this.paddingApplied = paddingApplied;
    }

    public static DoubleVectorFrameSource fromSampleAmount(
            PcmMonoInputStream pmis, int frameSize, int shiftAmount) {
        return new DoubleVectorFrameSource(pmis, frameSize, shiftAmount, false);
    }

    public static DoubleVectorFrameSource fromSampleAmountWithPadding(
            PcmMonoInputStream pmis, int frameSize, int shiftAmount) {
        return new DoubleVectorFrameSource(pmis, frameSize, shiftAmount, true);
    }

    public static DoubleVectorFrameSource fromSizeInMiliseconds(
            PcmMonoInputStream pmis, double frameSizeInMilis, double shiftAmountInMilis) {
        return new DoubleVectorFrameSource(pmis,
                pmis.getFormat().sampleCountForMiliseconds(frameSizeInMilis),
                pmis.getFormat().sampleCountForMiliseconds(shiftAmountInMilis),
                false);
    }

    public static DoubleVectorFrameSource fromSizeInMilisecondsWithPadding(
            PcmMonoInputStream pmis, double frameSizeInMilis, double shiftAmountInMilis) {
        return new DoubleVectorFrameSource(pmis,
                pmis.getFormat().sampleCountForMiliseconds(frameSizeInMilis),
                pmis.getFormat().sampleCountForMiliseconds(shiftAmountInMilis),
                true);
    }

    public Iterable<DoubleVector> getIterableFrameReader() {
        return new Iterable<DoubleVector>() {
            public Iterator<DoubleVector> iterator() {
                return new NormalizedFrameIterator(pmis, frameSize, shiftAmount, paddingApplied);
            }
        };
    }

    public Iterator<DoubleVector> getNormalizedFrameIterator() {
        return new NormalizedFrameIterator(pmis, frameSize, shiftAmount, paddingApplied);
    }

    public PcmMonoInputStream getPmis() {
        return pmis;
    }

    public int getFrameSize() {
        return frameSize;
    }

    public int getShiftAmount() {
        return shiftAmount;
    }

    public boolean isPaddingApplied() {
        return paddingApplied;
    }
}


================================================
FILE: SaidIt/src/main/java/simplesound/dsp/DoubleVectorProcessingPipeline.java
================================================
package simplesound.dsp;

import java.util.Iterator;
import java.util.List;

public class DoubleVectorProcessingPipeline  {

    List<DoubleVectorProcessor> processors;
    Iterator<DoubleVector> vectorSource;

    public DoubleVectorProcessingPipeline(Iterator<DoubleVector> vectorSource,
                                          List<DoubleVectorProcessor> processors) {
        this.vectorSource = vectorSource;
        this.processors = processors;
    }
}


================================================
FILE: SaidIt/src/main/java/simplesound/dsp/DoubleVectorProcessor.java
================================================
package simplesound.dsp;

public interface DoubleVectorProcessor {
    
    DoubleVector process(DoubleVector input);

    void processInPlace(DoubleVector input);
}


================================================
FILE: SaidIt/src/main/java/simplesound/dsp/MutableComplex.java
================================================
package simplesound.dsp;

public class MutableComplex {
    public double real;
    public double imaginary;

    public MutableComplex(double real, double imaginary) {
        this.real = real;
        this.imaginary = imaginary;
    }

    public MutableComplex(Complex complex) {
        this.real = complex.real;
        this.imaginary = complex.imaginary;
    }

    public Complex getImmutableComplex() {
        return new Complex(real, imaginary);
    }
}


================================================
FILE: SaidIt/src/main/java/simplesound/dsp/NormalizedFrameIterator.java
================================================
package simplesound.dsp;

import simplesound.dsp.DoubleVector;
import simplesound.pcm.PcmMonoInputStream;

import java.io.IOException;
import java.util.Iterator;

public class NormalizedFrameIterator implements Iterator<DoubleVector> {

    private final PcmMonoInputStream pmis;
    private final int frameSize;
    private final int shiftAmount;
    //TODO: not applied yet
    private final boolean applyPadding;

    public NormalizedFrameIterator(PcmMonoInputStream pmis, int frameSize, int shiftAmount, boolean applyPadding) {
        if (frameSize < 1)
            throw new IllegalArgumentException("Frame size must be larger than zero.");
        if (shiftAmount < 1)
            throw new IllegalArgumentException("Shift size must be larger than zero.");
        this.pmis = pmis;
        this.frameSize = frameSize;
        this.shiftAmount = shiftAmount;
        this.applyPadding = applyPadding;
    }

    public NormalizedFrameIterator(PcmMonoInputStream pmis, int frameSize, boolean applyPadding) {
        this(pmis, frameSize, frameSize, applyPadding);
    }

    public NormalizedFrameIterator(PcmMonoInputStream pmis, int frameSize) {
        this(pmis, frameSize, frameSize, false);
    }

    private DoubleVector currentFrame;
    private int frameCounter;

    public boolean hasNext() {
        double[] data;
        try {
            if (frameCounter == 0) {
                data = pmis.readSamplesNormalized(frameSize);
                if (data.length < frameSize)
                    return false;
                currentFrame = new DoubleVector(data);
            } else {
                data = pmis.readSamplesNormalized(shiftAmount);
                if (data.length < shiftAmount)
                    return false;
                double[] frameData = currentFrame.data.clone();
                System.arraycopy(data, 0, frameData, frameData.length - shiftAmount, shiftAmount);
                currentFrame = new DoubleVector(frameData);
            }
        } catch (IOException e) {
            return false;
        }
        frameCounter++;
        return true;
    }

    public DoubleVector next() {
        return currentFrame;
    }

    public void remove() {
        throw new UnsupportedOperationException("Remove is not supported.");
    }

    public int getFrameSize() {
        return frameSize;
    }

    public int getShiftAmount() {
        return shiftAmount;
    }
}


================================================
FILE: SaidIt/src/main/java/simplesound/dsp/WindowerFactory.java
================================================
package simplesound.dsp;

import org.jcaki.Doubles;

import static java.lang.Math.PI;
import static java.lang.Math.cos;

public class WindowerFactory {

    private static class RaisedCosineWindower implements DoubleVectorProcessor {
        double alpha;
        double cosineWindow[];

        RaisedCosineWindower(double alpha, int length) {
            if (length <= 0)
                throw new IllegalArgumentException("Window length cannot be smaller than 1");
            this.alpha = alpha;
            cosineWindow = new double[length];
            for (int i = 0; i < length; i++) {
                cosineWindow[i] = (1 - alpha) - alpha * cos(2 * PI * i / ((double) length - 1.0));
            }
        }

        public DoubleVector process(DoubleVector input) {
            return new DoubleVector(Doubles.multiply(input.data, cosineWindow));
        }

        public void processInPlace(DoubleVector input) {
            Doubles.multiplyInPlace(input.data, cosineWindow);
        }
    }

    public static DoubleVectorProcessor newHammingWindower(int length) {
        return new RaisedCosineWindower(0.46d, length);
    }

    public static DoubleVectorProcessor newHanningWindower(int length) {
        return new RaisedCosineWindower(0.5d, length);
    }

    public static DoubleVectorProcessor newTriangularWindower(int length) {
        return new RaisedCosineWindower(0.0d, length);
    }

}


================================================
FILE: SaidIt/src/main/java/simplesound/pcm/MonoWavFileReader.java
================================================
package simplesound.pcm;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class MonoWavFileReader {

    private final File file;
    private final RiffHeaderData riffHeaderData;

    public MonoWavFileReader(String fileName) throws IOException {
        this(new File(fileName));
    }

    public MonoWavFileReader(File file) throws IOException {
        this.file = file;
        riffHeaderData = new RiffHeaderData(file);
        if (riffHeaderData.getFormat().getChannels() != 1)
            throw new IllegalArgumentException("Wav file is not Mono.");
    }

    public PcmMonoInputStream getNewStream() throws IOException {
        PcmMonoInputStream asis = new PcmMonoInputStream(
                riffHeaderData.getFormat(),
                new FileInputStream(file));
        long amount = asis.skip(RiffHeaderData.PCM_RIFF_HEADER_SIZE);
        if (amount < RiffHeaderData.PCM_RIFF_HEADER_SIZE)
            throw new IllegalArgumentException("cannot skip necessary amount of bytes from underlying stream.");
        return asis;
    }

    private void validateFrameBoundaries(int frameStart, int frameEnd) {
        if (frameStart < 0)
            throw new IllegalArgumentException("Start Frame cannot be negative:" + frameStart);
        if (frameEnd < frameStart)
            throw new IllegalArgumentException("Start Frame cannot be after end frame. Start:"
                    + frameStart + ", end:" + frameEnd);
        if (frameEnd > riffHeaderData.getSampleCount())
            throw new IllegalArgumentException("Frame count out of bounds. Max sample count:"
                    + riffHeaderData.getSampleCount() + " but frame is:" + frameEnd);
    }

    public int[] getAllSamples() throws IOException {
        PcmMonoInputStream stream = getNewStream();
        try {
            return stream.readAll();
        } finally {
            stream.close();
        }
    }

    public int[] getSamplesAsInts(int frameStart, int frameEnd) throws IOException {
        validateFrameBoundaries(frameStart, frameEnd);
        PcmMonoInputStream stream = getNewStream();
        try {
            stream.skipSamples(frameStart);
            return stream.readSamplesAsIntArray(frameEnd - frameStart);
        } finally {
            stream.close();
        }
    }


    public PcmAudioFormat getFormat() {
        return riffHeaderData.getFormat();
    }

    public int getSampleCount() {
        return riffHeaderData.getSampleCount();
    }

    public File getFile() {
        return file;
    }
}


================================================
FILE: SaidIt/src/main/java/simplesound/pcm/PcmAudioFormat.java
================================================
package simplesound.pcm;

/**
 * Represents paramters for raw pcm audio sample data.
 * Channels represents mono or stereo data. mono=1, stereo=2
 */
public class PcmAudioFormat {

    /**
     * Sample frequency in sample/sec.
     */
    private final int sampleRate;
    /**
     * the amount of bits representing samples.
     */
    private final int sampleSizeInBits;
    /**
     * How many bytes are required for representing samples
     */
    private final int bytesRequiredPerSample;
    /**
     * channels. For now only 1 or two channels are allowed.
     */
    private final int channels;
    /**
     * if data is represented as big endian or little endian.
     */
    protected final boolean bigEndian;
    /**
     * if data is signed or unsigned.
     */
    private final boolean signed;

    protected PcmAudioFormat(int sampleRate, int sampleSizeInBits, int channels, boolean bigEndian, boolean signed) {

        if (sampleRate < 1)
            throw new IllegalArgumentException("sampleRate cannot be less than one. But it is:" + sampleRate);
        this.sampleRate = sampleRate;

        if (sampleSizeInBits < 2 || sampleSizeInBits > 31) {
            throw new IllegalArgumentException("sampleSizeInBits must be between (including) 2-31. But it is:" + sampleSizeInBits);
        }
        this.sampleSizeInBits = sampleSizeInBits;

        if (channels < 1 || channels > 2) {
            throw new IllegalArgumentException("channels must be 1 or 2. But it is:" + channels);
        }
        this.channels = channels;

        this.bigEndian = bigEndian;
        this.signed = signed;
        if (sampleSizeInBits % 8 == 0)
            bytesRequiredPerSample = sampleSizeInBits / 8;
        else
            bytesRequiredPerSample = sampleSizeInBits / 8 + 1;
    }

    /**
     * This is a builder class. By default it generates little endian, mono, signed, 16 bits per sample.
     */
    public static class Builder {
        private int _sampleRate;
        private int _sampleSizeInBits = 16;
        private int _channels = 1;
        private boolean _bigEndian = false;
        private boolean _signed = true;

        public Builder(int sampleRate) {
            this._sampleRate = sampleRate;
        }

        public Builder channels(int channels) {
            this._channels = channels;
            return this;
        }

        public Builder bigEndian() {
            this._bigEndian = true;
            return this;
        }

        public Builder unsigned() {
            this._signed = false;
            return this;
        }

        public Builder sampleSizeInBits(int sampleSizeInBits) {
            this._sampleSizeInBits = sampleSizeInBits;
            return this;
        }

        public PcmAudioFormat build() {
            return new PcmAudioFormat(_sampleRate, _sampleSizeInBits, _channels, _bigEndian, _signed);
        }
    }

    PcmAudioFormat mono16BitSignedLittleEndian(int sampleRate) {
        return new PcmAudioFormat(sampleRate, 16, 1, false, true);
    }

    public int getSampleRate() {
        return sampleRate;
    }

    public int getChannels() {
        return channels;
    }

    public int getSampleSizeInBits() {
        return sampleSizeInBits;
    }

    /**
     * returns the required bytes for the sample bit size. Such that, if 4 or 8 bit samples are used.
     * it returns 1, if 12 bit used 2 returns.
     *
     * @return required byte amount for the sample size in bits.
     */
    public int getBytePerSample() {
        return bytesRequiredPerSample;
    }

    public boolean isBigEndian() {
        return bigEndian;
    }

    public boolean isSigned() {
        return signed;
    }

    public int sampleCountForMiliseconds(double miliseconds) {
        return (int) ((double) sampleRate * miliseconds / 1000d);
    }

    public String toString() {
        return "[ Sample Rate:" + sampleRate + " , SampleSizeInBits:" + sampleSizeInBits +
                ", channels:" + channels + ", signed:" + signed + ", bigEndian:" + bigEndian + " ]";
    }
}


================================================
FILE: SaidIt/src/main/java/simplesound/pcm/PcmAudioHelper.java
================================================
package simplesound.pcm;

import static org.jcaki.Bytes.toByteArray;
import org.jcaki.IOs;

import java.io.*;

public class PcmAudioHelper {

    /**
     * Converts a pcm encoded raw audio stream to a wav file.
     *
     * @param af format
     * @param rawSource raw source file
     * @param wavTarget raw file target
     * @throws IOException thrown if an error occurs during file operations.
     */
    public static void convertRawToWav(WavAudioFormat af, File rawSource, File wavTarget) throws IOException {
        DataOutputStream dos = new DataOutputStream(new FileOutputStream(wavTarget));
        dos.write(new RiffHeaderData(af, 0).asByteArray());
        DataInputStream dis = new DataInputStream(new FileInputStream(rawSource));
        byte[] buffer = new byte[4096];
        int i;
        int total = 0;
        while ((i = dis.read(buffer)) != -1) {
            total += i;
            dos.write(buffer, 0, i);
        }
        dos.close();
        modifyRiffSizeData(wavTarget, total);
    }

    public static void convertWavToRaw(File wavSource, File rawTarget) throws IOException {
        IOs.copy(new MonoWavFileReader(wavSource).getNewStream(), new FileOutputStream(rawTarget));
    }

    public static double[] readAllFromWavNormalized(String fileName) throws IOException {
        return new MonoWavFileReader(new File(fileName)).getNewStream().readSamplesNormalized();
    }

    /**
     * Modifies the size information in a wav file header.
     *
     * @param wavFile a wav file
     * @param size    size to replace the header.
     * @throws IOException if an error occurs whule accesing the data.
     */
    static void modifyRiffSizeData(File wavFile, int size) throws IOException {
        RandomAccessFile raf = new RandomAccessFile(wavFile, "rw");
        raf.seek(RiffHeaderData.RIFF_CHUNK_SIZE_INDEX);
        raf.write(toByteArray(size + 36, false));
        raf.seek(RiffHeaderData.RIFF_SUBCHUNK2_SIZE_INDEX);
        raf.write(toByteArray(size, false));
        raf.close();
    }

    public static void generateSilenceWavFile(WavAudioFormat wavAudioFormat, File file, double sec) throws IOException {
        WavFileWriter wfr = new WavFileWriter(wavAudioFormat, file);
        int[] empty = new int[(int) (sec * wavAudioFormat.getSampleRate())];
        try {
            wfr.write(empty);
        } finally {
            wfr.close();
        }
    }

}


================================================
FILE: SaidIt/src/main/java/simplesound/pcm/PcmMonoInputStream.java
================================================
package simplesound.pcm;

import org.jcaki.Bytes;
import org.jcaki.IOs;

import java.io.Closeable;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

public class PcmMonoInputStream extends InputStream implements Closeable {

    private final PcmAudioFormat format;
    private final DataInputStream dis;
    /**
     * this is used for normalization.
     */
    private final int maxPositiveIntegerForSampleSize;


    public PcmMonoInputStream(PcmAudioFormat format, InputStream is) {
        if (format.getChannels() != 1)
            throw new IllegalArgumentException("Only mono streams are supported.");
        this.format = format;
        this.dis = new DataInputStream(is);
        this.maxPositiveIntegerForSampleSize = 0x7fffffff >>> (32 - format.getSampleSizeInBits());
    }

    public int read() throws IOException {
        return dis.read();
    }

    public int[] readSamplesAsIntArray(int amount) throws IOException {
        byte[] bytez = new byte[amount * format.getBytePerSample()];
        int readAmount = dis.read(bytez);
        if (readAmount == -1)
            return new int[0];
        return Bytes.toReducedBitIntArray(
                bytez,
                readAmount,
                format.getBytePerSample(),
                format.getSampleSizeInBits(),
                format.isBigEndian());
    }

    public int[] readAll() throws IOException {
        byte[] all = IOs.readAsByteArray(dis);
        return Bytes.toReducedBitIntArray(
                all,
                all.length,
                format.getBytePerSample(),
                format.getSampleSizeInBits(),
                format.isBigEndian());
    }

    private static final int BYTE_BUFFER_SIZE = 4096;

    /**
     * reads samples as byte array. if there is not enough data for the amount of samples, remaining data is returned
     * anyway. if the byte amount is not an order of bytes required for sample (such as 51 bytes left but 16 bit samples)
     * an IllegalStateException is thrown.
     *
     * @param amount amount of samples to read.
     * @return byte array.
     * @throws IOException           if there is an IO error.
     * @throws IllegalStateException if the amount of bytes read is not an order of correct.
     */
    public byte[] readSamplesAsByteArray(int amount) throws IOException {

        byte[] bytez = new byte[amount * format.getBytePerSample()];
        int readCount = dis.read(bytez);
        if (readCount != bytez.length) {
            validateReadCount(readCount);
            byte[] result = new byte[readCount];
            System.arraycopy(bytez, 0, result, 0, readCount);
            return result;
        } else
            return bytez;
    }

    private void validateReadCount(int readCount) {
        if (readCount % format.getBytePerSample() != 0)
            throw new IllegalStateException("unexpected amounts of bytes read from the input stream. " +
                    "Byte count must be an order of:" + format.getBytePerSample());
    }

    public int[] readSamplesAsIntArray(int frameStart, int frameEnd) throws IOException {
        skipSamples(frameStart * format.getBytePerSample());
        return readSamplesAsIntArray(frameEnd - frameStart);
    }

    /**
     * skips samples from the stream. if end of file is reached, it returns the amount that is actually skipped.
     *
     * @param skipAmount amount of samples to skip
     * @return actual skipped sample count.
     * @throws IOException if there is a problem while skipping.
     */
    public int skipSamples(int skipAmount) throws IOException {
        long actualSkipped = dis.skip(skipAmount * format.getBytePerSample());
        return (int) actualSkipped / format.getBytePerSample();
    }

    public double[] readSamplesNormalized(int amount) throws IOException {
        return normalize(readSamplesAsIntArray(amount));
    }

    public double[] readSamplesNormalized() throws IOException {
        return normalize(readAll());
    }

    private double[] normalize(int[] original) {
        if (original.length == 0)
            return new double[0];
        double[] normalized = new double[original.length];
        for (int i = 0; i < normalized.length; i++) {
            normalized[i] = (double) original[i] / maxPositiveIntegerForSampleSize;
        }
        return normalized;
    }

    public void close() throws IOException {
        dis.close();
    }

    /**
     * finds the byte location of a given time. if time is negative, exception is thrown.
     *
     * @param second second information
     * @return the byte location in the samples.
     */
    public int calculateSampleByteIndex(double second) {

        if (second < 0)
            throw new IllegalArgumentException("Time information cannot be negative.");

        int loc = (int) (second * format.getSampleRate() * format.getBytePerSample());

        //byte alignment. 
        if (loc % format.getBytePerSample() != 0) {
            loc += (format.getBytePerSample() - loc % format.getBytePerSample());
        }
        return loc;
    }

    /**
     * calcualates the time informationn for a given sample.
     *
     * @param sampleIndex sample index.
     * @return approximate seconds information for the given sample.
     */
    public double calculateSampleTime(int sampleIndex) {
        if (sampleIndex < 0)
            throw new IllegalArgumentException("sampleIndex information cannot be negative:" + sampleIndex);

        return (double) sampleIndex / format.getSampleRate();
    }

    public PcmAudioFormat getFormat() {
        return format;
    }
}


================================================
FILE: SaidIt/src/main/java/simplesound/pcm/PcmMonoOutputStream.java
================================================
package simplesound.pcm;

import org.jcaki.Bytes;
import org.jcaki.IOs;

import java.io.*;

public class PcmMonoOutputStream extends OutputStream implements Closeable {

    final PcmAudioFormat format;
    final DataOutputStream dos;

    public PcmMonoOutputStream(PcmAudioFormat format, DataOutputStream dos) {
        this.format = format;
        this.dos = dos;
    }

    public PcmMonoOutputStream(PcmAudioFormat format, File file) throws IOException {
        this.format = format;
        this.dos = new DataOutputStream(new FileOutputStream(file));
    }

    public void write(int b) throws IOException {
        dos.write(b);
    }

    @Override
    public void write(byte[] buffer, int offset, int count) throws IOException {
        dos.write(buffer, offset, count);
    }

    public void write(short[] shorts) throws IOException {
        dos.write(Bytes.toByteArray(shorts, shorts.length, format.isBigEndian()));
    }

    public void write(int[] ints) throws IOException {
        dos.write(Bytes.toByteArray(ints, ints.length, format.getBytePerSample(), format.isBigEndian()));
    }

    public void close() {
        IOs.closeSilently(dos);
    }
}


================================================
FILE: SaidIt/src/main/java/simplesound/pcm/RiffHeaderData.java
================================================
package simplesound.pcm;

import static org.jcaki.Bytes.toByteArray;
import static org.jcaki.Bytes.toInt;
import org.jcaki.IOs;

import java.io.*;

class RiffHeaderData {

    public static final int PCM_RIFF_HEADER_SIZE = 44;
    public static final int RIFF_CHUNK_SIZE_INDEX = 4;
    public static final int RIFF_SUBCHUNK2_SIZE_INDEX = 40;

    private final PcmAudioFormat format;
    private final int totalSamplesInByte;

    public RiffHeaderData(PcmAudioFormat format, int totalSamplesInByte) {
        this.format = format;
        this.totalSamplesInByte = totalSamplesInByte;
    }

    public double timeSeconds() {
        return (double) totalSamplesInByte / format.getBytePerSample() / format.getSampleRate();
    }

    public RiffHeaderData(DataInputStream dis) throws IOException {

        try {
            byte[] buf4 = new byte[4];
            byte[] buf2 = new byte[2];

            dis.skipBytes(4 + 4 + 4 + 4 + 4 + 2);

            dis.readFully(buf2);
            final int channels = toInt(buf2, false);

            dis.readFully(buf4);
            final int sampleRate = toInt(buf4, false);

            dis.skipBytes(4 + 2);

            dis.readFully(buf2);
            final int sampleSizeInBits = toInt(buf2, false);

            dis.skipBytes(4);

            dis.readFully(buf4);
            totalSamplesInByte = toInt(buf4, false);

            format = new WavAudioFormat.Builder().
                    channels(channels).
                    sampleRate(sampleRate).
                    sampleSizeInBits(sampleSizeInBits).
                    build();
        } finally {
            IOs.closeSilently(dis);
        }
    }

    public RiffHeaderData(File file) throws IOException {
        this(new DataInputStream(new FileInputStream(file)));
    }

    public byte[] asByteArray() {
        ByteArrayOutputStream baos = null;
        try {
            baos = new ByteArrayOutputStream();
            // ChunkID (the String "RIFF") 4 Bytes
            baos.write(toByteArray(0x52494646, true));
            // ChunkSize (Whole file size in byte minus 8 bytes ) , or (4 + (8 + SubChunk1Size) + (8 + SubChunk2Size))
            // little endian 4 Bytes.
            baos.write(toByteArray(36 + totalSamplesInByte, false));
            // Format (the String "WAVE") 4 Bytes big endian
            baos.write(toByteArray(0x57415645, true));

            // Subchunk1
            // Subchunk1ID (the String "fmt ") 4 bytes big endian.
            baos.write(toByteArray(0x666d7420, true));
            // Subchunk1Size. 16 for the PCM. little endian 4 bytes.
            baos.write(toByteArray(16, false));
            // AudioFormat , for PCM = 1, Little endian 2 Bytes.
            baos.write(toByteArray((short) 1, false));
            // Number of channels Mono = 1, Stereo = 2  Little Endian , 2 bytes.
            int channels = format.getChannels();
            baos.write(toByteArray((short) channels, false));
            // SampleRate (8000, 44100 etc.) little endian, 4 bytes
            int sampleRate = format.getSampleRate();
            baos.write(toByteArray(sampleRate, false));
            // byte rate (SampleRate * NumChannels * BitsPerSample/8) little endian, 4 bytes.
            baos.write(toByteArray(channels * sampleRate * format.getBytePerSample(), false));
            // Block Allign == NumChannels * BitsPerSample/8  The number of bytes for one sample including all channels. LE, 2 bytes
            baos.write(toByteArray((short) (channels * format.getBytePerSample()), false));
            // BitsPerSample (8, 16 etc.) LE, 2 bytes
            baos.write(toByteArray((short) format.getSampleSizeInBits(), false));

            // Subchunk2
            // SubChunk2ID (String "data") 4 bytes.
            baos.write(toByteArray(0x64617461, true));
            // Subchunk2Size    == NumSamples * NumChannels * BitsPerSample/8. This is the number of bytes in the data.
            // You can also think of this as the size of the read of the subchunk following this number. LE, 4 bytes.
            baos.write(toByteArray(totalSamplesInByte, false));

            return baos.toByteArray();
        } catch (IOException e) {
            e.printStackTrace();
            return new byte[0];
        } finally {
            IOs.closeSilently(baos);
        }
    }

    public PcmAudioFormat getFormat() {
        return format;
    }

    public int getTotalSamplesInByte() {
        return totalSamplesInByte;
    }

    public int getSampleCount() {
        return totalSamplesInByte / format.getBytePerSample();
    }

    public String toString() {
        return "[ Format: " + format.toString() + " , totalSamplesInByte:" + totalSamplesInByte + "]";
    }
}


================================================
FILE: SaidIt/src/main/java/simplesound/pcm/WavAudioFormat.java
================================================
package simplesound.pcm;

public class WavAudioFormat extends PcmAudioFormat {

    /**
     * if data is represented as big endian or little endian.
     */
    protected final boolean bigEndian = false;

    private WavAudioFormat(int sampleRate, int sampleSizeInBits, int channels, boolean signed) {
        super(sampleRate, sampleSizeInBits, channels, false, signed);
    }

    /**
     * a builder class for generating PCM Audio format for wav files.
     */
    public static class Builder {
        private int _sampleRate;
        private int _sampleSizeInBits = 16;
        private int _channels = 1;

        public Builder sampleRate(int sampleRate) {
            this._sampleRate = sampleRate;
            return this;
        }

        public Builder channels(int channels) {
            this._channels = channels;
            return this;
        }

        public Builder sampleSizeInBits(int sampleSizeInBits) {
            this._sampleSizeInBits = sampleSizeInBits;
            return this;
        }

        public WavAudioFormat build() {
            if (_sampleSizeInBits == 8)
                return new WavAudioFormat(_sampleRate, _sampleSizeInBits, _channels, false);
            else
                return new WavAudioFormat(_sampleRate, _sampleSizeInBits, _channels, true);
        }
    }

    /**
     * generates a PcmAudioFormat for wav files for 16 bits signed mono data.
     *
     * @param sampleRate sampling rate.
     * @return new PcmAudioFormat object for given wav header values. .
     */
    public static WavAudioFormat mono16Bit(int sampleRate) {
        return new WavAudioFormat(sampleRate, 16, 1, true);
    }

    /**
     * Generates audio format data for Wav audio format. returning PCM format is little endian.
     *
     * @param sampleRate       sample rate
     * @param sampleSizeInBits bit amount per sample
     * @param channels         channel count. can be 1 or 2
     * @return a RawAudioFormat suitable for wav format.
     */
    public static WavAudioFormat wavFormat(int sampleRate, int sampleSizeInBits, int channels) {
        if (sampleSizeInBits == 8)
            return new WavAudioFormat(sampleRate, sampleSizeInBits, channels, false);
        else
            return new WavAudioFormat(sampleRate, sampleSizeInBits, channels, true);
    }
}


================================================
FILE: SaidIt/src/main/java/simplesound/pcm/WavFileWriter.java
================================================
package simplesound.pcm;

import android.util.Log;

import java.io.Closeable;
import java.io.File;
import java.io.IOException;

/**
 * Writes a wav file. Careful that it writes the total amount of the bytes information once the close method
 * is called. It has a counter in it to calculate the samle size.
 */
public class WavFileWriter implements Closeable {

    private final WavAudioFormat pcmAudioFormat;
    private final PcmMonoOutputStream pos;
    private int totalSampleBytesWritten = 0;
    private final File file;

    public WavFileWriter(WavAudioFormat wavAudioFormat, File file) throws IOException {
        if (wavAudioFormat.isBigEndian())
            throw new IllegalArgumentException("Wav file cannot contain bigEndian sample data.");
        if (wavAudioFormat.getSampleSizeInBits() > 8 && !wavAudioFormat.isSigned())
            throw new IllegalArgumentException("Wav file cannot contain unsigned data for this sampleSize:"
                    + wavAudioFormat.getSampleSizeInBits());
        this.pcmAudioFormat = wavAudioFormat;
        this.file = file;
        this.pos = new PcmMonoOutputStream(wavAudioFormat, file);
        pos.write(new RiffHeaderData(wavAudioFormat, 0).asByteArray());
    }

    public WavFileWriter write(byte[] bytes) throws IOException {
        checkLimit(totalSampleBytesWritten, bytes.length);
        pos.write(bytes);
        totalSampleBytesWritten += bytes.length;
        return this;
    }

    public WavFileWriter write(byte[] bytes, int offset, int count) throws IOException {
        checkLimit(totalSampleBytesWritten, count);
        pos.write(bytes, offset, count);
        totalSampleBytesWritten += count;
        return this;
    }

    private void checkLimit(int total, int toAdd) {
        final long result = total + toAdd;
        if (result >= Integer.MAX_VALUE) {
            throw new IllegalStateException("Size of bytes is too big:" + result);
        }
    }

    public WavFileWriter write(int[] samples) throws IOException {
        final int bytePerSample = pcmAudioFormat.getBytePerSample();
        checkLimit(totalSampleBytesWritten, samples.length * bytePerSample);
        pos.write(samples);
        totalSampleBytesWritten += samples.length * bytePerSample;
        return this;
    }

    public WavFileWriter write(short[] samples) throws IOException {
        checkLimit(totalSampleBytesWritten, samples.length * 2);
        pos.write(samples);
        totalSampleBytesWritten += samples.length * 2;
        return this;
    }

    WavFileWriter writeNormalized(double[] samples) throws IOException {
        return this;
    }

    public void close() throws IOException {
        pos.close();
        PcmAudioHelper.modifyRiffSizeData(file, totalSampleBytesWritten);
    }

    public PcmAudioFormat getWavFormat() {
        return pcmAudioFormat;
    }


    public int getTotalSampleBytesWritten() {
        return totalSampleBytesWritten;
    }
}


================================================
FILE: SaidIt/src/main/res/anim/pulse.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<scale xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="1000"
    android:fromXScale="1"
    android:fromYScale="1"
    android:pivotX="50%"
    android:pivotY="50%"
    android:repeatCount="infinite"
    android:repeatMode="reverse"
    android:interpolator="@android:interpolator/accelerate_decelerate"
    android:toXScale="0.9"
    android:toYScale="0.9" />

================================================
FILE: SaidIt/src/main/res/color/button_text.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:color="@color/gray_d" android:state_enabled="false" />
    <item android:color="@color/gray_f" android:state_enabled="true" />
    <item android:color="@color/red" android:state_pressed="true" />
    <item android:color="@color/red" android:state_focused="true" />

</selector>

================================================
FILE: SaidIt/src/main/res/drawable/bg_et.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true">
        <shape>
            <solid android:color="#ffffff" />
            <stroke android:width="1dp" android:color="@color/gray_8" />
            <corners android:radius="5dp" />
        </shape>
    </item>
    <item>
        <shape>
            <solid android:color="#ffffff" />
            <stroke android:width="1dp" android:color="@color/gray_a" />
            <corners android:radius="5dp" />
        </shape>
    </item>
</selector>

================================================
FILE: SaidIt/src/main/res/drawable/circle_button.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/circle_button_pressed" android:state_pressed="true" />
    <item android:drawable="@drawable/circle_button_pressed" android:state_focused="true" />
    <item android:drawable="@drawable/circle_button_normal" />

</selector>


================================================
FILE: SaidIt/src/main/res/drawable/circle_button_normal.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval">
            <solid android:color="@color/transparent" />
            <stroke android:color="@color/gray_6" android:width="@dimen/shadow_offset" />
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape android:shape="oval">
            <solid android:color="@color/gray_8" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/circle_button_pressed.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval">
            <solid android:color="@color/transparent" />
            <stroke android:color="@color/gray_8" android:width="@dimen/shadow_offset" />
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape android:shape="oval">
            <solid android:color="@color/gray_a" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/cling_button_bg.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project

     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.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@drawable/btn_cling_pressed"/>
    <item android:drawable="@drawable/btn_cling_normal"/>
</selector>


================================================
FILE: SaidIt/src/main/res/drawable/dashed_line.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="line" >

    <stroke
        android:width="3dp"
        android:dashGap="6dp"
        android:dashWidth="12dp"
        android:color="@color/gray_c" />

</shape>

================================================
FILE: SaidIt/src/main/res/drawable/dialog_content.xml
================================================
<?xml version="1.0" encoding="utf-8"?>


<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:topLeftRadius="0dp" android:topRightRadius="0dp" android:bottomLeftRadius="@dimen/large_round" android:bottomRightRadius="@dimen/large_round" />
            <solid android:color="@color/transparent" />
            <stroke android:width="@dimen/shadow_offset" android:color="@color/gray_c"/>
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape>
            <padding android:bottom="@dimen/small_round" android:top="0dp" android:left="@dimen/small_round" android:right="@dimen/small_round" />
            <corners android:topLeftRadius="0dp" android:topRightRadius="0dp" android:bottomLeftRadius="@dimen/large_round" android:bottomRightRadius="@dimen/large_round" />
            <solid android:color="@color/gray_e" />
        </shape>

    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/dialog_title.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:topLeftRadius="@dimen/large_round" android:topRightRadius="@dimen/large_round" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" />
            <solid android:color="@color/transparent" />
            <stroke android:width="@dimen/shadow_offset" android:color="@color/dark_green" />
        </shape>
    </item>
    <item android:bottom="@dimen/negative_shadow_offset">
        <shape>
            <padding android:bottom="10dp" android:top="10dp" android:left="@dimen/large_round" android:right="@dimen/large_round" />
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" />
            <solid android:color="@color/green" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/error_dialog_title.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:topLeftRadius="@dimen/large_round" android:topRightRadius="@dimen/large_round" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" />
            <solid android:color="@color/transparent" />
            <stroke android:width="@dimen/shadow_offset" android:color="@color/dark_red" />
        </shape>
    </item>
    <item android:bottom="@dimen/negative_shadow_offset">
        <shape>
            <padding android:bottom="10dp" android:top="10dp" android:left="@dimen/large_round" android:right="@dimen/large_round" />
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" />
            <solid android:color="@color/red" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/gold_button.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/gold_button_pressed" android:state_pressed="true" />
    <item android:drawable="@drawable/gold_button_pressed" android:state_focused="true" />
    <item android:drawable="@drawable/gold_button_normal" />

</selector>

================================================
FILE: SaidIt/src/main/res/drawable/gold_button_normal.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/small_round" android:bottomRightRadius="@dimen/small_round" />
            <solid android:color="@color/transparent" />
            <stroke android:color="@color/dark_gold" android:width="@dimen/shadow_offset" />
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape>
            <padding android:bottom="@dimen/button_padding" android:top="@dimen/button_padding" android:left="@dimen/small_round" android:right="@dimen/small_round" />
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/small_round" android:bottomRightRadius="@dimen/small_round" />
            <solid android:color="@color/gold" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/gold_button_pressed.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/small_round" android:bottomRightRadius="@dimen/small_round" />
            <solid android:color="@color/transparent" />
            <stroke android:color="@color/gold" android:width="@dimen/shadow_offset" />
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape>
            <padding android:bottom="@dimen/button_padding" android:top="@dimen/button_padding" android:left="@dimen/small_round" android:right="@dimen/small_round" />
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/small_round" android:bottomRightRadius="@dimen/small_round" />
            <solid android:color="@color/light_gold" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/gray_button.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/gray_button_pressed" android:state_pressed="true" />
    <item android:drawable="@drawable/gray_button_focused" android:state_focused="true" />
    <item android:drawable="@drawable/gray_button_normal" />

</selector>

================================================
FILE: SaidIt/src/main/res/drawable/gray_button_focused.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <padding android:bottom="@dimen/button_padding" android:top="@dimen/button_padding" android:left="@dimen/small_round" android:right="@dimen/small_round" />
    <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/small_round" android:bottomRightRadius="@dimen/small_round" />
    <solid android:color="@color/gray_8" />
</shape>

================================================
FILE: SaidIt/src/main/res/drawable/gray_button_normal.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/small_round" android:bottomRightRadius="@dimen/small_round" />
            <solid android:color="@color/transparent" />
            <stroke android:color="@color/gray_6" android:width="@dimen/shadow_offset" />
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape>
            <padding android:bottom="@dimen/button_padding" android:top="@dimen/button_padding" android:left="@dimen/small_round" android:right="@dimen/small_round" />
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/small_round" android:bottomRightRadius="@dimen/small_round" />
            <solid android:color="@color/gray_8" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/gray_button_pressed.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/small_round" android:bottomRightRadius="@dimen/small_round" />
            <solid android:color="@color/transparent" />
            <stroke android:color="@color/gray_8" android:width="@dimen/shadow_offset" />
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape>
            <padding android:bottom="@dimen/button_padding" android:top="@dimen/button_padding" android:left="@dimen/small_round" android:right="@dimen/small_round" />
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/small_round" android:bottomRightRadius="@dimen/small_round" />
            <solid android:color="@color/gray_a" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/green_button.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/green_button_pressed" android:state_pressed="true" />
    <item android:drawable="@drawable/green_button_pressed" android:state_focused="true" />
    <item android:drawable="@drawable/green_button_normal" />

</selector>

================================================
FILE: SaidIt/src/main/res/drawable/green_button_normal.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/small_round" android:bottomRightRadius="@dimen/small_round" />
            <solid android:color="@color/transparent" />
            <stroke android:color="@color/dark_green" android:width="@dimen/shadow_offset" />
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape>
            <padding android:bottom="@dimen/button_padding" android:top="@dimen/button_padding" android:left="@dimen/small_round" android:right="@dimen/small_round" />
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/small_round" android:bottomRightRadius="@dimen/small_round" />
            <solid android:color="@color/green" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/green_button_pressed.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/small_round" android:bottomRightRadius="@dimen/small_round" />
            <solid android:color="@color/transparent" />
            <stroke android:color="@color/green" android:width="@dimen/shadow_offset" />
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape>
            <padding android:bottom="@dimen/button_padding" android:top="@dimen/button_padding" android:left="@dimen/small_round" android:right="@dimen/small_round" />
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/small_round" android:bottomRightRadius="@dimen/small_round" />
            <solid android:color="@color/slight_green" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/red_circle_button.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/red_circle_button_pressed" android:state_pressed="true" />
    <item android:drawable="@drawable/red_circle_button_pressed" android:state_focused="true" />
    <item android:drawable="@drawable/red_circle_button_normal" />

</selector>


================================================
FILE: SaidIt/src/main/res/drawable/red_circle_button_normal.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval">
            <solid android:color="@color/transparent" />
            <stroke android:color="@color/dark_red" android:width="@dimen/shadow_offset" />
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape android:shape="oval">
            <solid android:color="@color/red" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/red_circle_button_pressed.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval">
            <solid android:color="@color/transparent" />
            <stroke android:color="@color/red" android:width="@dimen/shadow_offset" />
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape android:shape="oval">
            <solid android:color="@color/light_red" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/top_gray_button.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/top_gray_button_pressed" android:state_pressed="true" />
    <item android:drawable="@drawable/top_gray_button_pressed" android:state_focused="true" />
    <item android:drawable="@drawable/top_gray_button_normal" />

</selector>


================================================
FILE: SaidIt/src/main/res/drawable/top_gray_button_normal.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:topLeftRadius="0dp" android:topRightRadius="0dp" android:bottomLeftRadius="@dimen/large_round" android:bottomRightRadius="@dimen/large_round" />
            <solid android:color="@color/transparent" />
            <stroke android:color="@color/gray_6" android:width="@dimen/shadow_offset" />
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape>
            <corners android:topLeftRadius="0dp" android:topRightRadius="0dp" android:bottomLeftRadius="@dimen/large_round" android:bottomRightRadius="@dimen/large_round" />
            <solid android:color="@color/gray_8" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/top_gray_button_pressed.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:topLeftRadius="0dp" android:topRightRadius="0dp" android:bottomLeftRadius="@dimen/large_round" android:bottomRightRadius="@dimen/large_round" />
            <solid android:color="@color/transparent" />
            <stroke android:color="@color/gray_8" android:width="@dimen/shadow_offset" />
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape>
            <corners android:topLeftRadius="0dp" android:topRightRadius="0dp" android:bottomLeftRadius="@dimen/large_round" android:bottomRightRadius="@dimen/large_round" />
            <solid android:color="@color/gray_a" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/top_green_button.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/top_green_button_pressed" android:state_pressed="true" />
    <item android:drawable="@drawable/top_green_button_pressed" android:state_focused="true" />
    <item android:drawable="@drawable/top_green_button_normal" />

</selector>


================================================
FILE: SaidIt/src/main/res/drawable/top_green_button_normal.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:topLeftRadius="0dp" android:topRightRadius="0dp" android:bottomLeftRadius="@dimen/large_round" android:bottomRightRadius="@dimen/large_round" />
            <solid android:color="@color/transparent" />
            <stroke android:color="@color/dark_green" android:width="@dimen/shadow_offset" />
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape>
            <corners android:topLeftRadius="0dp" android:topRightRadius="0dp" android:bottomLeftRadius="@dimen/large_round" android:bottomRightRadius="@dimen/large_round" />
            <solid android:color="@color/green" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/top_green_button_pressed.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:topLeftRadius="0dp" android:topRightRadius="0dp" android:bottomLeftRadius="@dimen/large_round" android:bottomRightRadius="@dimen/large_round" />
            <solid android:color="@color/transparent" />
            <stroke android:color="@color/green" android:width="@dimen/shadow_offset" />
        </shape>
    </item>
    <item android:bottom="@dimen/shadow_offset">
        <shape>
            <corners android:topLeftRadius="0dp" android:topRightRadius="0dp" android:bottomLeftRadius="@dimen/large_round" android:bottomRightRadius="@dimen/large_round" />
            <solid android:color="@color/slight_green" />
        </shape>
    </item>
</layer-list>

================================================
FILE: SaidIt/src/main/res/drawable/white_button.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/white_button_pressed" android:state_pressed="true" />
    <item android:drawable="@drawable/white_button_focused" android:state_focused="true" />
    <item android:drawable="@drawable/white_button_normal" />

</selector>

================================================
FILE: SaidIt/src/main/res/drawable/white_button_focused.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<shape  xmlns:android="http://schemas.android.com/apk/res/android">
    <padding android:bottom="@dimen/small_round" android:top="@dimen/small_round" android:left="@dimen/small_round" android:right="@dimen/small_round" />
    <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/small_round" android:bottomRightRadius="@dimen/small_round" />
    <solid android:color="@color/gray_c" />
    <stroke android:color="@color/gray_f" android:width="@dimen/shadow_offset" />
</shape>

================================================
FILE: SaidIt/src/main/res/drawable/white_button_normal.xml
================================================
<?xml version="1.0" encoding="utf-8"?>

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:topLeftRadius="@dimen/small_round" android:topRightRadius="@dimen/small_round" android:bottomLeftRadius="@dimen/sma
Download .txt
gitextract_ko78r43l/

├── .gitignore
├── LICENSE.txt
├── README.md
├── SaidIt/
│   ├── SaidIt-SaidIt.iml
│   ├── build.gradle
│   ├── libs/
│   │   └── jcaki-1.0-Alpha.jar
│   ├── proguard.cfg
│   └── src/
│       └── main/
│           ├── AndroidManifest.xml
│           ├── assets/
│           │   └── public_key.der
│           ├── java/
│           │   ├── eu/
│           │   │   └── mrogalski/
│           │   │       ├── StringFormat.java
│           │   │       ├── android/
│           │   │       │   ├── TimeFormat.java
│           │   │       │   └── Views.java
│           │   │       └── saidit/
│           │   │           ├── AudioMemory.java
│           │   │           ├── BroadcastReceiver.java
│           │   │           ├── ErrorResponseDialog.java
│           │   │           ├── IntentResult.java
│           │   │           ├── RecordingDoneDialog.java
│           │   │           ├── SaidIt.java
│           │   │           ├── SaidItActivity.java
│           │   │           ├── SaidItFragment.java
│           │   │           ├── SaidItService.java
│           │   │           ├── SettingsActivity.java
│           │   │           ├── ThemedDialog.java
│           │   │           ├── UserInfo.java
│           │   │           └── WorkingDialog.java
│           │   └── simplesound/
│           │       ├── dsp/
│           │       │   ├── Complex.java
│           │       │   ├── DoubleVector.java
│           │       │   ├── DoubleVectorFrameSource.java
│           │       │   ├── DoubleVectorProcessingPipeline.java
│           │       │   ├── DoubleVectorProcessor.java
│           │       │   ├── MutableComplex.java
│           │       │   ├── NormalizedFrameIterator.java
│           │       │   └── WindowerFactory.java
│           │       └── pcm/
│           │           ├── MonoWavFileReader.java
│           │           ├── PcmAudioFormat.java
│           │           ├── PcmAudioHelper.java
│           │           ├── PcmMonoInputStream.java
│           │           ├── PcmMonoOutputStream.java
│           │           ├── RiffHeaderData.java
│           │           ├── WavAudioFormat.java
│           │           └── WavFileWriter.java
│           └── res/
│               ├── anim/
│               │   └── pulse.xml
│               ├── color/
│               │   └── button_text.xml
│               ├── drawable/
│               │   ├── bg_et.xml
│               │   ├── circle_button.xml
│               │   ├── circle_button_normal.xml
│               │   ├── circle_button_pressed.xml
│               │   ├── cling_button_bg.xml
│               │   ├── dashed_line.xml
│               │   ├── dialog_content.xml
│               │   ├── dialog_title.xml
│               │   ├── error_dialog_title.xml
│               │   ├── gold_button.xml
│               │   ├── gold_button_normal.xml
│               │   ├── gold_button_pressed.xml
│               │   ├── gray_button.xml
│               │   ├── gray_button_focused.xml
│               │   ├── gray_button_normal.xml
│               │   ├── gray_button_pressed.xml
│               │   ├── green_button.xml
│               │   ├── green_button_normal.xml
│               │   ├── green_button_pressed.xml
│               │   ├── red_circle_button.xml
│               │   ├── red_circle_button_normal.xml
│               │   ├── red_circle_button_pressed.xml
│               │   ├── top_gray_button.xml
│               │   ├── top_gray_button_normal.xml
│               │   ├── top_gray_button_pressed.xml
│               │   ├── top_green_button.xml
│               │   ├── top_green_button_normal.xml
│               │   ├── top_green_button_pressed.xml
│               │   ├── white_button.xml
│               │   ├── white_button_focused.xml
│               │   ├── white_button_normal.xml
│               │   ├── white_button_pressed.xml
│               │   └── window_background.xml
│               ├── layout/
│               │   ├── activity_background_recorder.xml
│               │   ├── activity_settings.xml
│               │   ├── dialog_save_recording.xml
│               │   ├── fragment_background_recorder.xml
│               │   ├── progress_dialog.xml
│               │   └── recording_done_dialog.xml
│               ├── values/
│               │   ├── colors.xml
│               │   ├── dimens.xml
│               │   ├── paypal.xml
│               │   ├── strings.xml
│               │   └── styles.xml
│               ├── values-land-v19/
│               │   └── bools.xml
│               ├── values-pl/
│               │   └── strings.xml
│               ├── values-sw600dp-land-v19/
│               │   └── bools.xml
│               ├── values-v19/
│               │   └── styles.xml
│               └── xml/
│                   └── path_provider.xml
├── SaidIt.iml
├── build.gradle
├── fastlane/
│   └── metadata/
│       └── android/
│           └── en-US/
│               ├── changelogs/
│               │   └── 15.txt
│               ├── full_description.txt
│               ├── short_description.txt
│               └── title.txt
├── gradle/
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
Download .txt
SYMBOL INDEX (277 symbols across 32 files)

FILE: SaidIt/src/main/java/eu/mrogalski/StringFormat.java
  class StringFormat (line 5) | public class StringFormat {
    method shortFileSize (line 6) | public static String shortFileSize(long size) {

FILE: SaidIt/src/main/java/eu/mrogalski/android/TimeFormat.java
  class TimeFormat (line 7) | public class TimeFormat {
    method naturalLanguage (line 8) | public static void naturalLanguage(Resources resources, float secondsF...
    method shortTimer (line 31) | public static String shortTimer(float seconds) {
    class Result (line 35) | public static class Result {

FILE: SaidIt/src/main/java/eu/mrogalski/android/Views.java
  class Views (line 6) | public class Views {
    method search (line 7) | public static void search(ViewGroup viewGroup, SearchViewCallback call...
    type SearchViewCallback (line 19) | public static interface SearchViewCallback {
      method onView (line 20) | public void onView(View view, ViewGroup parent);

FILE: SaidIt/src/main/java/eu/mrogalski/saidit/AudioMemory.java
  class AudioMemory (line 8) | public class AudioMemory {
    method allocate (line 20) | synchronized public void allocate(long sizeToEnsure) {
    method getAllocatedMemorySize (line 43) | synchronized public long getAllocatedMemorySize() {
    type Consumer (line 47) | public interface Consumer {
      method consume (line 48) | public int consume(byte[] array, int offset, int count) throws IOExc...
    method skipAndFeed (line 51) | private int skipAndFeed(int bytesToSkip, byte[] arr, int offset, int l...
    method read (line 62) | public void read(int skipBytes, Consumer reader)  throws IOException {
    method countFilled (line 76) | public int countFilled() {
    method fill (line 92) | public void fill(Consumer filler) throws IOException {
    class Stats (line 123) | public static class Stats {
    method getStats (line 130) | public synchronized Stats getStats(int fillRate) {

FILE: SaidIt/src/main/java/eu/mrogalski/saidit/BroadcastReceiver.java
  class BroadcastReceiver (line 6) | public class BroadcastReceiver extends android.content.BroadcastReceiver {
    method onReceive (line 8) | @Override

FILE: SaidIt/src/main/java/eu/mrogalski/saidit/ErrorResponseDialog.java
  class ErrorResponseDialog (line 3) | public class ErrorResponseDialog extends ThemedDialog {
    method getShadowColorId (line 4) | @Override

FILE: SaidIt/src/main/java/eu/mrogalski/saidit/IntentResult.java
  class IntentResult (line 2) | public final class IntentResult {
    method IntentResult (line 10) | IntentResult() {
    method IntentResult (line 14) | IntentResult(String contents,
    method getContents (line 29) | public String getContents() {
    method getFormatName (line 36) | public String getFormatName() {
    method getRawBytes (line 43) | public byte[] getRawBytes() {
    method getOrientation (line 50) | public Integer getOrientation() {
    method getErrorCorrectionLevel (line 57) | public String getErrorCorrectionLevel() {
    method toString (line 61) | @Override

FILE: SaidIt/src/main/java/eu/mrogalski/saidit/RecordingDoneDialog.java
  class RecordingDoneDialog (line 25) | public class RecordingDoneDialog extends ThemedDialog {
    method onSaveInstanceState (line 34) | @Override
    method onCreate (line 41) | @Override
    method onCreateView (line 52) | @Override
    method setFile (line 107) | public RecordingDoneDialog setFile(File file) {
    method setRuntime (line 112) | public RecordingDoneDialog setRuntime(float runtime) {
    method openFolder (line 117) | public void openFolder() {
    method isExternalStorageWritable (line 131) | private static boolean isExternalStorageWritable() {

FILE: SaidIt/src/main/java/eu/mrogalski/saidit/SaidIt.java
  class SaidIt (line 3) | public class SaidIt {

FILE: SaidIt/src/main/java/eu/mrogalski/saidit/SaidItActivity.java
  class SaidItActivity (line 18) | public class SaidItActivity extends Activity {
    method onCreate (line 24) | @Override
    method onStart (line 30) | @Override
    method onRestart (line 42) | @Override
    method requestPermissions (line 54) | private void requestPermissions() {
    method onRequestPermissionsResult (line 64) | @Override
    method showFragment (line 116) | private void showFragment() {
    method showPermissionDeniedDialog (line 124) | private void showPermissionDeniedDialog() {

FILE: SaidIt/src/main/java/eu/mrogalski/saidit/SaidItFragment.java
  class SaidItFragment (line 50) | public class SaidItFragment extends Fragment {
    method onStart (line 81) | @Override
    method onStop (line 90) | @Override
    class ActivityResult (line 100) | class ActivityResult {
      method ActivityResult (line 105) | ActivityResult(int requestCode, int resultCode, Intent data) {
    method run (line 113) | @Override
    method onServiceConnected (line 125) | @Override
    method onServiceDisconnected (line 138) | @Override
    method getStatusBarHeight (line 145) | public int getStatusBarHeight() {
    method onCreateView (line 154) | @Override
    method state (line 293) | @Override
    class ListenButtonClickListener (line 356) | private class ListenButtonClickListener implements View.OnClickListener {
      method ListenButtonClickListener (line 361) | public ListenButtonClickListener() {
      method onClick (line 365) | @Override
    class RecordButtonClickListener (line 393) | private class RecordButtonClickListener implements View.OnClickListene...
      method onClick (line 395) | @Override
      method onLongClick (line 400) | @Override
      method record (line 406) | public void record(final View button, final boolean keepRecording) {
      method getPrependedSeconds (line 449) | float getPrependedSeconds(View button) {
    method buildNotificationForFile (line 468) | static Notification buildNotificationForFile(Context context, File out...
    class NotifyFileReceiver (line 488) | static class NotifyFileReceiver implements SaidItService.WavFileReceiv...
      method NotifyFileReceiver (line 492) | public NotifyFileReceiver(Context context) {
      method fileReady (line 496) | @Override
    class PromptFileReceiver (line 513) | static class PromptFileReceiver implements SaidItService.WavFileReceiv...
      method PromptFileReceiver (line 517) | public PromptFileReceiver(Activity activity) {
      method fileReady (line 521) | @Override

FILE: SaidIt/src/main/java/eu/mrogalski/saidit/SaidItService.java
  class SaidItService (line 38) | public class SaidItService extends Service {
    method onCreate (line 55) | @Override
    method onDestroy (line 75) | @Override
    method onBind (line 82) | @Override
    method onUnbind (line 87) | @Override
    method enableListening (line 92) | public void enableListening() {
    method disableListening (line 99) | public void disableListening() {
    method innerStartListening (line 112) | private void innerStartListening() {
    method innerStopListening (line 162) | private void innerStopListening() {
    method dumpRecording (line 189) | public void dumpRecording(final float memorySeconds, final WavFileRece...
    method isExternalStorageWritable (line 263) | private static boolean isExternalStorageWritable() {
    method showToast (line 267) | private void showToast(String message) {
    method startRecording (line 271) | public void startRecording(final float prependedMemorySeconds) {
    method getMemorySize (line 350) | public long getMemorySize() {
    method setMemorySize (line 354) | public void setMemorySize(final long memorySize) {
    method getSamplingRate (line 368) | public int getSamplingRate() {
    method setSampleRate (line 372) | public void setSampleRate(int sampleRate) {
    type WavFileReceiver (line 390) | public interface WavFileReceiver {
      method fileReady (line 391) | public void fileReady(File file, float runtime);
    method stopRecording (line 394) | public void stopRecording(final WavFileReceiver wavFileReceiver, Strin...
    method flushAudioRecord (line 428) | private void flushAudioRecord() {
    method consume (line 436) | @Override
    method run (line 473) | @Override
    type StateCallback (line 486) | public interface StateCallback {
      method state (line 487) | public void state(boolean listeningEnabled, boolean recording, float...
    method getState (line 490) | public void getState(final StateCallback stateCallback) {
    method getBytesToSeconds (line 522) | public float getBytesToSeconds() {
    class BackgroundRecorderBinder (line 526) | class BackgroundRecorderBinder extends Binder {
      method getService (line 527) | public SaidItService getService() {
    method onStartCommand (line 532) | @Override
    method onTaskRemoved (line 539) | @Override
    method buildNotification (line 552) | private Notification buildNotification() {

FILE: SaidIt/src/main/java/eu/mrogalski/saidit/SettingsActivity.java
  class SettingsActivity (line 31) | public class SettingsActivity extends Activity {
    method onStart (line 39) | @Override
    method onStop (line 46) | @Override
    method onServiceConnected (line 55) | @Override
    method onServiceDisconnected (line 63) | @Override
    method syncUI (line 71) | private void syncUI() {
    method highlightButtons (line 88) | void highlightButtons() {
    method highlightButton (line 101) | private void highlightButton(int button1, int button2, int button3, in...
    method onCreate (line 107) | @Override
    method debugPrintCodecs (line 176) | private void debugPrintCodecs() {
    method initSampleRateButton (line 195) | private void initSampleRateButton(ViewGroup layout, int buttonId, int ...
    method testSampleRateValid (line 209) | private boolean testSampleRateValid(int sampleRate) {
    class MemoryOnClickListener (line 214) | private class MemoryOnClickListener implements View.OnClickListener {
      method onClick (line 215) | @Override
      method getMultiplier (line 235) | private int getMultiplier(View button) {
    class QualityOnClickListener (line 245) | private class QualityOnClickListener implements View.OnClickListener {
      method onClick (line 246) | @Override
      method getSampleRate (line 266) | private int getSampleRate(View button) {

FILE: SaidIt/src/main/java/eu/mrogalski/saidit/ThemedDialog.java
  class ThemedDialog (line 18) | public class ThemedDialog extends DialogFragment {
    method onCreateDialog (line 21) | @Override
    method fixFonts (line 31) | protected void fixFonts(View root) {
    method getShadowColorId (line 66) | int getShadowColorId() {

FILE: SaidIt/src/main/java/eu/mrogalski/saidit/UserInfo.java
  class UserInfo (line 12) | public class UserInfo {
    method getUserPhoneNumber (line 14) | public static String getUserPhoneNumber(Context c) {
    method getUserID (line 24) | public static String getUserID(Context c) {
    method getUserCountryCode (line 42) | public static String getUserCountryCode(Context c) {
    method getUserEmail (line 57) | public static String getUserEmail(Context c) {

FILE: SaidIt/src/main/java/eu/mrogalski/saidit/WorkingDialog.java
  class WorkingDialog (line 9) | public class WorkingDialog extends ThemedDialog {
    method onSaveInstanceState (line 12) | @Override
    method getDescriptionKey (line 18) | private String getDescriptionKey() {
    method onCreate (line 22) | @Override
    method onCreateView (line 30) | @Override
    method setDescriptionOnView (line 41) | private void setDescriptionOnView(View root) {
    method getDescriptionStringId (line 46) | public int getDescriptionStringId() {
    method setDescriptionStringId (line 50) | public void setDescriptionStringId(int descriptionStringId) {

FILE: SaidIt/src/main/java/simplesound/dsp/Complex.java
  class Complex (line 3) | public final class Complex {
    method Complex (line 8) | public Complex(double real, double imaginary) {

FILE: SaidIt/src/main/java/simplesound/dsp/DoubleVector.java
  class DoubleVector (line 8) | public class DoubleVector {
    method DoubleVector (line 12) | public DoubleVector(double[] data) {
    method size (line 18) | public int size() {
    method getData (line 22) | public double[] getData() {
    method toString (line 27) | @Override

FILE: SaidIt/src/main/java/simplesound/dsp/DoubleVectorFrameSource.java
  class DoubleVectorFrameSource (line 7) | public class DoubleVectorFrameSource {
    method DoubleVectorFrameSource (line 14) | private DoubleVectorFrameSource(PcmMonoInputStream pmis, int frameSize...
    method fromSampleAmount (line 21) | public static DoubleVectorFrameSource fromSampleAmount(
    method fromSampleAmountWithPadding (line 26) | public static DoubleVectorFrameSource fromSampleAmountWithPadding(
    method fromSizeInMiliseconds (line 31) | public static DoubleVectorFrameSource fromSizeInMiliseconds(
    method fromSizeInMilisecondsWithPadding (line 39) | public static DoubleVectorFrameSource fromSizeInMilisecondsWithPadding(
    method getIterableFrameReader (line 47) | public Iterable<DoubleVector> getIterableFrameReader() {
    method getNormalizedFrameIterator (line 55) | public Iterator<DoubleVector> getNormalizedFrameIterator() {
    method getPmis (line 59) | public PcmMonoInputStream getPmis() {
    method getFrameSize (line 63) | public int getFrameSize() {
    method getShiftAmount (line 67) | public int getShiftAmount() {
    method isPaddingApplied (line 71) | public boolean isPaddingApplied() {

FILE: SaidIt/src/main/java/simplesound/dsp/DoubleVectorProcessingPipeline.java
  class DoubleVectorProcessingPipeline (line 6) | public class DoubleVectorProcessingPipeline  {
    method DoubleVectorProcessingPipeline (line 11) | public DoubleVectorProcessingPipeline(Iterator<DoubleVector> vectorSou...

FILE: SaidIt/src/main/java/simplesound/dsp/DoubleVectorProcessor.java
  type DoubleVectorProcessor (line 3) | public interface DoubleVectorProcessor {
    method process (line 5) | DoubleVector process(DoubleVector input);
    method processInPlace (line 7) | void processInPlace(DoubleVector input);

FILE: SaidIt/src/main/java/simplesound/dsp/MutableComplex.java
  class MutableComplex (line 3) | public class MutableComplex {
    method MutableComplex (line 7) | public MutableComplex(double real, double imaginary) {
    method MutableComplex (line 12) | public MutableComplex(Complex complex) {
    method getImmutableComplex (line 17) | public Complex getImmutableComplex() {

FILE: SaidIt/src/main/java/simplesound/dsp/NormalizedFrameIterator.java
  class NormalizedFrameIterator (line 9) | public class NormalizedFrameIterator implements Iterator<DoubleVector> {
    method NormalizedFrameIterator (line 17) | public NormalizedFrameIterator(PcmMonoInputStream pmis, int frameSize,...
    method NormalizedFrameIterator (line 28) | public NormalizedFrameIterator(PcmMonoInputStream pmis, int frameSize,...
    method NormalizedFrameIterator (line 32) | public NormalizedFrameIterator(PcmMonoInputStream pmis, int frameSize) {
    method hasNext (line 39) | public boolean hasNext() {
    method next (line 62) | public DoubleVector next() {
    method remove (line 66) | public void remove() {
    method getFrameSize (line 70) | public int getFrameSize() {
    method getShiftAmount (line 74) | public int getShiftAmount() {

FILE: SaidIt/src/main/java/simplesound/dsp/WindowerFactory.java
  class WindowerFactory (line 8) | public class WindowerFactory {
    class RaisedCosineWindower (line 10) | private static class RaisedCosineWindower implements DoubleVectorProce...
      method RaisedCosineWindower (line 14) | RaisedCosineWindower(double alpha, int length) {
      method process (line 24) | public DoubleVector process(DoubleVector input) {
      method processInPlace (line 28) | public void processInPlace(DoubleVector input) {
    method newHammingWindower (line 33) | public static DoubleVectorProcessor newHammingWindower(int length) {
    method newHanningWindower (line 37) | public static DoubleVectorProcessor newHanningWindower(int length) {
    method newTriangularWindower (line 41) | public static DoubleVectorProcessor newTriangularWindower(int length) {

FILE: SaidIt/src/main/java/simplesound/pcm/MonoWavFileReader.java
  class MonoWavFileReader (line 7) | public class MonoWavFileReader {
    method MonoWavFileReader (line 12) | public MonoWavFileReader(String fileName) throws IOException {
    method MonoWavFileReader (line 16) | public MonoWavFileReader(File file) throws IOException {
    method getNewStream (line 23) | public PcmMonoInputStream getNewStream() throws IOException {
    method validateFrameBoundaries (line 33) | private void validateFrameBoundaries(int frameStart, int frameEnd) {
    method getAllSamples (line 44) | public int[] getAllSamples() throws IOException {
    method getSamplesAsInts (line 53) | public int[] getSamplesAsInts(int frameStart, int frameEnd) throws IOE...
    method getFormat (line 65) | public PcmAudioFormat getFormat() {
    method getSampleCount (line 69) | public int getSampleCount() {
    method getFile (line 73) | public File getFile() {

FILE: SaidIt/src/main/java/simplesound/pcm/PcmAudioFormat.java
  class PcmAudioFormat (line 7) | public class PcmAudioFormat {
    method PcmAudioFormat (line 34) | protected PcmAudioFormat(int sampleRate, int sampleSizeInBits, int cha...
    class Builder (line 61) | public static class Builder {
      method Builder (line 68) | public Builder(int sampleRate) {
      method channels (line 72) | public Builder channels(int channels) {
      method bigEndian (line 77) | public Builder bigEndian() {
      method unsigned (line 82) | public Builder unsigned() {
      method sampleSizeInBits (line 87) | public Builder sampleSizeInBits(int sampleSizeInBits) {
      method build (line 92) | public PcmAudioFormat build() {
    method mono16BitSignedLittleEndian (line 97) | PcmAudioFormat mono16BitSignedLittleEndian(int sampleRate) {
    method getSampleRate (line 101) | public int getSampleRate() {
    method getChannels (line 105) | public int getChannels() {
    method getSampleSizeInBits (line 109) | public int getSampleSizeInBits() {
    method getBytePerSample (line 119) | public int getBytePerSample() {
    method isBigEndian (line 123) | public boolean isBigEndian() {
    method isSigned (line 127) | public boolean isSigned() {
    method sampleCountForMiliseconds (line 131) | public int sampleCountForMiliseconds(double miliseconds) {
    method toString (line 135) | public String toString() {

FILE: SaidIt/src/main/java/simplesound/pcm/PcmAudioHelper.java
  class PcmAudioHelper (line 8) | public class PcmAudioHelper {
    method convertRawToWav (line 18) | public static void convertRawToWav(WavAudioFormat af, File rawSource, ...
    method convertWavToRaw (line 33) | public static void convertWavToRaw(File wavSource, File rawTarget) thr...
    method readAllFromWavNormalized (line 37) | public static double[] readAllFromWavNormalized(String fileName) throw...
    method modifyRiffSizeData (line 48) | static void modifyRiffSizeData(File wavFile, int size) throws IOExcept...
    method generateSilenceWavFile (line 57) | public static void generateSilenceWavFile(WavAudioFormat wavAudioForma...

FILE: SaidIt/src/main/java/simplesound/pcm/PcmMonoInputStream.java
  class PcmMonoInputStream (line 11) | public class PcmMonoInputStream extends InputStream implements Closeable {
    method PcmMonoInputStream (line 21) | public PcmMonoInputStream(PcmAudioFormat format, InputStream is) {
    method read (line 29) | public int read() throws IOException {
    method readSamplesAsIntArray (line 33) | public int[] readSamplesAsIntArray(int amount) throws IOException {
    method readAll (line 46) | public int[] readAll() throws IOException {
    method readSamplesAsByteArray (line 68) | public byte[] readSamplesAsByteArray(int amount) throws IOException {
    method validateReadCount (line 81) | private void validateReadCount(int readCount) {
    method readSamplesAsIntArray (line 87) | public int[] readSamplesAsIntArray(int frameStart, int frameEnd) throw...
    method skipSamples (line 99) | public int skipSamples(int skipAmount) throws IOException {
    method readSamplesNormalized (line 104) | public double[] readSamplesNormalized(int amount) throws IOException {
    method readSamplesNormalized (line 108) | public double[] readSamplesNormalized() throws IOException {
    method normalize (line 112) | private double[] normalize(int[] original) {
    method close (line 122) | public void close() throws IOException {
    method calculateSampleByteIndex (line 132) | public int calculateSampleByteIndex(double second) {
    method calculateSampleTime (line 152) | public double calculateSampleTime(int sampleIndex) {
    method getFormat (line 159) | public PcmAudioFormat getFormat() {

FILE: SaidIt/src/main/java/simplesound/pcm/PcmMonoOutputStream.java
  class PcmMonoOutputStream (line 8) | public class PcmMonoOutputStream extends OutputStream implements Closeab...
    method PcmMonoOutputStream (line 13) | public PcmMonoOutputStream(PcmAudioFormat format, DataOutputStream dos) {
    method PcmMonoOutputStream (line 18) | public PcmMonoOutputStream(PcmAudioFormat format, File file) throws IO...
    method write (line 23) | public void write(int b) throws IOException {
    method write (line 27) | @Override
    method write (line 32) | public void write(short[] shorts) throws IOException {
    method write (line 36) | public void write(int[] ints) throws IOException {
    method close (line 40) | public void close() {

FILE: SaidIt/src/main/java/simplesound/pcm/RiffHeaderData.java
  class RiffHeaderData (line 9) | class RiffHeaderData {
    method RiffHeaderData (line 18) | public RiffHeaderData(PcmAudioFormat format, int totalSamplesInByte) {
    method timeSeconds (line 23) | public double timeSeconds() {
    method RiffHeaderData (line 27) | public RiffHeaderData(DataInputStream dis) throws IOException {
    method RiffHeaderData (line 61) | public RiffHeaderData(File file) throws IOException {
    method asByteArray (line 65) | public byte[] asByteArray() {
    method getFormat (line 113) | public PcmAudioFormat getFormat() {
    method getTotalSamplesInByte (line 117) | public int getTotalSamplesInByte() {
    method getSampleCount (line 121) | public int getSampleCount() {
    method toString (line 125) | public String toString() {

FILE: SaidIt/src/main/java/simplesound/pcm/WavAudioFormat.java
  class WavAudioFormat (line 3) | public class WavAudioFormat extends PcmAudioFormat {
    method WavAudioFormat (line 10) | private WavAudioFormat(int sampleRate, int sampleSizeInBits, int chann...
    class Builder (line 17) | public static class Builder {
      method sampleRate (line 22) | public Builder sampleRate(int sampleRate) {
      method channels (line 27) | public Builder channels(int channels) {
      method sampleSizeInBits (line 32) | public Builder sampleSizeInBits(int sampleSizeInBits) {
      method build (line 37) | public WavAudioFormat build() {
    method mono16Bit (line 51) | public static WavAudioFormat mono16Bit(int sampleRate) {
    method wavFormat (line 63) | public static WavAudioFormat wavFormat(int sampleRate, int sampleSizeI...

FILE: SaidIt/src/main/java/simplesound/pcm/WavFileWriter.java
  class WavFileWriter (line 13) | public class WavFileWriter implements Closeable {
    method WavFileWriter (line 20) | public WavFileWriter(WavAudioFormat wavAudioFormat, File file) throws ...
    method write (line 32) | public WavFileWriter write(byte[] bytes) throws IOException {
    method write (line 39) | public WavFileWriter write(byte[] bytes, int offset, int count) throws...
    method checkLimit (line 46) | private void checkLimit(int total, int toAdd) {
    method write (line 53) | public WavFileWriter write(int[] samples) throws IOException {
    method write (line 61) | public WavFileWriter write(short[] samples) throws IOException {
    method writeNormalized (line 68) | WavFileWriter writeNormalized(double[] samples) throws IOException {
    method close (line 72) | public void close() throws IOException {
    method getWavFormat (line 77) | public PcmAudioFormat getWavFormat() {
    method getTotalSampleBytesWritten (line 82) | public int getTotalSampleBytesWritten() {
Condensed preview — 104 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (279K chars).
[
  {
    "path": ".gitignore",
    "chars": 314,
    "preview": "# Built application files\n*.apk\n*.ap_\n\n# Files for the Dalvik VM\n*.dex\n\n# Java class files\n*.class\n\n# Generated files\nbi"
  },
  {
    "path": "LICENSE.txt",
    "chars": 35122,
    "preview": "GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation,"
  },
  {
    "path": "README.md",
    "chars": 512,
    "preview": "Echo\n====\n\nTime travelling recorder for Android.\nIt is free/libre and gratis software.\n\nDownload\n---\n\n* [F-Droid](https:"
  },
  {
    "path": "SaidIt/SaidIt-SaidIt.iml",
    "chars": 5660,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<module external.linked.project.path=\"$MODULE_DIR$\" external.root.project.path=\""
  },
  {
    "path": "SaidIt/build.gradle",
    "chars": 1357,
    "preview": "buildscript {\n    repositories {\n        google()\n        mavenCentral()\n        maven { url \"https://repo.maven.apache."
  },
  {
    "path": "SaidIt/proguard.cfg",
    "chars": 770,
    "preview": "-renamesourcefileattribute SourceFile\n-keepattributes SourceFile,LineNumberTable\n\n-dontwarn java.awt.**\n-dontwarn javax."
  },
  {
    "path": "SaidIt/src/main/AndroidManifest.xml",
    "chars": 3144,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <!-- B"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/StringFormat.java",
    "chars": 437,
    "preview": "package eu.mrogalski;\n\nimport java.text.DecimalFormat;\n\npublic class StringFormat {\n    public static String shortFileSi"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/android/TimeFormat.java",
    "chars": 1170,
    "preview": "package eu.mrogalski.android;\n\nimport android.content.res.Resources;\n\nimport eu.mrogalski.saidit.R;\n\npublic class TimeFo"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/android/Views.java",
    "chars": 629,
    "preview": "package eu.mrogalski.android;\n\nimport android.view.View;\nimport android.view.ViewGroup;\n\npublic class Views {\n    public"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/saidit/AudioMemory.java",
    "chars": 4769,
    "preview": "package eu.mrogalski.saidit;\n\nimport android.os.SystemClock;\n\nimport java.io.IOException;\nimport java.util.LinkedList;\n\n"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/saidit/BroadcastReceiver.java",
    "chars": 506,
    "preview": "package eu.mrogalski.saidit;\n\nimport android.content.Context;\nimport android.content.Intent;\n\npublic class BroadcastRece"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/saidit/ErrorResponseDialog.java",
    "chars": 170,
    "preview": "package eu.mrogalski.saidit;\n\npublic class ErrorResponseDialog extends ThemedDialog {\n    @Override\n    int getShadowCol"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/saidit/IntentResult.java",
    "chars": 2194,
    "preview": "package eu.mrogalski.saidit;\npublic final class IntentResult {\n\n    private final String contents;\n    private final Str"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/saidit/RecordingDoneDialog.java",
    "chars": 5084,
    "preview": "package eu.mrogalski.saidit;\n\nimport android.app.Activity;\nimport android.content.ActivityNotFoundException;\nimport andr"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/saidit/SaidIt.java",
    "chars": 888,
    "preview": "package eu.mrogalski.saidit;\n\npublic class SaidIt {\n\n    static final String PACKAGE_NAME = \"eu.mrogalski.saidit\";\n    s"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/saidit/SaidItActivity.java",
    "chars": 6069,
    "preview": "package eu.mrogalski.saidit;\n\nimport android.Manifest;\nimport android.app.Activity;\nimport android.app.AlertDialog;\nimpo"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/saidit/SaidItFragment.java",
    "chars": 22807,
    "preview": "package eu.mrogalski.saidit;\n\nimport android.annotation.SuppressLint;\nimport android.app.Activity;\nimport android.app.Al"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/saidit/SaidItService.java",
    "chars": 22736,
    "preview": "package eu.mrogalski.saidit;\n\nimport android.annotation.SuppressLint;\nimport android.app.AlarmManager;\nimport android.ap"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/saidit/SettingsActivity.java",
    "chars": 10982,
    "preview": "package eu.mrogalski.saidit;\n\nimport android.app.Activity;\nimport android.content.ComponentName;\nimport android.content."
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/saidit/ThemedDialog.java",
    "chars": 2711,
    "preview": "package eu.mrogalski.saidit;\n\nimport android.app.Activity;\nimport android.app.Dialog;\nimport android.app.DialogFragment;"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/saidit/UserInfo.java",
    "chars": 2230,
    "preview": "package eu.mrogalski.saidit;\n\nimport android.accounts.Account;\nimport android.accounts.AccountManager;\nimport android.co"
  },
  {
    "path": "SaidIt/src/main/java/eu/mrogalski/saidit/WorkingDialog.java",
    "chars": 1688,
    "preview": "package eu.mrogalski.saidit;\n\nimport android.os.Bundle;\nimport android.view.LayoutInflater;\nimport android.view.View;\nim"
  },
  {
    "path": "SaidIt/src/main/java/simplesound/dsp/Complex.java",
    "chars": 260,
    "preview": "package simplesound.dsp;\r\n\r\npublic final class Complex {\r\n    \r\n    public final double real;\r\n    public final double i"
  },
  {
    "path": "SaidIt/src/main/java/simplesound/dsp/DoubleVector.java",
    "chars": 572,
    "preview": "package simplesound.dsp;\r\n\r\nimport java.util.Arrays;\r\n\r\n/**\r\n * a vector containing a double numbers.\r\n */\r\npublic class"
  },
  {
    "path": "SaidIt/src/main/java/simplesound/dsp/DoubleVectorFrameSource.java",
    "chars": 2623,
    "preview": "package simplesound.dsp;\r\n\r\nimport simplesound.pcm.PcmMonoInputStream;\r\n\r\nimport java.util.Iterator;\r\n\r\npublic class Dou"
  },
  {
    "path": "SaidIt/src/main/java/simplesound/dsp/DoubleVectorProcessingPipeline.java",
    "chars": 478,
    "preview": "package simplesound.dsp;\r\n\r\nimport java.util.Iterator;\r\nimport java.util.List;\r\n\r\npublic class DoubleVectorProcessingPip"
  },
  {
    "path": "SaidIt/src/main/java/simplesound/dsp/DoubleVectorProcessor.java",
    "chars": 174,
    "preview": "package simplesound.dsp;\r\n\r\npublic interface DoubleVectorProcessor {\r\n    \r\n    DoubleVector process(DoubleVector input)"
  },
  {
    "path": "SaidIt/src/main/java/simplesound/dsp/MutableComplex.java",
    "chars": 484,
    "preview": "package simplesound.dsp;\r\n\r\npublic class MutableComplex {\r\n    public double real;\r\n    public double imaginary;\r\n\r\n    "
  },
  {
    "path": "SaidIt/src/main/java/simplesound/dsp/NormalizedFrameIterator.java",
    "chars": 2499,
    "preview": "package simplesound.dsp;\r\n\r\nimport simplesound.dsp.DoubleVector;\r\nimport simplesound.pcm.PcmMonoInputStream;\r\n\r\nimport j"
  },
  {
    "path": "SaidIt/src/main/java/simplesound/dsp/WindowerFactory.java",
    "chars": 1461,
    "preview": "package simplesound.dsp;\r\n\r\nimport org.jcaki.Doubles;\r\n\r\nimport static java.lang.Math.PI;\r\nimport static java.lang.Math."
  },
  {
    "path": "SaidIt/src/main/java/simplesound/pcm/MonoWavFileReader.java",
    "chars": 2636,
    "preview": "package simplesound.pcm;\r\n\r\nimport java.io.File;\r\nimport java.io.FileInputStream;\r\nimport java.io.IOException;\r\n\r\npublic"
  },
  {
    "path": "SaidIt/src/main/java/simplesound/pcm/PcmAudioFormat.java",
    "chars": 4199,
    "preview": "package simplesound.pcm;\r\n\r\n/**\r\n * Represents paramters for raw pcm audio sample data.\r\n * Channels represents mono or "
  },
  {
    "path": "SaidIt/src/main/java/simplesound/pcm/PcmAudioHelper.java",
    "chars": 2476,
    "preview": "package simplesound.pcm;\r\n\r\nimport static org.jcaki.Bytes.toByteArray;\r\nimport org.jcaki.IOs;\r\n\r\nimport java.io.*;\r\n\r\npu"
  },
  {
    "path": "SaidIt/src/main/java/simplesound/pcm/PcmMonoInputStream.java",
    "chars": 5809,
    "preview": "package simplesound.pcm;\r\n\r\nimport org.jcaki.Bytes;\r\nimport org.jcaki.IOs;\r\n\r\nimport java.io.Closeable;\r\nimport java.io."
  },
  {
    "path": "SaidIt/src/main/java/simplesound/pcm/PcmMonoOutputStream.java",
    "chars": 1216,
    "preview": "package simplesound.pcm;\r\n\r\nimport org.jcaki.Bytes;\r\nimport org.jcaki.IOs;\r\n\r\nimport java.io.*;\r\n\r\npublic class PcmMonoO"
  },
  {
    "path": "SaidIt/src/main/java/simplesound/pcm/RiffHeaderData.java",
    "chars": 4854,
    "preview": "package simplesound.pcm;\r\n\r\nimport static org.jcaki.Bytes.toByteArray;\r\nimport static org.jcaki.Bytes.toInt;\r\nimport org"
  },
  {
    "path": "SaidIt/src/main/java/simplesound/pcm/WavAudioFormat.java",
    "chars": 2387,
    "preview": "package simplesound.pcm;\r\n\r\npublic class WavAudioFormat extends PcmAudioFormat {\r\n\r\n    /**\r\n     * if data is represent"
  },
  {
    "path": "SaidIt/src/main/java/simplesound/pcm/WavFileWriter.java",
    "chars": 3035,
    "preview": "package simplesound.pcm;\r\n\r\nimport android.util.Log;\r\n\r\nimport java.io.Closeable;\r\nimport java.io.File;\r\nimport java.io."
  },
  {
    "path": "SaidIt/src/main/res/anim/pulse.xml",
    "chars": 433,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<scale xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:du"
  },
  {
    "path": "SaidIt/src/main/res/color/button_text.xml",
    "chars": 406,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/bg_et.xml",
    "chars": 589,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item a"
  },
  {
    "path": "SaidIt/src/main/res/drawable/circle_button.xml",
    "chars": 373,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/circle_button_normal.xml",
    "chars": 515,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/circle_button_pressed.xml",
    "chars": 515,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/cling_button_bg.xml",
    "chars": 899,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Copyright (C) 2011 The Android Open Source Project\n\n     Licensed under the "
  },
  {
    "path": "SaidIt/src/main/res/drawable/dashed_line.xml",
    "chars": 287,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:sh"
  },
  {
    "path": "SaidIt/src/main/res/drawable/dialog_content.xml",
    "chars": 970,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <it"
  },
  {
    "path": "SaidIt/src/main/res/drawable/dialog_title.xml",
    "chars": 968,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <ite"
  },
  {
    "path": "SaidIt/src/main/res/drawable/error_dialog_title.xml",
    "chars": 964,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <ite"
  },
  {
    "path": "SaidIt/src/main/res/drawable/gold_button.xml",
    "chars": 366,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/gold_button_normal.xml",
    "chars": 1050,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/gold_button_pressed.xml",
    "chars": 1051,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/gray_button.xml",
    "chars": 366,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/gray_button_focused.xml",
    "chars": 514,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <padding a"
  },
  {
    "path": "SaidIt/src/main/res/drawable/gray_button_normal.xml",
    "chars": 1049,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/gray_button_pressed.xml",
    "chars": 1049,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/green_button.xml",
    "chars": 369,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/green_button_normal.xml",
    "chars": 1052,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/green_button_pressed.xml",
    "chars": 1054,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/red_circle_button.xml",
    "chars": 385,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/red_circle_button_normal.xml",
    "chars": 514,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/red_circle_button_pressed.xml",
    "chars": 515,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/top_gray_button.xml",
    "chars": 379,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/top_gray_button_normal.xml",
    "chars": 822,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <ite"
  },
  {
    "path": "SaidIt/src/main/res/drawable/top_gray_button_pressed.xml",
    "chars": 822,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <ite"
  },
  {
    "path": "SaidIt/src/main/res/drawable/top_green_button.xml",
    "chars": 382,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/top_green_button_normal.xml",
    "chars": 825,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <ite"
  },
  {
    "path": "SaidIt/src/main/res/drawable/top_green_button_pressed.xml",
    "chars": 827,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <ite"
  },
  {
    "path": "SaidIt/src/main/res/drawable/white_button.xml",
    "chars": 369,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n    <item"
  },
  {
    "path": "SaidIt/src/main/res/drawable/white_button_focused.xml",
    "chars": 592,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<shape  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <padding"
  },
  {
    "path": "SaidIt/src/main/res/drawable/white_button_normal.xml",
    "chars": 1030,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <ite"
  },
  {
    "path": "SaidIt/src/main/res/drawable/white_button_pressed.xml",
    "chars": 1050,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <ite"
  },
  {
    "path": "SaidIt/src/main/res/drawable/window_background.xml",
    "chars": 354,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <corners a"
  },
  {
    "path": "SaidIt/src/main/res/layout/activity_background_recorder.xml",
    "chars": 328,
    "preview": "<FrameLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tool"
  },
  {
    "path": "SaidIt/src/main/res/layout/activity_settings.xml",
    "chars": 7269,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<ScrollView xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    andro"
  },
  {
    "path": "SaidIt/src/main/res/layout/dialog_save_recording.xml",
    "chars": 1213,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    andr"
  },
  {
    "path": "SaidIt/src/main/res/layout/fragment_background_recorder.xml",
    "chars": 12055,
    "preview": "<ScrollView  xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tool"
  },
  {
    "path": "SaidIt/src/main/res/layout/progress_dialog.xml",
    "chars": 1175,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    and"
  },
  {
    "path": "SaidIt/src/main/res/layout/recording_done_dialog.xml",
    "chars": 5875,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    and"
  },
  {
    "path": "SaidIt/src/main/res/values/colors.xml",
    "chars": 1009,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"gray_0\">#ff000000</color>\n    <color name=\"gray_6\">#"
  },
  {
    "path": "SaidIt/src/main/res/values/dimens.xml",
    "chars": 722,
    "preview": "<resources>\n    <!-- Default screen margins, per the Android Design guidelines. -->\n    <dimen name=\"activity_horizontal"
  },
  {
    "path": "SaidIt/src/main/res/values/paypal.xml",
    "chars": 5856,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <string-array name=\"country_codes\" translatable=\"false\">\n       "
  },
  {
    "path": "SaidIt/src/main/res/values/strings.xml",
    "chars": 6943,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <string name=\"app_name\" translatable=\"false\">Echo</string>\n\n    "
  },
  {
    "path": "SaidIt/src/main/res/values/styles.xml",
    "chars": 5074,
    "preview": "<resources>\n\n    <!-- Base application theme. -->\n    <style name=\"SaidIt\" parent=\"Theme.AppCompat.Light\">\n        <item"
  },
  {
    "path": "SaidIt/src/main/res/values-land-v19/bools.xml",
    "chars": 111,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <bool name=\"translucentNavBar\">false</bool>\n</resources>"
  },
  {
    "path": "SaidIt/src/main/res/values-pl/strings.xml",
    "chars": 7026,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <!-- Notifications -->\n\n    <string name=\"recording\">Nagrywanie…"
  },
  {
    "path": "SaidIt/src/main/res/values-sw600dp-land-v19/bools.xml",
    "chars": 110,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <bool name=\"translucentNavBar\">true</bool>\n</resources>"
  },
  {
    "path": "SaidIt/src/main/res/values-v19/styles.xml",
    "chars": 319,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <style name=\"Theme\" parent=\"SaidIt\">\n        <item name=\"android"
  },
  {
    "path": "SaidIt/src/main/res/xml/path_provider.xml",
    "chars": 184,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<paths xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <external-"
  },
  {
    "path": "SaidIt.iml",
    "chars": 600,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module external.linked.project.path=\"$MODULE_DIR$\" external.root.project.path=\"$"
  },
  {
    "path": "build.gradle",
    "chars": 99,
    "preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules."
  },
  {
    "path": "fastlane/metadata/android/en-US/changelogs/15.txt",
    "chars": 330,
    "preview": "<ul>\r\n<li>Bumped the minimum Android SDK level to 30 (Android 11)</li>\r\n<li>Fixed a crash when disabling & re-enabling l"
  },
  {
    "path": "fastlane/metadata/android/en-US/full_description.txt",
    "chars": 656,
    "preview": "Continuously record audio for retrieval at a later time.\r\n\r\nUnless saved, recordings are deleted on a rolling basis.\r\n\r\n"
  },
  {
    "path": "fastlane/metadata/android/en-US/short_description.txt",
    "chars": 43,
    "preview": "Time travelling audio recorder for Android."
  },
  {
    "path": "fastlane/metadata/android/en-US/title.txt",
    "chars": 4,
    "preview": "Echo"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "chars": 203,
    "preview": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributi"
  },
  {
    "path": "gradle.properties",
    "chars": 969,
    "preview": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Settings specified in this file will override any "
  },
  {
    "path": "gradlew",
    "chars": 8165,
    "preview": "#!/bin/sh\n\n#\n# Copyright © 2015-2021 the original authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice"
  },
  {
    "path": "gradlew.bat",
    "chars": 2747,
    "preview": "@rem\n@rem Copyright 2015 the original author or authors.\n@rem\n@rem Licensed under the Apache License, Version 2.0 (the \""
  },
  {
    "path": "settings.gradle",
    "chars": 18,
    "preview": "include ':SaidIt'\n"
  }
]

// ... and 3 more files (download for full content)

About this extraction

This page contains the full source code of the mafik/echo GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 104 files (253.8 KB), approximately 60.8k tokens, and a symbol index with 277 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!