82 Commits

Author SHA1 Message Date
Michachatz
c057aaaf2f Remove license badge from README
Removed license badge from README.
2026-03-30 00:21:43 +02:00
067177bd79 docs(readme): enhance credit attribution section 2026-03-30 00:15:52 +02:00
866dba6d3b docs(readme): simplify credit attribution 2026-03-30 00:14:27 +02:00
51c42dc6f1 style(license): fix formatting in GPLv3 license file 2026-03-30 00:13:04 +02:00
827f709450 chore(license): change project license from MIT to GPLv3 2026-03-30 00:11:37 +02:00
04866cfa35 docs(readme): add project badges to header 2026-03-29 23:53:49 +02:00
3171c21db9 style(ui): make television dialogs responsive 2026-03-28 23:11:42 +01:00
f43775d3f2 style(ui): adjust television dialog heights to 800dp 2026-03-28 23:05:53 +01:00
868c39a6e1 style(ui): increase find station dialog height 2026-03-28 22:59:25 +01:00
985e7d4e1b style(ui): increase find station dialog height 2026-03-28 22:53:00 +01:00
363d197ba5 style(ui): simplify theme selection dialog radio buttons 2026-03-28 22:47:13 +01:00
d0e412ca83 feat(ui): save theme selection to preferences 2026-03-28 22:37:55 +01:00
93008f7247 feat(ui): handle theme selection dialog results and update summary 2026-03-28 22:29:02 +01:00
7e95a0bfe1 refactor(ui): unify theme selection by removing TV-specific handling 2026-03-28 22:21:38 +01:00
8d509b6b23 refactor(ui): update theme selection dialog behavior and TV layout 2026-03-28 22:18:12 +01:00
cb4aff47a7 feat(ui): add theme selection dialog layout 2026-03-28 22:01:33 +01:00
293a823442 fix(ui): ensure theme selection dialog dismisses on button click 2026-03-28 21:58:24 +01:00
a5b11ba99a feat(ui): implement theme selection dialog with TV support 2026-03-28 21:55:38 +01:00
2ccb4225d4 refactor(ui): remove TV-specific preference layouts 2026-03-28 21:39:05 +01:00
453e6e5b71 refactor(ui): adjust TV preference layout structure 2026-03-28 21:30:02 +01:00
4108cf2c7c feat(ui): add TV-specific preference layouts for focus visibility 2026-03-28 21:25:50 +01:00
f038e01981 feat(ui): add keyboard shortcut for favouriting stations 2026-03-28 21:03:54 +01:00
f66b5af810 docs(readme): add DEL key alternative for station removal 2026-03-28 20:56:08 +01:00
a6a9daf3a3 docs(readme): add Android TV controls documentation 2026-03-28 20:54:56 +01:00
d79d5e15fa refactor(ui): consolidate keyboard shortcut handling in collection adapter 2026-03-28 20:48:54 +01:00
c3f37092de feat(ui): add keyboard shortcuts for station removal 2026-03-28 20:34:56 +01:00
48d14fecdb style(ui): adjust highlight colors for better contrast
Reduce opacity of focused highlight colors and adjust control highlight colors across all theme variants to improve visual consistency and accessibility. Changes include:
- Lowering alpha values for focused highlights in night themes
- Switching from white-based to black-based highlights in light themes
- Standardizing highlight opacity across API level-specific styles
2026-03-28 20:10:41 +01:00
c8293b1b6d - standardize highlight colors across themes 2026-03-28 19:38:28 +01:00
51c8d5b303 Add rotation animation to playback button for mobile devices 2026-03-28 19:02:38 +01:00
180d5c2218 Set enabled state for stream URI editing preference 2026-03-28 18:55:19 +01:00
391999c406 Update README to mention Android TV support 2026-03-28 18:40:13 +01:00
fb779bd661 Merge remote-tracking branch 'origin/main' 2026-03-28 18:37:07 +01:00
46ebf21c06 Add support for Android TV and update dependencies
*   Implement initial Android TV support, including `LEANBACK_LAUNCHER` intent filter, hardware feature declarations, and television-specific layouts for the player, search results, and dialogs.
*   Add a splash/loading screen for the TV interface and a dedicated `SplashTheme`.
*   Improve DPAD navigation by adding `OnKeyListener` for station cards and allowing focus on internal elements.
*   Update `LayoutHolder` and `PlayerFragment` to handle TV layouts and add previous/next station navigation buttons.
*   Adjust `PreferencesHelper` to disable station editing by default on TV devices.
*   Update `androidx.media3` to v1.10.0, `work-runtime-ktx` to v2.11.2, and add `androidx.leanback` dependency.
*   Bump `versionCode` to 144 and `versionName` to 14.4.
*   Refactor `PlayerService` to simplify sleep timer cancellation logic.
*   Remove stale copyright headers and license comments from several Kotlin files.
2026-03-28 18:36:50 +01:00
Michachatz
2d2d95875f Merge pull request #60 from Michatec/renovate/media3
Update media3 to v1.10.0
2026-03-27 14:12:16 +01:00
renovate[bot]
46e7b905c8 Update media3 to v1.10.0 2026-03-27 12:45:39 +00:00
Michachatz
d033ae6344 Merge pull request #59 from Michatec/renovate/workruntimektx
Update dependency androidx.work:work-runtime-ktx to v2.11.2
2026-03-27 13:45:08 +01:00
renovate[bot]
fc275d349b Update dependency androidx.work:work-runtime-ktx to v2.11.2 2026-03-25 20:25:14 +00:00
Michachatz
4e6f7c7c67 Update gradle-publish.yml to target main branch
Restrict workflow triggers to main branch for push and pull requests.
2026-03-25 07:52:12 +01:00
Michachatz
272d6fd908 Add installation instructions for Radio 2026-03-25 07:36:28 +01:00
Michachatz
4a30828c99 Update README with warning about Google requirements
Added a warning about Google's upcoming requirement for personal identity details for apps on certified Android devices, effective 2026/2027.
2026-03-25 07:35:21 +01:00
Michachatz
963f6e7618 Merge pull request #58 from Michatec/renovate/android-actions-setup-android-4.x
Update android-actions/setup-android action to v4
2026-03-25 07:30:33 +01:00
renovate[bot]
29ead7e1d8 Update android-actions/setup-android action to v4 2026-03-25 01:58:58 +00:00
9140b54a23 Update AndroidManifest to resolve App Link verification issues
- Update `tools:targetApi` from "tiramisu" to "33"
- Set `android:autoVerify="false"` for the MIME-type based intent-filter
- Add `tools:ignore="AppLinkUrlError"` to the wildcard host in the file-extension intent-filter
- Add comments clarifying App Link behavior for playlist links
2026-03-24 17:54:48 +01:00
57c4075f19 - Updated .gitignore 2026-03-24 12:40:25 +01:00
5334b88f1d Refactor code and clean up unused resources
- Replace `suspendCoroutine` with `suspendCancellableCoroutine` in helper classes for better cancellation support.
- Replace `bundleOf` with manual `Bundle` initialization in `MediaControllerExt` and `SettingsFragment`.
- Remove unused constants in `Keys.kt` and redundant `onTerminate` override in `Radio.kt`.
- Clean up syntax and remove semicolons in `MainActivity.kt`.
2026-03-24 12:36:04 +01:00
5978aab0aa - New Version Released.
- Updated the Gradle Structure.
- libs.versions.toml added.
2026-03-24 12:28:15 +01:00
Michachatz
c3c2ccfdd9 Add FreeDroidWarn import to MainActivity 2026-03-24 08:04:30 +01:00
Michachatz
38fb4d162b Change Maven repository URL from jetpack.io to jitpack.io 2026-03-24 08:00:10 +01:00
Michachatz
3c3c18104b Fix case sensitivity in FreeDroidWarn dependency 2026-03-24 07:58:25 +01:00
Michachatz
4e1ee7d6a7 Fix version tag format for FreeDroidWarn dependency 2026-03-24 07:56:42 +01:00
Michachatz
64ba020eae Update FreeDroidWarn dependency version to 1.10 2026-03-24 07:52:22 +01:00
Michachatz
b35d7bd67c Add JitPack and Jetpack repositories to settings 2026-03-24 07:48:05 +01:00
Michachatz
d3dd098639 Remove unused repositories block in build.gradle
Removed unused repositories block from allprojects.
2026-03-24 07:45:59 +01:00
Michachatz
a8f6c7f946 Re-add allprojects block with repositories configuration 2026-03-24 07:43:30 +01:00
Michachatz
765ccc9250 Add JitPack repository configuration
Add JitPack repository to all projects.
2026-03-24 07:41:22 +01:00
Michachatz
c9d6cf27ec Show warning on upgrade in MainActivity 2026-03-24 07:37:04 +01:00
Michachatz
7b7579d416 Add FreeDroidWarn library dependency 2026-03-24 07:34:09 +01:00
Michachatz
d452d7f7ee Merge pull request #57 from Michatec/renovate/gradle-9.x
Update Gradle to v9.4.1
2026-03-19 17:34:25 +01:00
renovate[bot]
2bb3d22cab Update Gradle to v9.4.1 2026-03-19 09:40:18 +00:00
Michachatz
b4ed3e107c Merge pull request #53 from Michatec/renovate/androidx.media3-media3-datasource-okhttp-1.x
Update dependency androidx.media3:media3-datasource-okhttp to v1.9.3
2026-03-17 08:09:16 +01:00
Michachatz
ef843b601a Merge pull request #54 from Michatec/renovate/androidx.media3-media3-exoplayer-1.x
Update dependency androidx.media3:media3-exoplayer to v1.9.3
2026-03-17 08:09:05 +01:00
renovate[bot]
219d54f4e4 Update dependency androidx.media3:media3-exoplayer to v1.9.3 2026-03-17 07:08:20 +00:00
Michachatz
c8a39bf2d7 Merge pull request #55 from Michatec/renovate/androidx.media3-media3-exoplayer-hls-1.x
Update dependency androidx.media3:media3-exoplayer-hls to v1.9.3
2026-03-17 08:07:59 +01:00
renovate[bot]
81ff920c2c Update dependency androidx.media3:media3-exoplayer-hls to v1.9.3 2026-03-17 07:07:36 +00:00
renovate[bot]
f4a5209e14 Update dependency androidx.media3:media3-datasource-okhttp to v1.9.3 2026-03-17 07:07:33 +00:00
Michachatz
c7b7bdcbed Merge pull request #56 from Michatec/renovate/androidx.media3-media3-session-1.x
Update dependency androidx.media3:media3-session to v1.9.3
2026-03-17 08:07:10 +01:00
Michachatz
eae9176f21 Merge pull request #52 from Michatec/renovate/kotlin-monorepo
Update plugin org.jetbrains.kotlin.android to v2.3.20
2026-03-17 08:06:54 +01:00
renovate[bot]
b3a833fa44 Update dependency androidx.media3:media3-session to v1.9.3 2026-03-16 20:52:12 +00:00
renovate[bot]
35a8ed46ff Update plugin org.jetbrains.kotlin.android to v2.3.20 2026-03-16 09:20:44 +00:00
Michachatz
fd18943878 Change copyright year to 2026
Update copyright year in the LICENSE file.
2026-03-13 06:30:07 +01:00
Michachatz
094fb508e2 Merge pull request #51 from Michatec/renovate/androidx.core-core-ktx-1.x
Update dependency androidx.core:core-ktx to v1.18.0
2026-03-13 06:28:00 +01:00
renovate[bot]
874cf1eb39 Update dependency androidx.core:core-ktx to v1.18.0 2026-03-13 05:26:26 +00:00
Michachatz
211cb387ad Merge pull request #50 from Michatec/renovate/androidx.activity-activity-ktx-1.x
Update dependency androidx.activity:activity-ktx to v1.13.0
2026-03-13 06:25:57 +01:00
renovate[bot]
5481a06343 Update dependency androidx.activity:activity-ktx to v1.13.0 2026-03-11 18:10:24 +00:00
fbafcb9773 - New Version Released
- Updated MainActivity.kt
2026-03-08 16:03:28 +01:00
27c405fd58 - Added Daemon Update
- Updated Icons in PlayerService.kt
2026-03-08 15:45:03 +01:00
Michachatz
c2cba26c66 Merge pull request #49 from Michatec/renovate/gradle-9.x
Update Gradle to v9.4.0
2026-03-04 21:15:21 +01:00
renovate[bot]
9224e45b18 Update Gradle to v9.4.0 2026-03-04 13:05:49 +00:00
Michachatz
90164d7e6a Merge pull request #48 from Michatec/renovate/com.android.library-9.x
Update plugin com.android.library to v9.1.0
2026-03-04 07:36:28 +01:00
renovate[bot]
45e208e7a9 Update plugin com.android.library to v9.1.0 2026-03-04 06:35:34 +00:00
Michachatz
1d040e3edc Merge pull request #47 from Michatec/renovate/com.android.application-9.x
Update plugin com.android.application to v9.1.0
2026-03-04 07:35:02 +01:00
renovate[bot]
efe17bc82b Update plugin com.android.application to v9.1.0 2026-03-03 16:37:22 +00:00
81 changed files with 2125 additions and 756 deletions

View File

@@ -3,8 +3,10 @@ name: Build and publish APK
on:
workflow_dispatch:
push:
tags:
- 'b*'
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
ANDROID_HOME: /usr/local/lib/android/sdk/
@@ -38,7 +40,7 @@ jobs:
## It is not necessary to check for cache hit as it
## will not download Android SDK again
#if: steps.cache-android-sdk.outputs.cache-hit != 'true'
uses: android-actions/setup-android@v3
uses: android-actions/setup-android@v4
with:
packages: ''
@@ -70,4 +72,4 @@ jobs:
uses: actions/upload-artifact@v7
with:
name: app-release
path: app-release.apk
path: app-release.apk

4
.gitignore vendored
View File

@@ -4,4 +4,6 @@
/local.properties
/.idea
/build
/captures
/captures
/gradle/gradle-daemon-jvm.properties
/.kotlin

View File

@@ -1,23 +1,678 @@
The MIT License (MIT)
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
=====================
Copyright (c) 2025 - Michatec
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
--------------------------------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Preamble
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@@ -1,15 +1,35 @@
<p align="center">
<a href="https://github.com/michatec/Radio/releases"><img src="https://img.shields.io/github/v/release/michatec/Radio?style=flat-square&include_prereleases&label=version" /></a>
<a href="https://github.com/michatec/Radio/releases"><img src="https://img.shields.io/github/downloads/michatec/Radio/total.svg?style=flat-square" /></a>
<a href="https://github.com/michatec/Radio/issues"><img src="https://img.shields.io/github/issues-raw/michatec/Radio.svg?style=flat-square&label=issues" /></a>
<a href="https://github.com/michatec/Radio/graphs/contributors"><img src="https://img.shields.io/github/contributors/michatec/Radio?style=flat-square" /></a>
</p>
<div align="center">
### About Radio
**Radio is an application with a minimalist approach to listening to radio over the Internet.** <br>
**Radio only offers a very basic search option, and it imports audio streaming links when you tap them in a web browser.** <br>
**Radio now also supports Android TV (Beta).** <br>
**Pull request are welcome at any time.**<br>
**Radio is free software. It is released under the [MIT open source license](https://opensource.org/licenses/MIT).**
**Radio is free software. It is released under the [GPLv3 open source license](https://opensource.org/licenses/GPL-3.0).**
</div>
----------------------------------------
<details>
<summary>❗Warning</summary>
<br>
<p>
Google has announced that, starting in 2026/2027, all apps on certified Android devices will require the developer to submit personal identity details directly to Google.
Since the developers of this app do not agree to this requirement, this app will no longer work on certified Android devices after that time.
</p>
<a href="https://github.com/woheller69/FreeDroidWarn"> More Information</a>
</details>
----------------------------------------
<details>
<summary>⚙️ Install Radio</summary>
<br>
@@ -57,10 +77,31 @@ You can help out the radio-browser.info community by [adding the missing station
----------------------------------------
<details>
<summary>📺 Android TV Controls</summary>
<br>
When **Edit Stations** is enabled:
- Press **← (Left)** on the remote to open the detailed station editing area
- Press **2** or **Back** to close the editing area
**General TV** Controls:
- Press **0** or **DEL** to remove the selected radio station
- Press **1** or **SPACE** to make the selected radio station favourite
</details>
----------------------------------------
<details>
<summary>📜️ Credit</summary>
Base app Michatec & [TRANSISTOR](https://codeberg.org/y20k/transistor).
- [Radio Browser](http://www.radio-browser.info/) for providing the radio station database
- [AndroidX Leanback](https://developer.android.com/jetpack/androidx/releases/leanback) for providing the Android TV UI components
- Michatec for developing the app and maintaining the project
- All the contributors who have contributed to the project by submitting pull requests, reporting issues, or providing feedback
</details>
<div align="right">

View File

@@ -1,5 +1,5 @@
plugins {
id 'com.android.application'
alias libs.plugins.android.application
id 'kotlin-parcelize'
}
@@ -19,8 +19,8 @@ android {
applicationId 'com.michatec.radio'
minSdk 28
targetSdk 36
versionCode 141
versionName '14.1'
versionCode 144
versionName '14.4'
resourceConfigurations += ['en', 'de', 'el', 'nl', 'pl', 'ru','uk', 'ja', 'da', 'fr']
}
@@ -55,24 +55,27 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Google Stuff //
implementation 'com.google.android.material:material:1.13.0'
implementation 'com.google.code.gson:gson:2.13.2'
implementation libs.material
implementation libs.gson
// AndroidX Stuff //
implementation 'androidx.core:core-ktx:1.17.0'
implementation 'androidx.activity:activity-ktx:1.12.4'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.media:media:1.7.1'
implementation 'androidx.media3:media3-exoplayer:1.9.2'
implementation 'androidx.media3:media3-exoplayer-hls:1.9.2'
implementation 'androidx.media3:media3-session:1.9.2'
implementation 'androidx.media3:media3-datasource-okhttp:1.9.2'
implementation 'androidx.navigation:navigation-fragment-ktx:2.9.7'
implementation 'androidx.navigation:navigation-ui-ktx:2.9.7'
implementation 'androidx.work:work-runtime-ktx:2.11.1'
implementation libs.core.ktx
implementation libs.activity.ktx
implementation libs.palette.ktx
implementation libs.preference.ktx
implementation libs.media
implementation libs.media3.exoplayer
implementation libs.media3.exoplayer.hls
implementation libs.media3.session
implementation libs.media3.datasource.okhttp
implementation libs.navigation.fragment.ktx
implementation libs.navigation.ui.ktx
implementation libs.work.runtime.ktx
implementation libs.leanback
implementation libs.freedroidwarn
// Volley HTTP request //
implementation 'com.android.volley:volley:1.2.1'
implementation 'androidx.compose.material3:material3:1.4.0'
implementation libs.volley
implementation libs.material3
}

View File

@@ -1,6 +1,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-feature
android:name="android.software.leanback"
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
@@ -10,6 +17,7 @@
<application
android:name=".Radio"
android:allowBackup="true"
android:banner="@mipmap/ic_launcher"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
@@ -21,7 +29,7 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:targetApi="tiramisu">
tools:targetApi="33">
<!-- ANDROID AUTO SUPPORT -->
<!-- https://developer.android.com/training/auto/audio/ -->
@@ -32,17 +40,19 @@
android:name="com.google.android.gms.car.notification.SmallIcon"
android:resource="@mipmap/ic_launcher" />
<!-- Main activity for radio station playback on phone -->
<!-- Main activity for radio station playback on phone and TV -->
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize"
android:windowSoftInputMode="adjustPan"
android:theme="@style/SplashTheme"
android:exported="true">
<!-- react to main intents -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
<!-- react to be recognized as a music player -->
@@ -58,6 +68,7 @@
</intent-filter>
<!-- react to playlist-links based on file extension -->
<!-- This is intended as an App Link for specific extensions -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
@@ -66,14 +77,16 @@
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="*" />
<data android:host="*"
tools:ignore="AppLinkUrlError" />
<data android:pathPattern=".*\\.m3u" />
<data android:pathPattern=".*\\.m3u8" />
<data android:pathPattern=".*\\.pls" />
</intent-filter>
<!-- react to playlist-links based on mimetype -->
<intent-filter android:autoVerify="true">
<!-- Note: MIME types prevent strict App Link verification, but are kept as requested -->
<intent-filter android:autoVerify="false">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />

View File

@@ -1,17 +1,3 @@
/*
* Keys.kt
* Implements the keys used throughout the app
* This object hosts all keys used to control Radio state
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio
import java.util.*
@@ -78,7 +64,6 @@ object Keys {
// default const values
const val DEFAULT_SIZE_OF_METADATA_HISTORY: Int = 25
const val DEFAULT_MAX_LENGTH_OF_METADATA_ENTRY: Int = 127
const val DEFAULT_DOWNLOAD_OVER_MOBILE: Boolean = false
const val ACTIVE_DOWNLOADS_EMPTY: String = "zero"
const val DEFAULT_MAX_RECONNECTION_COUNT: Int = 30
const val LARGE_BUFFER_SIZE_MULTIPLIER: Int = 8
@@ -99,6 +84,7 @@ object Keys {
const val DIALOG_REMOVE_STATION: Int = 2
const val DIALOG_UPDATE_STATION_IMAGES: Int = 4
const val DIALOG_RESTORE_COLLECTION: Int = 5
const val DIALOG_THEME_SELECTION: Int = 6
// dialog results
const val DIALOG_EMPTY_PAYLOAD_STRING: String = ""
@@ -149,9 +135,6 @@ object Keys {
const val RADIO_BROWSER_API_BASE: String = "all.api.radio-browser.info"
const val RADIO_BROWSER_API_DEFAULT: String = "de1.api.radio-browser.info"
// locations
const val LOCATION_DEFAULT_STATION_IMAGE: String = "android.resource://com.michatec.radio/drawable/ic_default_station_image_24dp"
// sizes (in dp)
const val SIZE_STATION_IMAGE_CARD: Int = 72
const val SIZE_STATION_IMAGE_MAXIMUM: Int = 640

View File

@@ -1,21 +1,11 @@
/*
* MainActivity.kt
* Implements the MainActivity class
* MainActivity is the default activity that can host the player fragment and the settings fragment
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio
import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.navigation.fragment.NavHostFragment
@@ -25,7 +15,7 @@ import androidx.navigation.ui.navigateUp
import com.michatec.radio.helpers.AppThemeHelper
import com.michatec.radio.helpers.FileHelper
import com.michatec.radio.helpers.PreferencesHelper
import org.woheller69.freeDroidWarn.FreeDroidWarn
/*
* MainActivity class
@@ -38,7 +28,11 @@ class MainActivity : AppCompatActivity() {
/* Overrides onCreate from AppCompatActivity */
override fun onCreate(savedInstanceState: Bundle?) {
setTheme(R.style.AppTheme)
super.onCreate(savedInstanceState)
// Free Android
FreeDroidWarn.showWarningOnUpgrade(this, BuildConfig.VERSION_CODE)
// set up views
setContentView(R.layout.activity_main)
@@ -55,11 +49,30 @@ class MainActivity : AppCompatActivity() {
NavigationUI.setupWithNavController(toolbar, navController, appBarConfiguration)
supportActionBar?.hide()
// TV-specific loading logic
if (packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {
Handler(Looper.getMainLooper()).postDelayed({
findViewById<View>(R.id.loading_layout)?.visibility = View.GONE
}, 1500)
} else {
findViewById<View>(R.id.loading_layout)?.visibility = View.GONE
}
// register listener for changes in shared preferences
PreferencesHelper.registerPreferenceChangeListener(sharedPreferenceChangeListener)
}
/* Overrides onResume from AppCompatActivity */
override fun onResume() {
try {
super.onResume()
} catch (_: ClassCastException) {
// Do nothing
}
}
/* Overrides onSupportNavigateUp from AppCompatActivity */
override fun onSupportNavigateUp(): Boolean {
// Taken from: https://developer.android.com/guide/navigation/navigation-ui#action_bar

View File

@@ -1,17 +1,3 @@
/*
* PlayerFragment.kt
* Implements the PlayerFragment class
* PlayerFragment is the fragment that hosts Radio's list of stations and a player sheet
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio
import android.app.Activity
@@ -462,7 +448,7 @@ class PlayerFragment : Fragment(),
swipeToMarkStarredItemTouchHelper.attachToRecyclerView(layout.recyclerView)
// set up sleep timer start button
layout.sheetSleepTimerStartButtonView.setOnClickListener {
layout.sheetSleepTimerStartButtonView?.setOnClickListener {
when (controller?.isPlaying) {
true -> {
val timePicker = MaterialTimePicker.Builder()
@@ -492,12 +478,28 @@ class PlayerFragment : Fragment(),
}
// set up sleep timer cancel button
layout.sheetSleepTimerCancelButtonView.setOnClickListener {
layout.sheetSleepTimerCancelButtonView?.setOnClickListener {
playerState.sleepTimerRunning = false
controller?.cancelSleepTimer()
togglePeriodicSleepTimerUpdateRequest()
}
// set up TV station navigation
layout.playerPrevButtonView?.setOnClickListener {
val currentPosition = CollectionHelper.getStationPosition(collection, playerState.stationUuid)
if (currentPosition > 0) {
val prevStation = collection.stations[currentPosition - 1]
onPlayButtonTapped(prevStation.uuid)
}
}
layout.playerNextButtonView?.setOnClickListener {
val currentPosition = CollectionHelper.getStationPosition(collection, playerState.stationUuid)
if (currentPosition < collection.stations.size - 1) {
val nextStation = collection.stations[currentPosition + 1]
onPlayButtonTapped(nextStation.uuid)
}
}
}
/* Sets up the player */
@@ -740,6 +742,7 @@ class PlayerFragment : Fragment(),
layout.showBufferingIndicator(buffering = false)
} else {
// playback is paused or stopped
layout.updateSleepTimer(activity as Context, 0L)
// check if buffering (playback is not active but playWhenReady is true)
if (controller?.playWhenReady == true) {
// playback is buffering, show the buffering indicator

View File

@@ -1,17 +1,3 @@
/*
* PlayerService.kt
* Implements the PlayerService class
* PlayerService is Radio's foreground service that plays radio station audio
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio
import android.app.PendingIntent
@@ -210,12 +196,9 @@ class PlayerService : MediaLibraryService() {
/* Cancels sleep timer */
private fun cancelSleepTimer() {
if (this::sleepTimer.isInitialized) {
if (manuallyCancelledSleepTimer) {
sleepTimerTimeRemaining = 0L
sleepTimer.cancel()
}
manuallyCancelledSleepTimer = false
sleepTimer.cancel()
}
sleepTimerTimeRemaining = 0L
// store timer state
PreferencesHelper.saveSleepTimerRunning(isRunning = false)
}
@@ -400,19 +383,19 @@ class PlayerService : MediaLibraryService() {
customLayout: ImmutableList<CommandButton>,
showPauseButton: Boolean
): ImmutableList<CommandButton> {
val seekToPreviousCommandButton = CommandButton.Builder()
val seekToPreviousCommandButton = CommandButton.Builder(CommandButton.ICON_UNDEFINED)
.setPlayerCommand(Player.COMMAND_SEEK_TO_PREVIOUS)
.setIconResId(R.drawable.ic_notification_skip_to_previous_36dp)
.setCustomIconResId(R.drawable.ic_notification_skip_to_previous_36dp)
.setEnabled(true)
.build()
val playCommandButton = CommandButton.Builder()
val playCommandButton = CommandButton.Builder(CommandButton.ICON_UNDEFINED)
.setPlayerCommand(Player.COMMAND_PLAY_PAUSE)
.setIconResId(if (player.isPlaying) R.drawable.ic_notification_stop_36dp else R.drawable.ic_notification_play_36dp)
.setCustomIconResId(if (player.isPlaying) R.drawable.ic_notification_stop_36dp else R.drawable.ic_notification_play_36dp)
.setEnabled(true)
.build()
val seekToNextCommandButton = CommandButton.Builder()
val seekToNextCommandButton = CommandButton.Builder(CommandButton.ICON_UNDEFINED)
.setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT)
.setIconResId(R.drawable.ic_notification_skip_to_next_36dp)
.setCustomIconResId(R.drawable.ic_notification_skip_to_next_36dp)
.setEnabled(true)
.build()
val commandButtons: MutableList<CommandButton> = mutableListOf(

View File

@@ -1,17 +1,3 @@
/*
* Radio.kt
* Implements the Radio class
* Radio is the base Application class that sets up day and night theme
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio
import android.app.Application
@@ -34,9 +20,4 @@ class Radio : Application() {
AppThemeHelper.setTheme(PreferencesHelper.loadThemeSelection())
}
/* Implements onTerminate */
override fun onTerminate() {
super.onTerminate()
}
}

View File

@@ -1,17 +1,3 @@
/*
* SettingsFragment.kt
* Implements the SettingsFragment fragment
* A SettingsFragment displays the user accessible settings of the app
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio
import android.app.Activity
@@ -28,11 +14,11 @@ import androidx.activity.result.ActivityResult
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
import androidx.appcompat.app.AppCompatActivity
import androidx.core.net.toUri
import androidx.core.os.bundleOf
import androidx.navigation.fragment.findNavController
import androidx.preference.*
import com.google.android.material.snackbar.Snackbar
import com.michatec.radio.dialogs.ErrorDialog
import com.michatec.radio.dialogs.ThemeSelectionDialog
import com.michatec.radio.dialogs.YesNoDialog
import com.michatec.radio.helpers.*
import com.michatec.radio.helpers.AppThemeHelper.getColor
@@ -46,7 +32,7 @@ import java.util.*
/*
* SettingsFragment class
*/
class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogListener {
class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogListener, ThemeSelectionDialog.ThemeSelectionDialogListener {
/* Define log tag */
@@ -70,33 +56,17 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
val screen = preferenceManager.createPreferenceScreen(context)
// set up "App Theme" preference
val preferenceThemeSelection = ListPreference(activity as Context)
val preferenceThemeSelection = Preference(activity as Context)
preferenceThemeSelection.title = getString(R.string.pref_theme_selection_title)
preferenceThemeSelection.setIcon(R.drawable.ic_brush_24dp)
preferenceThemeSelection.key = Keys.PREF_THEME_SELECTION
preferenceThemeSelection.summary = "${getString(R.string.pref_theme_selection_summary)} ${
AppThemeHelper.getCurrentTheme(activity as Context)
}"
preferenceThemeSelection.entries = arrayOf(
getString(R.string.pref_theme_selection_mode_device_default),
getString(R.string.pref_theme_selection_mode_light),
getString(R.string.pref_theme_selection_mode_dark)
)
preferenceThemeSelection.entryValues = arrayOf(
Keys.STATE_THEME_FOLLOW_SYSTEM,
Keys.STATE_THEME_LIGHT_MODE,
Keys.STATE_THEME_DARK_MODE
)
preferenceThemeSelection.setDefaultValue(Keys.STATE_THEME_FOLLOW_SYSTEM)
preferenceThemeSelection.setOnPreferenceChangeListener { preference, newValue ->
if (preference is ListPreference) {
val index: Int = preference.entryValues.indexOf(newValue)
preferenceThemeSelection.summary =
"${getString(R.string.pref_theme_selection_summary)} ${preference.entries[index]}"
return@setOnPreferenceChangeListener true
} else {
return@setOnPreferenceChangeListener false
}
preferenceThemeSelection.setOnPreferenceClickListener {
// show theme selection dialog
ThemeSelectionDialog(this).show(activity as Context)
return@setOnPreferenceClickListener true
}
// set up "Update Station Images" preference
@@ -115,7 +85,6 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
return@setOnPreferenceClickListener true
}
// set up "Update Stations" preference
val preferenceUpdateCollection = Preference(activity as Context)
preferenceUpdateCollection.title = getString(R.string.pref_update_collection_title)
@@ -194,7 +163,8 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
preferenceEnableEditingStreamUri.key = Keys.PREF_EDIT_STREAMS_URIS
preferenceEnableEditingStreamUri.summaryOn = getString(R.string.pref_edit_station_stream_summary_enabled)
preferenceEnableEditingStreamUri.summaryOff = getString(R.string.pref_edit_station_stream_summary_disabled)
preferenceEnableEditingStreamUri.setDefaultValue(PreferencesHelper.loadEditStreamUrisEnabled())
preferenceEnableEditingStreamUri.setDefaultValue(PreferencesHelper.loadEditStreamUrisEnabled(context))
preferenceEnableEditingStreamUri.isEnabled = PreferencesHelper.loadEditStreamUrisEnabled(context)
// set up "Edit Stations" preference
@@ -204,7 +174,7 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
preferenceEnableEditingGeneral.key = Keys.PREF_EDIT_STATIONS
preferenceEnableEditingGeneral.summaryOn = getString(R.string.pref_edit_station_summary_enabled)
preferenceEnableEditingGeneral.summaryOff = getString(R.string.pref_edit_station_summary_disabled)
preferenceEnableEditingGeneral.setDefaultValue(PreferencesHelper.loadEditStationsEnabled())
preferenceEnableEditingGeneral.setDefaultValue(PreferencesHelper.loadEditStationsEnabled(context))
preferenceEnableEditingGeneral.setOnPreferenceChangeListener { _, newValue ->
when (newValue) {
true -> {
@@ -218,7 +188,6 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
return@setOnPreferenceChangeListener true
}
// set up "App Version" preference
val preferenceAppVersion = Preference(context)
preferenceAppVersion.title = getString(R.string.pref_app_version_title)
@@ -319,6 +288,26 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
preferenceScreen = screen
}
/* Overrides onThemeSelectionDialog from ThemeSelectionDialogListener */
override fun onThemeSelectionDialog(dialogResult: Boolean, selectedTheme: String) {
if (dialogResult) {
// update summary
val themes = arrayOf(
getString(R.string.pref_theme_selection_mode_device_default),
getString(R.string.pref_theme_selection_mode_light),
getString(R.string.pref_theme_selection_mode_dark)
)
val themeValues = arrayOf(
Keys.STATE_THEME_FOLLOW_SYSTEM,
Keys.STATE_THEME_LIGHT_MODE,
Keys.STATE_THEME_DARK_MODE
)
val index = themeValues.indexOf(selectedTheme)
val preferenceThemeSelection = findPreference<Preference>(Keys.PREF_THEME_SELECTION)
preferenceThemeSelection?.summary = "${getString(R.string.pref_theme_selection_summary)} ${themes[index]}"
}
}
/* Overrides onYesNoDialog from YesNoDialogListener */
override fun onYesNoDialog(
@@ -427,9 +416,9 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
val sourceUri: Uri? = result.data?.data
if (sourceUri != null) {
// open and import OPML in player fragment
val bundle: Bundle = bundleOf(
Keys.ARG_RESTORE_COLLECTION to "$sourceUri"
)
val bundle = Bundle().apply {
putString(Keys.ARG_RESTORE_COLLECTION, "$sourceUri")
}
this.findNavController().navigate(R.id.player_destination, bundle)
}
}
@@ -445,7 +434,9 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
Snackbar.LENGTH_LONG
).show()
// update collection in player screen
val bundle: Bundle = bundleOf(Keys.ARG_UPDATE_COLLECTION to true)
val bundle = Bundle().apply {
putBoolean(Keys.ARG_UPDATE_COLLECTION, true)
}
this.findNavController().navigate(R.id.player_destination, bundle)
} else {
ErrorDialog().show(
@@ -466,9 +457,9 @@ class SettingsFragment : PreferenceFragmentCompat(), YesNoDialog.YesNoDialogList
Snackbar.LENGTH_LONG
).show()
// update collection in player screen
val bundle: Bundle = bundleOf(
Keys.ARG_UPDATE_IMAGES to true
)
val bundle = Bundle().apply {
putBoolean(Keys.ARG_UPDATE_IMAGES, true)
}
this.findNavController().navigate(R.id.player_destination, bundle)
} else {
ErrorDialog().show(

View File

@@ -1,17 +1,3 @@
/*
* CollectionAdapter.kt
* Implements the CollectionAdapter class
* A CollectionAdapter is a custom adapter providing station card views for a RecyclerView
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.collection
import android.annotation.SuppressLint
@@ -19,6 +5,7 @@ import android.content.Context
import android.content.SharedPreferences
import android.text.Editable
import android.text.TextWatcher
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -62,8 +49,8 @@ class CollectionAdapter(
/* Main class variables */
private lateinit var collectionViewModel: CollectionViewModel
private var collection: Collection = Collection()
private var editStationsEnabled: Boolean = PreferencesHelper.loadEditStationsEnabled()
private var editStationStreamsEnabled: Boolean = PreferencesHelper.loadEditStreamUrisEnabled()
private var editStationsEnabled: Boolean = PreferencesHelper.loadEditStationsEnabled(context)
private var editStationStreamsEnabled: Boolean = PreferencesHelper.loadEditStreamUrisEnabled(context)
private var expandedStationUuid: String = PreferencesHelper.loadStationListStreamUuid()
private var expandedStationPosition: Int = -1
var isExpandedForEdit: Boolean = false
@@ -214,6 +201,8 @@ class CollectionAdapter(
stationViewHolder.stationNameEditView.imeOptions =
EditorInfo.IME_ACTION_DONE
}
// Allow internal focus
stationViewHolder.stationCardView.descendantFocusability = ViewGroup.FOCUS_AFTER_DESCENDANTS
}
// hide edit views
else -> {
@@ -222,6 +211,8 @@ class CollectionAdapter(
stationViewHolder.stationStarredView.isVisible = station.starred
stationViewHolder.editViews.isGone = true
stationViewHolder.stationUriEditView.isGone = true
// Block internal focus
stationViewHolder.stationCardView.descendantFocusability = ViewGroup.FOCUS_BLOCK_DESCENDANTS
}
}
}
@@ -387,6 +378,7 @@ class CollectionAdapter(
false -> stationViewHolder.playButtonView.visibility = View.INVISIBLE
}
stationViewHolder.stationCardView.setOnClickListener {
if (expandedStationPosition == stationViewHolder.bindingAdapterPosition) return@setOnClickListener
collectionAdapterListener.onPlayButtonTapped(station.uuid)
}
stationViewHolder.playButtonView.setOnClickListener {
@@ -401,6 +393,38 @@ class CollectionAdapter(
stationViewHolder.stationImageView.setOnClickListener {
collectionAdapterListener.onPlayButtonTapped(station.uuid)
}
// TV improvement: Allow opening edit view with DPAD_LEFT
stationViewHolder.stationCardView.setOnKeyListener { _, keyCode, event ->
if (event.action == KeyEvent.ACTION_DOWN) {
when (keyCode) {
KeyEvent.KEYCODE_DPAD_LEFT -> {
if (editStationsEnabled && expandedStationPosition != stationViewHolder.bindingAdapterPosition) {
val position: Int = stationViewHolder.bindingAdapterPosition
toggleEditViews(position, station.uuid)
return@setOnKeyListener true
}
}
KeyEvent.KEYCODE_NUMPAD_2, KeyEvent.KEYCODE_2, KeyEvent.KEYCODE_BACK -> {
if (expandedStationPosition == stationViewHolder.bindingAdapterPosition) {
val position: Int = stationViewHolder.bindingAdapterPosition
toggleEditViews(position, station.uuid)
return@setOnKeyListener true
}
}
KeyEvent.KEYCODE_NUMPAD_0, KeyEvent.KEYCODE_0, KeyEvent.KEYCODE_DEL -> {
removeStation(context, stationViewHolder.bindingAdapterPosition)
return@setOnKeyListener true
}
KeyEvent.KEYCODE_NUMPAD_1, KeyEvent.KEYCODE_1, KeyEvent.KEYCODE_SPACE -> {
toggleStarredStation(context, stationViewHolder.bindingAdapterPosition)
return@setOnKeyListener true
}
}
}
false
}
stationViewHolder.playButtonView.setOnLongClickListener {
if (editStationsEnabled) {
val position: Int = stationViewHolder.bindingAdapterPosition
@@ -649,9 +673,9 @@ class CollectionAdapter(
SharedPreferences.OnSharedPreferenceChangeListener { _, key ->
when (key) {
Keys.PREF_EDIT_STATIONS -> editStationsEnabled =
PreferencesHelper.loadEditStationsEnabled()
PreferencesHelper.loadEditStationsEnabled(context)
Keys.PREF_EDIT_STREAMS_URIS -> editStationStreamsEnabled =
PreferencesHelper.loadEditStreamUrisEnabled()
PreferencesHelper.loadEditStreamUrisEnabled(context)
}
}
/*

View File

@@ -1,17 +1,3 @@
/*
* CollectionViewModel.kt
* Implements the CollectionViewModel class
* A CollectionViewModel stores the collection of stations as live data
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.collection
import android.app.Application

View File

@@ -1,16 +1,3 @@
/*
* Collection.kt
* Implements the Collection class
* A Collection object holds a list of radio stations
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.core
import android.os.Parcelable

View File

@@ -1,17 +1,3 @@
/*
* Station.kt
* Implements the Station class
* A Station object holds the base data of a radio
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.core
import android.os.Parcelable

View File

@@ -1,22 +1,10 @@
/*
* AddStationDialog.kt
* Implements the AddStationDialog class
* A AddStationDialog shows a dialog with list of stations to import
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-23 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.dialogs
import android.content.Context
import android.view.LayoutInflater
import android.widget.Button
import androidx.appcompat.app.AlertDialog
import androidx.core.view.isGone
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@@ -45,6 +33,8 @@ class AddStationDialog (
/* Main class variables */
private lateinit var dialog: AlertDialog
private lateinit var stationSearchResultList: RecyclerView
private var customPositiveButton: Button? = null
private var customNegativeButton: Button? = null
private lateinit var searchResultAdapter: SearchResultAdapter
private var station: Station = Station()
@@ -73,6 +63,10 @@ class AddStationDialog (
// set up list of search results
setupRecyclerView(context)
// find custom buttons (for TV layout)
customPositiveButton = view.findViewById(R.id.dialog_positive_button)
customNegativeButton = view.findViewById(R.id.dialog_negative_button)
// add okay ("Add") button
builder.setPositiveButton(R.string.dialog_find_station_button_add) { _, _ ->
// listen for click on add button
@@ -88,6 +82,17 @@ class AddStationDialog (
searchResultAdapter.stopPrePlayback()
}
// set up custom buttons if they exist (TV layout)
customPositiveButton?.setOnClickListener {
listener.onAddStationDialog(station)
searchResultAdapter.stopPrePlayback()
dialog.dismiss()
}
customNegativeButton?.setOnClickListener {
searchResultAdapter.stopPrePlayback()
dialog.dismiss()
}
// set dialog view
builder.setView(view)
@@ -95,8 +100,16 @@ class AddStationDialog (
dialog = builder.create()
dialog.show()
// initially disable "Add" button
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
// handle button visibility and state
if (customPositiveButton != null) {
// hide default buttons if custom ones are used
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isGone = true
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).isGone = true
customPositiveButton?.isEnabled = false
} else {
// initially disable default "Add" button
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
}
}
@@ -117,12 +130,14 @@ class AddStationDialog (
/* Implement activateAddButton to enable the "Add" button */
override fun activateAddButton() {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true
customPositiveButton?.isEnabled = true
}
/* Implement deactivateAddButton to disable the "Add" button */
override fun deactivateAddButton() {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
customPositiveButton?.isEnabled = false
}

View File

@@ -1,17 +1,3 @@
/*
* ErrorDialog.kt
* Implements the ErrorDialog class
* An ErrorDialog shows an error dialog with details
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.dialogs
import android.content.Context

View File

@@ -1,17 +1,3 @@
/*
* FindStationDialog.kt
* Implements the FindStationDialog class
* A FindStationDialog shows a dialog with search box and list of results
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.dialogs
import android.annotation.SuppressLint
@@ -21,6 +7,7 @@ import android.os.Handler
import android.os.Looper
import android.view.LayoutInflater
import android.view.inputmethod.InputMethodManager
import android.widget.Button
import android.widget.ProgressBar
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.SearchView
@@ -63,6 +50,8 @@ class FindStationDialog (
private lateinit var searchRequestProgressIndicator: ProgressBar
private lateinit var noSearchResultsTextView: MaterialTextView
private lateinit var stationSearchResultList: RecyclerView
private var customPositiveButton: Button? = null
private var customNegativeButton: Button? = null
private lateinit var searchResultAdapter: SearchResultAdapter
private lateinit var radioBrowserSearch: RadioBrowserSearch
private lateinit var directInputCheck: DirectInputCheck
@@ -134,6 +123,10 @@ class FindStationDialog (
// set up list of search results
setupRecyclerView(context)
// find custom buttons (for TV layout)
customPositiveButton = view.findViewById(R.id.dialog_positive_button)
customNegativeButton = view.findViewById(R.id.dialog_negative_button)
// add okay ("Add") button
builder.setPositiveButton(R.string.dialog_find_station_button_add) { _, _ ->
// listen for click on add button
@@ -152,6 +145,18 @@ class FindStationDialog (
searchResultAdapter.stopPrePlayback()
}
// set up custom buttons if they exist (TV layout)
customPositiveButton?.setOnClickListener {
listener.onFindStationDialog(station)
searchResultAdapter.stopPrePlayback()
dialog.dismiss()
}
customNegativeButton?.setOnClickListener {
radioBrowserSearch.stopSearchRequest()
searchResultAdapter.stopPrePlayback()
dialog.dismiss()
}
// listen for input
stationSearchBoxView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextChange(query: String): Boolean {
@@ -174,10 +179,18 @@ class FindStationDialog (
dialog = builder.create()
dialog.show()
// initially disable "Add" button
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isAllCaps = true
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).isAllCaps = true
// handle button visibility and state
if (customPositiveButton != null) {
// hide default buttons if custom ones are used
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isGone = true
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).isGone = true
customPositiveButton?.isEnabled = false
} else {
// initially disable default "Add" button
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isAllCaps = true
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).isAllCaps = true
}
}
@@ -242,12 +255,14 @@ class FindStationDialog (
/* Makes the "Add" button clickable */
override fun activateAddButton() {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = true
customPositiveButton?.isEnabled = true
searchRequestProgressIndicator.isGone = true
noSearchResultsTextView.isGone = true
}
override fun deactivateAddButton() {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
customPositiveButton?.isEnabled = false
searchRequestProgressIndicator.isGone = true
noSearchResultsTextView.isGone = true
}
@@ -256,6 +271,7 @@ class FindStationDialog (
/* Resets the dialog layout to default state */
private fun resetLayout(clearAdapter: Boolean = false) {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
customPositiveButton?.isEnabled = false
searchRequestProgressIndicator.isGone = true
noSearchResultsTextView.isGone = true
searchResultAdapter.resetSelection(clearAdapter)
@@ -265,6 +281,7 @@ class FindStationDialog (
/* Display the "No Results" error - hide other unneeded views */
private fun showNoResultsError() {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
customPositiveButton?.isEnabled = false
searchRequestProgressIndicator.isGone = true
noSearchResultsTextView.isVisible = true
}
@@ -273,6 +290,7 @@ class FindStationDialog (
/* Display the "No Results" error - hide other unneeded views */
private fun showProgressIndicator() {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
customPositiveButton?.isEnabled = false
searchRequestProgressIndicator.isVisible = true
noSearchResultsTextView.isGone = true
}

View File

@@ -0,0 +1,111 @@
package com.michatec.radio.dialogs
import android.content.Context
import android.view.LayoutInflater
import android.widget.RadioButton
import androidx.appcompat.app.AlertDialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.michatec.radio.Keys
import com.michatec.radio.R
import com.michatec.radio.helpers.AppThemeHelper
import com.michatec.radio.helpers.PreferencesHelper
/*
* ThemeSelectionDialog class
*/
class ThemeSelectionDialog(private var themeSelectionDialogListener: ThemeSelectionDialogListener) {
/* Interface used to communicate back to activity */
interface ThemeSelectionDialogListener {
fun onThemeSelectionDialog(dialogResult: Boolean, selectedTheme: String) {
}
}
/* Main class variables */
private lateinit var dialog: AlertDialog
/* Update radio buttons to reflect current theme */
private fun updateRadioButtons(
context: Context,
radioFollowSystem: RadioButton,
radioLight: RadioButton,
radioDark: RadioButton
) {
val currentTheme = AppThemeHelper.getCurrentTheme(context)
when (currentTheme) {
context.getString(R.string.pref_theme_selection_mode_device_default) -> {
radioFollowSystem.isChecked = true
}
context.getString(R.string.pref_theme_selection_mode_light) -> {
radioLight.isChecked = true
}
context.getString(R.string.pref_theme_selection_mode_dark) -> {
radioDark.isChecked = true
}
}
}
/* Construct and show dialog */
fun show(context: Context) {
// prepare dialog builder
val builder = MaterialAlertDialogBuilder(context)
// inflate custom layout
val inflater = LayoutInflater.from(context)
val view = inflater.inflate(R.layout.dialog_theme_selection, null)
// find radio buttons
val radioGroup = view.findViewById<android.widget.RadioGroup>(R.id.theme_radio_group)
val radioFollowSystem = view.findViewById<RadioButton>(R.id.radio_theme_follow_system)
val radioLight = view.findViewById<RadioButton>(R.id.radio_theme_light)
val radioDark = view.findViewById<RadioButton>(R.id.radio_theme_dark)
// set current selection
val currentTheme = AppThemeHelper.getCurrentTheme(context)
when (currentTheme) {
context.getString(R.string.pref_theme_selection_mode_device_default) -> {
radioFollowSystem.isChecked = true
}
context.getString(R.string.pref_theme_selection_mode_light) -> {
radioLight.isChecked = true
}
context.getString(R.string.pref_theme_selection_mode_dark) -> {
radioDark.isChecked = true
}
}
// set up radio group listener
radioGroup.setOnCheckedChangeListener { _, checkedId ->
val selectedTheme = when (checkedId) {
R.id.radio_theme_follow_system -> Keys.STATE_THEME_FOLLOW_SYSTEM
R.id.radio_theme_light -> Keys.STATE_THEME_LIGHT_MODE
R.id.radio_theme_dark -> Keys.STATE_THEME_DARK_MODE
else -> Keys.STATE_THEME_FOLLOW_SYSTEM
}
// save theme selection to preferences
PreferencesHelper.saveThemeSelection(selectedTheme)
// apply theme immediately
AppThemeHelper.setTheme(selectedTheme)
// notify listener
themeSelectionDialogListener.onThemeSelectionDialog(true, selectedTheme)
// dismiss dialog
dialog.dismiss()
}
// set custom view
builder.setView(view)
// handle outside-click as cancel
builder.setOnCancelListener {
themeSelectionDialogListener.onThemeSelectionDialog(false, Keys.STATE_THEME_FOLLOW_SYSTEM)
}
// display dialog
dialog = builder.create()
dialog.show()
}
}

View File

@@ -1,17 +1,3 @@
/*
* YesNoDialog
* Implements the YesNoDialog class
* A YesNoDialog asks the user if he/she wants to do something or not
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.dialogs
import android.content.Context

View File

@@ -1,18 +1,3 @@
/*
* ArrayListExt.kt
* Implements the ArrayListExt extension methods
* Useful extension methods for ArrayLists
* Source: https://raw.githubusercontent.com/googlesamples/android-UniversalMusicPlayer/master/common/src/main/java/com/example/android/uamp/media/extensions/MediaMetadataCompatExt.kt
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.extensions

View File

@@ -1,22 +1,7 @@
/*
* MediaControllerExt.kt
* Implements the MediaControllerExt extension methods
* Useful extension methods for MediaController
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.extensions
import android.content.Context
import android.os.Bundle
import androidx.core.os.bundleOf
import androidx.media3.session.MediaController
import androidx.media3.session.SessionCommand
import androidx.media3.session.SessionResult
@@ -71,8 +56,11 @@ fun MediaController.play(context: Context, station: Station) {
/* Starts playback with of a stream url */
fun MediaController.playStreamDirectly(streamUri: String) {
val bundle = Bundle().apply {
putString(Keys.KEY_STREAM_URI, streamUri)
}
sendCustomCommand(
SessionCommand(Keys.CMD_PLAY_STREAM, Bundle.EMPTY),
bundleOf(Pair(Keys.KEY_STREAM_URI, streamUri))
bundle
)
}

View File

@@ -1,17 +1,3 @@
/*
* AppThemeHelper.kt
* Implements the AppThemeHelper object
* A AppThemeHelper can set the different app themes: Light Mode, Dark Mode, Follow System
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.helpers
import android.content.Context

View File

@@ -1,17 +1,3 @@
/*
* AudioHelper.kt
* Implements the AudioHelper object
* A AudioHelper provides helper methods for handling audio files
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.helpers
import android.util.Log

View File

@@ -1,17 +1,3 @@
/*
* BackupHelper.kt
* Implements the BackupHelper object
* A BackupHelper provides helper methods for backing up and restoring the radio station collection
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.helpers
import android.content.ContentResolver

View File

@@ -1,17 +1,3 @@
/*
* CollectionHelper.kt
* Implements the CollectionHelper object
* A CollectionHelper provides helper methods for the collection of stations
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.helpers
import android.content.Context

View File

@@ -1,17 +1,3 @@
/*
* DateTimeHelper.kt
* Implements the DateTimeHelper object
* A DateTimeHelper provides helper methods for converting Date and Time objects
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.helpers
import android.util.Log

View File

@@ -1,17 +1,3 @@
/*
* DownloadFinishedReceiver.kt
* Implements the DownloadFinishedReceiver class
* A DownloadFinishedReceiver listens for finished downloads
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.helpers
import android.app.DownloadManager

View File

@@ -1,17 +1,3 @@
/*
* DownloadHelper.kt
* Implements the DownloadHelper object
* A DownloadHelper provides helper methods for downloading files
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.helpers
import android.app.DownloadManager

View File

@@ -1,17 +1,3 @@
/*
* FileHelper.kt
* Implements the FileHelper object
* A FileHelper provides helper methods for reading and writing files from and to device storage
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.helpers
import android.app.Activity
@@ -33,7 +19,6 @@ import kotlinx.coroutines.Dispatchers.IO
import java.io.*
import java.util.*
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine
/*
@@ -292,7 +277,7 @@ object FileHelper {
collection: Collection,
lastUpdate: Date
) {
return suspendCoroutine { cont ->
return suspendCancellableCoroutine { cont ->
cont.resume(saveCollection(context, collection, lastUpdate))
}
}
@@ -311,7 +296,7 @@ object FileHelper {
originalFileUri: Uri,
targetFileUri: Uri
): Boolean {
return suspendCoroutine { cont ->
return suspendCancellableCoroutine { cont ->
cont.resume(copyFile(context, originalFileUri, targetFileUri))
}
}
@@ -319,7 +304,7 @@ object FileHelper {
/* Suspend function: Exports collection of stations as M3U file - local backup copy */
suspend fun backupCollectionAsM3uSuspended(context: Context, collection: Collection) {
return suspendCoroutine { cont ->
return suspendCancellableCoroutine { cont ->
Log.v(TAG, "Backing up collection as M3U - Thread: ${Thread.currentThread().name}")
// create M3U string
val m3uString: String = CollectionHelper.createM3uString(collection)
@@ -338,7 +323,7 @@ object FileHelper {
/* Suspend function: Exports collection of stations as PLS file - local backup copy */
suspend fun backupCollectionAsPlsSuspended(context: Context, collection: Collection) {
return suspendCoroutine { cont ->
return suspendCancellableCoroutine { cont ->
Log.v(TAG, "Backing up collection as PLS - Thread: ${Thread.currentThread().name}")
// create PLS string
val plsString: String = CollectionHelper.createPlsString(collection)

View File

@@ -1,17 +1,3 @@
/*
* ImageHelper.kt
* Implements the ImageHelper object
* An ImageHelper provides helper methods for image related operations
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.helpers
import android.content.Context

View File

@@ -1,17 +1,3 @@
/*
* NetworkHelper.kt
* Implements the NetworkHelper object
* A NetworkHelper provides helper methods for network related operations
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.helpers
import android.content.Context
@@ -19,13 +5,13 @@ import android.net.ConnectivityManager
import android.net.Network
import android.util.Log
import com.michatec.radio.Keys
import kotlinx.coroutines.suspendCancellableCoroutine
import java.net.HttpURLConnection
import java.net.InetAddress
import java.net.URL
import java.net.UnknownHostException
import java.util.*
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine
/*
@@ -105,7 +91,7 @@ object NetworkHelper {
/* Suspend function: Detects content type (mime type) from given URL string - async using coroutine */
suspend fun detectContentTypeSuspended(urlString: String): ContentType {
return suspendCoroutine { cont ->
return suspendCancellableCoroutine { cont ->
cont.resume(detectContentType(urlString))
}
}
@@ -113,7 +99,7 @@ object NetworkHelper {
/* Suspend function: Gets a random radio-browser.info api address - async using coroutine */
suspend fun getRadioBrowserServerSuspended(): String {
return suspendCoroutine { cont ->
return suspendCancellableCoroutine { cont ->
val serverAddress: String = try {
// get all available radio browser servers
val serverAddressList: Array<InetAddress> =

View File

@@ -1,21 +1,8 @@
/*
* PreferencesHelper.kt
* Implements the PreferencesHelper object
* A PreferencesHelper provides helper methods for the saving and loading values from shared preferences
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.helpers
import android.content.Context
import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.util.Log
import androidx.core.content.edit
import androidx.preference.PreferenceManager
@@ -222,14 +209,24 @@ object PreferencesHelper {
}
/* Save currently selected app theme */
fun saveThemeSelection(theme: String) {
sharedPreferences.edit {
putString(Keys.PREF_THEME_SELECTION, theme)
}
}
/* Loads value of the option: Edit Stations */
fun loadEditStationsEnabled(): Boolean {
return sharedPreferences.getBoolean(Keys.PREF_EDIT_STATIONS, true)
fun loadEditStationsEnabled(context: Context): Boolean {
val defaultValue = !context.packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)
return sharedPreferences.getBoolean(Keys.PREF_EDIT_STATIONS, defaultValue)
}
/* Loads value of the option: Edit Station Streams */
fun loadEditStreamUrisEnabled(): Boolean {
return sharedPreferences.getBoolean(Keys.PREF_EDIT_STREAMS_URIS, true)
fun loadEditStreamUrisEnabled(context: Context): Boolean {
val defaultValue = !context.packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)
return sharedPreferences.getBoolean(Keys.PREF_EDIT_STREAMS_URIS, defaultValue)
}

View File

@@ -1,17 +1,3 @@
/*
* ShortcutHelper.kt
* Implements the ShortcutHelper object
* A ShortcutHelper creates and handles station shortcuts on the Home screen
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.helpers
import android.content.Context

View File

@@ -1,17 +1,3 @@
/*
* UpdateHelper.kt
* Implements the UpdateHelper class
* A UpdateHelper provides methods to update a single station or the whole collection of stations
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.helpers
import android.content.Context

View File

@@ -1,17 +1,3 @@
/*
* DirectInputCheck.kt
* Implements the DirectInputCheck class
* A DirectInputCheck checks if a station url is valid and returns station via a listener
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-23 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.search
import android.content.Context

View File

@@ -1,17 +1,3 @@
/*
* RadioBrowserResult.kt
* Implements the RadioBrowserResult class
* A RadioBrowserResult is the search result of a request to api.radio-browser.info
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.search
import com.google.gson.annotations.Expose

View File

@@ -1,17 +1,3 @@
/*
* RadioBrowserSearch.kt
* Implements the RadioBrowserSearch class
* A RadioBrowserSearch performs searches on the radio-browser.info database
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.search
import android.content.Context

View File

@@ -1,17 +1,3 @@
/*
* SearchResultAdapter.kt
* Implements the SearchResultAdapter class
* A SearchResultAdapter is a custom adapter providing search result views for a RecyclerView
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.search
import android.content.Context

View File

@@ -1,17 +1,3 @@
/*
* LayoutHolder.kt
* Implements the LayoutHolder class
* A LayoutHolder hold references to the main views
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.ui
import android.annotation.SuppressLint
@@ -19,6 +5,7 @@ import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.drawable.AnimatedVectorDrawable
import android.os.Build
import android.view.View
@@ -54,30 +41,32 @@ data class LayoutHolder(var rootView: View) {
/* Main class variables */
var recyclerView: RecyclerView = rootView.findViewById(R.id.station_list)
val layoutManager: LinearLayoutManager
private var bottomSheet: ConstraintLayout = rootView.findViewById(R.id.bottom_sheet)
private var bottomSheet: ConstraintLayout? = rootView.findViewById(R.id.bottom_sheet)
//private var sheetMetadataViews: Group
private var sleepTimerRunningViews: Group = rootView.findViewById(R.id.sleep_timer_running_views)
private var downloadProgressIndicator: ProgressBar = rootView.findViewById(R.id.download_progress_indicator)
private var stationImageView: ImageView = rootView.findViewById(R.id.station_icon)
private var stationNameView: TextView = rootView.findViewById(R.id.player_station_name)
private var metadataView: TextView = rootView.findViewById(R.id.player_station_metadata)
private var sleepTimerRunningViews: Group? = rootView.findViewById(R.id.sleep_timer_running_views)
private var downloadProgressIndicator: ProgressBar? = rootView.findViewById(R.id.download_progress_indicator)
private var stationImageView: ImageView? = rootView.findViewById(R.id.station_icon)
private var stationNameView: TextView? = rootView.findViewById(R.id.player_station_name)
private var metadataView: TextView? = rootView.findViewById(R.id.player_station_metadata)
var playButtonView: ImageButton = rootView.findViewById(R.id.player_play_button)
var playerPrevButtonView: ImageButton? = rootView.findViewById(R.id.player_prev_button)
var playerNextButtonView: ImageButton? = rootView.findViewById(R.id.player_next_button)
private var bufferingIndicator: ProgressBar = rootView.findViewById(R.id.player_buffering_indicator)
private var sheetStreamingLinkHeadline: TextView = rootView.findViewById(R.id.sheet_streaming_link_headline)
private var sheetStreamingLinkView: TextView = rootView.findViewById(R.id.sheet_streaming_link)
private var sheetMetadataHistoryHeadline: TextView = rootView.findViewById(R.id.sheet_metadata_headline)
private var sheetMetadataHistoryView: TextView = rootView.findViewById(R.id.sheet_metadata_history)
private var sheetNextMetadataView: ImageButton = rootView.findViewById(R.id.sheet_next_metadata_button)
private var sheetPreviousMetadataView: ImageButton = rootView.findViewById(R.id.sheet_previous_metadata_button)
private var sheetCopyMetadataButtonView: ImageButton = rootView.findViewById(R.id.copy_station_metadata_button)
private var sheetShareLinkButtonView: ImageView = rootView.findViewById(R.id.sheet_share_link_button)
private var sheetBitrateView: TextView = rootView.findViewById(R.id.sheet_bitrate_view)
var sheetSleepTimerStartButtonView: ImageButton = rootView.findViewById(R.id.sleep_timer_start_button)
var sheetSleepTimerCancelButtonView: ImageButton = rootView.findViewById(R.id.sleep_timer_cancel_button)
private var sheetStreamingLinkHeadline: TextView? = rootView.findViewById(R.id.sheet_streaming_link_headline)
private var sheetStreamingLinkView: TextView? = rootView.findViewById(R.id.sheet_streaming_link)
private var sheetMetadataHistoryHeadline: TextView? = rootView.findViewById(R.id.sheet_metadata_headline)
private var sheetMetadataHistoryView: TextView? = rootView.findViewById(R.id.sheet_metadata_history)
private var sheetNextMetadataView: ImageButton? = rootView.findViewById(R.id.sheet_next_metadata_button)
private var sheetPreviousMetadataView: ImageButton? = rootView.findViewById(R.id.sheet_previous_metadata_button)
private var sheetCopyMetadataButtonView: ImageButton? = rootView.findViewById(R.id.copy_station_metadata_button)
private var sheetShareLinkButtonView: ImageView? = rootView.findViewById(R.id.sheet_share_link_button)
private var sheetBitrateView: TextView? = rootView.findViewById(R.id.sheet_bitrate_view)
var sheetSleepTimerStartButtonView: ImageButton? = rootView.findViewById(R.id.sleep_timer_start_button)
var sheetSleepTimerCancelButtonView: ImageButton? = rootView.findViewById(R.id.sleep_timer_cancel_button)
private var sheetSleepTimerRemainingTimeView: TextView = rootView.findViewById(R.id.sleep_timer_remaining_time)
private var onboardingLayout: ConstraintLayout = rootView.findViewById(R.id.onboarding_layout)
private var bottomSheetBehavior: BottomSheetBehavior<ConstraintLayout> = BottomSheetBehavior.from(bottomSheet)
private var bottomSheetBehavior: BottomSheetBehavior<ConstraintLayout>? = bottomSheet?.let { BottomSheetBehavior.from(it) }
private var metadataHistory: MutableList<String>
private var metadataHistoryPosition: Int
private var isBuffering: Boolean
@@ -97,31 +86,31 @@ data class LayoutHolder(var rootView: View) {
recyclerView.itemAnimator = DefaultItemAnimator()
// set up metadata history next and previous buttons
sheetPreviousMetadataView.setOnClickListener {
sheetPreviousMetadataView?.setOnClickListener {
if (metadataHistory.isNotEmpty()) {
if (metadataHistoryPosition > 0) {
metadataHistoryPosition -= 1
} else {
metadataHistoryPosition = metadataHistory.size - 1
}
sheetMetadataHistoryView.text = metadataHistory[metadataHistoryPosition]
sheetMetadataHistoryView?.text = metadataHistory[metadataHistoryPosition]
}
}
sheetNextMetadataView.setOnClickListener {
sheetNextMetadataView?.setOnClickListener {
if (metadataHistory.isNotEmpty()) {
if (metadataHistoryPosition < metadataHistory.size - 1) {
metadataHistoryPosition += 1
} else {
metadataHistoryPosition = 0
}
sheetMetadataHistoryView.text = metadataHistory[metadataHistoryPosition]
sheetMetadataHistoryView?.text = metadataHistory[metadataHistoryPosition]
}
}
sheetMetadataHistoryView.setOnLongClickListener {
sheetMetadataHistoryView?.setOnLongClickListener {
copyMetadataHistoryToClipboard()
return@setOnLongClickListener true
}
sheetMetadataHistoryHeadline.setOnLongClickListener {
sheetMetadataHistoryHeadline?.setOnLongClickListener {
copyMetadataHistoryToClipboard()
return@setOnLongClickListener true
}
@@ -137,29 +126,29 @@ data class LayoutHolder(var rootView: View) {
// set default metadata views, when playback has stopped
if (!isPlaying) {
metadataView.text = station.name
sheetMetadataHistoryView.text = station.name
metadataView?.text = station.name
sheetMetadataHistoryView?.text = station.name
// sheetMetadataHistoryView.isSelected = true
}
// update name
stationNameView.text = station.name
stationNameView?.text = station.name
// toggle text scrolling (marquee) if necessary
stationNameView.isSelected = isPlaying
stationNameView?.isSelected = isPlaying
// reduce the shadow left and right because of scrolling (Marquee)
stationNameView.setFadingEdgeLength(8)
stationNameView?.setFadingEdgeLength(8)
// update cover
if (station.imageColor != -1) {
stationImageView.setBackgroundColor(station.imageColor)
stationImageView?.setBackgroundColor(station.imageColor)
}
stationImageView.setImageBitmap(ImageHelper.getStationImage(context, station.smallImage))
stationImageView.contentDescription = "${context.getString(R.string.descr_player_station_image)}: ${station.name}"
stationImageView?.setImageBitmap(ImageHelper.getStationImage(context, station.smallImage))
stationImageView?.contentDescription = "${context.getString(R.string.descr_player_station_image)}: ${station.name}"
// update streaming link
sheetStreamingLinkView.text = station.getStreamUri()
sheetStreamingLinkView?.text = station.getStreamUri()
val bitrateText: CharSequence = if (station.codec.isNotEmpty()) {
if (station.bitrate == 0) {
@@ -188,50 +177,50 @@ data class LayoutHolder(var rootView: View) {
}
// update bitrate
sheetBitrateView.text = bitrateText
sheetBitrateView?.text = bitrateText
// update click listeners
sheetStreamingLinkHeadline.setOnClickListener {
sheetStreamingLinkHeadline?.setOnClickListener {
copyToClipboard(
context,
sheetStreamingLinkView.text
sheetStreamingLinkView?.text ?: ""
)
}
sheetStreamingLinkView.setOnClickListener {
sheetStreamingLinkView?.setOnClickListener {
copyToClipboard(
context,
sheetStreamingLinkView.text
sheetStreamingLinkView?.text ?: ""
)
}
sheetMetadataHistoryHeadline.setOnClickListener {
sheetMetadataHistoryHeadline?.setOnClickListener {
copyToClipboard(
context,
sheetMetadataHistoryView.text
sheetMetadataHistoryView?.text ?: ""
)
}
sheetMetadataHistoryView.setOnClickListener {
sheetMetadataHistoryView?.setOnClickListener {
copyToClipboard(
context,
sheetMetadataHistoryView.text
sheetMetadataHistoryView?.text ?: ""
)
}
sheetCopyMetadataButtonView.setOnClickListener {
sheetCopyMetadataButtonView?.setOnClickListener {
copyToClipboard(
context,
sheetMetadataHistoryView.text
sheetMetadataHistoryView?.text ?: ""
)
}
sheetBitrateView.setOnClickListener {
sheetBitrateView?.setOnClickListener {
copyToClipboard(
context,
sheetBitrateView.text
sheetBitrateView?.text ?: ""
)
}
sheetShareLinkButtonView.setOnClickListener {
sheetShareLinkButtonView?.setOnClickListener {
val share = Intent.createChooser(Intent().apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_TITLE, stationNameView.text)
putExtra(Intent.EXTRA_TEXT, sheetStreamingLinkView.text)
putExtra(Intent.EXTRA_TITLE, stationNameView?.text)
putExtra(Intent.EXTRA_TEXT, sheetStreamingLinkView?.text ?: "")
type = "text/plain"
}, null)
context.startActivity(share)
@@ -264,11 +253,11 @@ data class LayoutHolder(var rootView: View) {
fun updateMetadata(metadataHistoryList: MutableList<String>?) {
if (!metadataHistoryList.isNullOrEmpty()) {
metadataHistory = metadataHistoryList
if (metadataHistory.last() != metadataView.text) {
if (metadataHistory.last() != metadataView?.text) {
metadataHistoryPosition = metadataHistory.size - 1
val metadataString = metadataHistory[metadataHistoryPosition]
metadataView.text = metadataString
sheetMetadataHistoryView.text = metadataString
metadataView?.text = metadataString
sheetMetadataHistoryView?.text = metadataString
}
}
}
@@ -278,14 +267,16 @@ data class LayoutHolder(var rootView: View) {
fun updateSleepTimer(context: Context, timeRemaining: Long = 0L) {
when (timeRemaining) {
0L -> {
sleepTimerRunningViews.isGone = true
sleepTimerRunningViews?.isGone = true
sheetSleepTimerRemainingTimeView.isVisible = false
}
else -> {
sleepTimerRunningViews.isVisible = true
sleepTimerRunningViews?.isVisible = true
sheetSleepTimerRemainingTimeView.isVisible = true
val sleepTimerTimeRemaining = DateTimeHelper.convertToHoursMinutesSeconds(timeRemaining)
sheetSleepTimerRemainingTimeView.text = sleepTimerTimeRemaining
sheetSleepTimerRemainingTimeView.contentDescription = "${context.getString(R.string.descr_expanded_player_sleep_timer_remaining_time)}: $sleepTimerTimeRemaining"
stationNameView.isSelected = false
stationNameView?.isSelected = false
}
}
}
@@ -297,11 +288,11 @@ data class LayoutHolder(var rootView: View) {
playButtonView.setImageResource(R.drawable.ic_audio_waves_animated)
val animatedVectorDrawable = playButtonView.drawable as? AnimatedVectorDrawable
animatedVectorDrawable?.start()
sheetSleepTimerStartButtonView.isVisible = true
sheetSleepTimerStartButtonView?.isVisible = true
// bufferingIndicator.isVisible = false
} else {
playButtonView.setImageResource(R.drawable.ic_player_play_symbol_42dp)
sheetSleepTimerStartButtonView.isVisible = false
sheetSleepTimerStartButtonView?.isVisible = false
// bufferingIndicator.isVisible = isBuffering
}
}
@@ -316,8 +307,8 @@ data class LayoutHolder(var rootView: View) {
/* Toggles visibility of the download progress indicator */
fun toggleDownloadProgressIndicator() {
when (PreferencesHelper.loadActiveDownloads()) {
Keys.ACTIVE_DOWNLOADS_EMPTY -> downloadProgressIndicator.isGone = true
else -> downloadProgressIndicator.isVisible = true
Keys.ACTIVE_DOWNLOADS_EMPTY -> downloadProgressIndicator?.isGone = true
else -> downloadProgressIndicator?.isVisible = true
}
}
@@ -338,27 +329,27 @@ data class LayoutHolder(var rootView: View) {
/* Initiates the rotation animation of the play button */
fun animatePlaybackButtonStateTransition(context: Context, isPlaying: Boolean) {
when (isPlaying) {
true -> {
val rotateClockwise = AnimationUtils.loadAnimation(context, R.anim.rotate_clockwise_slow)
rotateClockwise.setAnimationListener(createAnimationListener(true))
playButtonView.startAnimation(rotateClockwise)
}
false -> {
val rotateCounterClockwise = AnimationUtils.loadAnimation(context, R.anim.rotate_counterclockwise_fast)
rotateCounterClockwise.setAnimationListener(createAnimationListener(false))
playButtonView.startAnimation(rotateCounterClockwise)
}
if (context.packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {
// TV: Toggle play button immediately for snappier feel
togglePlayButton(isPlaying)
} else {
// Handy/Tablet: Rotate the play button
val rotateAnimation = AnimationUtils.loadAnimation(context, if (isPlaying) R.anim.rotate_clockwise_slow else R.anim.rotate_counterclockwise_fast)
rotateAnimation.setAnimationListener(createAnimationListener(isPlaying))
playButtonView.startAnimation(rotateAnimation)
}
}
/* Shows player */
fun showPlayer(context: Context): Boolean {
UiHelper.setViewMargins(context, recyclerView, 0, 0, 0, Keys.BOTTOM_SHEET_PEEK_HEIGHT)
if (bottomSheetBehavior.state == BottomSheetBehavior.STATE_HIDDEN && onboardingLayout.isGone) {
bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
if (bottomSheetBehavior != null) {
UiHelper.setViewMargins(context, recyclerView, 0, 0, 0, Keys.BOTTOM_SHEET_PEEK_HEIGHT)
if (bottomSheetBehavior?.state == BottomSheetBehavior.STATE_HIDDEN && onboardingLayout.isGone) {
bottomSheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
}
} else {
UiHelper.setViewMargins(context, recyclerView, 0, 0, 0, 0)
}
return true
}
@@ -367,15 +358,15 @@ data class LayoutHolder(var rootView: View) {
/* Hides player */
private fun hidePlayer(context: Context): Boolean {
UiHelper.setViewMargins(context, recyclerView, 0, 0, 0, 0)
bottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
bottomSheetBehavior?.state = BottomSheetBehavior.STATE_HIDDEN
return true
}
/* Minimizes player sheet if expanded */
fun minimizePlayerIfExpanded(): Boolean {
return if (bottomSheetBehavior.state == BottomSheetBehavior.STATE_EXPANDED) {
bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
return if (bottomSheetBehavior?.state == BottomSheetBehavior.STATE_EXPANDED) {
bottomSheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
true
} else {
false
@@ -388,7 +379,7 @@ data class LayoutHolder(var rootView: View) {
return object : Animation.AnimationListener {
override fun onAnimationStart(animation: Animation) {}
override fun onAnimationEnd(animation: Animation) {
// set up button symbol and playback indicator afterwards
// set up button symbol and playback indicator afterward
togglePlayButton(isPlaying)
}
@@ -399,38 +390,40 @@ data class LayoutHolder(var rootView: View) {
/* Sets up the player (BottomSheet) */
private fun setupBottomSheet() {
// show / hide the small player
bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
bottomSheetBehavior.addBottomSheetCallback(object :
BottomSheetBehavior.BottomSheetCallback() {
override fun onSlide(view: View, slideOffset: Float) {
}
override fun onStateChanged(view: View, state: Int) {
when (state) {
BottomSheetBehavior.STATE_COLLAPSED -> Unit // do nothing
BottomSheetBehavior.STATE_DRAGGING -> Unit // do nothing
BottomSheetBehavior.STATE_EXPANDED -> Unit // do nothing
BottomSheetBehavior.STATE_HALF_EXPANDED -> Unit // do nothing
BottomSheetBehavior.STATE_SETTLING -> Unit // do nothing
BottomSheetBehavior.STATE_HIDDEN -> showPlayer(rootView.context)
if (bottomSheetBehavior != null) {
// show / hide the small player
bottomSheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
bottomSheetBehavior?.addBottomSheetCallback(object :
BottomSheetBehavior.BottomSheetCallback() {
override fun onSlide(view: View, slideOffset: Float) {
}
}
})
// toggle collapsed state on tap
bottomSheet.setOnClickListener { toggleBottomSheetState() }
stationImageView.setOnClickListener { toggleBottomSheetState() }
stationNameView.setOnClickListener { toggleBottomSheetState() }
metadataView.setOnClickListener { toggleBottomSheetState() }
override fun onStateChanged(view: View, state: Int) {
when (state) {
BottomSheetBehavior.STATE_COLLAPSED -> Unit // do nothing
BottomSheetBehavior.STATE_DRAGGING -> Unit // do nothing
BottomSheetBehavior.STATE_EXPANDED -> Unit // do nothing
BottomSheetBehavior.STATE_HALF_EXPANDED -> Unit // do nothing
BottomSheetBehavior.STATE_SETTLING -> Unit // do nothing
BottomSheetBehavior.STATE_HIDDEN -> showPlayer(rootView.context)
}
}
})
// toggle collapsed state on tap
bottomSheet?.setOnClickListener { toggleBottomSheetState() }
stationImageView?.setOnClickListener { toggleBottomSheetState() }
stationNameView?.setOnClickListener { toggleBottomSheetState() }
metadataView?.setOnClickListener { toggleBottomSheetState() }
}
}
/* Toggle expanded/collapsed state of bottom sheet */
private fun toggleBottomSheetState() {
when (bottomSheetBehavior.state) {
BottomSheetBehavior.STATE_COLLAPSED -> bottomSheetBehavior.state =
when (bottomSheetBehavior?.state) {
BottomSheetBehavior.STATE_COLLAPSED -> bottomSheetBehavior?.state =
BottomSheetBehavior.STATE_EXPANDED
else -> bottomSheetBehavior.state = BottomSheetBehavior.STATE_COLLAPSED
else -> bottomSheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
}
}

View File

@@ -1,17 +1,3 @@
/*
* PlayerState.kt
* Implements the PlayerState class
* A PlayerState holds parameters describing the state of the player part of the UI
*
* This file is part of
* TRANSISTOR - Radio App for Android
*
* Copyright (c) 2015-22 - Y20K.org
* Licensed under the MIT-License
* http://opensource.org/licenses/MIT
*/
package com.michatec.radio.ui
import android.os.Parcelable

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/list_card_stroke_focused" android:state_focused="true" />
<item android:color="@color/list_card_stroke_background" />
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/search_result_background_selected" android:state_focused="true" />
<item android:drawable="@android:color/transparent" />
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/list_card_stroke_focused" android:state_focused="true" />
<item android:color="@color/list_card_stroke_background" />
</selector>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true">
<shape android:shape="rectangle">
<solid android:color="#80FFFFFF" />
<corners android:radius="8dp" />
<stroke android:width="3dp" android:color="@color/default_neutral_white" />
</shape>
</item>
<item android:drawable="@android:color/transparent" />
</selector>

View File

@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- View is "selected" -->
<!-- View is "selected" or "focused" (for TV) -->
<item android:drawable="@drawable/shape_search_result_item_selected" android:state_selected="true" />
<item android:drawable="@drawable/shape_search_result_item_selected" android:state_focused="true" />
<!-- Default state. -->
<item android:drawable="@drawable/shape_search_result_item" />

View File

@@ -1,8 +1,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
android:width="2dp"
android:color="@color/default_neutral_lighter" />
android:width="4dp"
android:color="@color/default_neutral_white" />
<size
android:width="56dp"
android:height="56dp" />

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splashBackgroundColor" />
<item
android:width="160dp"
android:height="160dp"
android:gravity="center">
<bitmap
android:gravity="center"
android:src="@mipmap/ic_launcher" />
</item>
</layer-list>

View File

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_player_sheet_background"
android:padding="24dp">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/station_icon"
android:layout_width="120dp"
android:layout_height="120dp"
android:background="@drawable/shape_cover_small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/RoundedCorners"
app:srcCompat="@drawable/ic_default_station_image_72dp" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/player_station_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:textAppearance="@style/TextAppearance.Material3.HeadlineMedium"
android:textColor="@color/player_sheet_text_main"
android:textStyle="bold"
app:layout_constraintEnd_toStartOf="@+id/player_play_button"
app:layout_constraintStart_toEndOf="@+id/station_icon"
app:layout_constraintTop_toTopOf="@+id/station_icon"
tools:text="Station Name" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/player_station_metadata"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
android:textColor="@color/player_sheet_text_main"
app:layout_constraintEnd_toEndOf="@+id/player_station_name"
app:layout_constraintStart_toStartOf="@+id/player_station_name"
app:layout_constraintTop_toBottomOf="@+id/player_station_name"
tools:text="Metadata Info" />
<ImageButton
android:id="@+id/player_play_button"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/selector_play_button"
android:focusable="true"
android:scaleType="center"
app:layout_constraintBottom_toBottomOf="@+id/station_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/station_icon"
app:srcCompat="@drawable/ic_player_play_symbol_42dp" />
<LinearLayout
android:id="@+id/detailed_controls_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:gravity="center_vertical"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@+id/station_icon">
<ImageButton
android:id="@+id/sheet_previous_metadata_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
app:srcCompat="@drawable/ic_chevron_left_24dp" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/sheet_metadata_history"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginHorizontal="16dp"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
android:textColor="@color/player_sheet_text_main"
tools:text="Metadata History" />
<ImageButton
android:id="@+id/sheet_next_metadata_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
app:srcCompat="@drawable/ic_chevron_right_24dp" />
<ImageButton
android:id="@+id/copy_station_metadata_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
app:srcCompat="@drawable/ic_copy_content_24dp" />
<ImageButton
android:id="@+id/sleep_timer_start_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
app:srcCompat="@drawable/ic_sleep_timer_24dp" />
<ImageButton
android:id="@+id/sleep_timer_cancel_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="8dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
android:visibility="gone"
app:srcCompat="@drawable/ic_clear_24dp" />
</LinearLayout>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/sleep_timer_remaining_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
android:textColor="@color/player_sheet_text_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/detailed_controls_row"
tools:text="15:00" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/station_list"
android:layout_width="0dp"
android:layout_height="0dp"
android:clipToPadding="false"
android:paddingBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.7" />
<LinearLayout
android:id="@+id/dialog_button_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/guideline"
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="@+id/dialog_positive_button"
style="@style/Widget.Material3.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dialog_find_station_button_add" />
<Button
android:id="@+id/dialog_negative_button"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/dialog_generic_button_cancel" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<androidx.appcompat.widget.SearchView
android:id="@+id/station_search_box_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:iconifiedByDefault="false"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:queryHint="@string/dialog_find_station_hint" />
<ProgressBar
android:id="@+id/search_request_progress_indicator"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="@+id/station_search_box_view"
app:layout_constraintStart_toStartOf="@+id/station_search_box_view"
app:layout_constraintTop_toBottomOf="@+id/station_search_box_view" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/no_results_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dialog_find_station_no_results"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
android:visibility="gone"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/search_request_progress_indicator" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/station_search_result_list"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="8dp"
android:clipToPadding="false"
android:paddingBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/no_results_text_view" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.7" />
<!-- Right side: Actions -->
<LinearLayout
android:id="@+id/dialog_button_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/guideline"
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="@+id/dialog_positive_button"
style="@style/Widget.Material3.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dialog_find_station_button_add" />
<Button
android:id="@+id/dialog_negative_button"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/dialog_generic_button_cancel" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="800dp"
android:layout_height="wrap_content"
android:padding="24dp">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/dialog_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dialog_error_message_default"
android:textAppearance="@style/TextAppearance.Material3.HeadlineSmall"
android:textColor="@color/text_default"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/dialog_error_message_default" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/dialog_details_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:focusable="true"
android:clickable="true"
android:background="?attr/selectableItemBackground"
android:padding="8dp"
android:text="@string/dialog_generic_details_button"
android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
android:textColor="@color/text_default"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dialog_message"
tools:text="@string/dialog_generic_details_button" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/dialog_details"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:focusable="true"
android:clickable="true"
android:scrollbars="vertical"
android:text="@string/dialog_opml_import_details_default"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
android:textColor="@color/text_default"
android:textIsSelectable="true"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dialog_details_link"
tools:text="@string/dialog_opml_import_details_default" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="24dp">
<TextView
android:id="@+id/dialog_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_title"
android:textSize="24sp"
android:textStyle="bold"
android:paddingBottom="16dp" />
<RadioGroup
android:id="@+id/theme_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/radio_theme_follow_system"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_mode_device_default"
android:textSize="20sp"
android:padding="12dp"
android:focusable="true"
android:clickable="true" />
<RadioButton
android:id="@+id/radio_theme_light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_mode_light"
android:textSize="20sp"
android:padding="12dp"
android:focusable="true"
android:clickable="true" />
<RadioButton
android:id="@+id/radio_theme_dark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_mode_dark"
android:textSize="20sp"
android:padding="12dp"
android:focusable="true"
android:clickable="true" />
</RadioGroup>
</LinearLayout>

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:focusable="true"
android:clickable="true"
android:nextFocusRight="@+id/dialog_positive_button"
android:background="@drawable/selector_search_result_item">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/station_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.Material3.TitleLarge"
android:textColor="@color/text_default"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Station Name" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/station_url"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
android:textColor="@color/text_lightweight"
app:layout_constraintEnd_toEndOf="@+id/station_name"
app:layout_constraintStart_toStartOf="@+id/station_name"
app:layout_constraintTop_toBottomOf="@+id/station_name"
tools:text="http://stream.url" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/station_bitrate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
android:textColor="@color/text_lightweight"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/station_url"
app:layout_constraintStart_toStartOf="@+id/station_url"
app:layout_constraintTop_toBottomOf="@+id/station_url"
tools:text="128 kbps" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View File

@@ -0,0 +1,206 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/station_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:clipToPadding="false"
android:padding="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<include
layout="@layout/element_onboarding"
android:visibility="gone" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ScrollView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.2"
android:background="@color/player_sheet_background"
android:fillViewport="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/player_ui"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="24dp">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/station_icon"
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_marginTop="16dp"
android:background="@drawable/shape_cover_small"
android:contentDescription="@string/descr_player_station_image"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shapeAppearanceOverlay="@style/RoundedCorners"
app:srcCompat="@drawable/ic_default_station_image_72dp" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/player_station_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.Material3.HeadlineMedium"
android:textColor="@color/player_sheet_text_main"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/station_icon"
tools:text="Station Name" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/player_station_metadata"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:ellipsize="end"
android:singleLine="true"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
android:textColor="@color/player_sheet_text_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/player_station_name"
tools:text="Artist - Title" />
<LinearLayout
android:id="@+id/controls_row"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/player_station_metadata">
<ImageButton
android:id="@+id/player_prev_button"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginEnd="16dp"
android:background="@drawable/selector_generic_button_focus"
android:contentDescription="@string/descr_expanded_player_metadata_previous_button"
android:focusable="true"
android:padding="12dp"
app:srcCompat="@drawable/ic_chevron_left_24dp" />
<ImageButton
android:id="@+id/player_play_button"
android:layout_width="80dp"
android:layout_height="80dp"
android:background="@drawable/selector_play_button"
android:contentDescription="@string/descr_player_playback_button"
android:focusable="true"
android:scaleType="center"
app:srcCompat="@drawable/ic_player_play_symbol_42dp" />
<ImageButton
android:id="@+id/player_next_button"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginStart="16dp"
android:background="@drawable/selector_generic_button_focus"
android:contentDescription="@string/descr_expanded_player_metadata_next_button"
android:focusable="true"
android:padding="12dp"
app:srcCompat="@drawable/ic_chevron_right_24dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/secondary_controls_row"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/controls_row">
<ImageButton
android:id="@+id/copy_station_metadata_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginEnd="12dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
android:padding="8dp"
app:srcCompat="@drawable/ic_copy_content_24dp"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@+id/sleep_timer_start_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginEnd="12dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
android:padding="8dp"
app:srcCompat="@drawable/ic_sleep_timer_24dp"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@+id/sleep_timer_cancel_button"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/selector_generic_button_focus"
android:focusable="true"
android:padding="8dp"
android:visibility="gone"
app:srcCompat="@drawable/ic_clear_24dp"
tools:ignore="ContentDescription" />
</LinearLayout>
<ProgressBar
android:id="@+id/player_buffering_indicator"
style="?android:attr/progressBarStyleLarge"
android:layout_width="96dp"
android:layout_height="96dp"
android:indeterminateTint="@color/player_button_buffering"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/controls_row"
app:layout_constraintEnd_toEndOf="@+id/controls_row"
app:layout_constraintStart_toStartOf="@+id/controls_row"
app:layout_constraintTop_toTopOf="@+id/controls_row" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/sleep_timer_remaining_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
android:textColor="@color/player_sheet_text_main"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/secondary_controls_row"
tools:text="15:00" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</LinearLayout>

View File

@@ -29,4 +29,49 @@
app:layout_constraintTop_toBottomOf="@+id/main_toolbar"
app:navGraph="@navigation/nav_graph_main" />
<!-- SPLASH / LOADING SCREEN -->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/loading_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/splashBackgroundColor"
android:elevation="10dp"
android:visibility="visible">
<ImageView
android:id="@+id/loading_logo"
android:layout_width="160dp"
android:layout_height="160dp"
android:contentDescription="@string/icon_launcher"
android:src="@mipmap/ic_launcher"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="@string/loading"
android:textAppearance="@style/TextAppearance.Material3.HeadlineSmall"
android:textColor="@color/default_neutral_white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/loading_logo" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:indeterminate="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/loading_logo"
android:visibility="invisible" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -12,6 +12,8 @@
android:layout_marginStart="8dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="24dp"
android:focusable="true"
android:clickable="true"
android:stateListAnimator="@null"
app:backgroundTint="@color/list_card_background"
app:icon="@drawable/ic_add_24dp"
@@ -28,6 +30,8 @@
android:layout_marginTop="10dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="24dp"
android:focusable="true"
android:clickable="true"
android:stateListAnimator="@null"
app:backgroundTint="@color/list_card_background"
app:icon="@drawable/ic_settings_24dp"

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/dialog_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_title"
android:textSize="18sp"
android:textStyle="bold"
android:paddingBottom="12dp" />
<RadioGroup
android:id="@+id/theme_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/radio_theme_follow_system"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_mode_device_default"
android:textSize="16sp"
android:padding="8dp"/>
<RadioButton
android:id="@+id/radio_theme_light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_mode_light"
android:textSize="16sp"
android:padding="8dp"/>
<RadioButton
android:id="@+id/radio_theme_dark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pref_theme_selection_mode_dark"
android:textSize="16sp"
android:padding="8dp"/>
</RadioGroup>
</LinearLayout>

View File

@@ -65,7 +65,7 @@
<string name="pref_edit_station_title">Rediger station</string>
<string name="pref_general_title">Generelt</string>
<string name="pref_license_title">Denne app er open source</string>
<string name="pref_license_summary">Licenseret under MIT-licensen</string>
<string name="pref_license_summary">Licenseret under GPLv3-licensen</string>
<string name="pref_links_title">Links</string>
<string name="pref_m3u_export_summary">Gem stationer som M3U-playlister til brug i andre afspillere.</string>
<string name="pref_m3u_export_title">Eksportér M3U-playliste</string>

View File

@@ -70,7 +70,7 @@
<string name="pref_edit_station_title">Sender bearbeiten</string>
<string name="pref_general_title">Allgemein</string>
<string name="pref_license_title">Diese Anwendung ist Open Source</string>
<string name="pref_license_summary">Lizenziert unter der MIT License</string>
<string name="pref_license_summary">Lizenziert unter der GPLv3 License</string>
<string name="pref_links_title">Links</string>
<string name="pref_m3u_export_summary">Radiosender in einer M3U-Playlistdatei sichern, die in andere Player importiert werden können.</string>
<string name="pref_m3u_export_title">M3U-Playlist exportieren</string>

View File

@@ -63,7 +63,7 @@
<string name="pref_edit_station_title">Επεξεργασία Σταθμών</string>
<string name="pref_general_title">Γενικές ρυθμίσεις</string>
<string name="pref_license_title">Αυτή η εφαρμογή είναι ανοικτού κώδικα</string>
<string name="pref_license_summary">Αδειοδότηση με άδεια MIT</string>
<string name="pref_license_summary">Αδειοδότηση με άδεια GPLv3</string>
<string name="pref_links_title">Σύνδεσμοι</string>
<string name="pref_m3u_export_summary">Αποθηκεύστε τους ραδιοφωνικούς σας σταθμούς σε ένα αρχείο λίστας αναπαραγωγής M3U που μπορεί να εισαχθεί σε άλλους αναπαραγωγούς.</string>
<string name="pref_m3u_export_title">Εξαγωγή M3U</string>

View File

@@ -65,7 +65,7 @@
<string name="pref_edit_station_title">Modifier la station</string>
<string name="pref_general_title">Général</string>
<string name="pref_license_title">Cette application est Open Source</string>
<string name="pref_license_summary">Sous licence MIT</string>
<string name="pref_license_summary">Sous licence GPLv3</string>
<string name="pref_links_title">Liens</string>
<string name="pref_m3u_export_summary">Enregistrez les stations dans un fichier de playlist M3U pouvant être importé dans dautres lecteurs.</string>
<string name="pref_m3u_export_title">Exporter la playlist M3U</string>

View File

@@ -65,7 +65,7 @@
<string name="pref_edit_station_title">局を編集</string>
<string name="pref_general_title">一般</string>
<string name="pref_license_title">このアプリはオープンソースです</string>
<string name="pref_license_summary">MITライセンスで提供されています</string>
<string name="pref_license_summary">GPLv3ライセンスで提供されています</string>
<string name="pref_links_title">リンク</string>
<string name="pref_m3u_export_summary">ラジオ局をM3Uプレイリストとして保存し、他のプレイヤーにインポートできます。</string>
<string name="pref_m3u_export_title">M3Uプレイリストをエクスポート</string>

View File

@@ -11,6 +11,9 @@
<item name="colorOnSurfaceVariant">@android:color/system_accent1_100</item>
<item name="android:colorBackground">@android:color/system_neutral1_900</item>
<item name="android:textColorHighlight">@android:color/system_accent1_500</item>
<item name="colorControlHighlight">#33FFFFFF</item>
<item name="android:colorControlHighlight">#33FFFFFF</item>
<item name="android:colorFocusedHighlight">#80FFFFFF</item>
<!-- Do not use primary colored elevation overlays to present a visual hierarchy - TOO COLORFUL -->
<item name="elevationOverlayEnabled">false</item>
@@ -39,6 +42,7 @@
<item name="colorSurface">@color/player_sheet_background</item>
<item name="materialAlertDialogBodyTextStyle">@style/TextAppearance.MaterialComponents.Body1</item>
<item name="android:backgroundDimAmount">0.64</item>
<item name="colorControlActivated">#FFDAE2FF</item>
</style>
<style name="ThemeOverlay.App.TimePicker" parent="ThemeOverlay.MaterialComponents.TimePicker">
@@ -49,5 +53,12 @@
<item name="android:background">@color/player_sheet_background</item>
<item name="dialogCornerRadius">28dp</item>
<item name="checkedTextViewStyle">@style/AlertDialog.TextColor</item>
<item name="colorControlActivated">#FFDAE2FF</item>
<item name="colorControlHighlight">#33FFFFFF</item>
<item name="android:colorFocusedHighlight">#80FFFFFF</item>
</style>
</resources>
<style name="AlertDialog.TextColor" parent="@style/TextAppearance.MaterialComponents.Body1">
<item name="android:textColor">?attr/colorControlNormal</item>
</style>
</resources>

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- NIGHT THEME COLORS -->

View File

@@ -7,6 +7,9 @@
<item name="colorAccent">#FFDAE2FF</item>
<item name="colorOnPrimary">#FF182E60</item>
<item name="android:textColorHighlight">#FF495D92</item>
<item name="colorControlHighlight">#33FFFFFF</item>
<item name="android:colorControlHighlight">#33FFFFFF</item>
<item name="android:colorFocusedHighlight">#80FFFFFF</item>
<!-- Do not use primary colored elevation overlays to present a visual hierarchy - TOO COLORFUL -->
<item name="elevationOverlayEnabled">false</item>

View File

@@ -63,7 +63,7 @@
<string name="pref_edit_station_title">Редактировать станции</string>
<string name="pref_general_title">Общие</string>
<string name="pref_license_title">Это приложение с открытым исходным кодом</string>
<string name="pref_license_summary">Лицензировано под лицензией MIT</string>
<string name="pref_license_summary">Лицензировано под лицензией GPLv3</string>
<string name="pref_links_title">Ссылки</string>
<string name="pref_m3u_export_summary">Сохраните ваши радиостанции в файл плейлиста M3U, который можно импортировать в другие проигрыватели.</string>
<string name="pref_m3u_export_title">Экспорт M3U</string>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SplashTheme" parent="Theme.Material3.DayNight.NoActionBar">
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:statusBarColor">@color/splashBackgroundColor</item>
<item name="android:navigationBarColor">@color/splashBackgroundColor</item>
</style>
</resources>

View File

@@ -63,7 +63,7 @@
<string name="pref_edit_station_title">Редагувати станції</string>
<string name="pref_general_title">Загальні</string>
<string name="pref_license_title">Цей застосунок має відкритий початковий код</string>
<string name="pref_license_summary">На умовах ліцензії MIT</string>
<string name="pref_license_summary">На умовах ліцензії GPLv3</string>
<string name="pref_links_title">Посилання</string>
<string name="pref_m3u_export_summary">Збережіть свої радіостанції у файлі списку відтворення M3U, який можна імпортувати в інші програвачі.</string>
<string name="pref_m3u_export_title">Експорт M3U</string>

View File

@@ -6,6 +6,9 @@
<item name="colorPrimary">#FF495D92</item>
<item name="colorAccent">#FF495D92</item>
<item name="android:textColorHighlight">#FF495D92</item>
<item name="colorControlHighlight">#33000000</item>
<item name="android:colorControlHighlight">#33000000</item>
<item name="android:colorFocusedHighlight">#80000000</item>
<!-- Do not use primary colored elevation overlays to present a visual hierarchy - TOO COLORFUL -->
<item name="elevationOverlayEnabled">false</item>

View File

@@ -11,6 +11,9 @@
<item name="colorOnSurfaceVariant">@android:color/system_accent1_600</item>
<item name="android:colorBackground">@android:color/system_neutral2_10</item>
<item name="android:textColorHighlight">@android:color/system_accent1_200</item>
<item name="colorControlHighlight">#22000000</item>
<item name="android:colorControlHighlight">#22000000</item>
<item name="android:colorFocusedHighlight">#66000000</item>
<!-- Do not use primary colored elevation overlays to present a visual hierarchy - TOO COLORFUL -->
<item name="elevationOverlayEnabled">false</item>
@@ -38,6 +41,8 @@
<item name="colorSurface">@color/list_card_background</item>
<item name="materialAlertDialogBodyTextStyle">@style/TextAppearance.MaterialComponents.Body1</item>
<item name="android:backgroundDimAmount">0.64</item>
<item name="colorControlHighlight">#22000000</item>
<item name="android:colorFocusedHighlight">#66000000</item>
</style>
<style name="ThemeOverlay.App.TimePicker" parent="ThemeOverlay.MaterialComponents.TimePicker">

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- DAY THEME COLORS -->
@@ -16,6 +15,7 @@
<!-- list -->
<color name="list_card_background">#FFFEFBFF</color>
<color name="list_card_stroke_background">#FFC0C6DD</color>
<color name="list_card_stroke_focused">#FF495D92</color>
<color name="list_card_cover_background">#FFE7E0EC</color>
<color name="list_card_delete_background">#FFB3261E</color>
<color name="list_card_delete_icon">#FFFFFFFF</color>

View File

@@ -80,7 +80,7 @@
<string name="pref_github_title" translatable="false">GitHub</string>
<string name="pref_github_summary" translatable="false">github.com/michatec/Radio</string>
<string name="pref_license_title">This application is open source</string>
<string name="pref_license_summary">Licensed under the MIT License</string>
<string name="pref_license_summary">Licensed under the GPLv3 License</string>
<string name="pref_links_title">Links</string>
<string name="pref_m3u_export_summary">Save your radio stations to an M3U playlist file that can be imported into other players.</string>
<string name="pref_m3u_export_title">Export M3U</string>
@@ -140,4 +140,6 @@
<string name="snackbar_url_app_home_page" translatable="false">https://github.com/michatec/Radio/releases/latest</string>
<string name="snackbar_github_update_check_url" translatable="false">https://api.github.com/repos/michatec/Radio/releases/latest</string>
<string name="app_name" translatable="false">Radio</string>
<string name="icon_launcher" translatable="false">Icon launcher.</string>
<string name="loading">Loading...</string>
</resources>

View File

@@ -2,29 +2,24 @@
<resources>
<style name="AppTheme" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Set AppCompats colors -->
<item name="colorPrimary">#FF495D92</item>
<item name="colorAccent">#FF495D92</item>
<item name="android:textColorHighlight">#FF495D92</item>
<!-- Do not use primary colored elevation overlays to present a visual hierarchy - TOO COLORFUL -->
<item name="elevationOverlayEnabled">false</item>
<!-- Switch Theming -->
<item name="colorControlActivated">#FFDAE2FF</item>
<item name="switchPreferenceCompatStyle">@style/Preference.SwitchPreferenceCompat.Material3</item>
<!-- Material Alert Dialog Theming -->
<item name="materialAlertDialogTheme">@style/ThemeOverlay.App.MaterialAlertDialog</item>
<item name="alertDialogTheme">@style/ThemeOverlay.App.AlertDialogTheme</item>
<!-- Material Time Picker Theming -->
<item name="materialTimePickerTheme">@style/ThemeOverlay.App.TimePicker</item>
<!-- Use "light" Status Bar -->
<item name="android:windowLightStatusBar">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="colorControlHighlight">#80000000</item>
<item name="android:colorControlHighlight">#80000000</item>
<item name="android:colorFocusedHighlight">#FF333333</item>
</style>
<style name="SplashTheme" parent="AppTheme" />
<style name="Preference.SwitchPreferenceCompat.Material3" parent="@style/Preference.SwitchPreferenceCompat.Material">
<item name="widgetLayout">@layout/preference_switch</item>
</style>
@@ -38,7 +33,13 @@
<style name="ThemeOverlay.App.AlertDialogTheme" parent="@style/ThemeOverlay.Material3.MaterialAlertDialog">
<item name="android:background">@color/list_card_background</item>
<item name="dialogCornerRadius">28dp</item>
<item name="checkedTextViewStyle">@style/AlertDialog.TextColor</item>
<!-- TV Fix: Explicitly set accent color for radio buttons/checkboxes -->
<item name="colorAccent">@color/icon_default</item>
<item name="colorControlActivated">@color/icon_default</item>
<item name="android:textColorPrimary">@color/text_default</item>
<item name="android:textColorSecondary">@color/text_lightweight</item>
<item name="colorControlHighlight">#80000000</item>
<item name="android:colorFocusedHighlight">#FF333333</item>
</style>
<style name="ThemeOverlay.App.TimePicker" parent="ThemeOverlay.MaterialComponents.TimePicker">
@@ -46,13 +47,16 @@
</style>
<style name="AlertDialog.TextColor" parent="@style/TextAppearance.MaterialComponents.Body1">
<item name="android:textColor">?attr/colorControlNormal</item>
<item name="android:textColor">@color/text_default</item>
</style>
<style name="App.Widget.Material3.CardView.Outlined" parent="@style/Widget.Material3.CardView.Outlined">
<item name="strokeColor">@color/list_card_stroke_background</item>
<item name="strokeWidth">3dp</item>
<item name="strokeColor">@color/selector_card_station_stroke</item>
<item name="strokeWidth">4dp</item>
<item name="cardCornerRadius">24dp</item>
<item name="android:focusable">true</item>
<item name="android:clickable">true</item>
<item name="android:descendantFocusability">afterDescendants</item>
</style>
<style name="App.Widget.MaterialComponents.TextView" parent="@style/Widget.MaterialComponents.TextView">

View File

@@ -1,11 +1,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '9.0.1' apply false
id 'com.android.library' version '9.0.1' apply false
id 'org.jetbrains.kotlin.android' version "2.3.10" apply false
alias libs.plugins.android.application apply false
alias libs.plugins.android.library apply false
alias libs.plugins.jetbrains.kotlin.android apply false
}
tasks.register('clean', Delete) {
delete rootProject.buildDir()
}
}

42
gradle/libs.versions.toml Normal file
View File

@@ -0,0 +1,42 @@
[versions]
activityKtx = "1.13.0"
agp = "9.1.0"
coreKtx = "1.18.0"
freedroidwarn = "V1.10"
gson = "2.13.2"
kotlin = "2.3.20"
leanback = "1.2.0"
material = "1.13.0"
material3 = "1.4.0"
media = "1.7.1"
media3 = "1.10.0"
navigation = "2.9.7"
paletteKtx = "1.0.0"
preferenceKtx = "1.2.1"
volley = "1.2.1"
workRuntimeKtx = "2.11.2"
[libraries]
activity-ktx = { group = "androidx.activity", name = "activity-ktx", version.ref = "activityKtx" }
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
freedroidwarn = { group = "com.github.woheller69", name = "FreeDroidWarn", version.ref = "freedroidwarn" }
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
leanback = { group = "androidx.leanback", name = "leanback", version.ref = "leanback" }
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
media = { group = "androidx.media", name = "media", version.ref = "media" }
media3-datasource-okhttp = { group = "androidx.media3", name = "media3-datasource-okhttp", version.ref = "media3" }
media3-exoplayer = { group = "androidx.media3", name = "media3-exoplayer", version.ref = "media3" }
media3-exoplayer-hls = { group = "androidx.media3", name = "media3-exoplayer-hls", version.ref = "media3" }
media3-session = { group = "androidx.media3", name = "media3-session", version.ref = "media3" }
navigation-fragment-ktx = { group = "androidx.navigation", name = "navigation-fragment-ktx", version.ref = "navigation" }
navigation-ui-ktx = { group = "androidx.navigation", name = "navigation-ui-ktx", version.ref = "navigation" }
palette-ktx = { group = "androidx.palette", name = "palette-ktx", version.ref = "paletteKtx" }
preference-ktx = { group = "androidx.preference", name = "preference-ktx", version.ref = "preferenceKtx" }
volley = { group = "com.android.volley", name = "volley", version.ref = "volley" }
work-runtime-ktx = { group = "androidx.work", name = "work-runtime-ktx", version.ref = "workRuntimeKtx" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

Binary file not shown.

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

2
gradlew vendored
View File

@@ -57,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.

View File

@@ -3,13 +3,19 @@ pluginManagement {
google()
mavenCentral()
gradlePluginPortal()
maven { url 'https://jitpack.io' }
}
}
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}