Loading res/values/strings.xml +0 −2 Original line number Diff line number Diff line Loading @@ -92,9 +92,7 @@ <string name="cannot_be_undone">This cannot be undone</string> <string name="delete_warning">This will permanently delete the cached image entries</string> <string name="new_photo">Choose photo from Gallery</string> <string name="google_search">Google search</string> <string name="use_default">Use default photo</string> <string name="old_photo">Use old photo</string> <!-- Context menu items --> <string name="context_menu_play_selection">Play</string> Loading src/org/lineageos/eleven/menu/PhotoSelectionDialog.java +13 −64 Original line number Diff line number Diff line /* * Copyright (C) 2012 Andrew Neal * Copyright (C) 2014 The CyanogenMod Project * Copyright (C) 2020-021 The LineageOS Project * Copyright (C) 2020-2021 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading Loading @@ -29,15 +29,12 @@ import androidx.fragment.app.DialogFragment; import org.lineageos.eleven.Config; import org.lineageos.eleven.R; import org.lineageos.eleven.ui.activities.HomeActivity; import org.lineageos.eleven.utils.Lists; import org.lineageos.eleven.utils.MusicUtils; import java.util.ArrayList; /** * Used when the user requests to modify Album art or Artist image * It provides an easy interface for them to choose a new image, use the old * image, or search Google for one. * It provides an easy interface for them to choose a new image or use the old * image. * * @author Andrew Neal (andrewdneal@gmail.com) */ Loading @@ -45,11 +42,7 @@ public class PhotoSelectionDialog extends DialogFragment { private static final int NEW_PHOTO = 0; private static final int OLD_PHOTO = 1; private final ArrayList<String> mChoices = Lists.newArrayList(); private static ProfileType mProfileType; private static final int DEFAULT_PHOTO = 1; private String mKey; Loading @@ -61,17 +54,14 @@ public class PhotoSelectionDialog extends DialogFragment { /** * @param title The dialog title. * @param type Either Artist or Album * @param key key to query ImageFetcher * @return A new instance of the dialog. */ public static PhotoSelectionDialog newInstance(final String title, final ProfileType type, String key) { public static PhotoSelectionDialog newInstance(final String title, String key) { final PhotoSelectionDialog frag = new PhotoSelectionDialog(); final Bundle args = new Bundle(); args.putString(Config.NAME, title); frag.setArguments(args); mProfileType = type; frag.mKey = key; return frag; } Loading @@ -81,23 +71,16 @@ public class PhotoSelectionDialog extends DialogFragment { public Dialog onCreateDialog(final Bundle savedInstanceState) { final Bundle args = getArguments(); final String title = args == null ? "" : args.getString(Config.NAME); switch (mProfileType) { case ARTIST: setArtistChoices(); break; case ALBUM: setAlbumChoices(); break; case OTHER: setOtherChoices(); break; default: break; } final String[] choices = new String[2]; // Select a photo from the gallery choices[NEW_PHOTO] = getString(R.string.new_photo); // Default photo choices[DEFAULT_PHOTO] = getString(R.string.use_default); // Dialog item Adapter final HomeActivity activity = (HomeActivity) getActivity(); final ListAdapter adapter = new ArrayAdapter<>(activity, android.R.layout.select_dialog_item, mChoices); android.R.layout.select_dialog_item, choices); return new AlertDialog.Builder(activity).setTitle(title) .setAdapter(adapter, (dialog, which) -> { switch (which) { Loading @@ -106,7 +89,7 @@ public class PhotoSelectionDialog extends DialogFragment { activity.selectNewPhoto(mKey); } break; case OLD_PHOTO: case DEFAULT_PHOTO: MusicUtils.selectOldPhoto(activity, mKey); break; default: Loading @@ -115,38 +98,4 @@ public class PhotoSelectionDialog extends DialogFragment { }) .create(); } /** * Adds the choices for the artist profile image. */ private void setArtistChoices() { // Select a photo from the gallery mChoices.add(NEW_PHOTO, getString(R.string.new_photo)); } /** * Adds the choices for the album profile image. */ private void setAlbumChoices() { // Select a photo from the gallery mChoices.add(NEW_PHOTO, getString(R.string.new_photo)); } /** * Adds the choices for the genre and playlist images. */ private void setOtherChoices() { // Select a photo from the gallery mChoices.add(NEW_PHOTO, getString(R.string.new_photo)); } /** * Easily detect the MIME type */ public enum ProfileType { ARTIST, ALBUM, PROFILE_TYPE, OTHER } } src/org/lineageos/eleven/utils/AlbumPopupMenuHelper.java +1 −2 Original line number Diff line number Diff line Loading @@ -87,8 +87,7 @@ public abstract class AlbumPopupMenuHelper extends PopupMenuHelper { if (item.getItemId() == FragmentMenuItems.CHANGE_IMAGE) { String key = ImageFetcher.generateAlbumCacheKey(mAlbum.mAlbumName, getArtistName()); PhotoSelectionDialog.newInstance(mAlbum.mAlbumName, PhotoSelectionDialog.ProfileType.ALBUM, key) PhotoSelectionDialog.newInstance(mAlbum.mAlbumName, key) .show(mFragmentManager, "PhotoSelectionDialog"); return true; } Loading src/org/lineageos/eleven/utils/ArtistPopupMenuHelper.java +1 −2 Original line number Diff line number Diff line Loading @@ -75,8 +75,7 @@ public abstract class ArtistPopupMenuHelper extends PopupMenuHelper { boolean handled = super.onMenuItemClick(item); if (!handled && item.getGroupId() == getGroupId()) { if (item.getItemId() == FragmentMenuItems.CHANGE_IMAGE) { PhotoSelectionDialog.newInstance(getArtistName(), PhotoSelectionDialog.ProfileType.ARTIST, getArtistName()) PhotoSelectionDialog.newInstance(getArtistName(), getArtistName()) .show(mFragmentManager, "PhotoSelectionDialog"); return true; } Loading Loading
res/values/strings.xml +0 −2 Original line number Diff line number Diff line Loading @@ -92,9 +92,7 @@ <string name="cannot_be_undone">This cannot be undone</string> <string name="delete_warning">This will permanently delete the cached image entries</string> <string name="new_photo">Choose photo from Gallery</string> <string name="google_search">Google search</string> <string name="use_default">Use default photo</string> <string name="old_photo">Use old photo</string> <!-- Context menu items --> <string name="context_menu_play_selection">Play</string> Loading
src/org/lineageos/eleven/menu/PhotoSelectionDialog.java +13 −64 Original line number Diff line number Diff line /* * Copyright (C) 2012 Andrew Neal * Copyright (C) 2014 The CyanogenMod Project * Copyright (C) 2020-021 The LineageOS Project * Copyright (C) 2020-2021 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading Loading @@ -29,15 +29,12 @@ import androidx.fragment.app.DialogFragment; import org.lineageos.eleven.Config; import org.lineageos.eleven.R; import org.lineageos.eleven.ui.activities.HomeActivity; import org.lineageos.eleven.utils.Lists; import org.lineageos.eleven.utils.MusicUtils; import java.util.ArrayList; /** * Used when the user requests to modify Album art or Artist image * It provides an easy interface for them to choose a new image, use the old * image, or search Google for one. * It provides an easy interface for them to choose a new image or use the old * image. * * @author Andrew Neal (andrewdneal@gmail.com) */ Loading @@ -45,11 +42,7 @@ public class PhotoSelectionDialog extends DialogFragment { private static final int NEW_PHOTO = 0; private static final int OLD_PHOTO = 1; private final ArrayList<String> mChoices = Lists.newArrayList(); private static ProfileType mProfileType; private static final int DEFAULT_PHOTO = 1; private String mKey; Loading @@ -61,17 +54,14 @@ public class PhotoSelectionDialog extends DialogFragment { /** * @param title The dialog title. * @param type Either Artist or Album * @param key key to query ImageFetcher * @return A new instance of the dialog. */ public static PhotoSelectionDialog newInstance(final String title, final ProfileType type, String key) { public static PhotoSelectionDialog newInstance(final String title, String key) { final PhotoSelectionDialog frag = new PhotoSelectionDialog(); final Bundle args = new Bundle(); args.putString(Config.NAME, title); frag.setArguments(args); mProfileType = type; frag.mKey = key; return frag; } Loading @@ -81,23 +71,16 @@ public class PhotoSelectionDialog extends DialogFragment { public Dialog onCreateDialog(final Bundle savedInstanceState) { final Bundle args = getArguments(); final String title = args == null ? "" : args.getString(Config.NAME); switch (mProfileType) { case ARTIST: setArtistChoices(); break; case ALBUM: setAlbumChoices(); break; case OTHER: setOtherChoices(); break; default: break; } final String[] choices = new String[2]; // Select a photo from the gallery choices[NEW_PHOTO] = getString(R.string.new_photo); // Default photo choices[DEFAULT_PHOTO] = getString(R.string.use_default); // Dialog item Adapter final HomeActivity activity = (HomeActivity) getActivity(); final ListAdapter adapter = new ArrayAdapter<>(activity, android.R.layout.select_dialog_item, mChoices); android.R.layout.select_dialog_item, choices); return new AlertDialog.Builder(activity).setTitle(title) .setAdapter(adapter, (dialog, which) -> { switch (which) { Loading @@ -106,7 +89,7 @@ public class PhotoSelectionDialog extends DialogFragment { activity.selectNewPhoto(mKey); } break; case OLD_PHOTO: case DEFAULT_PHOTO: MusicUtils.selectOldPhoto(activity, mKey); break; default: Loading @@ -115,38 +98,4 @@ public class PhotoSelectionDialog extends DialogFragment { }) .create(); } /** * Adds the choices for the artist profile image. */ private void setArtistChoices() { // Select a photo from the gallery mChoices.add(NEW_PHOTO, getString(R.string.new_photo)); } /** * Adds the choices for the album profile image. */ private void setAlbumChoices() { // Select a photo from the gallery mChoices.add(NEW_PHOTO, getString(R.string.new_photo)); } /** * Adds the choices for the genre and playlist images. */ private void setOtherChoices() { // Select a photo from the gallery mChoices.add(NEW_PHOTO, getString(R.string.new_photo)); } /** * Easily detect the MIME type */ public enum ProfileType { ARTIST, ALBUM, PROFILE_TYPE, OTHER } }
src/org/lineageos/eleven/utils/AlbumPopupMenuHelper.java +1 −2 Original line number Diff line number Diff line Loading @@ -87,8 +87,7 @@ public abstract class AlbumPopupMenuHelper extends PopupMenuHelper { if (item.getItemId() == FragmentMenuItems.CHANGE_IMAGE) { String key = ImageFetcher.generateAlbumCacheKey(mAlbum.mAlbumName, getArtistName()); PhotoSelectionDialog.newInstance(mAlbum.mAlbumName, PhotoSelectionDialog.ProfileType.ALBUM, key) PhotoSelectionDialog.newInstance(mAlbum.mAlbumName, key) .show(mFragmentManager, "PhotoSelectionDialog"); return true; } Loading
src/org/lineageos/eleven/utils/ArtistPopupMenuHelper.java +1 −2 Original line number Diff line number Diff line Loading @@ -75,8 +75,7 @@ public abstract class ArtistPopupMenuHelper extends PopupMenuHelper { boolean handled = super.onMenuItemClick(item); if (!handled && item.getGroupId() == getGroupId()) { if (item.getItemId() == FragmentMenuItems.CHANGE_IMAGE) { PhotoSelectionDialog.newInstance(getArtistName(), PhotoSelectionDialog.ProfileType.ARTIST, getArtistName()) PhotoSelectionDialog.newInstance(getArtistName(), getArtistName()) .show(mFragmentManager, "PhotoSelectionDialog"); return true; } Loading