mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-01-31 09:27:04 +01:00
Added setting to show artist picture
This commit is contained in:
parent
a3c4815a07
commit
4336e8e243
@ -63,6 +63,7 @@ public class SettingsFragment extends PreferenceFragment
|
||||
private CheckBoxPreference lockScreenEnabled;
|
||||
private CheckBoxPreference sendBluetoothNotifications;
|
||||
private CheckBoxPreference sendBluetoothAlbumArt;
|
||||
private CheckBoxPreference showArtistPicture;
|
||||
private ListPreference viewRefresh;
|
||||
private ListPreference imageLoaderConcurrency;
|
||||
private EditTextPreference sharingDefaultDescription;
|
||||
@ -121,6 +122,7 @@ public class SettingsFragment extends PreferenceFragment
|
||||
resumeOnBluetoothDevice = findPreference(Constants.PREFERENCES_KEY_RESUME_ON_BLUETOOTH_DEVICE);
|
||||
pauseOnBluetoothDevice = findPreference(Constants.PREFERENCES_KEY_PAUSE_ON_BLUETOOTH_DEVICE);
|
||||
debugLogToFile = (CheckBoxPreference) findPreference(Constants.PREFERENCES_KEY_DEBUG_LOG_TO_FILE);
|
||||
showArtistPicture = (CheckBoxPreference) findPreference(Constants.PREFERENCES_KEY_SHOW_ARTIST_PICTURE);
|
||||
|
||||
sharingDefaultGreeting.setText(Util.getShareGreeting(getActivity()));
|
||||
setupClearSearchPreference();
|
||||
@ -176,6 +178,9 @@ public class SettingsFragment extends PreferenceFragment
|
||||
setImageLoaderConcurrency(Integer.parseInt(sharedPreferences.getString(key, "5")));
|
||||
} else if (Constants.PREFERENCES_KEY_DEBUG_LOG_TO_FILE.equals(key)) {
|
||||
setDebugLogToFile(sharedPreferences.getBoolean(key, false));
|
||||
} else if (Constants.PREFERENCES_KEY_ID3_TAGS.equals(key)) {
|
||||
if (sharedPreferences.getBoolean(key, false)) showArtistPicture.setEnabled(true);
|
||||
else showArtistPicture.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -427,6 +432,9 @@ public class SettingsFragment extends PreferenceFragment
|
||||
} else {
|
||||
debugLogToFile.setSummary("");
|
||||
}
|
||||
|
||||
if (Util.getShouldUseId3Tags(getActivity())) showArtistPicture.setEnabled(true);
|
||||
else showArtistPicture.setEnabled(false);
|
||||
}
|
||||
|
||||
private static void setImageLoaderConcurrency(int concurrency) {
|
||||
|
@ -114,6 +114,7 @@ public final class Constants
|
||||
public static final String PREFERENCES_KEY_DOWNLOAD_TRANSITION = "transitionToDownloadOnPlay";
|
||||
public static final String PREFERENCES_KEY_INCREMENT_TIME = "incrementTime";
|
||||
public static final String PREFERENCES_KEY_ID3_TAGS = "useId3Tags";
|
||||
public static final String PREFERENCES_KEY_SHOW_ARTIST_PICTURE = "showArtistPicture";
|
||||
public static final String PREFERENCES_KEY_TEMP_LOSS = "tempLoss";
|
||||
public static final String PREFERENCES_KEY_CHAT_REFRESH_INTERVAL = "chatRefreshInterval";
|
||||
public static final String PREFERENCES_KEY_DIRECTORY_CACHE_TIME = "directoryCacheTime";
|
||||
|
@ -54,6 +54,7 @@ import org.moire.ultrasonic.R;
|
||||
import org.moire.ultrasonic.activity.DownloadActivity;
|
||||
import org.moire.ultrasonic.activity.MainActivity;
|
||||
import org.moire.ultrasonic.activity.SettingsActivity;
|
||||
import org.moire.ultrasonic.data.ActiveServerProvider;
|
||||
import org.moire.ultrasonic.domain.*;
|
||||
import org.moire.ultrasonic.domain.MusicDirectory.Entry;
|
||||
import org.moire.ultrasonic.receiver.MediaButtonIntentReceiver;
|
||||
@ -1181,6 +1182,15 @@ public class Util
|
||||
return preferences.getBoolean(Constants.PREFERENCES_KEY_ID3_TAGS, false);
|
||||
}
|
||||
|
||||
public static boolean getShouldShowArtistPicture(Context context)
|
||||
{
|
||||
SharedPreferences preferences = getPreferences(context);
|
||||
boolean isOffline = ActiveServerProvider.Companion.isOffline(context);
|
||||
boolean isId3Enabled = preferences.getBoolean(Constants.PREFERENCES_KEY_ID3_TAGS, false);
|
||||
boolean shouldShowArtistPicture = preferences.getBoolean(Constants.PREFERENCES_KEY_SHOW_ARTIST_PICTURE, false);
|
||||
return (!isOffline) && isId3Enabled && shouldShowArtistPicture;
|
||||
}
|
||||
|
||||
public static int getChatRefreshInterval(Context context)
|
||||
{
|
||||
SharedPreferences preferences = getPreferences(context);
|
||||
|
@ -36,6 +36,7 @@ import org.moire.ultrasonic.data.ActiveServerProvider.Companion.isOffline
|
||||
import org.moire.ultrasonic.domain.Artist
|
||||
import org.moire.ultrasonic.domain.MusicDirectory
|
||||
import org.moire.ultrasonic.util.ImageLoader
|
||||
import org.moire.ultrasonic.util.Util
|
||||
|
||||
/**
|
||||
* Creates a Row in a RecyclerView which contains the details of an Artist
|
||||
@ -118,11 +119,17 @@ class ArtistRowAdapter(
|
||||
holder.layout.setOnClickListener { onArtistClick(artistList[listPosition]) }
|
||||
holder.layout.setOnLongClickListener { view -> createPopupMenu(view, listPosition) }
|
||||
holder.coverArtId = artistList[listPosition].coverArt
|
||||
imageLoader.loadImage(
|
||||
holder.coverArt,
|
||||
MusicDirectory.Entry().apply { coverArt = holder.coverArtId },
|
||||
false, 0, false, true, R.drawable.ic_contact_picture
|
||||
)
|
||||
|
||||
if (Util.getShouldShowArtistPicture(holder.coverArt.context)) {
|
||||
holder.coverArt.visibility = View.VISIBLE
|
||||
imageLoader.loadImage(
|
||||
holder.coverArt,
|
||||
MusicDirectory.Entry().apply { coverArt = holder.coverArtId },
|
||||
false, 0, false, true, R.drawable.ic_contact_picture
|
||||
)
|
||||
} else {
|
||||
holder.coverArt.visibility = View.GONE
|
||||
}
|
||||
} else if (holder is HeaderViewHolder) {
|
||||
holder.folderName.text = folderName
|
||||
holder.layout.setOnClickListener { onFolderClick(holder.layout) }
|
||||
|
@ -316,6 +316,8 @@
|
||||
<string name="settings.use_folder_for_album_artist_summary">Assume top-level folder is the name of the album artist</string>
|
||||
<string name="settings.use_id3">Browse Using ID3 Tags</string>
|
||||
<string name="settings.use_id3_summary">Use ID3 tag methods instead of file system based methods</string>
|
||||
<string name="settings.show_artist_picture">Show artist picture in artist list</string>
|
||||
<string name="settings.show_artist_picture_summary">Displays the artist picture in the artist list if available</string>
|
||||
<string name="settings.video_title">Video</string>
|
||||
<string name="settings.video_player">Video player</string>
|
||||
<string name="settings.view_refresh">View Refresh</string>
|
||||
|
@ -64,6 +64,11 @@
|
||||
a:key="useId3Tags"
|
||||
a:summary="@string/settings.use_id3_summary"
|
||||
a:title="@string/settings.use_id3"/>
|
||||
<CheckBoxPreference
|
||||
a:defaultValue="false"
|
||||
a:key="showArtistPicture"
|
||||
a:summary="@string/settings.show_artist_picture_summary"
|
||||
a:title="@string/settings.show_artist_picture"/>
|
||||
<CheckBoxPreference
|
||||
a:defaultValue="true"
|
||||
a:key="mediaButtons"
|
||||
|
Loading…
x
Reference in New Issue
Block a user