Commit a1d90606 authored by sshivam95's avatar sshivam95

Merge branch 'nss' of https://github.com/sshivam95/InstiApp into nss

# Conflicts:
#	app/src/main/java/app/insti/fragment/FileComplaintFragment.java
parents 933a501c f05521e9
...@@ -52,5 +52,6 @@ dependencies { ...@@ -52,5 +52,6 @@ dependencies {
implementation "ru.noties:markwon:${markwonVersion}" implementation "ru.noties:markwon:${markwonVersion}"
implementation "com.github.Cutta:TagView:${tagViewVersion}" implementation "com.github.Cutta:TagView:${tagViewVersion}"
implementation "me.relex:circleindicator:${circleIndicatorVersion}" implementation "me.relex:circleindicator:${circleIndicatorVersion}"
implementation 'com.android.support:support-v4:28.0.0'
} }
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
...@@ -3,11 +3,11 @@ package app.insti; ...@@ -3,11 +3,11 @@ package app.insti;
/** /**
* Created by Shivam Sharma on 13-08-2018. * Created by Shivam Sharma on 13-08-2018.
*/ */
public class TagClass { public class ComplaintTag {
private String name; private String name;
public TagClass(String name) { public ComplaintTag(String name) {
this.name = name; this.name = name;
} }
......
...@@ -20,6 +20,7 @@ public class Constants { ...@@ -20,6 +20,7 @@ public class Constants {
public static final String IS_LOGGED_IN = "IsLoggedIn"; public static final String IS_LOGGED_IN = "IsLoggedIn";
public static final String GCM_ID = "GcmId"; public static final String GCM_ID = "GcmId";
public static final String CURRENT_USER = "current_user"; public static final String CURRENT_USER = "current_user";
public static final String CURRENT_USER_PROFILE_PICTURE = "current_user_profile_picture";
public static final String SESSION_ID = "session_id"; public static final String SESSION_ID = "session_id";
public static final int STATUS_GOING = 2; public static final int STATUS_GOING = 2;
public static final int STATUS_INTERESTED = 1; public static final int STATUS_INTERESTED = 1;
......
...@@ -55,10 +55,8 @@ import app.insti.api.model.Role; ...@@ -55,10 +55,8 @@ import app.insti.api.model.Role;
import app.insti.api.model.User; import app.insti.api.model.User;
import app.insti.api.request.UserFCMPatchRequest; import app.insti.api.request.UserFCMPatchRequest;
import app.insti.fragment.BackHandledFragment; import app.insti.fragment.BackHandledFragment;
import app.insti.fragment.BodyFragment;
import app.insti.fragment.CalendarFragment; import app.insti.fragment.CalendarFragment;
import app.insti.fragment.ComplaintFragment; import app.insti.fragment.ComplaintsFragment;
import app.insti.fragment.EventFragment;
import app.insti.fragment.ExploreFragment; import app.insti.fragment.ExploreFragment;
import app.insti.fragment.FeedFragment; import app.insti.fragment.FeedFragment;
import app.insti.fragment.FileComplaintFragment; import app.insti.fragment.FileComplaintFragment;
...@@ -530,8 +528,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -530,8 +528,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
case R.id.nav_complaint: case R.id.nav_complaint:
if (session.isLoggedIn()) { if (session.isLoggedIn()) {
ComplaintFragment complaintFragment = new ComplaintFragment(); ComplaintsFragment complaintsFragment = new ComplaintsFragment();
updateFragment(complaintFragment); updateFragment(complaintsFragment);
} else { } else {
Toast.makeText(this, Constants.LOGIN_MESSAGE, Toast.LENGTH_LONG).show(); Toast.makeText(this, Constants.LOGIN_MESSAGE, Toast.LENGTH_LONG).show();
} }
...@@ -577,8 +575,12 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -577,8 +575,12 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
bundle.putString(Constants.SESSION_ID, session.pref.getString(Constants.SESSION_ID, "")); bundle.putString(Constants.SESSION_ID, session.pref.getString(Constants.SESSION_ID, ""));
if (fragment instanceof MessMenuFragment) if (fragment instanceof MessMenuFragment)
bundle.putString(Constants.USER_HOSTEL, session.isLoggedIn() && currentUser.getHostel() != null ? currentUser.getHostel() : "1"); bundle.putString(Constants.USER_HOSTEL, session.isLoggedIn() && currentUser.getHostel() != null ? currentUser.getHostel() : "1");
if (fragment instanceof SettingsFragment && session.isLoggedIn() || fragment instanceof ComplaintFragment && session.isLoggedIn()) if (fragment instanceof SettingsFragment && session.isLoggedIn())
bundle.putString(Constants.USER_ID, currentUser.getUserID()); bundle.putString(Constants.USER_ID, currentUser.getUserID());
if (fragment instanceof ComplaintsFragment && session.isLoggedIn()){
bundle.putString(Constants.USER_ID, currentUser.getUserID());
bundle.putString(Constants.CURRENT_USER_PROFILE_PICTURE, currentUser.getUserProfilePictureUrl());
}
fragment.setArguments(bundle); fragment.setArguments(bundle);
FragmentManager manager = getSupportFragmentManager(); FragmentManager manager = getSupportFragmentManager();
if (fragment instanceof FeedFragment) if (fragment instanceof FeedFragment)
......
package app.insti.adapter; package app.insti.adapter;
import android.app.Activity;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v7.widget.CardView; import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.util.Log; import android.util.Log;
...@@ -12,8 +12,6 @@ import android.view.LayoutInflater; ...@@ -12,8 +12,6 @@ import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.PopupMenu; import android.widget.PopupMenu;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
...@@ -25,7 +23,6 @@ import java.util.List; ...@@ -25,7 +23,6 @@ import java.util.List;
import app.insti.R; import app.insti.R;
import app.insti.Utils; import app.insti.Utils;
import app.insti.activity.MainActivity;
import app.insti.api.RetrofitInterface; import app.insti.api.RetrofitInterface;
import app.insti.api.model.Venter; import app.insti.api.model.Venter;
import app.insti.utils.DateTimeUtil; import app.insti.utils.DateTimeUtil;
...@@ -38,25 +35,24 @@ import retrofit2.Response; ...@@ -38,25 +35,24 @@ import retrofit2.Response;
* Created by Shivam Sharma on 23-09-2018. * Created by Shivam Sharma on 23-09-2018.
*/ */
public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final String TAG = CommentRecyclerViewAdapter.class.getSimpleName(); private static final String TAG = CommentsAdapter.class.getSimpleName();
private Context context; private Context context;
private LayoutInflater inflater; private LayoutInflater inflater;
private String sessionId, userId; private String sessionId, userId;
Activity activity; private Fragment fragment;
private TextView textViewCommentLabel; private TextView textViewCommentLabel;
private List<Venter.Comment> commentList = new ArrayList<>(); private List<Venter.Comment> commentList = new ArrayList<>();
public CommentRecyclerViewAdapter(Activity activity, Context context, String sessionId, String userId, TextView textViewCommentLabel) { public CommentsAdapter(Context context, String sessionId, String userId, Fragment fragment) {
this.context = context; this.context = context;
this.sessionId = sessionId; this.sessionId = sessionId;
this.userId = userId; this.userId = userId;
inflater = LayoutInflater.from(context); inflater = LayoutInflater.from(context);
this.activity = activity; this.fragment =fragment;
this.textViewCommentLabel = textViewCommentLabel;
} }
public class CommentsViewHolder extends RecyclerView.ViewHolder { public class CommentsViewHolder extends RecyclerView.ViewHolder {
...@@ -66,9 +62,9 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie ...@@ -66,9 +62,9 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
private TextView textViewName; private TextView textViewName;
private TextView textViewCommentTime; private TextView textViewCommentTime;
private TextView textViewComment; private TextView textViewComment;
final RetrofitInterface retrofitInterface = Utils.getRetrofitInterface(); private final RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
public CommentsViewHolder(View itemView) { CommentsViewHolder(View itemView) {
super(itemView); super(itemView);
cardView = itemView.findViewById(R.id.cardViewComment); cardView = itemView.findViewById(R.id.cardViewComment);
textViewName = itemView.findViewById(R.id.textViewUserComment); textViewName = itemView.findViewById(R.id.textViewUserComment);
...@@ -77,22 +73,19 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie ...@@ -77,22 +73,19 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
circleImageView = itemView.findViewById(R.id.circleImageViewUserImage); circleImageView = itemView.findViewById(R.id.circleImageViewUserImage);
} }
public void bindHolder(final int position) { private void bindHolder(final int position) {
final Venter.Comment comment = commentList.get(position); final Venter.Comment comment = commentList.get(position);
try { try {
String profileUrl = comment.getUser().getUserProfilePictureUrl(); String profileUrl = comment.getUser().getUserProfilePictureUrl();
Log.i(TAG, "PROFILE URL: " + profileUrl); Log.i(TAG, "PROFILE URL: " + profileUrl);
if (profileUrl != null) Picasso.get().load(profileUrl).placeholder(R.drawable.user_placeholder).into(circleImageView);
Picasso.get().load(profileUrl).into(circleImageView);
else
Picasso.get().load(R.drawable.baseline_account_circle_black_36).into(circleImageView);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
try { try {
textViewName.setText(comment.getUser().getUserName()); textViewName.setText(comment.getUser().getUserName());
String time = DateTimeUtil.getDate(comment.getTime().toString()); String time = DateTimeUtil.getDate(comment.getTime());
Log.i(TAG, "time: " + time); Log.i(TAG, "time: " + time);
textViewCommentTime.setText(time); textViewCommentTime.setText(time);
textViewComment.setText(comment.getText()); textViewComment.setText(comment.getText());
...@@ -114,9 +107,11 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie ...@@ -114,9 +107,11 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.copy_comment_option: case R.id.copy_comment_option:
ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(context.CLIPBOARD_SERVICE); ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clipData = ClipData.newPlainText("Text Copied", textViewComment.getText().toString()); ClipData clipData = ClipData.newPlainText("Text Copied", textViewComment.getText().toString());
clipboardManager.setPrimaryClip(clipData); if (clipboardManager != null) {
clipboardManager.setPrimaryClip(clipData);
}
Toast.makeText(context, "Comment Copied", Toast.LENGTH_SHORT).show(); Toast.makeText(context, "Comment Copied", Toast.LENGTH_SHORT).show();
break; break;
case R.id.delete_comment_option: case R.id.delete_comment_option:
...@@ -124,7 +119,6 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie ...@@ -124,7 +119,6 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
@Override @Override
public void onResponse(Call<String> call, Response<String> response) { public void onResponse(Call<String> call, Response<String> response) {
if (response.isSuccessful()) { if (response.isSuccessful()) {
Toast.makeText(context, "Comment Deleted", Toast.LENGTH_SHORT).show();
commentList.remove(position); commentList.remove(position);
notifyDataSetChanged(); notifyDataSetChanged();
notifyItemRemoved(position); notifyItemRemoved(position);
...@@ -141,6 +135,15 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie ...@@ -141,6 +135,15 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
} }
}); });
break; break;
default:
clipboardManager = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
clipData = ClipData.newPlainText("Text Copied", textViewComment.getText().toString());
if (clipboardManager != null) {
clipboardManager.setPrimaryClip(clipData);
}
Toast.makeText(context, "Comment Copied", Toast.LENGTH_SHORT).show();
break;
} }
return true; return true;
} }
...@@ -157,7 +160,14 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie ...@@ -157,7 +160,14 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = inflater.inflate(R.layout.comments_card, parent, false); View view = inflater.inflate(R.layout.comments_card, parent, false);
CommentsViewHolder commentsViewHolder = new CommentsViewHolder(view); final CommentsViewHolder commentsViewHolder = new CommentsViewHolder(view);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Utils.openUserFragment(commentList.get(commentsViewHolder.getAdapterPosition()).getUser(), fragment.getActivity());
}
});
return commentsViewHolder; return commentsViewHolder;
} }
...@@ -173,7 +183,8 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie ...@@ -173,7 +183,8 @@ public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
return commentList.size(); return commentList.size();
} }
public void setCommentList(List<Venter.Comment> commentList) { public void setCommentList(List<Venter.Comment> commentList, TextView textViewCommentLabel) {
this.commentList = commentList; this.commentList = commentList;
this.textViewCommentLabel = textViewCommentLabel;
} }
} }
\ No newline at end of file
package app.insti.adapter; package app.insti.adapter;
import android.content.Context;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentPagerAdapter;
import app.insti.api.model.Venter; import app.insti.fragment.ComplaintDetailsFragment;
import app.insti.fragment.DetailedComplaintFragment;
/** /**
* Created by Shivam Sharma on 19-09-2018. * Created by Shivam Sharma on 19-09-2018.
...@@ -14,38 +12,43 @@ import app.insti.fragment.DetailedComplaintFragment; ...@@ -14,38 +12,43 @@ import app.insti.fragment.DetailedComplaintFragment;
public class ComplaintDetailsPagerAdapter extends FragmentPagerAdapter { public class ComplaintDetailsPagerAdapter extends FragmentPagerAdapter {
Venter.Complaint detailedComplaint; private String sessionid, complaintid, userid, userProfileUrl;
Context context;
String sessionid, complaintid, userid;
int voteCount;
public ComplaintDetailsPagerAdapter(FragmentManager fm, Venter.Complaint detailedComplaint, Context context, String sessionid, String complaintid, String userid, int voteCount) { public ComplaintDetailsPagerAdapter(FragmentManager fm, String sessionid, String complaintid, String userid, String userProfileUrl) {
super(fm); super(fm);
this.context = context;
this.detailedComplaint = detailedComplaint;
this.sessionid = sessionid; this.sessionid = sessionid;
this.complaintid = complaintid; this.complaintid = complaintid;
this.userid = userid; this.userid = userid;
this.voteCount = voteCount; this.userProfileUrl = userProfileUrl;
} }
@Override @Override
public Fragment getItem(int position) { public Fragment getItem(int position) {
switch (position) { switch (position) {
case 0: case 0:
return DetailedComplaintFragment.getInstance(sessionid, complaintid, userid, voteCount); return ComplaintDetailsFragment.getInstance(sessionid, complaintid, userid, userProfileUrl);
/*
For version 2:
case 1:
return RelevantComplaintsFragment.getInstance(sessionid, userid);
*/
default: default:
return DetailedComplaintFragment.getInstance(sessionid, complaintid, userid, voteCount); return ComplaintDetailsFragment.getInstance(sessionid, complaintid, userid, userProfileUrl);
} }
} }
@Override @Override
public CharSequence getPageTitle(int position) { public CharSequence getPageTitle(int position) {
return "Complaint Details"; if (position == 0) {
return "Complaint Details";
} else {
return "Relevant Complaints";
}
} }
@Override @Override
public int getCount() { public int getCount() {
return 1; /* Update as 2 on adding RelevantComplints*/ return 1;
} }
} }
package app.insti.adapter; package app.insti.adapter;
import android.content.Context;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.app.FragmentStatePagerAdapter;
import app.insti.fragment.HomeFragment; import app.insti.fragment.ComplaintsHomeFragment;
import app.insti.fragment.MeFragment; import app.insti.fragment.ComplaintsMeFragment;
/** /**
* Created by Shivam Sharma on 15-08-2018. * Created by Shivam Sharma on 15-08-2018.
...@@ -15,26 +14,24 @@ import app.insti.fragment.MeFragment; ...@@ -15,26 +14,24 @@ import app.insti.fragment.MeFragment;
public class ComplaintFragmentViewPagerAdapter extends FragmentStatePagerAdapter { public class ComplaintFragmentViewPagerAdapter extends FragmentStatePagerAdapter {
private static final String TAG = ComplaintFragmentViewPagerAdapter.class.getSimpleName(); private String userID, sessionID, userProfileUrl;
Context context;
String userID, sessionID;
public ComplaintFragmentViewPagerAdapter(FragmentManager fm, Context context, String userID, String sessionID) { public ComplaintFragmentViewPagerAdapter(FragmentManager fm,String userID, String sessionID, String userProfileUrl) {
super(fm); super(fm);
this.context = context;
this.userID = userID; this.userID = userID;
this.sessionID = sessionID; this.sessionID = sessionID;
this.userProfileUrl = userProfileUrl;
} }
@Override @Override
public Fragment getItem(int position) { public Fragment getItem(int position) {
switch (position) { switch (position) {
case 0: case 0:
return HomeFragment.getInstance(sessionID, userID); return ComplaintsHomeFragment.getInstance(sessionID, userID, userProfileUrl);
case 1: case 1:
return MeFragment.getInstance(sessionID,userID); return ComplaintsMeFragment.getInstance(sessionID,userID, userProfileUrl);
default: default:
return HomeFragment.getInstance(sessionID, userID); return ComplaintsHomeFragment.getInstance(sessionID, userID, userProfileUrl);
} }
} }
......
...@@ -2,36 +2,26 @@ package app.insti.adapter; ...@@ -2,36 +2,26 @@ package app.insti.adapter;
import android.app.Activity; import android.app.Activity;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.CardView; import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.format.DateUtils;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.TimeZone;
import app.insti.R; import app.insti.R;
import app.insti.Utils; import app.insti.Utils;
import app.insti.api.RetrofitInterface; import app.insti.api.RetrofitInterface;
import app.insti.api.model.User;
import app.insti.api.model.Venter; import app.insti.api.model.Venter;
import app.insti.fragment.ComplaintDetailsFragment; import app.insti.fragment.ComplaintFragment;
import app.insti.utils.DateTimeUtil; import app.insti.utils.DateTimeUtil;
import app.insti.utils.GsonProvider;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
import retrofit2.Response; import retrofit2.Response;
...@@ -40,14 +30,15 @@ import retrofit2.Response; ...@@ -40,14 +30,15 @@ import retrofit2.Response;
* Created by Shivam Sharma on 15-08-2018. * Created by Shivam Sharma on 15-08-2018.
*/ */
public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class ComplaintsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private LayoutInflater inflater; private LayoutInflater inflater;
private Activity context; private Activity context;
private String sessionID; private String sessionID;
private String userID; private String userID;
private static final String TAG = ComplaintsRecyclerViewAdapter.class.getSimpleName(); private String userProfileUrl;
List<Venter.Complaint> complaintList = new ArrayList<>(); private static final String TAG = ComplaintsAdapter.class.getSimpleName();
private List<Venter.Complaint> complaintList = new ArrayList<>();
public class ComplaintsViewHolder extends RecyclerView.ViewHolder { public class ComplaintsViewHolder extends RecyclerView.ViewHolder {
...@@ -61,9 +52,7 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler ...@@ -61,9 +52,7 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
private TextView textViewUserName; private TextView textViewUserName;
private TextView textViewReportDate; private TextView textViewReportDate;
private TextView textViewStatus; private TextView textViewStatus;
private int pos; private int pos;
private int voteCount = 0;
public ComplaintsViewHolder(View currentView) { public ComplaintsViewHolder(View currentView) {
super(currentView); super(currentView);
...@@ -81,7 +70,6 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler ...@@ -81,7 +70,6 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
public void bindHolder(final int position) { public void bindHolder(final int position) {
this.pos = position; this.pos = position;
Log.i(TAG, "json = " + GsonProvider.getGsonOutput().toJson(complaintList.get(pos)));
cardView.setOnClickListener(new View.OnClickListener() { cardView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
...@@ -89,10 +77,11 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler ...@@ -89,10 +77,11 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
bundle.putString("id", complaintList.get(pos).getComplaintID()); bundle.putString("id", complaintList.get(pos).getComplaintID());
bundle.putString("sessionId", sessionID); bundle.putString("sessionId", sessionID);
bundle.putString("userId", userID); bundle.putString("userId", userID);
ComplaintDetailsFragment complaintDetailsFragment = new ComplaintDetailsFragment(); bundle.putString("userProfileUrl", userProfileUrl);
complaintDetailsFragment.setArguments(bundle); ComplaintFragment complaintFragment = new ComplaintFragment();
complaintFragment.setArguments(bundle);
AppCompatActivity activity = (AppCompatActivity) context; AppCompatActivity activity = (AppCompatActivity) context;
activity.getSupportFragmentManager().beginTransaction().replace(R.id.framelayout_for_fragment, complaintDetailsFragment).addToBackStack(TAG).commit(); activity.getSupportFragmentManager().beginTransaction().replace(R.id.framelayout_for_fragment, complaintFragment).addToBackStack(TAG).commit();
} }
}); });
...@@ -124,18 +113,19 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler ...@@ -124,18 +113,19 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
bundle.putString("id", complaintList.get(pos).getComplaintID()); bundle.putString("id", complaintList.get(pos).getComplaintID());
bundle.putString("sessionId", sessionID); bundle.putString("sessionId", sessionID);
bundle.putString("userId", userID); bundle.putString("userId", userID);
ComplaintDetailsFragment complaintDetailsFragment = new ComplaintDetailsFragment(); bundle.putString("userProfileUrl", userProfileUrl);
complaintDetailsFragment.setArguments(bundle); ComplaintFragment complaintFragment = new ComplaintFragment();
complaintFragment.setArguments(bundle);
AppCompatActivity activity = (AppCompatActivity) context; AppCompatActivity activity = (AppCompatActivity) context;
activity.getSupportFragmentManager().beginTransaction().replace(R.id.framelayout_for_fragment, complaintDetailsFragment).addToBackStack(TAG).commit(); activity.getSupportFragmentManager().beginTransaction().replace(R.id.framelayout_for_fragment, complaintFragment).addToBackStack(TAG).commit();
} }
}); });
buttonVotes.setOnClickListener(new View.OnClickListener() { buttonVotes.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (voteCount == 0) { if (complaintList.get(position).getVoteCount() == 0) {
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface(); RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
retrofitInterface.upVote("sessionid=" + sessionID, complaintList.get(pos).getComplaintID()).enqueue(new Callback<Venter.Complaint>() { retrofitInterface.upVote("sessionid=" + sessionID, complaintList.get(pos).getComplaintID(), 1).enqueue(new Callback<Venter.Complaint>() {
@Override @Override
public void onResponse(Call<Venter.Complaint> call, Response<Venter.Complaint> response) { public void onResponse(Call<Venter.Complaint> call, Response<Venter.Complaint> response) {
if (response.isSuccessful()) { if (response.isSuccessful()) {
...@@ -143,8 +133,26 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler ...@@ -143,8 +133,26 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
if (complaint != null) { if (complaint != null) {
textViewVotes.setText(String.valueOf(complaint.getUsersUpVoted().size())); textViewVotes.setText(String.valueOf(complaint.getUsersUpVoted().size()));
} }
Toast.makeText(context, "You have Up Voted this complaint", Toast.LENGTH_SHORT).show(); complaintList.get(position).setVoteCount(1);
voteCount++; }
}
@Override
public void onFailure(Call<Venter.Complaint> call, Throwable t) {
Log.i(TAG, "failure in up vote: " + t.toString());
}
});
} else if (complaintList.get(position).getVoteCount() == 1) {
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
retrofitInterface.upVote("sessionid=" + sessionID, complaintList.get(pos).getComplaintID(), 0).enqueue(new Callback<Venter.Complaint>() {
@Override
public void onResponse(Call<Venter.Complaint> call, Response<Venter.Complaint> response) {
if (response.isSuccessful()) {
Venter.Complaint complaint = response.body();
if (complaint != null) {
textViewVotes.setText(String.valueOf(complaint.getUsersUpVoted().size()));
}
complaintList.get(position).setVoteCount(0);
} }
} }
...@@ -153,8 +161,6 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler ...@@ -153,8 +161,6 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
Log.i(TAG, "failure in up vote: " + t.toString()); Log.i(TAG, "failure in up vote: " + t.toString());
} }
}); });
} else {
Toast.makeText(context, "You have already UpVoted this complaint", Toast.LENGTH_SHORT).show();
} }
} }
}); });
...@@ -164,10 +170,11 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler ...@@ -164,10 +170,11 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
} }
} }
public ComplaintsRecyclerViewAdapter(Activity ctx, String sessionID, String userID) { public ComplaintsAdapter(Activity ctx, String sessionID, String userID, String userProfileUrl) {
this.context = ctx; this.context = ctx;
this.sessionID = sessionID; this.sessionID = sessionID;
this.userID = userID; this.userID = userID;
this.userProfileUrl = userProfileUrl;
inflater = LayoutInflater.from(ctx); inflater = LayoutInflater.from(ctx);
} }
...@@ -181,6 +188,13 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler ...@@ -181,6 +188,13 @@ public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
List<User> userList = complaintList.get(position).getUsersUpVoted();
for (User user : userList) {
if (user.getUserID().equals(userID))
complaintList.get(position).setVoteCount(1);
else
complaintList.get(position).setVoteCount(0);
}
if (viewHolder instanceof ComplaintsViewHolder) { if (viewHolder instanceof ComplaintsViewHolder) {
((ComplaintsViewHolder) viewHolder).bindHolder(position); ((ComplaintsViewHolder) viewHolder).bindHolder(position);
} }
......
...@@ -20,7 +20,6 @@ public class ImageViewPagerAdapter extends FragmentPagerAdapter { ...@@ -20,7 +20,6 @@ public class ImageViewPagerAdapter extends FragmentPagerAdapter {
private static final String TAG = ImageViewPagerAdapter.class.getSimpleName(); private static final String TAG = ImageViewPagerAdapter.class.getSimpleName();
private List<String> images = new ArrayList<>(); private List<String> images = new ArrayList<>();
Venter.Complaint detailedComplaint;
public ImageViewPagerAdapter(FragmentManager fragmentManager, List<String> images) { public ImageViewPagerAdapter(FragmentManager fragmentManager, List<String> images) {
super(fragmentManager); super(fragmentManager);
...@@ -29,11 +28,7 @@ public class ImageViewPagerAdapter extends FragmentPagerAdapter { ...@@ -29,11 +28,7 @@ public class ImageViewPagerAdapter extends FragmentPagerAdapter {
public ImageViewPagerAdapter(FragmentManager fragmentManager, Venter.Complaint detailedComplaint){ public ImageViewPagerAdapter(FragmentManager fragmentManager, Venter.Complaint detailedComplaint){
super(fragmentManager); super(fragmentManager);
this.detailedComplaint = detailedComplaint; images.addAll(detailedComplaint.getImages());
for (String image: detailedComplaint.getImages()){
images.add(image);
}
} }
@Override @Override
...@@ -54,7 +49,7 @@ public class ImageViewPagerAdapter extends FragmentPagerAdapter { ...@@ -54,7 +49,7 @@ public class ImageViewPagerAdapter extends FragmentPagerAdapter {
return new AddImageFragment(); return new AddImageFragment();
}else { }else {
Log.i(TAG,"calling 2"); Log.i(TAG,"calling 2");
return ImageFragment.newInstance(images.get(position),position); return ImageFragment.newInstance(images.get(position));
} }
} }
} }
\ No newline at end of file
package app.insti.adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.List;
import app.insti.R;
import app.insti.Utils;
import app.insti.api.model.User;
import de.hdodenhof.circleimageview.CircleImageView;
public class UpVotesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final String TAG = CommentsAdapter.class.getSimpleName();
private LayoutInflater inflater;
private Fragment fragment;
private List<User> userList = new ArrayList<>();
public UpVotesAdapter(Fragment fragment, Context context) {
inflater = LayoutInflater.from(context);
this.fragment = fragment;
}
public class UpVotesViewHolder extends RecyclerView.ViewHolder {
private CardView cardView;
private CircleImageView circleImageView;
private TextView textViewName;
UpVotesViewHolder(View itemView) {
super(itemView);
cardView = itemView.findViewById(R.id.cardViewUpVote);
textViewName = itemView.findViewById(R.id.textViewUserUpVoteName);
circleImageView = itemView.findViewById(R.id.circleImageViewUserUpVoteImage);
cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Utils.openUserFragment(userList.get(getAdapterPosition()), fragment.getActivity());
}
});
}
private void bindHolder(final int position) {
final User user = userList.get(position);
try {
String profileUrl = user.getUserProfilePictureUrl();
Log.i(TAG, "PROFILE URL: " + profileUrl);
Picasso.get().load(profileUrl).placeholder(R.drawable.user_placeholder).into(circleImageView);
textViewName.setText(user.getUserName());
} catch (Exception e) {
e.printStackTrace();
}
}
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = inflater.inflate(R.layout.vote_up_card, viewGroup, false);
return new UpVotesViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
if (viewHolder instanceof UpVotesViewHolder) {
((UpVotesViewHolder) viewHolder).bindHolder(i);
}
}
@Override
public int getItemCount() {
return userList.size();
}
public void setUpVoteList(List<User> userList) {
this.userList = userList;
}
}
\ No newline at end of file
package app.insti.adapter; package app.insti.adapter;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
...@@ -20,7 +21,6 @@ import app.insti.api.model.User; ...@@ -20,7 +21,6 @@ import app.insti.api.model.User;
public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> { public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
private List<User> userList; private List<User> userList;
private Context context;
private Fragment fragment; private Fragment fragment;
public UserAdapter(List<User> userList, Fragment mFragment) { public UserAdapter(List<User> userList, Fragment mFragment) {
...@@ -28,9 +28,10 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> { ...@@ -28,9 +28,10 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
fragment = mFragment; fragment = mFragment;
} }
@NonNull
@Override @Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
context = parent.getContext(); Context context = parent.getContext();
View v = LayoutInflater.from(context) View v = LayoutInflater.from(context)
.inflate(R.layout.feed_card, parent, false); .inflate(R.layout.feed_card, parent, false);
final ViewHolder postViewHolder = new ViewHolder(v); final ViewHolder postViewHolder = new ViewHolder(v);
...@@ -46,7 +47,7 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> { ...@@ -46,7 +47,7 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
} }
@Override @Override
public void onBindViewHolder(ViewHolder holder, int position) { public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
User user = userList.get(position); User user = userList.get(position);
holder.userName.setText(user.getUserName()); holder.userName.setText(user.getUserName());
if (user.getCurrentRole() == null || user.getCurrentRole().equals("")) { if (user.getCurrentRole() == null || user.getCurrentRole().equals("")) {
...@@ -72,15 +73,15 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> { ...@@ -72,15 +73,15 @@ public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ViewHolder> {
} }
public class ViewHolder extends RecyclerView.ViewHolder { public class ViewHolder extends RecyclerView.ViewHolder {
public TextView userName; private TextView userName;
public TextView role; private TextView role;
public ImageView image; public ImageView image;
public ViewHolder(View itemView) { public ViewHolder(View itemView) {
super(itemView); super(itemView);
userName = (TextView) itemView.findViewById(R.id.object_title); userName = itemView.findViewById(R.id.object_title);
role = (TextView) itemView.findViewById(R.id.object_subtitle); role = itemView.findViewById(R.id.object_subtitle);
image = (ImageView) itemView.findViewById(R.id.object_picture); image = itemView.findViewById(R.id.object_picture);
} }
} }
} }
package app.insti.api; package app.insti.api;
import android.app.Activity;
import android.content.Context;
import android.util.Log; import android.util.Log;
import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView; import com.google.android.gms.maps.MapView;
...@@ -21,8 +18,8 @@ import com.google.android.gms.maps.model.MarkerOptions; ...@@ -21,8 +18,8 @@ import com.google.android.gms.maps.model.MarkerOptions;
public class LocationAPIUtils { public class LocationAPIUtils {
private static final String TAG = LocationAPIUtils.class.getSimpleName(); private static final String TAG = LocationAPIUtils.class.getSimpleName();
GoogleMap googleMap; private GoogleMap googleMap;
MapView mMapView; private MapView mMapView;
public LocationAPIUtils(GoogleMap googleMap, MapView mMapView) { public LocationAPIUtils(GoogleMap googleMap, MapView mMapView) {
this.googleMap = googleMap; this.googleMap = googleMap;
......
...@@ -123,8 +123,8 @@ public interface RetrofitInterface { ...@@ -123,8 +123,8 @@ public interface RetrofitInterface {
@GET("venter/complaints/{complaintId}") @GET("venter/complaints/{complaintId}")
Call<Venter.Complaint> getComplaint(@Header("Cookie") String sessionId, @Path("complaintId") String complaintId); Call<Venter.Complaint> getComplaint(@Header("Cookie") String sessionId, @Path("complaintId") String complaintId);
@PUT("venter/complaints/{complaintId}") @GET("venter/complaints/{complaintId}/upvote")
Call<Venter.Complaint> upVote(@Header("Cookie") String sessionId, @Path("complaintId") String complaintId); Call<Venter.Complaint> upVote(@Header("Cookie") String sessionId, @Path("complaintId") String complaintId, @Query("action") int count);
@POST("venter/complaints") @POST("venter/complaints")
Call<ComplaintCreateResponse> postComplaint(@Header("Cookie") String sessionId, @Body ComplaintCreateRequest complaintCreateRequest); Call<ComplaintCreateResponse> postComplaint(@Header("Cookie") String sessionId, @Body ComplaintCreateRequest complaintCreateRequest);
......
...@@ -4,59 +4,38 @@ import android.support.annotation.NonNull; ...@@ -4,59 +4,38 @@ import android.support.annotation.NonNull;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import java.util.List; import java.util.List;
import app.insti.api.model.User;
/** /**
* Created by Shivam Sharma on 04-09-2018. * Created by Shivam Sharma on 04-09-2018.
*/ */
public class Venter { public class Venter {
public Venter(){ public static class Complaint{
}
public static class Complaint {
@NonNull
@SerializedName("id") @SerializedName("id")
String complaintID; private String complaintID;
@SerializedName("created_by") @SerializedName("created_by")
User complaintCreatedBy; private User complaintCreatedBy;
@SerializedName("description") @SerializedName("description")
String description; private String description;
@SerializedName("report_date") @SerializedName("report_date")
String complaintReportDate; private String complaintReportDate;
@SerializedName("status") @SerializedName("status")
String status; private String status;
@SerializedName("latitude") @SerializedName("latitude")
Float latitude; private Float latitude;
@SerializedName("longitude") @SerializedName("longitude")
Float longitude; private Float longitude;
@SerializedName("location_description") @SerializedName("location_description")
String locationDescription; private String locationDescription;
@SerializedName("tags") @SerializedName("tags")
List<TagUri> tags; private List<TagUri> tags;
@SerializedName("users_up_voted") @SerializedName("users_up_voted")
List<User> usersUpVoted; private List<User> usersUpVoted;
@SerializedName("images") @SerializedName("images")
List<String> images; private List<String> images;
@SerializedName("comments") @SerializedName("comments")
List<Comment> comment; private List<Comment> comment;
private int voteCount;
public Complaint(@NonNull String complaintID, User complaintCreatedBy, String description, String complaintReportDate, String status, Float latitude, Float longitude, String locationDescription, List<TagUri> tags, List<User> usersUpVoted, List<String> images, List<Comment> comment) {
this.complaintID = complaintID;
this.complaintCreatedBy = complaintCreatedBy;
this.description = description;
this.complaintReportDate = complaintReportDate;
this.status = status;
this.latitude = latitude;
this.longitude = longitude;
this.locationDescription = locationDescription;
this.tags = tags;
this.usersUpVoted = usersUpVoted;
this.images = images;
this.comment = comment;
}
@NonNull @NonNull
public String getComplaintID() { public String getComplaintID() {
...@@ -154,14 +133,21 @@ public class Venter { ...@@ -154,14 +133,21 @@ public class Venter {
public void setComment(List<Comment> comment) { public void setComment(List<Comment> comment) {
this.comment = comment; this.comment = comment;
} }
public int getVoteCount() {
return voteCount;
}
public void setVoteCount(int voteCount) {
this.voteCount = voteCount;
}
} }
public static class TagUri { public static class TagUri {
@NonNull
@SerializedName("id") @SerializedName("id")
String id; private String id;
@SerializedName("tag_uri") @SerializedName("tag_uri")
String tagUri; private String tagUri;
@NonNull @NonNull
public String getId() { public String getId() {
...@@ -183,15 +169,14 @@ public class Venter { ...@@ -183,15 +169,14 @@ public class Venter {
public static class Comment { public static class Comment {
@NonNull
@SerializedName("id") @SerializedName("id")
String id; private String id;
@SerializedName("time") @SerializedName("time")
String time; private String time;
@SerializedName("text") @SerializedName("text")
String text; private String text;
@SerializedName("commented_by") @SerializedName("commented_by")
User commented_by; private User commented_by;
@NonNull @NonNull
public String getId() { public String getId() {
......
package app.insti.fragment;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.TabLayout;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import app.insti.Constants;
import app.insti.R;
import app.insti.adapter.ComplaintFragmentViewPagerAdapter;
public class ComplaintsFragment extends BaseFragment {
private String userID, userProfileUrl;
private TabLayout slidingTabLayout;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_complaints, container, false);
Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
toolbar.setTitle("Complaints/Suggestions");
Bundle bundle = getArguments();
userID = bundle.getString(Constants.USER_ID);
userProfileUrl = bundle.getString(Constants.CURRENT_USER_PROFILE_PICTURE);
CollapsingToolbarLayout collapsingToolbarLayout = view.findViewById(R.id.collapsing_toolbar);
collapsingToolbarLayout.setTitleEnabled(false);
ViewPager viewPager = view.findViewById(R.id.tab_viewpager);
slidingTabLayout = view.findViewById(R.id.sliding_tab_layout);
Button buttonVentIssues = view.findViewById(R.id.buttonVentIssues);
buttonVentIssues.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FileComplaintFragment fileComplaintFragment = new FileComplaintFragment();
fileComplaintFragment.setArguments(getArguments());
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.framelayout_for_fragment, fileComplaintFragment, fileComplaintFragment.getTag());
fragmentTransaction.addToBackStack("Complaint Fragment").commit();
}
});
slidingTabLayout = view.findViewById(R.id.sliding_tab_layout);
if (viewPager != null) {
setupViewPager(viewPager);
}
return view;
}
private void setupViewPager(final ViewPager viewPager) {
viewPager.setAdapter(new ComplaintFragmentViewPagerAdapter(getChildFragmentManager(), userID, getArguments().getString(Constants.SESSION_ID), userProfileUrl));
slidingTabLayout.setupWithViewPager(viewPager);
slidingTabLayout.post(new Runnable() {
@Override
public void run() {
int tabLayoutWidth = slidingTabLayout.getWidth();
DisplayMetrics metrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
int deviceWidth = metrics.widthPixels;
if (tabLayoutWidth <= (deviceWidth + 1)) {
final TypedArray styledAttributes = getActivity().getTheme().obtainStyledAttributes(
new int[]{android.R.attr.actionBarSize}
);
int mActionBarSize = (int) styledAttributes.getDimension(0, 0);
styledAttributes.recycle();
AppBarLayout.LayoutParams layoutParams = new AppBarLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
mActionBarSize);
slidingTabLayout.setLayoutParams(layoutParams);
slidingTabLayout.setTabMode(TabLayout.MODE_FIXED);
slidingTabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
} else {
slidingTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
}
}
});
slidingTabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
viewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
//On Tab Unselected
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
//On Tab Reselected
}
});
viewPager.setOffscreenPageLimit(3);
}
}
package app.insti.fragment; package app.insti.fragment;
import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
...@@ -12,35 +11,31 @@ import android.view.LayoutInflater; ...@@ -12,35 +11,31 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import java.util.List; import java.util.List;
import app.insti.R; import app.insti.R;
import app.insti.Utils; import app.insti.Utils;
import app.insti.activity.MainActivity; import app.insti.adapter.ComplaintsAdapter;
import app.insti.adapter.ComplaintsRecyclerViewAdapter;
import app.insti.api.RetrofitInterface; import app.insti.api.RetrofitInterface;
import app.insti.api.model.Venter; import app.insti.api.model.Venter;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
import retrofit2.Response; import retrofit2.Response;
public class HomeFragment extends Fragment { public class ComplaintsHomeFragment extends Fragment {
Activity activity; private ComplaintsAdapter homeListAdapter;
ComplaintsRecyclerViewAdapter homeListAdapter;
RecyclerView recyclerViewHome;
private SwipeRefreshLayout swipeContainer; private SwipeRefreshLayout swipeContainer;
private static String TAG = HomeFragment.class.getSimpleName(); private static String TAG = ComplaintsHomeFragment.class.getSimpleName();
private boolean isCalled = false; private boolean isCalled = false;
private TextView error_message_home; private TextView error_message_home;
static String sID, uID; private static String sID, uID, uProfileUrl;
public static HomeFragment getInstance(String sessionID, String userID) { public static ComplaintsHomeFragment getInstance(String sessionID, String userID, String userProfileUrl) {
sID = sessionID; sID = sessionID;
uID = userID; uID = userID;
return new HomeFragment(); uProfileUrl = userProfileUrl;
return new ComplaintsHomeFragment();
} }
@Override @Override
...@@ -58,13 +53,13 @@ public class HomeFragment extends Fragment { ...@@ -58,13 +53,13 @@ public class HomeFragment extends Fragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home, container, false); View view = inflater.inflate(R.layout.fragment_complaints_home, container, false);
recyclerViewHome = (RecyclerView) view.findViewById(R.id.recyclerViewHome); RecyclerView recyclerViewHome = view.findViewById(R.id.recyclerViewHome);
homeListAdapter = new ComplaintsRecyclerViewAdapter(getActivity(), sID, uID); homeListAdapter = new ComplaintsAdapter(getActivity(), sID, uID, uProfileUrl);
swipeContainer = (SwipeRefreshLayout) view.findViewById(R.id.swipeContainer); swipeContainer = view.findViewById(R.id.swipeContainer);
error_message_home = view.findViewById(R.id.error_message_home); error_message_home = view.findViewById(R.id.error_message_home);
LinearLayoutManager llm = new LinearLayoutManager(activity); LinearLayoutManager llm = new LinearLayoutManager(getActivity());
recyclerViewHome.setLayoutManager(llm); recyclerViewHome.setLayoutManager(llm);
recyclerViewHome.setHasFixedSize(true); recyclerViewHome.setHasFixedSize(true);
...@@ -130,3 +125,4 @@ public class HomeFragment extends Fragment { ...@@ -130,3 +125,4 @@ public class HomeFragment extends Fragment {
homeListAdapter.notifyDataSetChanged(); homeListAdapter.notifyDataSetChanged();
} }
} }
package app.insti.fragment; package app.insti.fragment;
import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
...@@ -12,34 +11,30 @@ import android.view.LayoutInflater; ...@@ -12,34 +11,30 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import java.util.List; import java.util.List;
import app.insti.R; import app.insti.R;
import app.insti.Utils; import app.insti.Utils;
import app.insti.activity.MainActivity; import app.insti.adapter.ComplaintsAdapter;
import app.insti.adapter.ComplaintsRecyclerViewAdapter;
import app.insti.api.RetrofitInterface; import app.insti.api.RetrofitInterface;
import app.insti.api.model.Venter; import app.insti.api.model.Venter;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
import retrofit2.Response; import retrofit2.Response;
public class MeFragment extends Fragment { public class ComplaintsMeFragment extends Fragment {
static String uID, sID; private static String uID, sID, uProfileUrl;
Activity activity; private ComplaintsAdapter meListAdapter;
RecyclerView recyclerViewMe; private TextView error_message_me;
ComplaintsRecyclerViewAdapter meListAdapter; private SwipeRefreshLayout swipeContainer;
TextView error_message_me; private static String TAG = ComplaintsMeFragment.class.getSimpleName();
SwipeRefreshLayout swipeContainer;
private static String TAG = MeFragment.class.getSimpleName();
private boolean isCalled = false; private boolean isCalled = false;
public static MeFragment getInstance(String sessionID, String userID) { public static ComplaintsMeFragment getInstance(String sessionID, String userID, String userProfileUrl) {
sID = sessionID; sID = sessionID;
uID = userID; uID = userID;
return new MeFragment(); uProfileUrl = userProfileUrl;
return new ComplaintsMeFragment();
} }
@Override @Override
...@@ -58,13 +53,13 @@ public class MeFragment extends Fragment { ...@@ -58,13 +53,13 @@ public class MeFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
// Inflate the layout for this fragment // Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_me, container, false); View view = inflater.inflate(R.layout.fragment_complaints_me, container, false);
recyclerViewMe = view.findViewById(R.id.recyclerViewMe); RecyclerView recyclerViewMe = view.findViewById(R.id.recyclerViewMe);
meListAdapter = new ComplaintsRecyclerViewAdapter(getActivity(), sID, uID); meListAdapter = new ComplaintsAdapter(getActivity(), sID, uID, uProfileUrl);
swipeContainer = view.findViewById(R.id.swipeContainer); swipeContainer = view.findViewById(R.id.swipeContainer);
error_message_me = view.findViewById(R.id.error_message_me); error_message_me = view.findViewById(R.id.error_message_me);
LinearLayoutManager llm = new LinearLayoutManager(activity); LinearLayoutManager llm = new LinearLayoutManager(getActivity());
recyclerViewMe.setLayoutManager(llm); recyclerViewMe.setLayoutManager(llm);
recyclerViewMe.setHasFixedSize(true); recyclerViewMe.setHasFixedSize(true);
recyclerViewMe.setAdapter(meListAdapter); recyclerViewMe.setAdapter(meListAdapter);
...@@ -128,4 +123,4 @@ public class MeFragment extends Fragment { ...@@ -128,4 +123,4 @@ public class MeFragment extends Fragment {
meListAdapter.setcomplaintList(list); meListAdapter.setcomplaintList(list);
meListAdapter.notifyDataSetChanged(); meListAdapter.notifyDataSetChanged();
} }
} }
\ No newline at end of file
package app.insti.fragment; package app.insti.fragment;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
...@@ -16,13 +17,11 @@ public class ImageFragment extends BaseFragment { ...@@ -16,13 +17,11 @@ public class ImageFragment extends BaseFragment {
private static final String TAG = ImageFragment.class.getSimpleName(); private static final String TAG = ImageFragment.class.getSimpleName();
private String image; private String image;
int indexChosen;
public static ImageFragment newInstance(String image, int index) { public static ImageFragment newInstance(String image) {
ImageFragment fragment = new ImageFragment(); ImageFragment fragment = new ImageFragment();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString("image", image); args.putString("image", image);
args.putInt("index", index);
fragment.setArguments(args); fragment.setArguments(args);
return fragment; return fragment;
} }
...@@ -33,13 +32,12 @@ public class ImageFragment extends BaseFragment { ...@@ -33,13 +32,12 @@ public class ImageFragment extends BaseFragment {
Log.i(TAG, "getArguments in ImageFragment" + getArguments()); Log.i(TAG, "getArguments in ImageFragment" + getArguments());
if (getArguments() != null) { if (getArguments() != null) {
image = getArguments().getString("image"); image = getArguments().getString("image");
indexChosen = getArguments().getInt("index", 0);
} }
} }
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_image, container, false); View view = inflater.inflate(R.layout.fragment_image, container, false);
ImageView imageView = view.findViewById(R.id.imageView); ImageView imageView = view.findViewById(R.id.imageView);
Picasso.get().load(image).into(imageView); Picasso.get().load(image).into(imageView);
......
...@@ -7,8 +7,6 @@ import java.util.concurrent.TimeUnit; ...@@ -7,8 +7,6 @@ import java.util.concurrent.TimeUnit;
public class DateTimeUtil { public class DateTimeUtil {
private static String time_ago = "";
public static String getDate(String dtStart) { public static String getDate(String dtStart) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'+05:30'"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'+05:30'");
try { try {
...@@ -19,12 +17,18 @@ public class DateTimeUtil { ...@@ -19,12 +17,18 @@ public class DateTimeUtil {
long minutes = TimeUnit.MILLISECONDS.toMinutes(now.getTime() - date.getTime()); long minutes = TimeUnit.MILLISECONDS.toMinutes(now.getTime() - date.getTime());
long hours = TimeUnit.MILLISECONDS.toHours(now.getTime() - date.getTime()); long hours = TimeUnit.MILLISECONDS.toHours(now.getTime() - date.getTime());
if (seconds <= 0) { if (seconds <= 0) {
return time_ago = "now"; return "now";
} else if (seconds < 60 && seconds > 0) { } else if (seconds == 1){
return time_ago = seconds + " seconds ago"; return seconds + " second ago";
} else if (minutes < 60 && minutes > 0) { } else if (seconds < 60 && seconds > 1) {
return time_ago = minutes + " minutes ago"; return seconds + " seconds ago";
} else if (hours < 24 && hours > 0) { } else if (minutes == 1) {
return minutes + " 1 minute ago";
} else if (minutes < 60 && minutes > 1) {
return minutes + " minutes ago";
} else if (hours == 1) {
return hours + " hour ago";
} else if (hours < 24 && hours > 1) {
return hours + " hours ago"; return hours + " hours ago";
} else { } else {
long days = Math.round(diff / (24.0 * 60 * 60 * 1000)); long days = Math.round(diff / (24.0 * 60 * 60 * 1000));
...@@ -32,14 +36,25 @@ public class DateTimeUtil { ...@@ -32,14 +36,25 @@ public class DateTimeUtil {
return "today"; return "today";
else if (days == 1) else if (days == 1)
return "yesterday"; return "yesterday";
else if (days == 1)
return days + " day ago";
else if (days < 14) else if (days < 14)
return days + " days ago"; return days + " days ago";
else if (days < 30) else if (days < 30)
return ((int) (days / 7)) + " weeks ago"; if ((int) (days / 7) == 1)
return ((int) (days / 7)) + " week ago";
else
return ((int) (days / 7)) + " weeks ago";
else if (days < 365) else if (days < 365)
return ((int) (days / 30)) + " months ago"; if ((int) (days / 30) == 1)
return ((int) (days / 30)) + " month ago";
else
return ((int) (days / 30)) + " months ago";
else else
return ((int) (days / 365)) + " years ago"; if ((int) (days / 365) == 1)
return ((int) (days / 365)) + " year ago";
else
return ((int) (days / 365)) + " years ago";
} }
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
......
package app.insti.utils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
/**
* Created by Shivam Sharma on 13-08-2018.
*/
public class GsonProvider {
private static final Gson gsonInput = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").create();
private static final Gson gsonOutput = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").create();
public static Gson getGsonInput() {
return gsonInput;
}
public static Gson getGsonOutput() {
return gsonOutput;
}
}
\ No newline at end of file
...@@ -28,6 +28,13 @@ public class TagCategories { ...@@ -28,6 +28,13 @@ public class TagCategories {
"Fencing issues", "Fencing issues",
"Security issues", "Security issues",
"Infrastructural defaults in the academic area", "Infrastructural defaults in the academic area",
"Cycle pooling issues"}; "Cycle pooling issues",
"Water coolers & Aqua Guards",
"Mess menu complaints",
"PHO cleaning complaints",
"PHO cleaning complaints",
"Hostel common room complaints",
"Hostel Stationary shop complaints"
};
} }
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/>
</vector>
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<corners android:radius="20dp"/> <corners android:radius="20dp"/>
<!--<padding android:left="10dp" android:right="10dp" android:top="10dp" android:bottom="10dp"/>--> <padding android:left="10dp" android:right="10dp"/>
<stroke android:width="1dp" android:color="@color/colorPrimary"/> <stroke android:width="1dp" android:color="@color/colorPrimary"/>
</shape> </shape>
\ No newline at end of file
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <?xml version="1.0" encoding="utf-8"?>
xmlns:tools="http://schemas.android.com/tools" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context="app.insti.fragment.ComplaintFragment"> android:orientation="vertical">
<android.support.design.widget.CoordinatorLayout <android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:id="@+id/appBar" android:id="@+id/appBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> android:theme="@style/Base.ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout <android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar" android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:contentScrim="?attr/colorPrimary" app:contentScrim="@android:color/white"
android:background="@color/colorWhite"
app:layout_scrollFlags="scroll|exitUntilCollapsed"> app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout <LinearLayout
android:id="@+id/layoutTopCardViewHolder" android:id="@+id/image_holder_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="175dp" android:layout_height="2dp"
android:orientation="vertical" android:orientation="vertical"
app:layout_collapseMode="parallax"> app:layout_collapseMode="parallax">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:layout_marginTop="30dp">
<LinearLayout <android.support.v4.view.ViewPager
android:id="@+id/complaint_image_view_pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"/>
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginTop="20dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/venter_super_head"
android:textColor="@color/primaryTextColor"
android:textStyle="bold" />
<Button <me.relex.circleindicator.CircleIndicator
android:id="@+id/buttonVentIssues" android:id="@+id/indicator"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="48dp"
android:layout_marginTop="10dp" app:ci_animator="@animator/scale_with_alpha"
android:background="@color/colorSecondary" app:ci_drawable="@drawable/selected_dot" />
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:text="@string/vent_your_issues_now"
android:textAllCaps="false"
android:textColor="@color/secondaryTextColor"
android:textSize="18sp" />
</LinearLayout>
</RelativeLayout> </RelativeLayout>
...@@ -78,18 +57,20 @@ ...@@ -78,18 +57,20 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:layout_gravity="bottom" android:layout_gravity="bottom"
app:tabIndicatorColor="@color/colorAccent" app:tabIndicatorColor="@color/colorPrimary"
style="@style/CustomTabLayout" android:background="@color/colorWhite"
android:background="?attr/colorPrimary" /> app:tabTextColor="@color/colorGray"
app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"
app:tabSelectedTextColor="#4a4a4a"/>
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager <android.support.v4.view.ViewPager
android:id="@+id/tab_viewpager" android:id="@+id/tab_viewpager_details"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>
</FrameLayout> </LinearLayout>
\ No newline at end of file
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="app.insti.fragment.ComplaintsFragment">
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout
android:id="@+id/layoutTopCardViewHolder"
android:layout_width="match_parent"
android:layout_height="175dp"
android:orientation="vertical"
app:layout_collapseMode="parallax">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginTop="20dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/venter_super_head"
android:textColor="@color/primaryTextColor"
android:textStyle="bold" />
<Button
android:id="@+id/buttonVentIssues"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@color/colorSecondary"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:text="@string/vent_your_issues_now"
android:textAllCaps="false"
android:textColor="@color/secondaryTextColor"
android:textSize="18sp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
<android.support.design.widget.TabLayout
android:id="@+id/sliding_tab_layout"
android:layout_width="wrap_content"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="bottom"
app:tabIndicatorColor="@color/colorAccent"
style="@style/CustomTabLayout"
android:background="?attr/colorPrimary" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/tab_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
</FrameLayout>
\ No newline at end of file
...@@ -251,25 +251,34 @@ ...@@ -251,25 +251,34 @@
</LinearLayout> </LinearLayout>
<ScrollView <LinearLayout
android:id="@+id/tags_layout" android:id="@+id/linearLayoutScrollTags"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="6dp" android:orientation="vertical">
android:background="@android:color/white"
android:visibility="invisible">
<com.cunoraz.tagview.TagView <ScrollView
android:id="@+id/tag_populate" android:id="@+id/tags_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_margin="10dp" /> android:layout_marginLeft="6dp"
android:background="@android:color/white"
android:visibility="invisible">
</ScrollView> <com.cunoraz.tagview.TagView
android:id="@+id/tag_populate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp" />
<View </ScrollView>
android:layout_width="match_parent"
android:layout_height="17dp" /> <View
android:id="@+id/viewTagsLayout"
android:layout_width="match_parent"
android:layout_height="17dp" />
</LinearLayout>
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardViewUpVote"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical" android:orientation="vertical"
android:padding="10dp"> android:layout_margin="5dp"
android:padding="10dp"
app:cardUseCompatPadding="true"
app:cardBackgroundColor="@color/colorWhite"
app:cardCornerRadius="0dp">>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -15,6 +22,7 @@ ...@@ -15,6 +22,7 @@
android:paddingTop="4dp"> android:paddingTop="4dp">
<LinearLayout <LinearLayout
android:id="@+id/layoutUpVote"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="80dp" android:layout_height="80dp"
android:orientation="horizontal"> android:orientation="horizontal">
...@@ -49,4 +57,4 @@ ...@@ -49,4 +57,4 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </android.support.v7.widget.CardView>
\ No newline at end of file \ No newline at end of file
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<color name="colorGray">#757575</color> <color name="colorGray">#757575</color>
<color name="colorWhite">#FFFFFF</color> <color name="colorWhite">#FFFFFF</color>
<color name="colorTagGreen">#AED581</color>
<color name="colorRed">#FF0000</color> <color name="colorRed">#FF0000</color>
<color name="colorGreen">#00FF00</color> <color name="colorGreen">#00FF00</color>
<!-- Map --> <!-- Map -->
......
...@@ -45,8 +45,9 @@ ...@@ -45,8 +45,9 @@
<string name="enter_suggestions_if_any">Enter Suggestions (if any)</string> <string name="enter_suggestions_if_any">Enter Suggestions (if any)</string>
<string name="no_complaints">No complaints at the moment</string> <string name="no_complaints">No complaints at the moment</string>
<string name="initial_message_file_complaint">Please provide the complaint description before submitting</string> <string name="initial_message_file_complaint">Please provide the complaint description before submitting</string>
<string name="getting_current_location">Getting current location. Please try after some time</string> <string name="getting_current_location">Getting current location.</string>
<string name="GPS_not_enables">GPS is not enabled!</string> <string name="GPS_not_enables">GPS is not enabled!</string>
<string name="no_permission">No permission!</string> <string name="no_permission">No permission!</string>
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="enter_location_details">Enter Location Details</string> <string name="enter_location_details">Enter Location Details</string>
</resources> </resources>
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