Skip to content

Commit

Permalink
Merge branch 'release-1.2.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
nikclayton committed Dec 9, 2014
2 parents 6b7a6b0 + b95b1a2 commit bef2748
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 9 deletions.
9 changes: 8 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
1.2.4
=====

* Fix potential crash when resuming Squeezer.

* Fix bug with players not showing on devices running Android 2.1 and
2.2.x.

1.2.3
=====

Expand All @@ -13,7 +21,6 @@
* Fix crashes caused be initialising the UI before the connection
to the server completes.

*
1.2.2
=====

Expand Down
7 changes: 4 additions & 3 deletions Squeezer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ buildscript {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.2'
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}

apply plugin: 'com.android.application'
apply plugin: 'crashlytics'

Expand Down Expand Up @@ -91,8 +92,8 @@ android {
}

live {
versionCode 35
versionName "1.2.3"
versionCode 36
versionName "1.2.4"
signingConfig android.signingConfigs.release
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ protected void registerCallback(@NonNull ISqueezeService service) {
= new IServiceHandshakeCallback() {
@Override
public void onHandshakeCompleted() {
resultsExpandableListView.setAdapter(searchResultsAdapter);
if (resultsExpandableListView.getExpandableListAdapter() == null)
resultsExpandableListView.setAdapter(searchResultsAdapter);
doSearch();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ protected void registerCallback(@NonNull ISqueezeService service) {
@Override
public void onHandshakeCompleted() {
maybeOrderVisiblePages(mListView);
setAdapter();
if (mListView.getAdapter() == null)
setAdapter();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ protected void registerCallback(@NonNull ISqueezeService service) {
private final IServiceHandshakeCallback mHandshakeCallback = new IServiceHandshakeCallback() {
@Override
public void onHandshakeCompleted() {
mResultsExpandableListView.setAdapter(mResultsAdapter);
if (mResultsExpandableListView.getExpandableListAdapter() == null)
mResultsExpandableListView.setAdapter(mResultsAdapter);
updateAndExpandPlayerList();
}

Expand Down
19 changes: 18 additions & 1 deletion Squeezer/src/main/java/uk/org/ngo/squeezer/model/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package uk.org.ngo.squeezer.model;

import android.os.Build;
import android.os.Parcel;
import android.support.annotation.NonNull;

Expand All @@ -24,6 +25,7 @@
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;

import java.io.UnsupportedEncodingException;
import java.util.Comparator;
import java.util.Map;

Expand Down Expand Up @@ -59,7 +61,22 @@ public Player(Map<String, String> record) {
mModel = record.get("model");
mCanPowerOff = Util.parseDecimalIntOrZero(record.get("canpoweroff")) == 1;
mConnected = Util.parseDecimalIntOrZero(record.get("connected")) == 1;
mHashCode = mHashFunction.hashString(getId(), Charsets.UTF_8);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
mHashCode = mHashFunction.hashString(getId(), Charsets.UTF_8);
} else {
// API versions < GINGERBREAD do not have String.getBytes(Charset charset),
// which hashString() ends up calling. This will trigger an exception.
byte[] bytes;
try {
bytes = getId().getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
// Can't happen, Android's native charset is UTF-8. But just in case
// we're running on something wacky, fallback to the un-parsed bytes.
bytes = getId().getBytes();
}
mHashCode = mHashFunction.hashBytes(bytes);
}
}

private Player(Parcel source) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ private boolean canPower() {
* @return True if it does, false otherwise.
*/
@Override
public boolean canFavorites() throws HandshakeNotCompleteException{
public boolean canFavorites() throws HandshakeNotCompleteException {
if (!mHandshakeComplete) {
throw new HandshakeNotCompleteException("Handshake with server has not completed.");
}
Expand Down
9 changes: 9 additions & 0 deletions Squeezer/src/main/res/xml/changelog_master.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>

<changelog>
<release
version="1.2.4"
versioncode="36">
<change>Fix potential crash when resuming Squeezer.</change>

<change>Fix bug with players not showing on devices running Android 2.1 and
2.2.x.</change>
</release>

<release
version="1.2.3"
versioncode="35">
Expand Down

0 comments on commit bef2748

Please sign in to comment.