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