Javascript 在muzei类似应用程序中按日期更新壁纸

Javascript 在muzei类似应用程序中按日期更新壁纸,javascript,android,date,live-wallpaper,muzei,Javascript,Android,Date,Live Wallpaper,Muzei,我用muzei代码(开源)开发了一款壁纸,但在更新壁纸时遇到了一个棘手的问题 我在主机中使用了本地源,而不是api或db。所以我像这样修改了FeautedArtSource.java package com.google.android.apps.muzei.featuredart; 导入android.app.AlarmManager; 导入android.app.pendingent; 导入android.content.ActivityNotFoundException; 导入andro

我用muzei代码(开源)开发了一款壁纸,但在更新壁纸时遇到了一个棘手的问题

我在主机中使用了本地源,而不是api或db。所以我像这样修改了FeautedArtSource.java

package com.google.android.apps.muzei.featuredart;
导入android.app.AlarmManager;
导入android.app.pendingent;
导入android.content.ActivityNotFoundException;
导入android.content.ComponentName;
导入android.content.Context;
导入android.content.Intent;
导入android.net.Uri;
导入android.os.Handler;
导入android.os.Looper;
导入android.telephony.smsmsmanager;
导入android.text.TextUtils;
导入android.widget.Toast;
导入com.google.android.apps.muzei.api.Artwork;
导入com.google.android.apps.muzei.api.RemoteMuzeiArtSource;
导入com.google.android.apps.muzei.api.UserCommand;
导入com.google.android.apps.muzei.util.IOUtil;
导入com.google.android.apps.muzei.util.LogUtil;
导入com.xxx.xxx.BuildConfig;
导入com.xxx.xxx.R;
导入org.json.JSONException;
导入org.json.JSONObject;
导入java.io.IOException;
导入java.text.ParseException;
导入java.text.simpleDataFormat;
导入java.util.ArrayList;
导入java.util.Calendar;
导入java.util.Date;
导入java.util.List;
导入java.util.Random;
导入java.util.TimeZone;
导入静态com.google.android.apps.muzei.util.LogUtil.LOGD;
导入静态com.google.android.apps.muzei.util.LogUtil.LOGE;
导入静态com.google.android.apps.muzei.util.LogUtil.LOGW;
公共类功能DartSource扩展了RemoteMuzeiArtSource{
私有静态最终字符串标记=LogUtil.makeLogTag(FeaturedArtSource.class);
私有静态最终字符串源\u NAME=“FeaturedArt”;
私有静态字符串查询\u URL=”file:///android_asset/starrynight.jpg";
私有静态Uri存档\u Uri=Uri.parse(“file:///android_asset/starrynight.jpg");
私有静态最终int命令\u ID\u SHARE=1;
私有静态最终int命令\u ID\u VIEW\u ARCHIVE=2;
私有静态最终int命令\u ID\u DEBUG\u INFO=51;
专用静态最终整数最大抖动为1*60*1000;
私有静态随机sRandom=new Random();
专用静态最终简化格式SDATEFORMATZ
=新的简化格式(“yyyy-MM-dd'T'HH:MM:ssZ”);
专用静态最终简化格式sDateFormatLocal
=新的简化格式(“yyyy-MM-dd'HH:MM:ss”);
静止的{
sDateFormatTZ.setTimeZone(TimeZone.getTimeZone(“UTC”);
}
公共功能DartSource(){
超级(来源名称);
}
公共无效URL()
{
日历=Calendar.getInstance();
if(calendar.get(calendar.DATE)==1)
{
查询URL=”file:///android_asset/image1.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image1.jpg");
}
if(calendar.get(calendar.DATE)==2)
{
查询URL=”file:///android_asset/image2.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image2.jpg");
}
if(calendar.get(calendar.DATE)==3)
{
查询URL=”file:///android_asset/image3.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image3.jpg");
}
if(calendar.get(calendar.DATE)==4)
{
查询URL=”file:///android_asset/image4.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image4.jpg");
}
if(calendar.get(calendar.DATE)==5)
{
查询URL=”file:///android_asset/image5.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image5.jpg");
}
if(calendar.get(calendar.DATE)==6)
{
查询URL=”file:///android_asset/image6.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image6.jpg");
}
if(calendar.get(calendar.DATE)==7)
{
查询URL=”file:///android_asset/image7.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image7.jpg");
}
if(calendar.get(calendar.DATE)==8)
{
查询URL=”file:///android_asset/image8.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image8.jpg");
}
if(calendar.get(calendar.DATE)==9)
{
查询URL=”file:///android_asset/image9.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image9.jpg");
}
if(calendar.get(calendar.DATE)==10)
{
查询URL=”file:///android_asset/image10.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image10.jpg");
}
if(calendar.get(calendar.DATE)==11)
{
查询URL=”file:///android_asset/image11.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image11.jpg");
}
if(calendar.get(calendar.DATE)==12)
{
查询URL=”file:///android_asset/image12.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image12.jpg");
}
if(calendar.get(calendar.DATE)==13)
{
查询URL=”file:///android_asset/image13.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image13.jpg");
}
if(calendar.get(calendar.DATE)==14)
{
查询URL=”file:///android_asset/image14.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image14.jpg");
}
if(calendar.get(calendar.DATE)==15)
{
查询URL=”file:///android_asset/image15.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image15.jpg");
}
if(calendar.get(calendar.DATE)==16)
{
查询URL=”file:///android_asset/image16.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image16.jpg");
}
if(calendar.get(calendar.DATE)==17)
{
查询URL=”file:///android_asset/image17.jpg";
ARCHIVE_URI=URI.parse(“file:///android_asset/image17.jpg");
}
如果(日历)