Skip to content

Commit

Permalink
Increased API level to Android 14
Browse files Browse the repository at this point in the history
  • Loading branch information
mkulesh committed Dec 15, 2023
1 parent d6cbb54 commit 1baa242
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 15 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 33
buildToolsVersion "33.0.2"
compileSdkVersion 34
buildToolsVersion "34.0.0"
defaultConfig {
applicationId "com.mkulesh.onpc"
minSdkVersion 14
targetSdkVersion 33
targetSdkVersion 34
versionCode 44
versionName "1.31"
setProperty("archivesBaseName", "onpc-v" + versionName)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/mkulesh/onpc/config/CfgAppSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ public enum Tabs

final boolean isIscp, isDcp;

@SuppressWarnings("SameParameterValue")
Tabs(final boolean isIscp, final boolean isDcp)
{
this.isIscp = isIscp;
this.isDcp = isDcp;
}

@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public boolean isVisible(ConnectionIf.ProtoType pt)
{
return (pt == ConnectionIf.ProtoType.ISCP && isIscp) || (pt == ConnectionIf.ProtoType.DCP && isDcp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ private void hidePreferences()
{
screen.removePreference(findPreference(CfgAppSettings.REMOTE_INTERFACE_AMP));
screen.removePreference(findPreference(CfgAppSettings.REMOTE_INTERFACE_CD));
//noinspection RedundantCast
final PreferenceCategory adv = (PreferenceCategory) findPreference("category_advanced");
if (adv != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ void setButtonSelected(View b, boolean isSelected)
Utils.setButtonSelected(activity, b, isSelected);
}

@SuppressWarnings("SameParameterValue")
AppCompatButton createButton(@StringRes int descriptionId,
final ISCPMessage msg, Object tag, final ButtonListener listener)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ private XmlListItemMsg findDcpMenuItem(@NonNull List<XmlListItemMsg> menuItems,
return null;
}

@SuppressWarnings("SameReturnValue")
private boolean callDcpMenuItem(DcpMediaContainerMsg dcpCmd, int id)
{
final List<XmlListItemMsg> menuItems = activity.getStateManager().getState().cloneDcpTrackMenuItems(dcpCmd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ void setItems(final List<CfgFavoriteShortcuts.Shortcut> newItems)
{
items.add(new CfgFavoriteShortcuts.Shortcut(d, d.alias));
}
//noinspection ComparatorCombinators
Collections.sort(items, (o1, o2) -> Integer.compare(o1.order, o2.order));
notifyDataSetChanged();
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/mkulesh/onpc/iscp/ConnectionIf.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ enum ProtoType
int getPort();

@NonNull
@SuppressWarnings("unused")
String getHostAndPort();
}
3 changes: 1 addition & 2 deletions app/src/main/java/com/mkulesh/onpc/iscp/PopupBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,7 @@ public void afterTextChanged(Editable s)
private String getDefaultValue(Element box)
{
final String text = box.getAttribute("text");
//noinspection PointlessNullCheck
if (serviceType == ServiceType.DEEZER && text != null && "Search".equals(text)
if (serviceType == ServiceType.DEEZER && "Search".equals(text)
&& artist != null && !artist.isEmpty())
{
return artist.contains("(") ? artist.substring(0, artist.indexOf("(")) : artist;
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/mkulesh/onpc/iscp/State.java
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ private boolean process(ListInfoMsg msg)
{
for (NetworkServiceMsg i : serviceItems)
{
if (i.getService().getName().toUpperCase().equals(msg.getListedData().toUpperCase()))
if (i.getService().getName().equalsIgnoreCase(msg.getListedData()))
{
return false;
}
Expand All @@ -1420,7 +1420,7 @@ else if (isMenuMode() || !isReceiverInformation())
{
for (XmlListItemMsg i : mediaItems)
{
if (i.getTitle().toUpperCase().equals(msg.getListedData().toUpperCase()))
if (i.getTitle().equalsIgnoreCase(msg.getListedData()))
{
return false;
}
Expand Down Expand Up @@ -1578,7 +1578,7 @@ boolean listInfoConsistent()
{
for (XmlListItemMsg i : mediaItems)
{
if (i.getTitle().toUpperCase().equals(s.toUpperCase()))
if (i.getTitle().equalsIgnoreCase(s))
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/mkulesh/onpc/iscp/ZonedMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected ZonedMessage(EISCPMessage raw, final String[] zoneCommands) throws Exc
super(raw);
for (int i = 0; i < zoneCommands.length; i++)
{
if (zoneCommands[i].toUpperCase().equals(raw.getCode().toUpperCase()))
if (zoneCommands[i].equalsIgnoreCase(raw.getCode()))
{
zoneIndex = i;
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ public String toString()
+ ", volMax=" + volMax;
}

@SuppressWarnings("unused")
public boolean equals(Zone other)
{
return other != null &&
Expand Down Expand Up @@ -397,6 +398,7 @@ else if (isDab())
return R.drawable.media_item_unknown;
}

@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public boolean equals(Preset other)
{
return other != null &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/*
* Tone/Front (for main zone) and Tone (for zones 2, 3) command
*/
@SuppressWarnings("DuplicateExpressions")
@SuppressWarnings({ "DuplicateExpressions", "RedundantSuppression" })
public class ToneCommandMsg extends ZonedMessage
{
final static String CODE = "TFR";
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/mkulesh/onpc/utils/Logging.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public final class Logging
public static boolean isEnabled()
{
// Should be false in release build
return true;
return false;
}

public static boolean isTimeMsgEnabled()
Expand All @@ -56,6 +56,7 @@ public static void info(Object o, String text)
latestLogging.take();
}
final int l = logLineNumber.addAndGet(1);
//noinspection ResultOfMethodCallIgnored
latestLogging.offer(String.format("#%04d: ", l) + out);
}
catch (Exception e)
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/com/mkulesh/onpc/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

public class Utils
{
@SuppressWarnings("CharsetObjectCanBeUsed")
public static final Charset UTF_8 = Charset.forName("UTF-8");

public static byte[] catBuffer(byte[] bytes, int offset, int length)
Expand Down Expand Up @@ -368,10 +369,9 @@ public static int timeToSeconds(final String timestampStr)
}
else
{
int hours = 0;
int minutes = Integer.parseInt(tokens[0]);
int seconds = Integer.parseInt(tokens[1]);
return 3600 * hours + 60 * minutes + seconds;
return 60 * minutes + seconds;
}
}
catch (Exception ex)
Expand Down Expand Up @@ -488,6 +488,7 @@ public static String getStringPref(@NonNull final SharedPreferences preferences,
@NonNull final String par, @NonNull final String def)
{
final String val = preferences.getString(par, def);
//noinspection ConstantConditions
return val == null ? def : val;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ private int convertToInt(Editable field, int inc)
{
try
{
final int r = Integer.valueOf(field.length() > 0 ? field.toString() : "") + inc;
return ((r < minValue) ? minValue : ((r > maxValue) ? maxValue : r));
final int r = Integer.parseInt(field.length() > 0 ? field.toString() : "") + inc;
return Math.max(minValue, Math.min(maxValue, r));
}
catch (Exception e)
{
Expand Down

0 comments on commit 1baa242

Please sign in to comment.