Permalink
Browse files

Upgrade to Scaledrone Java client v0.6.0

  • Loading branch information...
herkyl committed Feb 5, 2019
1 parent a782ba9 commit 2b19d33897c2a6aac746fcff24809503caca5575
@@ -117,4 +117,7 @@ gradle-app.setting
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties

# End of https://www.gitignore.io/api/osx,java,gradle,intellij
# End of https://www.gitignore.io/api/osx,java,gradle,intellij

app/app.iml
*.iml

This file was deleted.

Oops, something went wrong.
@@ -25,5 +25,5 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.scaledrone:scaledrone-java:0.3.0'
compile 'com.scaledrone:scaledrone-java:0.6.0'
}
@@ -84,12 +84,12 @@ public void onOpenFailure(Room room, Exception ex) {
}

@Override
public void onMessage(Room room, final JsonNode json, final Member member) {
public void onMessage(Room room, com.scaledrone.lib.Message receivedMessage) {
final ObjectMapper mapper = new ObjectMapper();
try {
final MemberData data = mapper.treeToValue(member.getClientData(), MemberData.class);
boolean belongsToCurrentUser = member.getId().equals(scaledrone.getClientID());
final Message message = new Message(json.asText(), data, belongsToCurrentUser);
final MemberData data = mapper.treeToValue(receivedMessage.getMember().getClientData(), MemberData.class);
boolean belongsToCurrentUser = receivedMessage.getClientID().equals(scaledrone.getClientID());
final Message message = new Message(receivedMessage.getData().asText(), data, belongsToCurrentUser);
runOnUiThread(new Runnable() {
@Override
public void run() {
@@ -2,21 +2,21 @@

public class Message {
private String text;
private MemberData data;
private MemberData memberData;
private boolean belongsToCurrentUser;

public Message(String text, MemberData data, boolean belongsToCurrentUser) {
this.text = text;
this.data = data;
this.memberData = data;
this.belongsToCurrentUser = belongsToCurrentUser;
}

public String getText() {
return text;
}

public MemberData getData() {
return data;
public MemberData getMemberData() {
return memberData;
}

public boolean isBelongsToCurrentUser() {
@@ -62,10 +62,10 @@ public View getView(int i, View convertView, ViewGroup viewGroup) {
holder.messageBody = (TextView) convertView.findViewById(R.id.message_body);
convertView.setTag(holder);

holder.name.setText(message.getData().getName());
holder.name.setText(message.getMemberData().getName());
holder.messageBody.setText(message.getText());
GradientDrawable drawable = (GradientDrawable) holder.avatar.getBackground();
drawable.setColor(Color.parseColor(message.getData().getColor()));
drawable.setColor(Color.parseColor(message.getMemberData().getColor()));
}

return convertView;

0 comments on commit 2b19d33

Please sign in to comment.