diff options
| -rw-r--r-- | res/values/config.xml | 22 | ||||
| -rw-r--r-- | res/values/strings.xml | 2 | ||||
| -rw-r--r-- | src/org/omnirom/omnistyle/BrowseWallsActivity.java | 23 |
3 files changed, 40 insertions, 7 deletions
diff --git a/res/values/config.xml b/res/values/config.xml new file mode 100644 index 0000000..593b032 --- /dev/null +++ b/res/values/config.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2021 Android Ice Cold Project + +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 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +--> +<resources> + <string name="wallpaper_list_source"> + https://raw.githubusercontent.com/AICP/aicp-media/master/images/wallpapers/wallpaper_index.json + </string> +</resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index d1aaa60..551807c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. <string name="browse_header">Headers</string> <string name="custom_header_image_notice">Header image set</string> <string name="browse_walls">Wallpapers</string> - <string name="omni_walls">Omni</string> + <string name="omni_walls">AICP</string> <string name="wallpaper_type_dialog_title">Set wallpaper</string> <string name="wallpaper_type_both">Home screen and lock screen</string> <string name="wallpaper_type_system">Home screen</string> diff --git a/src/org/omnirom/omnistyle/BrowseWallsActivity.java b/src/org/omnirom/omnistyle/BrowseWallsActivity.java index fe548f3..61f18c5 100644 --- a/src/org/omnirom/omnistyle/BrowseWallsActivity.java +++ b/src/org/omnirom/omnistyle/BrowseWallsActivity.java @@ -78,9 +78,6 @@ public class BrowseWallsActivity extends Activity { private static final String TAG = "BrowseWallsActivity"; private static final String IMAGE_TYPE = "image/*"; private static final int IMAGE_CROP_AND_SET = 1; - private static final String WALLPAPER_LIST_URI = "https://dl.omnirom.org/images/wallpapers/thumbs/json_wallpapers_xml.php"; - private static final String WALLPAPER_THUMB_URI = "https://dl.omnirom.org/images/wallpapers/thumbs/"; - private static final String WALLPAPER_FULL_URI = "https://dl.omnirom.org/images/wallpapers/"; private static final String EMPTY_CREATOR = "ZZZ"; private static final int SORT_BY_DEFAULT = 0; @@ -530,10 +527,16 @@ public class BrowseWallsActivity extends Activity { } private List<RemoteWallpaperInfo> getWallpaperList() { - String wallData = NetworkUtils.downloadUrlMemoryAsString(WALLPAPER_LIST_URI); + String listUrl = mRes.getString(R.string.wallpaper_list_source); + if (TextUtils.isEmpty(listUrl)) { + return null; + } + + String wallData = NetworkUtils.downloadUrlMemoryAsString(listUrl); if (TextUtils.isEmpty(wallData)) { return null; } + List<RemoteWallpaperInfo> urlList = new ArrayList<RemoteWallpaperInfo>(); try { JSONArray walls = new JSONArray(wallData); @@ -552,6 +555,14 @@ public class BrowseWallsActivity extends Activity { if (build.has("tag")) { tag = build.getString("tag"); } + String fileUrl = null; + if (build.has("url")) { + fileUrl = build.getString("url"); + } + String thumbUrl = null; + if (build.has("thumb")) { + thumbUrl = build.getString("thumb"); + } if (!TextUtils.isEmpty(mFilterTag)) { if (TextUtils.isEmpty(tag) || !tag.equals(mFilterTag)) { continue; @@ -562,8 +573,8 @@ public class BrowseWallsActivity extends Activity { if (ext.equals(".png") || ext.equals(".jpg")) { RemoteWallpaperInfo wi = new RemoteWallpaperInfo(); wi.mImage = fileName; - wi.mThumbUri = WALLPAPER_THUMB_URI + fileName; - wi.mUri = WALLPAPER_FULL_URI + fileName; + wi.mThumbUri = thumbUrl; + wi.mUri = fileUrl; wi.mCreator = TextUtils.isEmpty(creator) ? EMPTY_CREATOR : creator; wi.mDisplayName = TextUtils.isEmpty(displayName) ? "" : displayName; wi.mTag = TextUtils.isEmpty(tag) ? "" : tag; |
