-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from maxcanna/muzei3
Support Muzei API 3
- Loading branch information
Showing
120 changed files
with
159 additions
and
400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,5 +20,5 @@ jobs: | |
./gradlew getVersionNumber | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Massimiliano Cannarozzo" | ||
git tag -a $(cat versionNumber) -m "$(cat versionNumber)" | ||
git tag -a $(cat MuzeiWebcam/versionNumber) -m "$(cat MuzeiWebcam/versionNumber)" | ||
git push "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" --tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
MuzeiWebcam/src/main/java/net/luxteam/muzeiwebcam/api/WebcamArtProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package net.luxteam.muzeiwebcam.api; | ||
// | ||
// WebcamArtProvider | ||
// Muzei Webcam | ||
// | ||
// Created by massimilianocannarozzo on 07/03/21. | ||
// Copyright (c) 2021 Muzei Webcam. All rights reserved. | ||
// | ||
|
||
import android.content.Context; | ||
import android.net.Uri; | ||
import android.text.TextUtils; | ||
|
||
import com.google.android.apps.muzei.api.provider.Artwork; | ||
import com.google.android.apps.muzei.api.provider.MuzeiArtProvider; | ||
|
||
import net.luxteam.muzeiwebcam.R; | ||
import net.luxteam.muzeiwebcam.utils.Utils; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
|
||
public class WebcamArtProvider extends MuzeiArtProvider { | ||
|
||
@Override | ||
public void onLoadRequested(boolean firstTime) { | ||
final Date now = new Date(); | ||
final Artwork lastAddedArtwork = getLastAddedArtwork(); | ||
|
||
if (lastAddedArtwork != null && now.getTime() - lastAddedArtwork.getDateAdded().getTime() < 10000) { | ||
return; | ||
} | ||
|
||
Context ctx = this.getContext(); | ||
String subtitle = SimpleDateFormat.getInstance().format(now); | ||
String title = Utils.getStringValue(ctx, ctx.getString(R.string.preference_key_name)); | ||
String url = Utils.getStringValue(ctx, ctx.getString(R.string.preference_key_url)); | ||
String viewUrl = url; | ||
|
||
if(TextUtils.isEmpty(title)){ | ||
title = ctx.getString(R.string.app_name); | ||
} | ||
|
||
if(TextUtils.isEmpty(url)){ | ||
url = ctx.getString(R.string.source_default_url); | ||
viewUrl = ctx.getString(R.string.source_default_view_url); | ||
subtitle = ctx.getString(R.string.source_default_subtitle); | ||
} | ||
|
||
final Artwork artwork = new Artwork.Builder() | ||
.title(title) | ||
.byline(subtitle) | ||
.webUri(Uri.parse(viewUrl)) | ||
.persistentUri(Uri.parse(url)) | ||
.metadata(String.valueOf(now.getTime())) | ||
.build(); | ||
setArtwork(artwork); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public String getDescription() { | ||
final Context ctx = getContext(); | ||
String url = Utils.getStringValue(ctx, ctx.getString(R.string.preference_key_url)); | ||
return url == null | ||
? ctx.getString(R.string.source_default_subtitle) | ||
: null; | ||
} | ||
} |
110 changes: 0 additions & 110 deletions
110
MuzeiWebcam/src/main/java/net/luxteam/muzeiwebcam/api/WebcamArtSource.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.