mirror of
https://github.com/Kurocon/projectivy-booru-wallpaper-provider.git
synced 2025-06-03 06:30:20 +00:00
Initial commit
This commit is contained in:
commit
2a6c87df54
33
.gitignore
vendored
Normal file
33
.gitignore
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Gradle files
|
||||
.gradle/
|
||||
build/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
|
||||
# Log/OS Files
|
||||
*.log
|
||||
|
||||
# Android Studio generated files and folders
|
||||
captures/
|
||||
.externalNativeBuild/
|
||||
.cxx/
|
||||
*.apk
|
||||
output.json
|
||||
|
||||
# IntelliJ
|
||||
*.iml
|
||||
.idea/
|
||||
misc.xml
|
||||
deploymentTargetDropDown.xml
|
||||
render.experimental.xml
|
||||
|
||||
# Keystore files
|
||||
*.jks
|
||||
*.keystore
|
||||
|
||||
# Google Services (e.g. APIs or Firebase)
|
||||
google-services.json
|
||||
|
||||
# Android Profiling
|
||||
*.hprof
|
201
LICENSE
Normal file
201
LICENSE
Normal file
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
46
README.md
Normal file
46
README.md
Normal file
|
@ -0,0 +1,46 @@
|
|||
# Projectivy Plugin : Wallpaper Provider
|
||||
|
||||
This is a sample project for developing a wallpaper provider plugin for Projectivy Launcher.
|
||||
- /sample : sample code for the plugin service and its setting activity
|
||||
- /api : api used to communicate with Projectivy through AIDL (don't change it)
|
||||
- Version: 1
|
||||
|
||||
# Usage
|
||||
- fork/clone the repo
|
||||
- adapt the sample manifest according to your needs (at least modify the unique id)
|
||||
- customize the Wallpaper provider service and Settings fragment
|
||||
|
||||
# Manifest parameters
|
||||
- apiVersion: api version used in your code. Projectivy will use it to detect if your plugin is compatible with its own code
|
||||
- uuid: unique id (format : UUID V4) used to identify your plugin. *You must generate one*
|
||||
- name: plugin name as displayed in Projectivy plugins list
|
||||
- settingsActivity: class name of your settings activity. Projectivy will launch it when users click on settings button
|
||||
- itemsCacheDurationMillis: how long should Projectivy keep the last wallpapers returned by this plugin before considering them expired
|
||||
- updateMode: int representing the events your plugin is interested in. This should be a combination of TIME_ELAPSED, NOW_PLAYING_CHANGED, CARD_FOCUSED, PROGRAM_CARD_FOCUSED, LAUNCHER_IDLE_MODE_CHANGED (check class WallpaperUpdateEventType)
|
||||
|
||||
# How it works
|
||||
## Timer event
|
||||
For standard wallpaper providers such as the stock Reddit wallpaper provider, the wallpapers will change according to time events.
|
||||
First, Projectivy will request wallpaper(s) to the provider selected in the settings, and keep them in cache for itemsCacheDurationMillis.
|
||||
Then, each X minutes (depending on user settings), Projectivy will refresh the wallpaper by fetching a random one in its cache.
|
||||
When itemsCacheDurationMillis has expired, Projectivy will ask the plugin again.
|
||||
|
||||
## Other events
|
||||
Other events might lead to wallpaper requests if you set the corresponding updateMode (in that case, there is no cache on Projectivy side, these events are considered dynamic and only the provider knows how to react).
|
||||
- card focused: each time a card is focused (used by the stock "dynamic colors" wallpaper provider)
|
||||
- program card focused: each time a program card is focused (used by the stock "current focused program" wallpaper provider)
|
||||
- now playing changed: each time the "now playing" metadata has changed (could be used to set wallpaper according to the music currently playing)
|
||||
- launcher idle mode changed: when Projectivy enters/exits launcher idle mode
|
||||
|
||||
Each of these events will lead to a call to getWallpapers() depending on your updateMode. They will also provide this function an object containing details regarding this particular event (check the Event class for more details)
|
||||
|
||||
# Hints
|
||||
- Be responsible : even though getWallpapers() isn't called from the UI thread, it doesn't mean you can waste precious device resources (keep in mind that many Android Tv devices have less memory or cpu power than most smartphones).
|
||||
- If you're fetching wallpapers from an external source, consider using an http cache to prevent flooding it with requests.
|
||||
- Don't request an update mode you won't use. This is particularly true with card focused events. Those requests might be sent each second or so when a user navigates in the launcher.
|
||||
- Take advantage of the itemsCacheDurationMillis to limit requests to your plugin and leverage Projectivy's cache (the stock "Reddit" wallpaper provider uses a 12h cache, meaning you will cycle through the same wallpapers for 12 hours before they are updated)
|
||||
- Don't send to many wallpapers to Projectivy: it will cache them and only use them for itemsCacheDurationMillis, so this will waste memory
|
||||
- Respect authors : the wallpaper class allows you to define an author and source uri, fill them to give credit when possible
|
||||
|
||||
# Note
|
||||
This sample is provided as is. It is by no means perfect and should serve as a quick start.
|
1
api/.gitignore
vendored
Normal file
1
api/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
47
api/build.gradle.kts
Normal file
47
api/build.gradle.kts
Normal file
|
@ -0,0 +1,47 @@
|
|||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("kotlin-parcelize")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "tv.projectivy.plugin.wallpaperprovider.api"
|
||||
compileSdk = 35
|
||||
|
||||
defaultConfig {
|
||||
minSdk = 23
|
||||
|
||||
consumerProguardFiles("consumer-rules.pro")
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
aidl = true
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.JVM_17)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("androidx.core:core-ktx:1.13.1")
|
||||
implementation("androidx.appcompat:appcompat:1.7.0")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
}
|
0
api/consumer-rules.pro
Normal file
0
api/consumer-rules.pro
Normal file
21
api/proguard-rules.pro
vendored
Normal file
21
api/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
4
api/src/main/AndroidManifest.xml
Normal file
4
api/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,4 @@
|
|||
// Wallpaper.aidl
|
||||
package tv.projectivy.plugin.wallpaperprovider.api;
|
||||
|
||||
parcelable Event;
|
|
@ -0,0 +1,11 @@
|
|||
// IWallpaperProviderService.aidl
|
||||
package tv.projectivy.plugin.wallpaperprovider.api;
|
||||
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.Wallpaper;
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.Event;
|
||||
|
||||
interface IWallpaperProviderService {
|
||||
List<Wallpaper> getWallpapers(in Event event);
|
||||
String getPreferences();
|
||||
void setPreferences(String params);
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
// Wallpaper.aidl
|
||||
package tv.projectivy.plugin.wallpaperprovider.api;
|
||||
|
||||
parcelable Wallpaper;
|
|
@ -0,0 +1,68 @@
|
|||
package tv.projectivy.plugin.wallpaperprovider.api
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import androidx.annotation.IntDef
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperUpdateEventType.Companion.CARD_FOCUSED
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperUpdateEventType.Companion.LAUNCHER_IDLE_MODE_CHANGED
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperUpdateEventType.Companion.NOW_PLAYING_CHANGED
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperUpdateEventType.Companion.PROGRAM_CARD_FOCUSED
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperUpdateEventType.Companion.TIME_ELAPSED
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@IntDef(TIME_ELAPSED, NOW_PLAYING_CHANGED, CARD_FOCUSED, PROGRAM_CARD_FOCUSED, LAUNCHER_IDLE_MODE_CHANGED)
|
||||
annotation class WallpaperUpdateEventType {
|
||||
companion object {
|
||||
const val TIME_ELAPSED = 1
|
||||
const val NOW_PLAYING_CHANGED = 2
|
||||
const val CARD_FOCUSED = 4
|
||||
const val PROGRAM_CARD_FOCUSED = 8
|
||||
const val LAUNCHER_IDLE_MODE_CHANGED = 16
|
||||
}
|
||||
}
|
||||
|
||||
sealed class Event(open val eventType: Int) : Parcelable {
|
||||
|
||||
companion object CREATOR : Parcelable.Creator<Event> {
|
||||
override fun createFromParcel(parcel: Parcel): Event? {
|
||||
val initialDataPosition = parcel.dataPosition() // save current data position
|
||||
val eventType = parcel.readInt() // get the Event type for dynamic creation
|
||||
parcel.setDataPosition(initialDataPosition) // reset position to let the specialized CREATOR read from start
|
||||
|
||||
return when(eventType) {
|
||||
TIME_ELAPSED -> createEventFromParcel(parcel, TimeElapsed::class.java)
|
||||
NOW_PLAYING_CHANGED -> createEventFromParcel(parcel, NowPlayingChanged::class.java)
|
||||
CARD_FOCUSED -> createEventFromParcel(parcel, CardFocused::class.java)
|
||||
PROGRAM_CARD_FOCUSED -> createEventFromParcel(parcel, ProgramCardFocused::class.java)
|
||||
LAUNCHER_IDLE_MODE_CHANGED -> createEventFromParcel(parcel, LauncherIdleModeChanged::class.java)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
override fun newArray(size: Int): Array<Event?> {
|
||||
return arrayOfNulls(size)
|
||||
}
|
||||
|
||||
private fun <T> createEventFromParcel(parcel: Parcel, clazz: Class<T>): T {
|
||||
val creatorField = clazz.getField("CREATOR")
|
||||
val creator = creatorField.get(null) as Parcelable.Creator<*>
|
||||
return creator.createFromParcel(parcel) as T
|
||||
}
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
data class TimeElapsed(override val eventType: Int = TIME_ELAPSED): Event(eventType)
|
||||
@Parcelize
|
||||
data class NowPlayingChanged(override val eventType: Int = NOW_PLAYING_CHANGED, val isPlaying: Boolean = true, val title: String?=null, val artist: String?=null, val album: String?=null, val iconUri: String?=null): Event(eventType)
|
||||
@Parcelize
|
||||
data class CardFocused(override val eventType: Int = CARD_FOCUSED, val lightColor: Int=0, val darkColor: Int=0): Event(eventType)
|
||||
// type refers to TYPE_* in TvContractCompat.PreviewProgramColumns
|
||||
@Parcelize
|
||||
data class ProgramCardFocused(override val eventType: Int = PROGRAM_CARD_FOCUSED, val title: String?=null, val type: Int?=null, val iconUri: String?=null, val iconAspectRatio: Int=0): Event(eventType)
|
||||
@Parcelize
|
||||
data class LauncherIdleModeChanged(override val eventType: Int = LAUNCHER_IDLE_MODE_CHANGED, val isIdle: Boolean = true): Event(eventType)
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package tv.projectivy.plugin.wallpaperprovider.api
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.annotation.IntDef
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperDisplayMode.Companion.BLUR
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperDisplayMode.Companion.CROP
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperDisplayMode.Companion.DEFAULT
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperDisplayMode.Companion.STRETCH
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperType.Companion.ANIMATED_DRAWABLE
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperType.Companion.DRAWABLE
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperType.Companion.IMAGE
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperType.Companion.LOTTIE
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperType.Companion.VIDEO
|
||||
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@IntDef(IMAGE, DRAWABLE, ANIMATED_DRAWABLE, LOTTIE, VIDEO)
|
||||
annotation class WallpaperType {
|
||||
companion object {
|
||||
const val IMAGE = 0
|
||||
const val DRAWABLE = 1
|
||||
const val ANIMATED_DRAWABLE = 2
|
||||
const val LOTTIE = 3
|
||||
const val VIDEO = 4
|
||||
}
|
||||
}
|
||||
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.VALUE_PARAMETER)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@IntDef(DEFAULT, CROP, STRETCH, BLUR)
|
||||
annotation class WallpaperDisplayMode {
|
||||
companion object {
|
||||
const val DEFAULT = 0
|
||||
const val CROP = 1
|
||||
const val STRETCH = 2
|
||||
const val BLUR = 3
|
||||
}
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
data class Wallpaper(
|
||||
val uri: String,
|
||||
val type: @WallpaperType Int = IMAGE,
|
||||
val displayMode: @WallpaperDisplayMode Int = CROP,
|
||||
val title: String? = null,
|
||||
val source: String? = null,
|
||||
val author: String? = null,
|
||||
val actionUri: String? = null
|
||||
) : Parcelable
|
6
build.gradle.kts
Normal file
6
build.gradle.kts
Normal file
|
@ -0,0 +1,6 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id("com.android.application") version "8.7.0" apply false
|
||||
id("com.android.library") version "8.7.0" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.0.20" apply false
|
||||
}
|
23
gradle.properties
Normal file
23
gradle.properties
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
||||
# Enables namespacing of each library's R class so that its R class includes only the
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
#Sun Dec 31 14:34:51 CET 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
185
gradlew
vendored
Normal file
185
gradlew
vendored
Normal file
|
@ -0,0 +1,185 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
89
gradlew.bat
vendored
Normal file
89
gradlew.bat
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
1
sample/.gitignore
vendored
Normal file
1
sample/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
49
sample/build.gradle.kts
Normal file
49
sample/build.gradle.kts
Normal file
|
@ -0,0 +1,49 @@
|
|||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "tv.projectivy.plugin.wallpaperprovider.sample"
|
||||
compileSdk = 35
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "tv.projectivy.plugin.wallpaperprovider.sample"
|
||||
minSdk = 23
|
||||
targetSdk = 35
|
||||
versionCode = 1
|
||||
versionName = "1.01"
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.JVM_17)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("androidx.core:core-ktx:1.13.1")
|
||||
implementation("androidx.leanback:leanback:1.2.0-alpha04")
|
||||
implementation("androidx.appcompat:appcompat:1.7.0")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
implementation("androidx.preference:preference-ktx:1.2.1")
|
||||
implementation("com.google.code.gson:gson:2.11.0")
|
||||
implementation(project(":api"))
|
||||
}
|
21
sample/proguard-rules.pro
vendored
Normal file
21
sample/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
82
sample/src/main/AndroidManifest.xml
Normal file
82
sample/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:ignore="MissingLeanbackLauncher">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.software.leanback"
|
||||
android:required="true" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:label="@string/plugin_name"
|
||||
android:supportsRtl="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:banner="@mipmap/ic_banner"
|
||||
android:theme="@style/Theme.ProjectivyWallpaperProvider">
|
||||
<activity
|
||||
android:name=".SettingsActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name=".WallpaperProviderService"
|
||||
android:exported="true"
|
||||
android:label="@string/plugin_name"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:banner="@mipmap/ic_banner"
|
||||
tools:ignore="ExportedService">
|
||||
|
||||
<!-- Mandatory for the plugin to be detected, DO NOT CHANGE -->
|
||||
<intent-filter>
|
||||
<action android:name="tv.projectivy.plugin.WALLPAPER_PROVIDER"/>
|
||||
</intent-filter>
|
||||
|
||||
<!-- Api version this plugin is compatible with -->
|
||||
<meta-data
|
||||
android:name="apiVersion"
|
||||
android:value="1"/>
|
||||
|
||||
<!--Plugin UUID *** YOU NEED TO CHANGE IT *** -->
|
||||
<!--https://www.uuidgenerator.net/version4 -->
|
||||
<meta-data
|
||||
android:name="uuid"
|
||||
android:value="@string/plugin_uuid"/>
|
||||
|
||||
<!-- Plugin name -->
|
||||
<meta-data
|
||||
android:name="name"
|
||||
android:value="@string/plugin_name"/>
|
||||
|
||||
<!-- Plugin activity called by Projectivy to configure it -->
|
||||
<meta-data
|
||||
android:name="settingsActivity"
|
||||
android:value=".SettingsActivity"/>
|
||||
|
||||
<!-- How long should Projectivy keep wallpapers before a new request -->
|
||||
<meta-data
|
||||
android:name="itemsCacheDurationMillis"
|
||||
android:value="@integer/items_cache_duration_millis"/>
|
||||
|
||||
<!-- This sample plugin will receive time_elapsed and launcher_idle_mode_changed events -->
|
||||
<meta-data
|
||||
android:name="updateMode"
|
||||
android:value="17"/>
|
||||
</service>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,86 @@
|
|||
package tv.projectivy.plugin.wallpaperprovider.sample
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.GsonBuilder
|
||||
import com.google.gson.ToNumberPolicy
|
||||
import com.google.gson.reflect.TypeToken
|
||||
|
||||
object PreferencesManager {
|
||||
private const val IMAGE_URL_KEY = "image_url_key"
|
||||
|
||||
lateinit var preferences: SharedPreferences
|
||||
|
||||
fun init(context: Context) {
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
}
|
||||
|
||||
private inline fun SharedPreferences.edit(operation: (SharedPreferences.Editor) -> Unit) {
|
||||
val editor = this.edit()
|
||||
operation(editor)
|
||||
editor.apply()
|
||||
}
|
||||
|
||||
operator fun set(key: String, value: Any?) =
|
||||
when (value) {
|
||||
is String? -> preferences.edit { it.putString(key, value) }
|
||||
is Int -> preferences.edit { it.putInt(key, value) }
|
||||
is Boolean -> preferences.edit { it.putBoolean(key, value) }
|
||||
is Float -> preferences.edit { it.putFloat(key, value) }
|
||||
is Long -> preferences.edit { it.putLong(key, value) }
|
||||
else -> throw UnsupportedOperationException("Not yet implemented")
|
||||
}
|
||||
|
||||
inline operator fun <reified T : Any> get(
|
||||
key: String,
|
||||
defaultValue: T? = null
|
||||
): T =
|
||||
when (T::class) {
|
||||
String::class -> preferences.getString(key, defaultValue as String? ?: "") as T
|
||||
Int::class -> preferences.getInt(key, defaultValue as? Int ?: -1) as T
|
||||
Boolean::class -> preferences.getBoolean(key, defaultValue as? Boolean ?: false) as T
|
||||
Float::class -> preferences.getFloat(key, defaultValue as? Float ?: -1f) as T
|
||||
Long::class -> preferences.getLong(key, defaultValue as? Long ?: -1) as T
|
||||
else -> throw UnsupportedOperationException("Not yet implemented")
|
||||
}
|
||||
|
||||
var imageUrl: String
|
||||
get() = PreferencesManager[IMAGE_URL_KEY, "https://images.pexels.com/photos/462162/pexels-photo-462162.jpeg"]
|
||||
set(value) { PreferencesManager[IMAGE_URL_KEY]=value }
|
||||
|
||||
fun export(): String {
|
||||
return Gson().toJson(preferences.all)
|
||||
}
|
||||
|
||||
fun import(prefs: String): Boolean {
|
||||
val gson = GsonBuilder()
|
||||
.setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE)
|
||||
.create()
|
||||
|
||||
try {
|
||||
val type = object : TypeToken<Map<String, Any>>() {}.type
|
||||
val map = gson.fromJson<Map<String, Any>>(prefs, type)
|
||||
val editor = preferences.edit()
|
||||
editor.clear()
|
||||
map.forEach { (key: String, value: Any) ->
|
||||
when(value) {
|
||||
is Boolean -> editor.putBoolean(key, value)
|
||||
is Double -> editor.putFloat(key, value.toFloat())
|
||||
is Float -> editor.putFloat(key, value)
|
||||
is Int -> editor.putInt(key, value)
|
||||
is Long -> editor.putInt(key, value.toInt())
|
||||
is String -> editor.putString(key, value)
|
||||
is ArrayList<*> -> editor.putStringSet(key, java.util.HashSet(value as java.util.ArrayList<String>))
|
||||
is Set<*> -> editor.putStringSet(key, value as Set<String>)
|
||||
}
|
||||
}
|
||||
editor.apply()
|
||||
} catch (ex: Exception) {
|
||||
ex.printStackTrace()
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package tv.projectivy.plugin.wallpaperprovider.sample
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.leanback.app.GuidedStepSupportFragment
|
||||
|
||||
class SettingsActivity : FragmentActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val fragment: GuidedStepSupportFragment = SettingsFragment()
|
||||
if (savedInstanceState == null) {
|
||||
GuidedStepSupportFragment.addAsRoot(this, fragment, android.R.id.content)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package tv.projectivy.plugin.wallpaperprovider.sample
|
||||
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.leanback.app.GuidedStepSupportFragment
|
||||
import androidx.leanback.widget.GuidanceStylist.Guidance
|
||||
import androidx.leanback.widget.GuidedAction
|
||||
import kotlin.CharSequence
|
||||
|
||||
class SettingsFragment : GuidedStepSupportFragment() {
|
||||
override fun onCreateGuidance(savedInstanceState: Bundle?): Guidance {
|
||||
return Guidance(
|
||||
getString(R.string.plugin_name),
|
||||
getString(R.string.plugin_description),
|
||||
getString(R.string.settings),
|
||||
AppCompatResources.getDrawable(requireActivity(), R.drawable.ic_plugin)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onCreateActions(actions: MutableList<GuidedAction>, savedInstanceState: Bundle?) {
|
||||
PreferencesManager.init(requireContext())
|
||||
|
||||
val currentImageUrl = PreferencesManager.imageUrl
|
||||
val action = GuidedAction.Builder(context)
|
||||
.id(ACTION_ID_IMAGE_URL)
|
||||
.title(R.string.setting_image_url_title)
|
||||
.description(currentImageUrl)
|
||||
.editDescription(currentImageUrl)
|
||||
.descriptionEditable(true)
|
||||
.build()
|
||||
actions.add(action)
|
||||
}
|
||||
|
||||
override fun onGuidedActionClicked(action: GuidedAction) {
|
||||
when (action.id) {
|
||||
ACTION_ID_IMAGE_URL -> {
|
||||
val params: CharSequence? = action.editDescription
|
||||
findActionById(ACTION_ID_IMAGE_URL)?.description = params
|
||||
notifyActionChanged(findActionPositionById(ACTION_ID_IMAGE_URL))
|
||||
PreferencesManager.imageUrl = params.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val ACTION_ID_IMAGE_URL = 1L
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package tv.projectivy.plugin.wallpaperprovider.sample
|
||||
|
||||
import android.app.Service
|
||||
import android.content.ContentResolver
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.IBinder
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.Event
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.IWallpaperProviderService
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.Wallpaper
|
||||
import tv.projectivy.plugin.wallpaperprovider.api.WallpaperType
|
||||
|
||||
class WallpaperProviderService: Service() {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
PreferencesManager.init(this)
|
||||
}
|
||||
|
||||
override fun onBind(intent: Intent): IBinder {
|
||||
// Return the interface.
|
||||
return binder
|
||||
}
|
||||
|
||||
|
||||
private val binder = object : IWallpaperProviderService.Stub() {
|
||||
override fun getWallpapers(event: Event?): List<Wallpaper> {
|
||||
|
||||
return when (event) {
|
||||
is Event.TimeElapsed -> {
|
||||
// This is where you generate the wallpaper list that will be cycled every x minute
|
||||
return listOf(
|
||||
// DRAWABLE can be served from app drawable/
|
||||
Wallpaper(getDrawableUri(R.drawable.ic_banner_drawable).toString(), WallpaperType.DRAWABLE),
|
||||
// IMAGE can be served from app drawable/, local storage or internet
|
||||
Wallpaper(PreferencesManager.imageUrl, WallpaperType.IMAGE, author = "Pixabay"),
|
||||
// ANIMATED_DRAWABLE can be served from app drawable/
|
||||
Wallpaper(getDrawableUri(R.drawable.anim_sample).toString(), WallpaperType.ANIMATED_DRAWABLE),
|
||||
// LOTTIE can be served from app raw/, local storage or internet
|
||||
Wallpaper(getDrawableUri(R.raw.gradient).toString(), WallpaperType.LOTTIE),
|
||||
// VIDEO can be served from app raw/, local storage or internet (some formats might not be supported, though)
|
||||
Wallpaper(getDrawableUri(R.raw.light).toString(), WallpaperType.VIDEO)
|
||||
)
|
||||
}
|
||||
|
||||
// Below are "dynamic events" that might interest you in special cases
|
||||
// You will only receive dynamic events depending on the updateMode declared in your manifest
|
||||
// Don't subscribe if not interested :
|
||||
// - this will consume device resources unnecessarily
|
||||
// - some cache optimizations won't be enabled for dynamic wallpaper providers
|
||||
|
||||
// When "now playing" changes (ex: a song starts or stops)
|
||||
is Event.NowPlayingChanged -> emptyList()
|
||||
// When the focused card changes
|
||||
is Event.CardFocused -> emptyList()
|
||||
// When the focused "program" card changes
|
||||
is Event.ProgramCardFocused -> emptyList()
|
||||
// When Projectivy enters or exits idle mode
|
||||
is Event.LauncherIdleModeChanged -> {
|
||||
return if (event.isIdle) { listOf(Wallpaper(getDrawableUri(R.drawable.ic_plugin).toString(), WallpaperType.DRAWABLE)) }
|
||||
else emptyList()
|
||||
}
|
||||
else -> emptyList() // Returning an empty list won't change the currently displayed wallpaper
|
||||
}
|
||||
}
|
||||
|
||||
override fun getPreferences(): String {
|
||||
return PreferencesManager.export()
|
||||
}
|
||||
|
||||
override fun setPreferences(params: String) {
|
||||
PreferencesManager.import(params)
|
||||
}
|
||||
|
||||
fun getDrawableUri(drawableId: Int): Uri {
|
||||
return Uri.Builder()
|
||||
.scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
|
||||
.authority(resources.getResourcePackageName(drawableId))
|
||||
.appendPath(resources.getResourceTypeName(drawableId))
|
||||
.appendPath(resources.getResourceEntryName(drawableId))
|
||||
.build()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
89
sample/src/main/res/drawable/anim_sample.xml
Normal file
89
sample/src/main/res/drawable/anim_sample.xml
Normal file
|
@ -0,0 +1,89 @@
|
|||
<animated-vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt">
|
||||
<aapt:attr name="android:drawable">
|
||||
<vector android:height="100dp" android:viewportHeight="1333.3"
|
||||
android:viewportWidth="1333.3" android:width="100dp">
|
||||
<group
|
||||
android:name="group"
|
||||
android:rotation="0"
|
||||
android:pivotX="666"
|
||||
android:pivotY="666"
|
||||
android:scaleX="1.5"
|
||||
android:scaleY="1.5"
|
||||
>
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C807.3,378.3 585.1,156 0,-0L95.2,-0C648.3,173.6 838.7,395.8 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="m666.7,666.7c201.3,-249.9 42.6,-472.1 -476.2,-666.7l95.2,-0C767.7,218.7 894.7,440.9 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="m666.7,666.7c251.9,-198.8 156.6,-421 -285.7,-666.7l95.2,-0C875.7,275.1 939.2,497.3 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="m666.7,666.7c289.8,-137.8 258.1,-360 -95.2,-666.7L666.7,-0c303.4,340 303.4,562.2 0,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="m666.7,666.7c313.2,-69.8 344.9,-292.1 95.2,-666.7l95.2,-0C1049.2,410.1 985.7,632.3 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="m666.7,666.7c320.9,1.6 416.1,-220.6 285.7,-666.7l95.2,-0C1112.3,482 985.4,704.2 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="m666.7,666.7c312.5,73 471.2,-149.3 476.2,-666.7l95.2,-0C1159.5,551.9 969,774.2 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="m666.7,666.7c288.4,140.7 510.6,-81.6 666.7,-666.7L1333.3,95.2C1159.7,648.3 937.5,838.7 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C916.5,868 1138.8,709.3 1333.3,190.5L1333.3,285.7C1114.7,767.7 892.4,894.7 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C865.5,918.5 1087.7,823.3 1333.3,381L1333.3,476.2C1058.3,875.7 836,939.2 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C804.5,956.5 1026.7,924.7 1333.3,571.4L1333.3,666.7C993.4,970.1 771.1,970.1 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C736.5,979.9 958.7,1011.6 1333.3,761.9L1333.3,857.1C923.2,1049.2 701,985.7 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C665.1,987.6 887.3,1082.8 1333.3,952.4L1333.3,1047.6C851.4,1112.3 629.1,985.4 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C593.7,979.1 815.9,1137.9 1333.3,1142.9L1333.3,1238.1C781.4,1159.5 559.2,969 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C526,955.1 748.2,1177.3 1333.3,1333.3L1238.1,1333.3C685.1,1159.7 494.6,937.5 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C465.3,916.5 624.1,1138.8 1142.9,1333.3L1047.6,1333.3C565.6,1114.7 438.6,892.4 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C414.8,865.5 510,1087.7 952.4,1333.3L857.1,1333.3C457.6,1058.3 394.1,836 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C376.9,804.5 408.6,1026.7 761.9,1333.3L666.7,1333.3c-303.4,-340 -303.4,-562.2 0,-666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C353.5,736.5 321.7,958.7 571.4,1333.3L476.2,1333.3C284.1,923.2 347.6,701 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C345.8,665.1 250.5,887.3 381,1333.3L285.7,1333.3C221,851.4 348,629.1 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C354.2,593.7 195.5,815.9 190.5,1333.3L95.2,1333.3C173.8,781.4 364.3,559.2 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C378.3,526 156,748.2 0,1333.3L0,1238.1C173.6,685.1 395.8,494.6 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C416.8,465.3 194.6,624.1 0,1142.9l0,-95.2C218.7,565.6 440.9,438.6 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C467.8,414.8 245.6,510 0,952.4l0,-95.2C275.1,457.6 497.3,394.1 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C528.9,376.9 306.7,408.6 0,761.9L0,666.7c340,-303.4 562.2,-303.4 666.7,-0" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C596.8,353.5 374.6,321.7 0,571.4l0,-95.2C410.1,284.1 632.3,347.6 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C668.3,345.8 446,250.5 0,381l0,-95.2C482,221 704.2,348 666.7,666.7" />
|
||||
<path android:fillColor="#ccd35933"
|
||||
android:pathData="M666.7,666.7C739.6,354.2 517.4,195.5 0,190.5l0,-95.2C551.9,173.8 774.2,364.3 666.7,666.7" />
|
||||
|
||||
</group>
|
||||
</vector>
|
||||
</aapt:attr>
|
||||
<target android:name="group">
|
||||
<aapt:attr name="android:animation">
|
||||
<set>
|
||||
<objectAnimator
|
||||
android:startOffset="0"
|
||||
android:interpolator="@android:anim/linear_interpolator"
|
||||
android:repeatCount="infinite"
|
||||
android:duration="10000"
|
||||
android:propertyName="rotation"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="360" />
|
||||
</set>
|
||||
</aapt:attr>
|
||||
</target>
|
||||
</animated-vector>
|
20
sample/src/main/res/drawable/ic_banner_drawable.xml
Normal file
20
sample/src/main/res/drawable/ic_banner_drawable.xml
Normal file
|
@ -0,0 +1,20 @@
|
|||
<vector android:height="180dp" android:viewportHeight="90"
|
||||
android:viewportWidth="160" android:width="320dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M66.5,37.8h-0.7c-0.5,0 -0.8,-0.4 -0.8,-0.9c0,-0.2 0.1,-0.4 0.2,-0.6l0.5,-0.5c0.3,-0.3 0.3,-0.8 0,-1.1l-1.2,-1.2c-0.3,-0.3 -0.8,-0.3 -1.1,0l-0.5,0.5c-0.3,0.3 -0.8,0.3 -1.1,0c-0.2,-0.2 -0.2,-0.4 -0.2,-0.6v-0.7c0,-0.4 -0.4,-0.8 -0.8,-0.8l0,0H59c-0.4,0 -0.8,0.4 -0.8,0.8l0,0v0.7c0,0.5 -0.4,0.8 -0.9,0.8c-0.2,0 -0.3,-0.1 -0.5,-0.2l-0.5,-0.5c-0.3,-0.3 -0.8,-0.3 -1.1,0L54,34.7c-0.3,0.3 -0.3,0.8 0,1.1c0,0 0,0 0,0l0.4,0.4c0.4,0.3 0.4,0.9 0,1.3c-0.2,0.2 -0.4,0.3 -0.6,0.3h-0.7c-0.4,0 -0.8,0.4 -0.8,0.8c0,0 0,0 0,0v1.6c0,0.4 0.4,0.8 0.8,0.8c0,0 0,0 0,0h0.7c0.5,0 0.9,0.5 0.8,1c0,0.2 -0.1,0.4 -0.2,0.5L54,43.1c-0.3,0.3 -0.3,0.8 0,1.1c0,0 0,0 0,0l1.2,1.2c0.3,0.3 0.8,0.3 1.1,0c0,0 0,0 0,0l0.5,-0.5c0.4,-0.3 0.9,-0.3 1.2,0.1c0.1,0.1 0.2,0.3 0.2,0.5v0.7c0,0.4 0.3,0.8 0.8,0.9c0,0 0,0 0,0h1.6c0.4,0 0.8,-0.4 0.8,-0.8c0,0 0,0 0,0v-0.7c0,-0.5 0.5,-0.8 0.9,-0.8c0.2,0 0.4,0.1 0.5,0.2l0.5,0.5c0.3,0.3 0.8,0.3 1.1,0c0,0 0,0 0,0l1.2,-1.2c0.3,-0.3 0.3,-0.8 0,-1.1c0,0 0,0 0,0l-0.4,-0.4c-0.4,-0.4 -0.3,-1 0,-1.3c0.2,-0.1 0.4,-0.2 0.6,-0.3h0.7c0.4,0 0.8,-0.4 0.8,-0.8c0,0 0,0 0,0v-1.7C67.3,38.2 66.9,37.8 66.5,37.8zM59.8,42.2c-1.5,0 -2.7,-1.2 -2.7,-2.7c0,-1.5 1.2,-2.7 2.7,-2.7c1.5,0 2.7,1.2 2.7,2.7l0,0C62.5,41 61.3,42.2 59.8,42.2z"/>
|
||||
<path android:fillColor="@color/projectivy_plugin_color" android:pathData="M73.9,36.4c-0.4,-0.9 -2.4,-1.7 -5.7,-2.3c2.9,4.6 1.6,10.7 -3,13.7c-4.6,2.9 -10.7,1.6 -13.7,-3c-2.4,-3.7 -2,-8.6 1,-11.9c-2.9,-0.1 -6.1,-0.1 -9.7,-0.1c-19.6,0 -30,1.4 -31.1,3.7c0,0 -1.1,2.1 -1,6.8h11.1c0.5,-0.1 0.9,0.2 1,0.7c0,0 0,0.1 0,0.1c0,0.5 -0.6,0.8 -1.2,0.8H10.8c0.1,0.7 0.2,1.5 0.3,2.3h13.1c0.5,-0.1 0.9,0.2 1,0.7c0,0 0,0.1 0,0.1c0,0.5 -0.6,0.8 -1.2,0.8H11.3c0.1,0.8 0.3,1.5 0.4,2.2h14.8c0.5,-0.1 0.9,0.2 1,0.7c0,0 0,0.1 0,0.1c0,0.4 -0.6,0.8 -1.2,0.8H12.1c1.5,5.7 2.9,5.7 2.9,5.7h2v1.2c0,0.6 1.2,1 2.4,1h9.6c1.2,0 2.4,-0.5 2.4,-1v-1.2h22.7v1.2c0,0.6 1.2,1 2.4,1h9.6c1.2,0 2.4,-0.5 2.4,-1v-1.2h2c0,0 2.2,0 4,-10.8C75.8,39.7 73.9,36.4 73.9,36.4z"/>
|
||||
<path android:fillColor="@color/projectivy_plugin_color" android:pathData="M100,59.9v5h-1V53.1h1v1.5h0c0.3,-0.6 0.7,-1 1.2,-1.3s1.1,-0.4 1.7,-0.4c0.5,0 1,0.1 1.4,0.3s0.7,0.4 1,0.8s0.5,0.8 0.6,1.2s0.2,1 0.2,1.6c0,0.7 -0.1,1.3 -0.2,1.8s-0.4,1 -0.7,1.4s-0.7,0.7 -1.1,0.9s-0.9,0.3 -1.5,0.3C101.4,61.3 100.6,60.8 100,59.9L100,59.9zM100,57.8c0,0.4 0.1,0.7 0.2,1s0.3,0.6 0.5,0.8s0.5,0.4 0.8,0.6s0.7,0.2 1,0.2c0.4,0 0.8,-0.1 1.1,-0.3s0.6,-0.4 0.8,-0.7s0.4,-0.7 0.5,-1.1s0.2,-0.9 0.2,-1.5c0,-0.5 -0.1,-0.9 -0.2,-1.3s-0.3,-0.7 -0.5,-1s-0.5,-0.5 -0.8,-0.6s-0.6,-0.2 -1,-0.2c-0.4,0 -0.8,0.1 -1.1,0.2s-0.6,0.4 -0.9,0.6s-0.4,0.6 -0.5,0.9s-0.2,0.7 -0.2,1.1V57.8z"/>
|
||||
<path android:fillColor="@color/projectivy_plugin_color" android:pathData="M109.2,61.1V49.3h1v11.8H109.2z"/>
|
||||
<path android:fillColor="@color/projectivy_plugin_color" android:pathData="M119.7,61.1v-1.4h0c-0.5,1 -1.4,1.5 -2.5,1.5c-1.9,0 -2.9,-1.2 -2.9,-3.5v-4.7h1v4.5c0,1 0.2,1.7 0.5,2.1s0.9,0.7 1.6,0.7c0.3,0 0.7,-0.1 0.9,-0.2s0.5,-0.3 0.7,-0.6s0.4,-0.5 0.5,-0.9s0.2,-0.7 0.2,-1.1v-4.6h1v8H119.7z"/>
|
||||
<path android:fillColor="@color/projectivy_plugin_color" android:pathData="M130.5,60.5c0,1.5 -0.3,2.6 -1,3.3c-0.7,0.7 -1.7,1.1 -3.1,1.1c-0.9,0 -1.7,-0.2 -2.5,-0.6v-1c0.9,0.5 1.7,0.7 2.5,0.7c2.1,0 3.1,-1.1 3.1,-3.3v-1h0c-0.6,1.1 -1.6,1.6 -2.8,1.6c-0.5,0 -0.9,-0.1 -1.4,-0.3s-0.8,-0.4 -1.1,-0.8s-0.5,-0.8 -0.7,-1.3s-0.2,-1 -0.2,-1.7c0,-0.7 0.1,-1.3 0.3,-1.8s0.4,-1 0.7,-1.4s0.7,-0.7 1.2,-0.9s1,-0.3 1.5,-0.3c1.1,0 2,0.5 2.5,1.4h0v-1.2h1V60.5zM129.5,56.3c0,-0.3 -0.1,-0.6 -0.2,-0.9s-0.3,-0.6 -0.5,-0.8s-0.5,-0.4 -0.8,-0.5c-0.3,-0.1 -0.6,-0.2 -1,-0.2c-0.4,0 -0.8,0.1 -1.1,0.2s-0.6,0.4 -0.9,0.7s-0.4,0.7 -0.5,1.1s-0.2,0.9 -0.2,1.4c0,0.5 0.1,0.9 0.2,1.3s0.3,0.7 0.5,1s0.5,0.5 0.8,0.6s0.7,0.2 1,0.2c0.4,0 0.8,-0.1 1.1,-0.2c0.3,-0.1 0.6,-0.3 0.8,-0.6s0.4,-0.5 0.5,-0.9s0.2,-0.7 0.2,-1.1V56.3z"/>
|
||||
<path android:fillColor="@color/projectivy_plugin_color" android:pathData="M135,51.1c-0.2,0 -0.4,-0.1 -0.5,-0.2s-0.2,-0.3 -0.2,-0.5c0,-0.2 0.1,-0.4 0.2,-0.5s0.3,-0.2 0.5,-0.2c0.1,0 0.2,0 0.3,0.1s0.2,0.1 0.2,0.1s0.1,0.1 0.2,0.2s0.1,0.2 0.1,0.3c0,0.1 0,0.2 -0.1,0.3s-0.1,0.2 -0.2,0.2s-0.1,0.1 -0.2,0.2S135.1,51.1 135,51.1zM134.5,61.1v-8h1v8H134.5z"/>
|
||||
<path android:fillColor="@color/projectivy_plugin_color" android:pathData="M144.4,61.1v-4.6c0,-1.8 -0.7,-2.7 -2,-2.7c-0.3,0 -0.7,0.1 -1,0.2s-0.6,0.3 -0.8,0.6s-0.4,0.5 -0.5,0.9s-0.2,0.7 -0.2,1.1v4.6h-1v-8h1v1.4h0c0.6,-1.1 1.5,-1.6 2.7,-1.6c0.9,0 1.5,0.3 2,0.9s0.7,1.4 0.7,2.5v4.9H144.4z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M80.2,31.2v9.9c0,0.8 -0.2,1.6 -0.5,2.3c-0.3,0.7 -0.7,1.3 -1.3,1.8c-1.1,1.1 -2.6,1.7 -4.1,1.7h-0.1c-0.8,0 -1.5,-0.2 -2.3,-0.5c-0.7,-0.3 -1.4,-0.7 -1.9,-1.3c-0.5,-0.5 -1,-1.2 -1.3,-1.9c-0.3,-0.7 -0.4,-1.5 -0.4,-2.3h3.6c0,0.6 0.2,1.2 0.7,1.7c0.4,0.4 1,0.7 1.7,0.7c0.3,0 0.6,-0.1 0.9,-0.2c0.3,-0.1 0.5,-0.3 0.7,-0.5c0.2,-0.2 0.4,-0.5 0.5,-0.7c0.1,-0.3 0.2,-0.6 0.2,-0.9v-9.8H80.2z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M91.7,34.9h-6.5v2.4h5.2v3.6h-5.2v2.5h6.5V47H81.6V31.3h10.1V34.9z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M99.8,47c-1,0 -2,-0.2 -3,-0.6c-1,-0.4 -1.9,-1 -2.6,-1.7c-0.7,-0.7 -1.3,-1.6 -1.7,-2.6c-0.8,-1.9 -0.8,-4.1 0,-6c0.8,-1.9 2.4,-3.5 4.3,-4.3c1.9,-0.8 4,-0.8 5.9,0c1,0.4 1.9,1 2.6,1.7l-2.6,2.5c-0.4,-0.4 -0.9,-0.7 -1.4,-0.9c-0.5,-0.2 -1.1,-0.3 -1.6,-0.3c-0.5,0 -1.1,0.1 -1.6,0.3c-0.5,0.2 -1,0.5 -1.4,0.9c-0.4,0.4 -0.7,0.9 -0.9,1.4c-0.2,0.5 -0.3,1.1 -0.3,1.6c0,0.6 0.1,1.1 0.3,1.6c0.2,0.5 0.5,1 0.9,1.4c0.4,0.4 0.9,0.7 1.4,0.9c0.5,0.2 1,0.3 1.6,0.3c0.6,0 1.1,-0.1 1.6,-0.3c0.5,-0.2 1,-0.5 1.4,-0.9l2.6,2.6c-0.7,0.7 -1.6,1.3 -2.6,1.7C101.8,46.8 100.8,47 99.8,47z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M115.8,31.2v3.6h-3V47h-3.6V34.9h-3v-3.6H115.8z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M120.7,47h-3.6V31.2h3.6V47z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M132,31.2h3.8L130.5,47h-3.4l-5,-15.8h3.8l3,9.7L132,31.2z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M139.1,47l1.8,-4.4l-5.3,-11.3h4l3.2,6.7l2.8,-6.8h3.9L143,47H139.1z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M38.4,38.1c0,0.9 -0.2,1.7 -0.5,2.5c-0.6,1.5 -1.9,2.8 -3.4,3.4c-0.8,0.3 -1.6,0.5 -2.5,0.5V47h-3.6V31.6H32c0.9,0 1.7,0.2 2.5,0.6c0.7,0.3 1.4,0.8 2,1.4c0.6,0.6 1,1.3 1.4,2C38.2,36.3 38.4,37.2 38.4,38.1zM32,41c0.4,0 0.8,-0.1 1.1,-0.3c0.3,-0.2 0.6,-0.4 0.9,-0.6c0.3,-0.3 0.5,-0.6 0.6,-0.9c0.1,-0.4 0.2,-0.7 0.2,-1.1c0,-0.4 -0.1,-0.8 -0.2,-1.1c-0.1,-0.4 -0.3,-0.7 -0.6,-1c-0.3,-0.3 -0.6,-0.5 -0.9,-0.6c-0.3,-0.2 -0.7,-0.3 -1.1,-0.3L32,41z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M44.1,43l-0.5,0.1H43V47h-3.6V31.6H43c0.8,0 1.7,0.2 2.5,0.5c0.7,0.3 1.4,0.7 2,1.2c0.6,0.5 1,1.1 1.4,1.8c0.3,0.7 0.5,1.4 0.5,2.2c0,0.8 -0.2,1.6 -0.5,2.3c-0.4,0.7 -0.9,1.3 -1.5,1.8l3.4,5.5h-4.2L44.1,43zM43,39.5c0.4,0 0.7,-0.1 1.1,-0.2c0.3,-0.1 0.6,-0.3 0.9,-0.5c0.2,-0.2 0.5,-0.4 0.6,-0.7c0.1,-0.2 0.2,-0.5 0.2,-0.8c0,-0.3 -0.1,-0.6 -0.2,-0.8c-0.2,-0.3 -0.4,-0.5 -0.6,-0.7c-0.3,-0.2 -0.6,-0.4 -0.9,-0.5c-0.4,-0.1 -0.7,-0.2 -1.1,-0.2V39.5z"/>
|
||||
</vector>
|
17
sample/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
17
sample/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<group android:scaleX="0.67"
|
||||
android:scaleY="0.67"
|
||||
android:translateX="18"
|
||||
android:translateY="18">
|
||||
<path
|
||||
android:pathData="M81.31,44.21h-0.82a1,1 0,0 1,-0.67 -1.64l0.56,-0.56a0.89,0.89 0,0 0,0 -1.28l-1.33,-1.34a0.91,0.91 0,0 0,-1.29 0L77.2,40a0.91,0.91 0,0 1,-1.55 -0.67v-0.82a0.92,0.92 0,0 0,-0.92 -0.92h-2a0.92,0.92 0,0 0,-0.92 0.92v0.82A1,1 0,0 1,70.3 40l-0.56,-0.57a0.91,0.91 0,0 0,-1.29 0l-1.34,1.34a0.89,0.89 0,0 0,0 1.28l0.47,0.46A1,1 0,0 1,67 44.21h-0.82a0.92,0.92 0,0 0,-0.93 0.93L65.25,47a0.92,0.92 0,0 0,0.93 0.93h0.77a1.06,1.06 0,0 1,0.72 1.74l-0.57,0.56a0.91,0.91 0,0 0,0 1.29l1.34,1.33a0.91,0.91 0,0 0,1.29 0l0.56,-0.56a1,1 0,0 1,1.65 0.66v0.77a0.92,0.92 0,0 0,0.92 0.92h1.8a0.92,0.92 0,0 0,0.93 -0.92v-0.77a1,1 0,0 1,1.65 -0.66l0.56,0.56a0.91,0.91 0,0 0,1.29 0l1.33,-1.33a0.91,0.91 0,0 0,0 -1.29l-0.46,-0.46A1.06,1.06 0,0 1,80.59 48h0.77a0.92,0.92 0,0 0,0.93 -0.93L82.29,45.19A1,1 0,0 0,81.31 44.21ZM73.7,49.21a3.08,3.08 0,1 1,3.08 -3.08A3.1,3.1 0,0 1,73.7 49.19Z"
|
||||
android:fillColor="@android:color/white"/>
|
||||
<path
|
||||
android:pathData="M89.79,42.65c-0.5,-1.06 -2.7,-1.93 -6.52,-2.6a11.28,11.28 0,1 1,-18 -1.45c-3.33,-0.1 -7,-0.15 -11,-0.15C32,38.46 20.16,40 18.88,42.65c0,0 -1.31,2.34 -1.14,7.76H30.4a1,1 0,0 1,1.09 1c0,0.54 -0.68,1 -1.36,1H17.86c0.07,0.81 0.18,1.68 0.32,2.59h15a1,1 0,0 1,1.09 1c0,0.54 -0.68,1 -1.37,1H18.5c0.16,0.88 0.32,1.71 0.48,2.46H35.85a1,1 0,0 1,1.09 0.95c0,0.41 -0.68,1 -1.36,1H19.44c1.7,6.5 3.35,6.52 3.35,6.52H25v1.37c0,0.68 1.36,1.09 2.73,1.09H38.68c1.37,0 2.73,-0.55 2.73,-1.09V67.7H67.26v1.37c0,0.68 1.37,1.09 2.73,1.09H80.91c1.37,0 2.74,-0.55 2.74,-1.09V67.7h2.23s2.52,0 4.54,-12.25C91.91,46.39 89.79,42.65 89.79,42.65Z"
|
||||
android:fillColor="@color/projectivy_plugin_color"/>
|
||||
</group>
|
||||
</vector>
|
5
sample/src/main/res/drawable/ic_plugin.xml
Normal file
5
sample/src/main/res/drawable/ic_plugin.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M4,4h7L11,2L4,2c-1.1,0 -2,0.9 -2,2v7h2L4,4zM10,13l-4,5h12l-3,-4 -2.03,2.71L10,13zM17,8.5c0,-0.83 -0.67,-1.5 -1.5,-1.5S14,7.67 14,8.5s0.67,1.5 1.5,1.5S17,9.33 17,8.5zM20,2h-7v2h7v7h2L22,4c0,-1.1 -0.9,-2 -2,-2zM20,20h-7v2h7c1.1,0 2,-0.9 2,-2v-7h-2v7zM4,13L2,13v7c0,1.1 0.9,2 2,2h7v-2L4,20v-7z"/>
|
||||
</vector>
|
7
sample/src/main/res/mipmap-anydpi-v26/ic_banner.xml
Normal file
7
sample/src/main/res/mipmap-anydpi-v26/ic_banner.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/projectivy_icon_background"/>
|
||||
<foreground>
|
||||
<inset android:drawable="@drawable/ic_banner_drawable" android:inset="18%"/>
|
||||
</foreground>
|
||||
</adaptive-icon>
|
6
sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
6
sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/projectivy_icon_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
BIN
sample/src/main/res/mipmap-xhdpi/ic_banner.webp
Normal file
BIN
sample/src/main/res/mipmap-xhdpi/ic_banner.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
1
sample/src/main/res/raw/gradient.json
Normal file
1
sample/src/main/res/raw/gradient.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"v":"5.4.4","fr":29.9700012207031,"ip":0,"op":120.0000048877,"w":1920,"h":1080,"nm":"Gradient 1","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0],"e":[360]},{"t":119.000004846969}],"ix":10},"p":{"a":0,"k":[960,540,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":2,"s":{"a":0,"k":[2489,1768.076],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"gf","o":{"a":0,"k":100,"ix":10},"r":1,"bm":0,"g":{"p":3,"k":{"a":0,"k":[0,1,0.49,0.373,0.5,0.998,0.575,0.416,1,0.996,0.659,0.459],"ix":9}},"s":{"a":0,"k":[-411.974,-6.334],"ix":5},"e":{"a":0,"k":[352.025,-5.646],"ix":6},"t":1,"nm":"Gradient Fill 1","mn":"ADBE Vector Graphic - G-Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-68,-34],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,184.116],"ix":3},"r":{"a":0,"k":89.879,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":120.0000048877,"st":0,"bm":0}],"markers":[]}
|
BIN
sample/src/main/res/raw/light.mp4
Normal file
BIN
sample/src/main/res/raw/light.mp4
Normal file
Binary file not shown.
8
sample/src/main/res/values/colors.xml
Normal file
8
sample/src/main/res/values/colors.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<resources>
|
||||
<color name="projectivy_icon_background">#272525</color>
|
||||
<color name="default_background">#3d3d3d</color>
|
||||
<color name="app_background">#ff000000</color>
|
||||
<color name="color_accent">#ffaa3f</color>
|
||||
<color name="projectivy_color">#f08029</color>
|
||||
<color name="projectivy_plugin_color">#904049</color>
|
||||
</resources>
|
10
sample/src/main/res/values/strings.xml
Normal file
10
sample/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<resources>
|
||||
<string name="plugin_name">Projectivy Wallpaper Provider Sample</string>
|
||||
<string name="plugin_description">Plugin description</string>
|
||||
<string name="plugin_uuid">CHANGE_ME</string>
|
||||
|
||||
<!-- Setting parameters -->
|
||||
<string name="settings">Settings</string>
|
||||
<string name="setting_image_url_title">Image URL</string>
|
||||
|
||||
</resources>
|
16
sample/src/main/res/values/themes.xml
Normal file
16
sample/src/main/res/values/themes.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<resources>
|
||||
|
||||
<style name="Theme.ProjectivyWallpaperProvider" parent="@style/Theme.Leanback">
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:backgroundDimEnabled">false</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
<item name="android:windowActivityTransitions">true</item>
|
||||
<item name="android:windowContentTransitions">true</item>
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
<item name="colorPrimary">@color/app_background</item>
|
||||
<item name="colorAccent">@color/color_accent</item>
|
||||
</style>
|
||||
</resources>
|
9
sample/src/main/res/values/values.xml
Normal file
9
sample/src/main/res/values/values.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<integer name="items_cache_duration_millis">3600000</integer>
|
||||
<integer name="update_mode_time_elapsed">1</integer>
|
||||
<integer name="update_mode_now_playing_changed">2</integer>
|
||||
<integer name="update_mode_card_focused">4</integer>
|
||||
<integer name="update_mode_program_card_focused">8</integer>
|
||||
<integer name="update_mode_launcher_idle_mode_changed">16</integer>
|
||||
</resources>
|
18
settings.gradle.kts
Normal file
18
settings.gradle.kts
Normal file
|
@ -0,0 +1,18 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "Projectivy Wallpaper Provider"
|
||||
include(":sample")
|
||||
include(":api")
|
Loading…
Reference in a new issue