Commit 3411736e authored by Tiago Cunha's avatar Tiago Cunha

Fixed PMD problems

parent 2cbdaf96
......@@ -32,7 +32,7 @@ import chat.rocket.android.layouthelper.chatroom.MessageListAdapter;
import chat.rocket.android.layouthelper.chatroom.PairedMessage;
import chat.rocket.android.log.RCLog;
import chat.rocket.android.message.AudioUploadMessageSpec;
import chat.rocket.android.message.FileUploadMessageSpec;
import chat.rocket.android.message.AbstractUploadMessageSpec;
import chat.rocket.android.message.ImageUploadMessageSpec;
import chat.rocket.android.message.VideoUploadMessageSpec;
import chat.rocket.android.model.ServerConfig;
......@@ -246,7 +246,7 @@ public class RoomFragment extends AbstractChatRoomFragment
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode != FileUploadMessageSpec.RC_UPL || resultCode != Activity.RESULT_OK) {
if (requestCode != AbstractUploadMessageSpec.RC_UPL || resultCode != Activity.RESULT_OK) {
return;
}
......
......@@ -4,7 +4,7 @@ import android.support.v7.widget.RecyclerView;
import chat.rocket.android.R;
import chat.rocket.android.layouthelper.chatroom.dialog.MessageSelectionAdapter;
import chat.rocket.android.message.MessageSpec;
import chat.rocket.android.message.AbstractMessageSpec;
public class MessageSelectionDialogFragment extends AbstractChatRoomDialogFragment {
......@@ -27,8 +27,8 @@ public class MessageSelectionDialogFragment extends AbstractChatRoomDialogFragme
});
}
public void addMessageSpec(MessageSpec messageSpec) {
adapter.addMessageSpec(messageSpec);
public void addMessageSpec(AbstractMessageSpec abstractMessageSpec) {
adapter.addMessageSpec(abstractMessageSpec);
}
public void setListener(ClickListener listener) {
......@@ -47,6 +47,6 @@ public class MessageSelectionDialogFragment extends AbstractChatRoomDialogFragme
}
public interface ClickListener {
void onClick(MessageSpec messageSpec);
void onClick(AbstractMessageSpec abstractMessageSpec);
}
}
......@@ -8,20 +8,20 @@ import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import chat.rocket.android.R;
import chat.rocket.android.message.MessageSpec;
import chat.rocket.android.message.AbstractMessageSpec;
public class MessageSelectionAdapter
extends RecyclerView.Adapter<MessageSelectionViewHolder> {
private List<MessageSpec> messageSpecs = new ArrayList<>();
private List<AbstractMessageSpec> abstractMessageSpecs = new ArrayList<>();
private ClickListener listener;
public void setListener(ClickListener listener) {
this.listener = listener;
}
public void addMessageSpec(MessageSpec messageSpec) {
messageSpecs.add(messageSpec);
public void addMessageSpec(AbstractMessageSpec abstractMessageSpec) {
abstractMessageSpecs.add(abstractMessageSpec);
notifyDataSetChanged();
}
......@@ -31,9 +31,9 @@ public class MessageSelectionAdapter
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.dialog_message_selection_item, parent, false);
itemView.setOnClickListener(v -> {
itemView.setOnClickListener(view -> {
if (listener != null) {
listener.onClick((MessageSpec) itemView.getTag());
listener.onClick((AbstractMessageSpec) itemView.getTag());
}
});
......@@ -43,16 +43,16 @@ public class MessageSelectionAdapter
@Override
public void onBindViewHolder(MessageSelectionViewHolder holder,
int position) {
holder.onBind(messageSpecs.get(position));
holder.onBind(abstractMessageSpecs.get(position));
}
@Override
public int getItemCount() {
return messageSpecs.size();
return abstractMessageSpecs.size();
}
public interface ClickListener {
void onClick(MessageSpec messageSpec);
void onClick(AbstractMessageSpec abstractMessageSpec);
}
}
......@@ -11,7 +11,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import chat.rocket.android.R;
import chat.rocket.android.message.MessageSpec;
import chat.rocket.android.message.AbstractMessageSpec;
public class MessageSelectionViewHolder extends RecyclerView.ViewHolder {
......@@ -24,10 +24,10 @@ public class MessageSelectionViewHolder extends RecyclerView.ViewHolder {
messageSpecTitle = (TextView) itemView.findViewById(R.id.message_spec_title);
}
public void onBind(MessageSpec messageSpec) {
itemView.setTag(messageSpec);
public void onBind(AbstractMessageSpec abstractMessageSpec) {
itemView.setTag(abstractMessageSpec);
MessageSpec.ViewData viewData = messageSpec.getViewData();
AbstractMessageSpec.ViewData viewData = abstractMessageSpec.getViewData();
setIconBackgroundColorTint(viewData.getBackgroundTint());
setIcon(viewData.getIcon());
setTitle(viewData.getTitle());
......
......@@ -6,7 +6,7 @@ import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes;
public abstract class MessageSpec {
public abstract class AbstractMessageSpec {
public abstract ViewData getViewData();
......
......@@ -4,7 +4,7 @@ import android.app.Activity;
import android.support.v4.app.Fragment;
import android.content.Intent;
public abstract class FileUploadMessageSpec extends MessageSpec {
public abstract class AbstractUploadMessageSpec extends AbstractMessageSpec {
public static final int RC_UPL = 0x12;
......
......@@ -4,7 +4,7 @@ import android.content.Intent;
import chat.rocket.android.R;
public class AudioUploadMessageSpec extends FileUploadMessageSpec {
public class AudioUploadMessageSpec extends AbstractUploadMessageSpec {
@Override
protected Intent getIntent() {
......@@ -19,7 +19,7 @@ public class AudioUploadMessageSpec extends FileUploadMessageSpec {
return new AudioUploadViewData();
}
private static class AudioUploadViewData implements MessageSpec.ViewData {
private static class AudioUploadViewData implements AbstractMessageSpec.ViewData {
@Override
public int getBackgroundTint() {
return R.color.colorAccent;
......
......@@ -4,7 +4,7 @@ import android.content.Intent;
import chat.rocket.android.R;
public class ImageUploadMessageSpec extends FileUploadMessageSpec {
public class ImageUploadMessageSpec extends AbstractUploadMessageSpec {
@Override
public ViewData getSpecificViewData() {
......@@ -19,7 +19,7 @@ public class ImageUploadMessageSpec extends FileUploadMessageSpec {
return Intent.createChooser(intent, "Select Picture to Upload");
}
private static class ImageUploadViewData implements MessageSpec.ViewData {
private static class ImageUploadViewData implements AbstractMessageSpec.ViewData {
@Override
public int getBackgroundTint() {
return R.color.colorAccent;
......
......@@ -4,7 +4,7 @@ import android.content.Intent;
import chat.rocket.android.R;
public class VideoUploadMessageSpec extends FileUploadMessageSpec {
public class VideoUploadMessageSpec extends AbstractUploadMessageSpec {
@Override
public ViewData getSpecificViewData() {
......@@ -19,7 +19,7 @@ public class VideoUploadMessageSpec extends FileUploadMessageSpec {
return Intent.createChooser(intent, "Select Video to Upload");
}
private static class VideoUploadViewData implements MessageSpec.ViewData {
private static class VideoUploadViewData implements AbstractMessageSpec.ViewData {
@Override
public int getBackgroundTint() {
return R.color.colorAccent;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment