Commit e217fd9a authored by sshivam95's avatar sshivam95

Venter: clean the changes for merge

parent 346905ff
package app.insti; package app.insti;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.support.v4.content.ContextCompat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; import java.util.Random;
...@@ -13,22 +18,6 @@ public class TagClass { ...@@ -13,22 +18,6 @@ public class TagClass {
public TagClass(String name) { public TagClass(String name) {
this.name = name; this.name = name;
this.color = getRandomColor();
}
public String getRandomColor() {
ArrayList<String> colors = new ArrayList<>();
colors.add("#ED7D31");
colors.add("#00B0F0");
colors.add("#FF0000");
colors.add("#D0CECE");
colors.add("#00B050");
colors.add("#9999FF");
colors.add("#FF5FC6");
colors.add("#FFC000");
colors.add("#7F7F7F");
colors.add("#4800FF");
return colors.get(new Random().nextInt(colors.size()));
} }
public String getName() { public String getName() {
...@@ -38,12 +27,4 @@ public class TagClass { ...@@ -38,12 +27,4 @@ public class TagClass {
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
} }
\ No newline at end of file
...@@ -90,20 +90,9 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie ...@@ -90,20 +90,9 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
} }
try { try {
textViewName.setText(comment.getUser().getUserName()); textViewName.setText(comment.getUser().getUserName());
} catch (Exception e) {
e.printStackTrace();
}
try {
String time = DateTimeUtil.getDate(comment.getTime().toString()); String time = DateTimeUtil.getDate(comment.getTime().toString());
Log.i(TAG, "time: " + time); Log.i(TAG, "time: " + time);
Log.i(TAG, "inside try");
textViewCommentTime.setText(time); textViewCommentTime.setText(time);
} catch (Exception e) {
Log.i(TAG, "Inside catch");
e.printStackTrace();
}
try {
textViewComment.setText(comment.getText()); textViewComment.setText(comment.getText());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -86,50 +86,23 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler ...@@ -86,50 +86,23 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
Venter.Complaint complaint = complaintList.get(position); Venter.Complaint complaint = complaintList.get(position);
try { try {
textViewDescription.setText(complaint.getDescription()); textViewDescription.setText(complaint.getDescription());
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewLocation.setText(complaint.getLocationDescription()); textViewLocation.setText(complaint.getLocationDescription());
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewUserName.setText(complaint.getComplaintCreatedBy().getUserName()); textViewUserName.setText(complaint.getComplaintCreatedBy().getUserName());
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewStatus.setText(complaint.getStatus().toUpperCase()); textViewStatus.setText(complaint.getStatus().toUpperCase());
if (complaint.getStatus().equalsIgnoreCase("Reported")) { if (complaint.getStatus().equalsIgnoreCase("Reported")) {
textViewStatus.setBackgroundColor(Color.parseColor("#FF0000")); textViewStatus.setBackgroundColor(context.getResources().getColor(R.color.colorRed));
textViewStatus.setTextColor(context.getResources().getColor(R.color.primaryTextColor)); textViewStatus.setTextColor(context.getResources().getColor(R.color.primaryTextColor));
} else if (complaint.getStatus().equalsIgnoreCase("In Progress")) { } else if (complaint.getStatus().equalsIgnoreCase("In Progress")) {
textViewStatus.setBackgroundColor(context.getResources().getColor(R.color.colorSecondary)); textViewStatus.setBackgroundColor(context.getResources().getColor(R.color.colorSecondary));
textViewStatus.setTextColor(context.getResources().getColor(R.color.secondaryTextColor)); textViewStatus.setTextColor(context.getResources().getColor(R.color.secondaryTextColor));
} else if (complaint.getStatus().equalsIgnoreCase("Resolved")) { } else if (complaint.getStatus().equalsIgnoreCase("Resolved")) {
textViewStatus.setBackgroundColor(Color.parseColor("#00FF00")); textViewStatus.setBackgroundColor(context.getResources().getColor(R.color.colorGreen));
textViewStatus.setTextColor(context.getResources().getColor(R.color.secondaryTextColor)); textViewStatus.setTextColor(context.getResources().getColor(R.color.secondaryTextColor));
} }
} catch (Exception e) {
e.printStackTrace();
}
try {
String time = DateTimeUtil.getDate(complaint.getComplaintReportDate().toString()); String time = DateTimeUtil.getDate(complaint.getComplaintReportDate().toString());
Log.i(TAG, "time: " + time); Log.i(TAG, "time: " + time);
textViewReportDate.setText(time); textViewReportDate.setText(time);
} catch (Exception e) {
e.printStackTrace();
}
try {
buttonComments.setText("COMMENTS(" + complaint.getComment().size() + ")"); buttonComments.setText("COMMENTS(" + complaint.getComment().size() + ")");
} catch (Exception e) {
e.printStackTrace();
}
try {
buttonVotes.setText("UP VOTES(" + complaint.getUsersUpVoted().size() + ")"); buttonVotes.setText("UP VOTES(" + complaint.getUsersUpVoted().size() + ")");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -175,30 +175,11 @@ public class DetailedComplaintFragment extends Fragment { ...@@ -175,30 +175,11 @@ public class DetailedComplaintFragment extends Fragment {
private void populateViews() { private void populateViews() {
try { try {
textViewUserName.setText(detailedComplaint.getComplaintCreatedBy().getUserName()); textViewUserName.setText(detailedComplaint.getComplaintCreatedBy().getUserName());
} catch (Exception e) {
e.printStackTrace();
}
try {
String time = DateTimeUtil.getDate(detailedComplaint.getComplaintReportDate().toString()); String time = DateTimeUtil.getDate(detailedComplaint.getComplaintReportDate().toString());
Log.i(TAG, " time: " + time); Log.i(TAG, " time: " + time);
Log.i(TAG, "inside try");
textViewReportDate.setText(time); textViewReportDate.setText(time);
} catch (Exception e) {
Log.i(TAG, "Inside catch");
e.printStackTrace();
}
try {
textViewLocation.setText(detailedComplaint.getLocationDescription()); textViewLocation.setText(detailedComplaint.getLocationDescription());
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewDescription.setText(detailedComplaint.getDescription()); textViewDescription.setText(detailedComplaint.getDescription());
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewStatus.setText(detailedComplaint.getStatus().toUpperCase()); textViewStatus.setText(detailedComplaint.getStatus().toUpperCase());
if (detailedComplaint.getStatus().equalsIgnoreCase("Reported")) { if (detailedComplaint.getStatus().equalsIgnoreCase("Reported")) {
textViewStatus.setBackgroundColor(Color.parseColor("#FF0000")); textViewStatus.setBackgroundColor(Color.parseColor("#FF0000"));
...@@ -210,25 +191,9 @@ public class DetailedComplaintFragment extends Fragment { ...@@ -210,25 +191,9 @@ public class DetailedComplaintFragment extends Fragment {
textViewStatus.setBackgroundColor(Color.parseColor("#00FF00")); textViewStatus.setBackgroundColor(Color.parseColor("#00FF00"));
textViewStatus.setTextColor(getResources().getColor(R.color.secondaryTextColor)); textViewStatus.setTextColor(getResources().getColor(R.color.secondaryTextColor));
} }
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewCommentLabel.setText("COMMENTS"); textViewCommentLabel.setText("COMMENTS");
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewVoteUpLabel.setText("UP VOTES"); textViewVoteUpLabel.setText("UP VOTES");
} catch (Exception e) {
e.printStackTrace();
}
try {
addVotesToView(detailedComplaint); addVotesToView(detailedComplaint);
} catch (Exception e) {
e.printStackTrace();
}
try {
addCommentsToView(detailedComplaint); addCommentsToView(detailedComplaint);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -535,7 +535,6 @@ public class FileComplaintFragment extends Fragment { ...@@ -535,7 +535,6 @@ public class FileComplaintFragment extends Fragment {
for (int i = 0; i < tagList2.size(); i++) { for (int i = 0; i < tagList2.size(); i++) {
tag = new Tag(tagList2.get(i).getName()); tag = new Tag(tagList2.get(i).getName());
tag.radius = 10f; tag.radius = 10f;
tag.layoutColor = Color.parseColor(tagList2.get(i).getColor());
tag.isDeletable = true; tag.isDeletable = true;
tags.add(tag); tags.add(tag);
} }
...@@ -552,7 +551,6 @@ public class FileComplaintFragment extends Fragment { ...@@ -552,7 +551,6 @@ public class FileComplaintFragment extends Fragment {
tagsLayout.setVisibility(View.VISIBLE); tagsLayout.setVisibility(View.VISIBLE);
tag = new Tag(tagList.get(i).getName()); tag = new Tag(tagList.get(i).getName());
tag.radius = 10f; tag.radius = 10f;
tag.layoutColor = Color.parseColor(tagList.get(i).getColor());
tag.isDeletable = false; tag.isDeletable = false;
tags.add(tag); tags.add(tag);
} }
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
<color name="colorGray">#757575</color> <color name="colorGray">#757575</color>
<color name="colorWhite">#FFFFFF</color> <color name="colorWhite">#FFFFFF</color>
<color name="colorRed">#FF0000</color>
<color name="colorGreen">#00FF00</color>
<!-- Map --> <!-- Map -->
<item name="transparent_black" type="color">#20000000</item> <item name="transparent_black" type="color">#20000000</item>
<item name="list_item_gray_even" type="color">#ffe6e6e6</item> <item name="list_item_gray_even" type="color">#ffe6e6e6</item>
......
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