Commit 346905ff authored by sshivam95's avatar sshivam95

Venter: add complaint form module.

parent cf8ff48c
...@@ -29,15 +29,21 @@ ext { ...@@ -29,15 +29,21 @@ ext {
picassoVersion = '2.71828' picassoVersion = '2.71828'
circleImageViewVersion = '2.2.0' circleImageViewVersion = '2.2.0'
markwonVersion = '1.0.6' markwonVersion = '1.0.6'
commonsIOVersion = '2.4'
tagViewVersion = '1.3'
circleIndicatorVersion = '1.2.2@aar'
} }
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-messaging:17.3.2' implementation 'com.google.firebase:firebase-messaging:17.3.2'
implementation "com.android.support:design:${supportLibVersion}" implementation "com.android.support:design:${supportLibVersion}"
implementation "com.android.support:exifinterface:${supportLibVersion}" implementation "com.android.support:exifinterface:${supportLibVersion}"
implementation "com.android.support:support-v4:${supportLibVersion}" implementation "com.android.support:support-v4:${supportLibVersion}"
implementation "com.google.android.gms:play-services-maps:${playServicesVersion}"
implementation "com.google.android.gms:play-services-location:${playServicesVersion}" implementation "com.google.android.gms:play-services-location:${playServicesVersion}"
implementation "com.google.android.gms:play-services-places:${playServicesVersion}"
implementation "com.squareup.retrofit2:retrofit:${retrofitVersion}" implementation "com.squareup.retrofit2:retrofit:${retrofitVersion}"
implementation "com.squareup.retrofit2:converter-gson:${retrofitVersion}" implementation "com.squareup.retrofit2:converter-gson:${retrofitVersion}"
implementation "com.squareup.okhttp3:okhttp:${okhttpVersion}" implementation "com.squareup.okhttp3:okhttp:${okhttpVersion}"
...@@ -46,5 +52,8 @@ dependencies { ...@@ -46,5 +52,8 @@ dependencies {
implementation "com.android.support:cardview-v7:${supportLibVersion}" implementation "com.android.support:cardview-v7:${supportLibVersion}"
implementation "de.hdodenhof:circleimageview:${circleImageViewVersion}" implementation "de.hdodenhof:circleimageview:${circleImageViewVersion}"
implementation "ru.noties:markwon:${markwonVersion}" implementation "ru.noties:markwon:${markwonVersion}"
implementation "commons-io:commons-io:${commonsIOVersion}"
implementation "com.github.Cutta:TagView:${tagViewVersion}"
implementation "me.relex:circleindicator:${circleIndicatorVersion}"
} }
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
android:name="com.google.android.gms.version" android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" /> android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_api_key" />
<!-- FCM styling --> <!-- FCM styling -->
<meta-data <meta-data
android:name="com.google.firebase.messaging.default_notification_icon" android:name="com.google.firebase.messaging.default_notification_icon"
......
...@@ -5,6 +5,7 @@ public class Constants { ...@@ -5,6 +5,7 @@ public class Constants {
public static final int MY_PERMISSIONS_REQUEST_ACCESS_LOCATION = 2; public static final int MY_PERMISSIONS_REQUEST_ACCESS_LOCATION = 2;
public static final int MY_PERMISSIONS_REQUEST_LOCATION = 3; public static final int MY_PERMISSIONS_REQUEST_LOCATION = 3;
public static final int RESULT_LOAD_IMAGE = 11; public static final int RESULT_LOAD_IMAGE = 11;
public static final int REQUEST_CAMERA_INT_ID = 101;
public static final String NOTIFICATIONS_RESPONSE_JSON = "notifications_json"; public static final String NOTIFICATIONS_RESPONSE_JSON = "notifications_json";
public static final String EVENT_ID = "event_id"; public static final String EVENT_ID = "event_id";
public static final String EVENT_LATITUDE = "event_latitude"; public static final String EVENT_LATITUDE = "event_latitude";
......
package app.insti;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ProgressBar;
/**
* Created by Shivam Sharma on 13-08-2018.
*/
public class CustomAutoCompleteTextView extends android.support.v7.widget.AppCompatAutoCompleteTextView {
private static final int MESSAGE_TEXT_CHANGED = 100;
private static final int DEFAULT_AUTOCOMPLETE_DELAY = 750;
private int mAutoCompleteDelay = DEFAULT_AUTOCOMPLETE_DELAY;
private ProgressBar mLoadingIndicator;
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
CustomAutoCompleteTextView.super.performFiltering((CharSequence) msg.obj, msg.arg1);
}
};
public CustomAutoCompleteTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setLoadingIndicator(ProgressBar progressBar) {
mLoadingIndicator = progressBar;
}
public void setAutoCompleteDelay(int autoCompleteDelay) {
mAutoCompleteDelay = autoCompleteDelay;
}
@Override
protected void performFiltering(CharSequence text, int keyCode) {
if (mLoadingIndicator != null) {
mLoadingIndicator.setVisibility(View.VISIBLE);
}
mHandler.removeMessages(MESSAGE_TEXT_CHANGED);
mHandler.sendMessageDelayed(mHandler.obtainMessage(MESSAGE_TEXT_CHANGED, text), mAutoCompleteDelay);
}
@Override
public void onFilterComplete(int count) {
if (mLoadingIndicator != null) {
mLoadingIndicator.setVisibility(View.GONE);
}
super.onFilterComplete(count);
}
}
package app.insti;
import java.util.ArrayList;
import java.util.Random;
/**
* Created by Shivam Sharma on 13-08-2018.
*/
public class TagClass {
private String name;
private String color;
public TagClass(String 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() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
}
\ No newline at end of file
...@@ -57,9 +57,11 @@ import app.insti.api.request.UserFCMPatchRequest; ...@@ -57,9 +57,11 @@ 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.BodyFragment;
import app.insti.fragment.CalendarFragment; import app.insti.fragment.CalendarFragment;
import app.insti.fragment.ComplaintFragment;
import app.insti.fragment.EventFragment; 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.MapFragment; import app.insti.fragment.MapFragment;
import app.insti.fragment.MessMenuFragment; import app.insti.fragment.MessMenuFragment;
import app.insti.fragment.NewsFragment; import app.insti.fragment.NewsFragment;
...@@ -79,6 +81,7 @@ import static app.insti.Constants.DATA_TYPE_PT; ...@@ -79,6 +81,7 @@ import static app.insti.Constants.DATA_TYPE_PT;
import static app.insti.Constants.DATA_TYPE_USER; import static app.insti.Constants.DATA_TYPE_USER;
import static app.insti.Constants.FCM_BUNDLE_NOTIFICATION_ID; import static app.insti.Constants.FCM_BUNDLE_NOTIFICATION_ID;
import static app.insti.Constants.MY_PERMISSIONS_REQUEST_ACCESS_LOCATION; import static app.insti.Constants.MY_PERMISSIONS_REQUEST_ACCESS_LOCATION;
import static app.insti.Constants.MY_PERMISSIONS_REQUEST_LOCATION;
import static app.insti.Constants.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE; import static app.insti.Constants.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE;
import static app.insti.Constants.RESULT_LOAD_IMAGE; import static app.insti.Constants.RESULT_LOAD_IMAGE;
...@@ -94,7 +97,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -94,7 +97,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private RetrofitInterface retrofitInterface; private RetrofitInterface retrofitInterface;
private List<Notification> notifications = null; private List<Notification> notifications = null;
/** which menu item should be checked on activity start */ /**
* which menu item should be checked on activity start
*/
private int initMenuChecked = R.id.nav_feed; private int initMenuChecked = R.id.nav_feed;
public static void hideKeyboard(Activity activity) { public static void hideKeyboard(Activity activity) {
...@@ -152,7 +157,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -152,7 +157,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
checkLatestVersion(); checkLatestVersion();
} }
/** Get the notifications from memory cache or network */ /**
* Get the notifications from memory cache or network
*/
private void fetchNotifications() { private void fetchNotifications() {
// Try memory cache // Try memory cache
if (notifications != null) { if (notifications != null) {
...@@ -173,7 +180,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -173,7 +180,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}); });
} }
/** Show the right notification icon */ /**
* Show the right notification icon
*/
private void showNotifications() { private void showNotifications() {
if (notifications != null && !notifications.isEmpty()) { if (notifications != null && !notifications.isEmpty()) {
menu.findItem(R.id.action_notifications).setIcon(R.drawable.baseline_notifications_active_white_24); menu.findItem(R.id.action_notifications).setIcon(R.drawable.baseline_notifications_active_white_24);
...@@ -182,7 +191,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -182,7 +191,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
} }
} }
/** Get version code we are currently on */ /**
* Get version code we are currently on
*/
private int getCurrentVersion() { private int getCurrentVersion() {
try { try {
PackageInfo pInfo = this.getPackageManager().getPackageInfo(getPackageName(), 0); PackageInfo pInfo = this.getPackageManager().getPackageInfo(getPackageName(), 0);
...@@ -192,10 +203,14 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -192,10 +203,14 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
} }
} }
/** Check for updates in andro.json */ /**
* Check for updates in andro.json
*/
private void checkLatestVersion() { private void checkLatestVersion() {
final int versionCode = getCurrentVersion(); final int versionCode = getCurrentVersion();
if (versionCode == 0) { return; } if (versionCode == 0) {
return;
}
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface(); RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
retrofitInterface.getLatestVersion().enqueue(new EmptyCallback<JsonObject>() { retrofitInterface.getLatestVersion().enqueue(new EmptyCallback<JsonObject>() {
@Override @Override
...@@ -257,7 +272,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -257,7 +272,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
mNotificationManager.createNotificationChannel(mChannel); mNotificationManager.createNotificationChannel(mChannel);
} }
/** Handle opening event/body/blog from FCM notification */ /**
* Handle opening event/body/blog from FCM notification
*/
private void handleFCMIntent(Bundle bundle) { private void handleFCMIntent(Bundle bundle) {
/* Mark the notification read */ /* Mark the notification read */
final String notificationId = bundle.getString(FCM_BUNDLE_NOTIFICATION_ID); final String notificationId = bundle.getString(FCM_BUNDLE_NOTIFICATION_ID);
...@@ -273,7 +290,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -273,7 +290,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
); );
} }
/** Handle intents for links */ /**
* Handle intents for links
*/
private void handleIntent(Intent appLinkIntent) { private void handleIntent(Intent appLinkIntent) {
String appLinkAction = appLinkIntent.getAction(); String appLinkAction = appLinkIntent.getAction();
String appLinkData = appLinkIntent.getDataString(); String appLinkData = appLinkIntent.getDataString();
...@@ -282,9 +301,13 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -282,9 +301,13 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
} }
} }
/** Open the proper fragment from given type and id */ /**
* Open the proper fragment from given type and id
*/
private void chooseIntent(String type, String id) { private void chooseIntent(String type, String id) {
if (type == null || id == null) { return; } if (type == null || id == null) {
return;
}
switch (type) { switch (type) {
case DATA_TYPE_BODY: case DATA_TYPE_BODY:
openBodyFragment(id); openBodyFragment(id);
...@@ -303,7 +326,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -303,7 +326,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
Log.e("NOTIFICATIONS", "Server sent invalid notification?"); Log.e("NOTIFICATIONS", "Server sent invalid notification?");
} }
/** Open the proper fragment from given type, id and extra */ /**
* Open the proper fragment from given type, id and extra
*/
private void chooseIntent(String type, String id, String extra) { private void chooseIntent(String type, String id, String extra) {
if (extra == null) { if (extra == null) {
chooseIntent(type, id); chooseIntent(type, id);
...@@ -323,18 +348,24 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -323,18 +348,24 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
} }
} }
/** Open user fragment from given id */ /**
* Open user fragment from given id
*/
private void openUserFragment(String id) { private void openUserFragment(String id) {
UserFragment userFragment = UserFragment.newInstance(id); UserFragment userFragment = UserFragment.newInstance(id);
updateFragment(userFragment); updateFragment(userFragment);
} }
/** Open the body fragment from given id */ /**
* Open the body fragment from given id
*/
private void openBodyFragment(String id) { private void openBodyFragment(String id) {
Utils.openBodyFragment(new Body(id), this); Utils.openBodyFragment(new Body(id), this);
} }
/** Open the event fragment from the provided id */ /**
* Open the event fragment from the provided id
*/
private void openEventFragment(String id) { private void openEventFragment(String id) {
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface(); RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
final FragmentActivity self = this; final FragmentActivity self = this;
...@@ -525,6 +556,15 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -525,6 +556,15 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
updateFragment(mapFragment); updateFragment(mapFragment);
break; break;
case R.id.nav_complaint:
if (session.isLoggedIn()) {
ComplaintFragment complaintFragment = new ComplaintFragment();
updateFragment(complaintFragment);
} else {
Toast.makeText(this, Constants.LOGIN_MESSAGE, Toast.LENGTH_LONG).show();
}
break;
case R.id.nav_settings: case R.id.nav_settings:
SettingsFragment settingsFragment = new SettingsFragment(); SettingsFragment settingsFragment = new SettingsFragment();
updateFragment(settingsFragment); updateFragment(settingsFragment);
...@@ -536,7 +576,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -536,7 +576,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
return true; return true;
} }
/** Open placement blog fragment */ /**
* Open placement blog fragment
*/
private void openPlacementBlog() { private void openPlacementBlog() {
if (session.isLoggedIn()) { if (session.isLoggedIn()) {
PlacementBlogFragment placementBlogFragment = new PlacementBlogFragment(); PlacementBlogFragment placementBlogFragment = new PlacementBlogFragment();
...@@ -555,7 +597,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -555,7 +597,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
} }
} }
/** Change the active fragment to the supplied one */ /**
* Change the active fragment to the supplied one
*/
public void updateFragment(Fragment fragment) { public void updateFragment(Fragment fragment) {
Log.d(TAG, "updateFragment: " + fragment.toString()); Log.d(TAG, "updateFragment: " + fragment.toString());
Bundle bundle = fragment.getArguments(); Bundle bundle = fragment.getArguments();
...@@ -565,7 +609,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -565,7 +609,7 @@ 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()) if (fragment instanceof SettingsFragment && session.isLoggedIn() || fragment instanceof ComplaintFragment && session.isLoggedIn())
bundle.putString(Constants.USER_ID, currentUser.getUserID()); bundle.putString(Constants.USER_ID, currentUser.getUserID());
fragment.setArguments(bundle); fragment.setArguments(bundle);
FragmentManager manager = getSupportFragmentManager(); FragmentManager manager = getSupportFragmentManager();
...@@ -599,6 +643,17 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -599,6 +643,17 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
Toast toast = Toast.makeText(MainActivity.this, "Need Permission", Toast.LENGTH_SHORT); Toast toast = Toast.makeText(MainActivity.this, "Need Permission", Toast.LENGTH_SHORT);
toast.show(); toast.show();
} }
break;
case MY_PERMISSIONS_REQUEST_LOCATION:
Log.i(TAG, "Permission request captured");
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Log.i(TAG, "Permission Granted");
FileComplaintFragment.getMainActivity().getMapReady();
} else {
Log.i(TAG, "Permission Cancelled");
Toast toast = Toast.makeText(MainActivity.this, "Need Permission", Toast.LENGTH_SHORT);
toast.show();
}
} }
} }
......
package app.insti.adapter;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.List;
import app.insti.R;
import app.insti.Utils;
import app.insti.activity.MainActivity;
import app.insti.api.RetrofitInterface;
import app.insti.api.model.Venter;
import app.insti.utils.DateTimeUtil;
import de.hdodenhof.circleimageview.CircleImageView;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
/**
* Created by Shivam Sharma on 23-09-2018.
*/
public class CommentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final String TAG = CommentRecyclerViewAdapter.class.getSimpleName();
private Context context;
private LayoutInflater inflater;
private String sessionId, userId;
private Activity activity;
private List<Venter.Comment> commentList = new ArrayList<>();
public CommentRecyclerViewAdapter(Activity activity, Context context, String sessionId, String userId) {
this.context = context;
this.sessionId = sessionId;
this.userId = userId;
inflater = LayoutInflater.from(context);
this.activity = activity;
}
public class CommentsViewHolder extends RecyclerView.ViewHolder {
private CardView cardView;
private CircleImageView circleImageView;
private TextView textViewName;
private TextView textViewCommentTime;
private TextView textViewComment;
final RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
public CommentsViewHolder(View itemView) {
super(itemView);
cardView = itemView.findViewById(R.id.cardViewComment);
textViewName = itemView.findViewById(R.id.textViewUserComment);
textViewComment = itemView.findViewById(R.id.textViewComment);
textViewCommentTime = itemView.findViewById(R.id.textViewTime);
circleImageView = itemView.findViewById(R.id.circleImageViewUserImage);
}
public void bindHolder(final int position) {
final Venter.Comment comment = commentList.get(position);
try {
String profileUrl = comment.getUser().getUserProfilePictureUrl();
Log.i(TAG, "PROFILE URL: " + profileUrl);
if (profileUrl != null)
Picasso.get().load(profileUrl).into(circleImageView);
else
Picasso.get().load(R.drawable.baseline_account_circle_black_36).into(circleImageView);
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewName.setText(comment.getUser().getUserName());
} catch (Exception e) {
e.printStackTrace();
}
try {
String time = DateTimeUtil.getDate(comment.getTime().toString());
Log.i(TAG, "time: " + time);
Log.i(TAG, "inside try");
textViewCommentTime.setText(time);
} catch (Exception e) {
Log.i(TAG, "Inside catch");
e.printStackTrace();
}
try {
textViewComment.setText(comment.getText());
} catch (Exception e) {
e.printStackTrace();
}
cardView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(final View v) {
PopupMenu popupMenu = new PopupMenu(context, cardView);
if (!(comment.getUser().getUserID().equals(userId))) {
popupMenu.inflate(R.menu.comments_options_secondary_menu);
} else {
popupMenu.inflate(R.menu.comment_options_primary_menu);
}
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.copy_comment_option:
ClipboardManager clipboardManager = (ClipboardManager) context.getSystemService(context.CLIPBOARD_SERVICE);
ClipData clipData = ClipData.newPlainText("Text Copied", textViewComment.getText().toString());
clipboardManager.setPrimaryClip(clipData);
Toast.makeText(context, "Comment Copied", Toast.LENGTH_SHORT).show();
break;
case R.id.delete_comment_option:
retrofitInterface.deleteComment("sessionid=" + sessionId, comment.getId()).enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
if (response.isSuccessful()) {
Toast.makeText(context, "Comment Deleted", Toast.LENGTH_SHORT).show();
commentList.remove(position);
notifyDataSetChanged();
notifyItemRemoved(position);
notifyItemRangeChanged(position, commentList.size() - position);
} else {
Toast.makeText(context, "You can't delete this comment", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<String> call, Throwable t) {
Log.i(TAG, " failure in deleting: " + t.toString());
}
});
break;
}
return true;
}
});
popupMenu.show();
return true;
}
});
}
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = inflater.inflate(R.layout.comments_card, parent, false);
CommentsViewHolder commentsViewHolder = new CommentsViewHolder(view);
return commentsViewHolder;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (holder instanceof CommentsViewHolder) {
((CommentsViewHolder) holder).bindHolder(position);
}
}
@Override
public int getItemCount() {
return commentList.size();
}
public void setCommentList(List<Venter.Comment> commentList) {
this.commentList = commentList;
}
}
\ No newline at end of file
package app.insti.adapter;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import app.insti.api.model.Venter;
import app.insti.fragment.DetailedComplaintFragment;
/**
* Created by Shivam Sharma on 19-09-2018.
*/
public class ComplaintDetailsPagerAdapter extends FragmentPagerAdapter {
Venter.Complaint detailedComplaint;
Context context;
String sessionid, complaintid, userid;
public ComplaintDetailsPagerAdapter(FragmentManager fm, Venter.Complaint detailedComplaint, Context context, String sessionid, String complaintid, String userid) {
super(fm);
this.context = context;
this.detailedComplaint = detailedComplaint;
this.sessionid = sessionid;
this.complaintid = complaintid;
this.userid = userid;
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
return DetailedComplaintFragment.getInstance(sessionid, complaintid, userid);
default:
return DetailedComplaintFragment.getInstance(sessionid, complaintid, userid);
}
}
@Override
public CharSequence getPageTitle(int position) {
return "Complaint Details";
}
@Override
public int getCount() {
return 1; /* Update as 2 on adding RelevantComplints*/
}
}
package app.insti.adapter;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import app.insti.fragment.HomeFragment;
import app.insti.fragment.MeFragment;
/**
* Created by Shivam Sharma on 15-08-2018.
*/
public class ComplaintFragmentViewPagerAdapter extends FragmentStatePagerAdapter {
private static final String TAG = ComplaintFragmentViewPagerAdapter.class.getSimpleName();
Context context;
String userID, sessionID;
public ComplaintFragmentViewPagerAdapter(FragmentManager fm, Context context, String userID, String sessionID) {
super(fm);
this.context = context;
this.userID = userID;
this.sessionID = sessionID;
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
return HomeFragment.getInstance(sessionID, userID);
case 1:
return MeFragment.getInstance(sessionID,userID);
default:
return HomeFragment.getInstance(sessionID, userID);
}
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
if (position == 0) {
return "Home";
} else {
return "Me";
}
}
@Override
public int getCount() {
return 2;
}
}
package app.insti.adapter;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.text.format.DateUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.TimeZone;
import app.insti.R;
import app.insti.api.model.Venter;
import app.insti.fragment.ComplaintDetailsFragment;
import app.insti.utils.DateTimeUtil;
import app.insti.utils.GsonProvider;
/**
* Created by Shivam Sharma on 15-08-2018.
*/
public class ComplaintsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private LayoutInflater inflater;
private Activity context;
private String sessionID;
private String userID;
private static final String TAG = ComplaintsRecyclerViewAdapter.class.getSimpleName();
List<Venter.Complaint> complaintList = new ArrayList<>();
public class ComplaintsViewHolder extends RecyclerView.ViewHolder {
private CardView cardView;
private TextView textViewDescription;
private Button buttonComments;
private Button buttonVotes;
private TextView textViewLocation;
private TextView textViewUserName;
private TextView textViewReportDate;
private TextView textViewStatus;
private int pos;
public ComplaintsViewHolder(View currentView) {
super(currentView);
cardView = currentView.findViewById(R.id.cardView);
textViewUserName = currentView.findViewById(R.id.textViewUserName);
textViewStatus = currentView.findViewById(R.id.textViewStatus);
textViewReportDate = currentView.findViewById(R.id.textViewReportDate);
textViewLocation = currentView.findViewById(R.id.textViewLocation);
textViewDescription = currentView.findViewById(R.id.textViewDescription);
buttonComments = currentView.findViewById(R.id.buttonComments);
buttonVotes = currentView.findViewById(R.id.buttonVotes);
}
public void bindHolder(int position) {
this.pos = position;
Log.i(TAG, "json = " + GsonProvider.getGsonOutput().toJson(complaintList.get(pos)));
cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle bundle = new Bundle();
bundle.putString("id", complaintList.get(pos).getComplaintID());
bundle.putString("sessionId", sessionID);
bundle.putString("userId", userID);
ComplaintDetailsFragment complaintDetailsFragment = new ComplaintDetailsFragment();
complaintDetailsFragment.setArguments(bundle);
AppCompatActivity activity = (AppCompatActivity) context;
activity.getSupportFragmentManager().beginTransaction().replace(R.id.framelayout_for_fragment, complaintDetailsFragment).addToBackStack(TAG).commit();
}
});
Venter.Complaint complaint = complaintList.get(position);
try {
textViewDescription.setText(complaint.getDescription());
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewLocation.setText(complaint.getLocationDescription());
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewUserName.setText(complaint.getComplaintCreatedBy().getUserName());
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewStatus.setText(complaint.getStatus().toUpperCase());
if (complaint.getStatus().equalsIgnoreCase("Reported")) {
textViewStatus.setBackgroundColor(Color.parseColor("#FF0000"));
textViewStatus.setTextColor(context.getResources().getColor(R.color.primaryTextColor));
} else if (complaint.getStatus().equalsIgnoreCase("In Progress")) {
textViewStatus.setBackgroundColor(context.getResources().getColor(R.color.colorSecondary));
textViewStatus.setTextColor(context.getResources().getColor(R.color.secondaryTextColor));
} else if (complaint.getStatus().equalsIgnoreCase("Resolved")) {
textViewStatus.setBackgroundColor(Color.parseColor("#00FF00"));
textViewStatus.setTextColor(context.getResources().getColor(R.color.secondaryTextColor));
}
} catch (Exception e) {
e.printStackTrace();
}
try {
String time = DateTimeUtil.getDate(complaint.getComplaintReportDate().toString());
Log.i(TAG, "time: " + time);
textViewReportDate.setText(time);
} catch (Exception e) {
e.printStackTrace();
}
try {
buttonComments.setText("COMMENTS(" + complaint.getComment().size() + ")");
} catch (Exception e) {
e.printStackTrace();
}
try {
buttonVotes.setText("UP VOTES(" + complaint.getUsersUpVoted().size() + ")");
} catch (Exception e) {
e.printStackTrace();
}
}
}
public ComplaintsRecyclerViewAdapter(Activity ctx, String sessionID, String userID) {
this.context = ctx;
this.sessionID = sessionID;
this.userID = userID;
inflater = LayoutInflater.from(ctx);
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view;
view = inflater.inflate(R.layout.complaint_card, parent, false);
return new ComplaintsViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
if (viewHolder instanceof ComplaintsViewHolder) {
((ComplaintsViewHolder) viewHolder).bindHolder(position);
}
}
@Override
public int getItemCount() {
return complaintList.size();
}
public void setcomplaintList(List<Venter.Complaint> list) {
this.complaintList = list;
}
}
\ No newline at end of file
package app.insti.adapter;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
import app.insti.api.model.Venter;
import app.insti.fragment.AddImageFragment;
import app.insti.fragment.ImageFragment;
/**
* Created by Shivam Sharma on 25-09-2018.
*/
public class ImageViewPagerAdapter extends FragmentPagerAdapter {
private static final String TAG = ImageViewPagerAdapter.class.getSimpleName();
private List<String> images = new ArrayList<>();
Venter.Complaint detailedComplaint;
public ImageViewPagerAdapter(FragmentManager fragmentManager, List<String> images) {
super(fragmentManager);
this.images = images;
}
public ImageViewPagerAdapter(FragmentManager fragmentManager, Venter.Complaint detailedComplaint){
super(fragmentManager);
this.detailedComplaint = detailedComplaint;
for (String image: detailedComplaint.getImages()){
images.add(image);
}
}
@Override
public int getCount() {
if (images.size() == 0)
return 1;
return images.size();
}
@Override
public Fragment getItem(int position) {
Log.i(TAG, "images = " + images.size());
Log.i(TAG, "size = " + getCount());
Log.i(TAG, "pos = " + position);
if (images.size() == 0){
Log.i(TAG,"calling 1");
return new AddImageFragment();
}else {
Log.i(TAG,"calling 2");
return ImageFragment.newInstance(images.get(position),position);
}
}
}
\ No newline at end of file
package app.insti.api;
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
/**
* Created by Shivam Sharma on 13-08-2018.
* <p>
* This API updates the Google Map when the location is added.
*/
public class LocationAPIUtils {
private static final String TAG = LocationAPIUtils.class.getSimpleName();
GoogleMap googleMap;
MapView mMapView;
public LocationAPIUtils(GoogleMap googleMap, MapView mMapView) {
this.googleMap = googleMap;
this.mMapView = mMapView;
}
public void callGoogleToShowLocationOnMap( final LatLng location, final String name, final String address, final int cursor) {
mMapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap mMap) {
googleMap = mMap;
if (cursor != 0) {
googleMap.clear();
}
googleMap.addMarker(new MarkerOptions().position(location).title(name).snippet(address));
CameraPosition cameraPosition = new CameraPosition.Builder().target(location).zoom(17).build();
googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
Log.i(TAG, "curser = " + cursor);
}
});
}
}
\ No newline at end of file
...@@ -11,10 +11,14 @@ import app.insti.api.model.Notification; ...@@ -11,10 +11,14 @@ import app.insti.api.model.Notification;
import app.insti.api.model.PlacementBlogPost; import app.insti.api.model.PlacementBlogPost;
import app.insti.api.model.TrainingBlogPost; import app.insti.api.model.TrainingBlogPost;
import app.insti.api.model.User; import app.insti.api.model.User;
import app.insti.api.model.Venter;
import app.insti.api.model.Venue; import app.insti.api.model.Venue;
import app.insti.api.request.CommentCreateRequest;
import app.insti.api.request.ComplaintCreateRequest;
import app.insti.api.request.EventCreateRequest; import app.insti.api.request.EventCreateRequest;
import app.insti.api.request.ImageUploadRequest; import app.insti.api.request.ImageUploadRequest;
import app.insti.api.request.UserFCMPatchRequest; import app.insti.api.request.UserFCMPatchRequest;
import app.insti.api.response.ComplaintCreateResponse;
import app.insti.api.response.EventCreateResponse; import app.insti.api.response.EventCreateResponse;
import app.insti.api.response.ExploreResponse; import app.insti.api.response.ExploreResponse;
import app.insti.api.response.ImageUploadResponse; import app.insti.api.response.ImageUploadResponse;
...@@ -22,10 +26,12 @@ import app.insti.api.response.LoginResponse; ...@@ -22,10 +26,12 @@ import app.insti.api.response.LoginResponse;
import app.insti.api.response.NewsFeedResponse; import app.insti.api.response.NewsFeedResponse;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.Header; import retrofit2.http.Header;
import retrofit2.http.PATCH; import retrofit2.http.PATCH;
import retrofit2.http.POST; import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path; import retrofit2.http.Path;
import retrofit2.http.Query; import retrofit2.http.Query;
...@@ -107,4 +113,29 @@ public interface RetrofitInterface { ...@@ -107,4 +113,29 @@ public interface RetrofitInterface {
@GET("search") @GET("search")
Call<ExploreResponse> search(@Header("Cookie") String sessionID, @Query("query") String query); Call<ExploreResponse> search(@Header("Cookie") String sessionID, @Query("query") String query);
@GET("venter/complaints")
Call<List<Venter.Complaint>> getAllComplaints(@Header("Cookie") String sessionId);
@GET("venter/complaints?filter=me")
Call<List<Venter.Complaint>> getUserComplaints(@Header("Cookie") String sessionId);
@GET("venter/complaints/{complaintId}")
Call<Venter.Complaint> getComplaint(@Header("Cookie") String sessionId, @Path("complaintId") String complaintId);
@PUT("venter/complaints/{complaintId}")
Call<Venter.Complaint> upVote(@Header("Cookie") String sessionId, @Path("complaintId") String complaintId);
@POST("venter/complaints")
Call<ComplaintCreateResponse> postComplaint(@Header("Cookie") String sessionId, @Body ComplaintCreateRequest complaintCreateRequest);
@POST("venter/complaints/{complaintId}/comments")
Call<Venter.Comment> postComment(@Header("Cookie") String sessionId, @Path("complaintId") String commentId, @Body CommentCreateRequest commentCreateRequest);
@PUT("venter/comments/{commentId}")
Call<Venter.Comment> updateComment(@Header("Cookie") String sessionId, @Path("commentId") String commentId, @Body CommentCreateRequest commentCreateRequest);
@DELETE("venter/comments/{commentId}")
Call<String> deleteComment(@Header("Cookie") String sessionId, @Path("commentId") String commentId);
} }
package app.insti.api.model;
import android.support.annotation.NonNull;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import app.insti.api.model.User;
/**
* Created by Shivam Sharma on 04-09-2018.
*/
public class Venter {
public Venter(){
}
public static class Complaint {
@NonNull
@SerializedName("id")
String complaintID;
@SerializedName("created_by")
User complaintCreatedBy;
@SerializedName("description")
String description;
@SerializedName("report_date")
String complaintReportDate;
@SerializedName("status")
String status;
@SerializedName("latitude")
Float latitude;
@SerializedName("longitude")
Float longitude;
@SerializedName("location_description")
String locationDescription;
@SerializedName("tags")
List<TagUri> tags;
@SerializedName("users_up_voted")
List<User> usersUpVoted;
@SerializedName("images")
List<String> images;
@SerializedName("comments")
List<Comment> comment;
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
public String getComplaintID() {
return complaintID;
}
public void setComplaintID(@NonNull String complaintID) {
this.complaintID = complaintID;
}
public User getComplaintCreatedBy() {
return complaintCreatedBy;
}
public void setComplaintCreatedBy(User complaintCreatedBy) {
this.complaintCreatedBy = complaintCreatedBy;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getComplaintReportDate() {
return complaintReportDate;
}
public void setComplaintReportDate(String complaintReportDate) {
this.complaintReportDate = complaintReportDate;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Float getLatitude() {
return latitude;
}
public void setLatitude(Float latitude) {
this.latitude = latitude;
}
public Float getLongitude() {
return longitude;
}
public void setLongitude(Float longitude) {
this.longitude = longitude;
}
public String getLocationDescription() {
return locationDescription;
}
public void setLocationDescription(String locationDescription) {
this.locationDescription = locationDescription;
}
public List<TagUri> getTags() {
return tags;
}
public void setTags(List<TagUri> tags) {
this.tags = tags;
}
public List<User> getUsersUpVoted() {
return usersUpVoted;
}
public void setUsersUpVoted(List<User> usersUpVoted) {
this.usersUpVoted = usersUpVoted;
}
public List<String> getImages() {
return images;
}
public void setImages(List<String> images) {
this.images = images;
}
public List<Comment> getComment() {
return comment;
}
public void setComment(List<Comment> comment) {
this.comment = comment;
}
}
public static class TagUri {
@NonNull
@SerializedName("id")
String id;
@SerializedName("tag_uri")
String tagUri;
@NonNull
public String getId() {
return id;
}
public void setId(@NonNull String id) {
this.id = id;
}
public String getTagUri() {
return tagUri;
}
public void setTagUri(String tagUri) {
this.tagUri = tagUri;
}
}
public static class Comment {
@NonNull
@SerializedName("id")
String id;
@SerializedName("time")
String time;
@SerializedName("text")
String text;
@SerializedName("commented_by")
User commented_by;
@NonNull
public String getId() {
return id;
}
public void setId(@NonNull String id) {
this.id = id;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public User getUser() {
return commented_by;
}
public void setUser(User commented_by) {
this.commented_by = commented_by;
}
}
}
package app.insti.api.request;
import com.google.gson.annotations.SerializedName;
/**
* Created by Shivam Sharma on 21-09-2018.
*/
public class CommentCreateRequest {
@SerializedName("text")
private String text;
public CommentCreateRequest(String text) {
this.text = text;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}
package app.insti.api.request;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Created by Shivam Sharma on 18-09-2018.
*/
public class ComplaintCreateRequest {
@SerializedName("description")
private String complaintDescription;
@SerializedName("location_description")
private String complaintLocation;
@SerializedName("latitude")
private Float complaintLatitude;
@SerializedName("longitude")
private Float complaintLongitude;
@SerializedName("tags")
private List<String> tags;
@SerializedName("images")
private List<String> images;
public ComplaintCreateRequest(String complaintDescription, String complaintLocation, Float complaintLatitude, Float complaintLongitude, List<String> tags, List<String> images) {
this.complaintDescription = complaintDescription;
this.complaintLocation = complaintLocation;
this.complaintLatitude = complaintLatitude;
this.complaintLongitude = complaintLongitude;
this.tags = tags;
this.images = images;
}
public String getComplaintDescription() {
return complaintDescription;
}
public void setComplaintDescription(String complaintDescription) {
this.complaintDescription = complaintDescription;
}
public String getComplaintLocation() {
return complaintLocation;
}
public void setComplaintLocation(String complaintLocation) {
this.complaintLocation = complaintLocation;
}
public Float getComplaintLatitude() {
return complaintLatitude;
}
public void setComplaintLatitude(Float complaintLatitude) {
this.complaintLatitude = complaintLatitude;
}
public Float getComplaintLongitude() {
return complaintLongitude;
}
public void setComplaintLongitude(Float complaintLongitude) {
this.complaintLongitude = complaintLongitude;
}
public List<String> getTags() {
return tags;
}
public void setTags(List<String> tags) {
this.tags = tags;
}
public List<String> getImages() {
return images;
}
public void setImages(List<String> images) {
this.images = images;
}
}
package app.insti.api.response;
/**
* Created by Shivam Sharma on 18-09-2018.
*/
public class ComplaintCreateResponse {
private String result;
private String complaintId;
public ComplaintCreateResponse(String result, String complaintId) {
this.result = result;
this.complaintId = complaintId;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getComplaintId() {
return complaintId;
}
public void setComplaintId(String complaintId) {
this.complaintId = complaintId;
}
}
package app.insti.fragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import app.insti.R;
/**
* Created by Shivam Sharma on 25-09-2018.
*/
public class AddImageFragment extends BaseFragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_add_image, container, false);
return view;
}
}
package app.insti.fragment;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Toast;
import java.util.Objects;
import app.insti.R;
import app.insti.Utils;
import app.insti.activity.MainActivity;
import app.insti.adapter.ComplaintDetailsPagerAdapter;
import app.insti.adapter.ImageViewPagerAdapter;
import app.insti.api.RetrofitInterface;
import app.insti.api.model.User;
import app.insti.api.model.Venter;
import me.relex.circleindicator.CircleIndicator;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ComplaintDetailsFragment extends Fragment {
private static final String TAG = ComplaintDetailsFragment.class.getSimpleName();
Button buttonVoteUp;
TabLayout slidingTabLayout;
ViewPager viewPager;
View mview;
private String complaintId, sessionID, userId;
private ComplaintDetailsPagerAdapter complaintDetailsPagerAdapter;
private int voteCount;
CircleIndicator circleIndicator;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_complaint_details, container, false);
LinearLayout imageViewHolder = view.findViewById(R.id.image_holder_view);
CollapsingToolbarLayout.LayoutParams layoutParams = new CollapsingToolbarLayout.LayoutParams
(CollapsingToolbarLayout.LayoutParams.MATCH_PARENT,
getResources().getDisplayMetrics().heightPixels / 2);
imageViewHolder.setLayoutParams(layoutParams);
buttonVoteUp = view.findViewById(R.id.buttonVoteUp);
slidingTabLayout = view.findViewById(R.id.sliding_tab_layout);
circleIndicator = view.findViewById(R.id.indicator);
this.mview = view;
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
buttonVoteUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
upVote();
}
});
Bundle bundle = getArguments();
complaintId = bundle.getString("id");
sessionID = bundle.getString("sessionId");
userId = bundle.getString("userId");
if (bundle != null) {
Log.i(TAG, "bundle != null");
callServerToGetDetailedComplaint();
}
}
private void upVote() {
if (voteCount == 0) {
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
retrofitInterface.upVote("sessionid=" + sessionID, complaintId).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();
initTabViews(complaint);
Toast.makeText(getActivity().getApplicationContext(), "You have Up Voted this complaint", Toast.LENGTH_SHORT).show();
voteCount++;
}
}
@Override
public void onFailure(Call<Venter.Complaint> call, Throwable t) {
Log.i(TAG, "failure in up vote: " + t.toString());
}
});
} else {
Toast.makeText(getActivity().getApplicationContext(), "You have already UpVoted this complaint", Toast.LENGTH_SHORT).show();
}
}
private void callServerToGetDetailedComplaint() {
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
retrofitInterface.getComplaint("sessionid=" + sessionID, complaintId).enqueue(new Callback<Venter.Complaint>() {
@Override
public void onResponse(Call<Venter.Complaint> call, Response<Venter.Complaint> response) {
if (response.body() != null) {
Venter.Complaint complaint = response.body();
for (User currentUser : complaint.getUsersUpVoted()) {
if (currentUser.getUserID().equals(userId)) {
voteCount = 1;
}
}
initViewPagerForImages(complaint);
initTabViews(complaint);
}
}
@Override
public void onFailure(Call<Venter.Complaint> call, Throwable t) {
if (t != null) {
Log.i(TAG, "error and t = " + t.toString());
}
}
});
}
private void initViewPagerForImages(Venter.Complaint detailedComplaint) {
viewPager = mview.findViewById(R.id.complaint_image_view_pager);
if (viewPager != null) {
try {
ImageViewPagerAdapter imageFragmentPagerAdapter = new ImageViewPagerAdapter(getChildFragmentManager(), detailedComplaint);
viewPager.setAdapter(imageFragmentPagerAdapter);
circleIndicator.setViewPager(viewPager);
imageFragmentPagerAdapter.registerDataSetObserver(circleIndicator.getDataSetObserver());
viewPager.getAdapter().notifyDataSetChanged();
synchronized (viewPager) {
viewPager.notifyAll();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
private void initTabViews(final Venter.Complaint detailedComplaint) {
try {
buttonVoteUp.setText("UpVote");
} catch (Exception e) {
e.printStackTrace();
}
try {
if (detailedComplaint != null) {
viewPager = mview.findViewById(R.id.tab_viewpager_details);
if (viewPager != null) {
Log.i(TAG, "viewPager != null");
complaintDetailsPagerAdapter = new ComplaintDetailsPagerAdapter(getChildFragmentManager(), detailedComplaint, getContext(), sessionID, complaintId, userId);
viewPager.setAdapter(complaintDetailsPagerAdapter);
slidingTabLayout.setupWithViewPager(viewPager);
slidingTabLayout.post(new Runnable() {
@Override
public void run() {
int tablLayoutWidth = slidingTabLayout.getWidth();
DisplayMetrics metrics = new DisplayMetrics();
Objects.requireNonNull(getActivity()).getWindowManager().getDefaultDisplay().getMetrics(metrics);
int deviceWidth = metrics.widthPixels;
if (tablLayoutWidth <= deviceWidth) {
final TypedArray styledAttributes = Objects.requireNonNull(ComplaintDetailsFragment.this.getActivity()).getTheme().obtainStyledAttributes(
new int[]{android.R.attr.actionBarSize});
int mActionBarSize = (int) styledAttributes.getDimension(0, 0);
styledAttributes.recycle();
AppBarLayout.LayoutParams layoutParams = new AppBarLayout.LayoutParams(AppBarLayout.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) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
DetailedComplaintFragment detailedComplaintFragment = (DetailedComplaintFragment) getChildFragmentManager().findFragmentByTag(
"android:switcher:" + R.id.tab_viewpager_details + ":0"
);
Log.i(TAG, "detailedComplaintFragment: " + detailedComplaint);
/*For Relevant Complaint Fragment
* RelevantComplaintFragment relevantComplaintFragment = (RelevantComplaintFragment) getSupportFragmentManager().findFragmentByTag(
"android:switcher:" + R.id.tab_viewpager + ":1");
*/
if (detailedComplaintFragment != null) {
Log.i(TAG, "detailedComplinatFragment != null");
detailedComplaintFragment.setDetailedComplaint(detailedComplaint);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package app.insti.fragment;
import android.content.Context;
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 ComplaintFragment extends BaseFragment {
private static String TAG = ComplaintFragment.class.getSimpleName();
String userID;
Context context;
private Button buttonVentIssues;
private ViewPager viewPager;
private TabLayout slidingTabLayout;
private CollapsingToolbarLayout collapsingToolbarLayout;
public ComplaintFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_complaint, container, false);
Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
toolbar.setTitle("Complaints/Suggestions");
Bundle bundle = getArguments();
userID = bundle.getString(Constants.USER_ID);
collapsingToolbarLayout = view.findViewById(R.id.collapsing_toolbar);
collapsingToolbarLayout.setTitleEnabled(false);
viewPager = (ViewPager) view.findViewById(R.id.tab_viewpager);
slidingTabLayout = (TabLayout) view.findViewById(R.id.sliding_tab_layout);
context = getContext();
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(fileComplaintFragment.getTag()).commit();
}
});
viewPager = view.findViewById(R.id.tab_viewpager);
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(), getContext(), userID, getArguments().getString(Constants.SESSION_ID)));
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) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
viewPager.setOffscreenPageLimit(3);
}
}
package app.insti.fragment;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
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.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.cunoraz.tagview.TagView;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.MapsInitializer;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.List;
import app.insti.R;
import app.insti.Utils;
import app.insti.activity.MainActivity;
import app.insti.adapter.CommentRecyclerViewAdapter;
import app.insti.api.RetrofitInterface;
import app.insti.api.model.User;
import app.insti.api.model.Venter;
import app.insti.api.request.CommentCreateRequest;
import app.insti.utils.DateTimeUtil;
import de.hdodenhof.circleimageview.CircleImageView;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class DetailedComplaintFragment extends Fragment {
private final String TAG = DetailedComplaintFragment.class.getSimpleName();
private LayoutInflater inflater;
private Venter.Complaint detailedComplaint;
private MapView mMapView;
private GoogleMap googleMap;
private TextView textViewUserName;
private TextView textViewReportDate;
private TextView textViewLocation;
private TextView textViewDescription;
private TextView textViewCommentLabel;
private TextView textViewVoteUpLabel;
private TextView textViewStatus;
private LinearLayout layoutVotes;
private TagView tagView;
private EditText editTextComment;
private ImageButton imageButtonSend;
private CircleImageView circleImageViewCommentUserImage;
private RecyclerView recyclerViewComments;
private static String sId, cId, uId;
private CommentRecyclerViewAdapter commentListAdapter;
private List<Venter.Comment> commentList;
public static DetailedComplaintFragment getInstance(String sessionid, String complaintid, String userid) {
sId = sessionid;
cId = complaintid;
uId = userid;
return new DetailedComplaintFragment();
}
private void initialiseViews(View view) {
textViewUserName = view.findViewById(R.id.textViewUserName);
textViewReportDate = view.findViewById(R.id.textViewReportDate);
textViewLocation = view.findViewById(R.id.textViewLocation);
textViewDescription = view.findViewById(R.id.textViewDescription);
textViewStatus = view.findViewById(R.id.textViewStatus);
textViewCommentLabel = view.findViewById(R.id.comment_label);
textViewVoteUpLabel = view.findViewById(R.id.up_vote_label);
layoutVotes = view.findViewById(R.id.layoutVotes);
tagView = view.findViewById(R.id.tag_group);
recyclerViewComments = view.findViewById(R.id.recyclerViewComments);
editTextComment = view.findViewById(R.id.edit_comment);
imageButtonSend = view.findViewById(R.id.send_comment);
circleImageViewCommentUserImage = view.findViewById(R.id.comment_user_image);
Picasso.get().load(R.drawable.baseline_account_circle_black_36).into(circleImageViewCommentUserImage);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_detailed_complaint, container, false);
this.inflater = inflater;
commentList = new ArrayList<>();
initialiseViews(view);
commentListAdapter = new CommentRecyclerViewAdapter(getActivity(), getContext(), sId, uId);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
recyclerViewComments.setLayoutManager(linearLayoutManager);
recyclerViewComments.setHasFixedSize(true);
recyclerViewComments.setAdapter(commentListAdapter);
mMapView = view.findViewById(R.id.google_map);
mMapView.onCreate(savedInstanceState);
mMapView.onResume();
try {
MapsInitializer.initialize(getActivity().getApplicationContext());
} catch (Exception e) {
e.printStackTrace();
}
imageButtonSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!(editTextComment.getText().toString().trim().isEmpty())) {
postComment();
} else {
Toast.makeText(getContext(), "Please enter comment text", Toast.LENGTH_SHORT).show();
}
}
});
return view;
}
private void postComment() {
final CommentCreateRequest commentCreateRequest = new CommentCreateRequest(editTextComment.getText().toString());
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
retrofitInterface.postComment("sessionid=" + sId, cId, commentCreateRequest).enqueue(new Callback<Venter.Comment>() {
@Override
public void onResponse(Call<Venter.Comment> call, Response<Venter.Comment> response) {
if (response.isSuccessful()) {
Venter.Comment comment = response.body();
addNewComment(comment);
editTextComment.setText(null);
Toast.makeText(getActivity(), "Comment Added", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<Venter.Comment> call, Throwable t) {
Log.i(TAG, "failure in posting comments: " + t.toString());
}
});
}
private void addNewComment(Venter.Comment newComment) {
commentList.add(newComment);
commentListAdapter.setCommentList(commentList);
commentListAdapter.notifyItemInserted(commentList.indexOf(newComment));
commentListAdapter.notifyItemRangeChanged(0, commentListAdapter.getItemCount());
recyclerViewComments.post(new Runnable() {
@Override
public void run() {
MainActivity.hideKeyboard(getActivity());
}
});
}
public void setDetailedComplaint(Venter.Complaint detailedComplaint) {
this.detailedComplaint = detailedComplaint;
populateViews();
}
private void populateViews() {
try {
textViewUserName.setText(detailedComplaint.getComplaintCreatedBy().getUserName());
} catch (Exception e) {
e.printStackTrace();
}
try {
String time = DateTimeUtil.getDate(detailedComplaint.getComplaintReportDate().toString());
Log.i(TAG, " time: " + time);
Log.i(TAG, "inside try");
textViewReportDate.setText(time);
} catch (Exception e) {
Log.i(TAG, "Inside catch");
e.printStackTrace();
}
try {
textViewLocation.setText(detailedComplaint.getLocationDescription());
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewDescription.setText(detailedComplaint.getDescription());
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewStatus.setText(detailedComplaint.getStatus().toUpperCase());
if (detailedComplaint.getStatus().equalsIgnoreCase("Reported")) {
textViewStatus.setBackgroundColor(Color.parseColor("#FF0000"));
textViewStatus.setTextColor(getResources().getColor(R.color.primaryTextColor));
} else if (detailedComplaint.getStatus().equalsIgnoreCase("In Progress")) {
textViewStatus.setBackgroundColor(getResources().getColor(R.color.colorSecondary));
textViewStatus.setTextColor(getResources().getColor(R.color.secondaryTextColor));
} else if (detailedComplaint.getStatus().equalsIgnoreCase("Resolved")) {
textViewStatus.setBackgroundColor(Color.parseColor("#00FF00"));
textViewStatus.setTextColor(getResources().getColor(R.color.secondaryTextColor));
}
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewCommentLabel.setText("COMMENTS");
} catch (Exception e) {
e.printStackTrace();
}
try {
textViewVoteUpLabel.setText("UP VOTES");
} catch (Exception e) {
e.printStackTrace();
}
try {
addVotesToView(detailedComplaint);
} catch (Exception e) {
e.printStackTrace();
}
try {
addCommentsToView(detailedComplaint);
} catch (Exception e) {
e.printStackTrace();
}
List<String> tags = new ArrayList<>();
for (Venter.TagUri tagUri : detailedComplaint.getTags()) {
tags.add(tagUri.getTagUri());
}
String[] tagArray = tags.toArray(new String[tags.size()]);
tagView.addTags(tagArray);
mMapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap mGoogleMap) {
googleMap = mGoogleMap;
// For dropping a marker at a point on the Map
LatLng loc = new LatLng(detailedComplaint.getLatitude(), detailedComplaint.getLongitude());
if (loc != null) {
googleMap.addMarker(new MarkerOptions().position(loc).title(detailedComplaint.getLatitude().toString() + " , " + detailedComplaint.getLongitude().toString()).snippet(detailedComplaint.getLocationDescription()));
// For zooming automatically to the location of the marker
CameraPosition cameraPosition = new CameraPosition.Builder().target(loc).zoom(16).build();
googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
}
});
}
private void addCommentsToView(Venter.Complaint detailedComplaint) {
for (Venter.Comment comment : detailedComplaint.getComment())
commentList.add(comment);
commentListAdapter.setCommentList(commentList);
commentListAdapter.notifyDataSetChanged();
}
public void addVotesToView(Venter.Complaint detailedComplaint) {
layoutVotes.removeAllViews();
for (User users : detailedComplaint.getUsersUpVoted()) {
View voteView = inflater.inflate(R.layout.vote_up_card, null);
CircleImageView circleImageView = voteView.findViewById(R.id.circleImageViewUserUpVoteImage);
String profileUrl = users.getUserProfilePictureUrl();
if (profileUrl != null)
Picasso.get().load(profileUrl).into(circleImageView);
else
Picasso.get().load(R.drawable.baseline_account_circle_black_36).into(circleImageView);
TextView textViewName = voteView.findViewById(R.id.textViewUserUpVoteName);
textViewName.setText(users.getUserName());
layoutVotes.addView(voteView);
}
}
@Override
public void onResume() {
super.onResume();
mMapView.onResume();
}
@Override
public void onPause() {
super.onPause();
mMapView.onPause();
}
@Override
public void onDestroy() {
super.onDestroy();
mMapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
mMapView.onLowMemory();
}
}
\ No newline at end of file
package app.insti.fragment;
import android.Manifest;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.location.Location;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.NestedScrollView;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Base64;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.Toast;
import com.cunoraz.tagview.Tag;
import com.cunoraz.tagview.TagView;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.ResolvableApiException;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.LocationSettingsRequest;
import com.google.android.gms.location.LocationSettingsResponse;
import com.google.android.gms.location.LocationSettingsStatusCodes;
import com.google.android.gms.location.places.AutocompleteFilter;
import com.google.android.gms.location.places.ui.PlaceAutocompleteFragment;
import com.google.android.gms.location.places.ui.PlaceSelectionListener;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.UiSettings;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.List;
import app.insti.Constants;
import app.insti.CustomAutoCompleteTextView;
import app.insti.R;
import app.insti.TagClass;
import app.insti.Utils;
import app.insti.activity.MainActivity;
import app.insti.adapter.ImageViewPagerAdapter;
import app.insti.api.LocationAPIUtils;
import app.insti.api.RetrofitInterface;
import app.insti.api.request.ComplaintCreateRequest;
import app.insti.api.request.ImageUploadRequest;
import app.insti.api.response.ComplaintCreateResponse;
import app.insti.api.response.ImageUploadResponse;
import app.insti.utils.TagCategories;
import me.relex.circleindicator.CircleIndicator;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import static app.insti.Constants.MY_PERMISSIONS_REQUEST_LOCATION;
import static app.insti.Constants.MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE;
import static app.insti.Constants.RESULT_LOAD_IMAGE;
public class FileComplaintFragment extends Fragment {
private static final String TAG = FileComplaintFragment.class.getSimpleName();
private static FileComplaintFragment mainactivity;
private Button buttonSubmit;
private FloatingActionButton floatingActionButton;
private CustomAutoCompleteTextView autoCompleteTextView;
private EditText editTextSuggestions;
private EditText editTextTags;
private MapView mMapView;
GoogleMap googleMap;
private TagView tagView;
private TagView tagViewPopulate;
private ScrollView tagsLayout;
private LatLng Location;
private String Name;
private String Address;
private List<String> Tags;
private ArrayList<TagClass> tagList;
private List<String> uploadedImagesUrl = new ArrayList<>();
private int cursor = 1;
private List<TagClass> tagList2 = new ArrayList<>();
private String base64Image;
private ImageViewPagerAdapter imageViewPagerAdapter;
private ViewPager viewPager;
private CircleIndicator indicator;
private Button buttonAnalysis;
private LinearLayout layout_buttons;
String userId;
View view;
NestedScrollView nestedScrollView;
LinearLayout linearLayoutAddImage;
private boolean GPSIsSetup = false;
FusedLocationProviderClient mFusedLocationClient;
ProgressDialog progressDialog;
public FileComplaintFragment() {
// Required empty public constructor
}
public static FileComplaintFragment getMainActivity() {
return mainactivity;
}
@Override
public void onDestroyView() {
super.onDestroyView();
android.app.FragmentManager fragmentManager = getActivity().getFragmentManager();
PlaceAutocompleteFragment fragment = (PlaceAutocompleteFragment) fragmentManager.findFragmentById(R.id.place_autocomplete_fragment);
android.app.FragmentTransaction ft = fragmentManager.beginTransaction();
ft.remove(fragment);
ft.commit();
}
@Override
public void onStart() {
super.onStart();
Toast.makeText(getContext(), getString(R.string.initial_message_file_complaint), Toast.LENGTH_SHORT).show();
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
mainactivity = this;
mFusedLocationClient = LocationServices.getFusedLocationProviderClient(getActivity());
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
if (view != null) {
ViewGroup parent = (ViewGroup) view.getParent();
if (parent != null)
parent.removeView(view);
}
view = inflater.inflate(R.layout.fragment_file_complaint, container, false);
Bundle bundle = getArguments();
userId = bundle.getString(Constants.USER_ID);
prepareTags();
progressDialog = new ProgressDialog(getContext());
LinearLayout imageViewHolder = view.findViewById(R.id.image_holder_view);
CollapsingToolbarLayout.LayoutParams layoutParams = new CollapsingToolbarLayout.LayoutParams(
CollapsingToolbarLayout.LayoutParams.MATCH_PARENT,
getResources().getDisplayMetrics().heightPixels / 2
);
imageViewHolder.setLayoutParams(layoutParams);
Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
toolbar.setTitle("Add Complaint");
nestedScrollView = view.findViewById(R.id.nested_scrollview);
layout_buttons = view.findViewById(R.id.layout_buttons);
layout_buttons.setVisibility(View.GONE);
buttonSubmit = view.findViewById(R.id.buttonSubmit);
buttonSubmit.setVisibility(View.INVISIBLE);
buttonSubmit.setVisibility(View.GONE);
buttonAnalysis = view.findViewById(R.id.button_analysis);
buttonAnalysis.setVisibility(View.INVISIBLE);
buttonAnalysis.setVisibility(View.GONE);
tagsLayout = view.findViewById(R.id.tags_layout);
viewPager = view.findViewById(R.id.complaint_image_view_pager);
indicator = view.findViewById(R.id.indicator);
linearLayoutAddImage = view.findViewById(R.id.linearLayoutAddImage);
floatingActionButton = view.findViewById(R.id.fabButton);
floatingActionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
giveOptionsToAddImage();
}
});
ImageButton imageButtonAddTags = (ImageButton) view.findViewById(R.id.imageButtonAddTags);
autoCompleteTextView = (CustomAutoCompleteTextView) view.findViewById(R.id.dynamicAutoCompleteTextView);
autoCompleteTextView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
if (!(autoCompleteTextView.getText().toString().trim().isEmpty())) {
layout_buttons.setVisibility(View.VISIBLE);
buttonSubmit.setVisibility(View.VISIBLE);
} else {
Toast.makeText(getContext(), getString(R.string.initial_message_file_complaint), Toast.LENGTH_SHORT).show();
}
} else {
buttonSubmit.setVisibility(View.INVISIBLE);
buttonSubmit.setVisibility(View.GONE);
}
}
});
editTextSuggestions = view.findViewById(R.id.editTextSuggestions);
editTextTags = view.findViewById(R.id.editTextTags);
editTextTags.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
setTags(s);
}
@Override
public void afterTextChanged(Editable s) {
}
});
imageButtonAddTags.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Add Tags
populateTags(editTextTags.getText().toString());
editTextTags.setText("");
tagViewPopulate.addTags(new ArrayList<Tag>());
MainActivity.hideKeyboard(getActivity());
}
});
buttonSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Tags = new ArrayList<>();
for (int i = 0; i < tagList2.size(); i++) {
Tags.add(tagList2.get(i).getName());
}
addComplaint();
}
});
buttonAnalysis.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showAnalysis();
}
});
mMapView = view.findViewById(R.id.google_map);
mMapView.onCreate(savedInstanceState);
mMapView.onResume();
getMapReady();
// Autocomplete location bar
final PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) getActivity().getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
AutocompleteFilter typeFilter = new AutocompleteFilter.Builder()
.setCountry("IN")
.build();
autocompleteFragment.setFilter(typeFilter);
autocompleteFragment.setHint("Enter Location");
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(com.google.android.gms.location.places.Place place) {
Location = place.getLatLng();
Name = place.getName().toString();
Address = place.getAddress().toString();
updateMap(Location, Name, Address, cursor); //on selecting the place will automatically shows the Details on the map.
cursor++;
}
@Override
public void onError(Status status) {
Log.i(TAG, "An error occurred: " + status);
}
});
// ends here
tagView = view.findViewById(R.id.tag_view);
tagView.setOnTagDeleteListener(new TagView.OnTagDeleteListener() {
@Override
public void onTagDeleted(final TagView tagView, final Tag tag, final int i) {
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(getActivity());
builder.setMessage("\"" + tag.text + "\" will be deleted. Are you sure?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
tagView.remove(i);
tagList2.remove(i);
Log.i(TAG, "tagList2: " + tagList2.toString());
Toast.makeText(getContext(), "\"" + tag.text + "\" deleted", Toast.LENGTH_SHORT).show();
}
});
builder.setNegativeButton("No", null);
builder.show();
}
});
tagViewPopulate = view.findViewById(R.id.tag_populate);
tagViewPopulate.setOnTagClickListener(new TagView.OnTagClickListener() {
@Override
public void onTagClick(Tag tag, int i) {
editTextTags.setText(tag.text);
editTextTags.setSelection(tag.text.length()); //to set cursor position
}
});
tagViewPopulate.setOnTagDeleteListener(new TagView.OnTagDeleteListener() {
@Override
public void onTagDeleted(final TagView tagView, final Tag tag, final int i) {
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(getActivity());
builder.setMessage("\"" + tag.text + "\" will be deleted. Are you sure?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
tagView.remove(i);
Toast.makeText(getContext(), "\"" + tag.text + "\" deleted", Toast.LENGTH_SHORT).show();
}
});
builder.setNegativeButton("No", null);
builder.show();
}
});
return view;
}
public void getMapReady() {
Log.i(TAG, "in getMapReady");
mMapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap map) {
googleMap = map;
UiSettings uiSettings = googleMap.getUiSettings();
uiSettings.setAllGesturesEnabled(true);
uiSettings.setZoomControlsEnabled(true);
uiSettings.setMyLocationButtonEnabled(true);
uiSettings.setIndoorLevelPickerEnabled(true);
uiSettings.setScrollGesturesEnabled(true);
if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
&& ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
Log.i(TAG, "No initial permission granted");
ActivityCompat.requestPermissions(getActivity(),
new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
MY_PERMISSIONS_REQUEST_LOCATION);
} else {
Log.i(TAG, "Initial Permission Granted");
googleMap.setMyLocationEnabled(true);
googleMap.getUiSettings().setMyLocationButtonEnabled(true);
googleMap.setOnMyLocationButtonClickListener(new GoogleMap.OnMyLocationButtonClickListener() {
@Override
public boolean onMyLocationButtonClick() {
Log.i(TAG, "in onMyLocationButtonClick");
locate();
return false;
}
});
}
}
});
}
private void locate() {
Log.i(TAG, "In locate");
if (!GPSIsSetup) {
Log.i(TAG, "GPS not enabled");
displayLocationSettingsRequest();
} else {
Log.i(TAG, "GPS enabled");
try {
mFusedLocationClient.getLastLocation().addOnSuccessListener(new OnSuccessListener<Location>() {
@Override
public void onSuccess(Location location) {
// Got last known location. In some rare situations this can be null.
if (location != null) {
// Logic to handle location object
Log.i(TAG, "lat = " + location.getLatitude() + " lon = " + location.getLongitude());
Location = new LatLng(location.getLatitude(), location.getLongitude());
updateMap(Location, "Current Location", location.getLatitude() + ", " + location.getLongitude(), cursor);
} else {
Toast.makeText(getContext(), getString(R.string.getting_current_location), Toast.LENGTH_SHORT).show();
}
}
});
mFusedLocationClient.getLastLocation().addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(Exception e) {
e.printStackTrace();
}
});
GPSIsSetup = true;
} catch (SecurityException ignored) {
Toast.makeText(getContext(), getString(R.string.no_permission), Toast.LENGTH_LONG).show();
}
}
}
private void displayLocationSettingsRequest() {
Log.i(TAG, "In displayLocationSettingsRequest");
if (getView() == null || getActivity() == null) return;
LocationRequest mLocationRequest = LocationRequest.create()
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
.setInterval(10 * 1000)
.setFastestInterval(1 * 1000);
LocationSettingsRequest.Builder settingsBuilder = new LocationSettingsRequest.Builder()
.addLocationRequest(mLocationRequest);
settingsBuilder.setAlwaysShow(true);
Task<LocationSettingsResponse> result = LocationServices.getSettingsClient(getActivity())
.checkLocationSettings(settingsBuilder.build());
result.addOnCompleteListener(new OnCompleteListener<LocationSettingsResponse>() {
@Override
public void onComplete(@NonNull Task<LocationSettingsResponse> task) {
try {
Log.i(TAG, "In displayLocationSettingsRequest try");
LocationSettingsResponse result = task.getResult(ApiException.class);
if (result.getLocationSettingsStates().isGpsPresent() &&
result.getLocationSettingsStates().isGpsUsable() &&
result.getLocationSettingsStates().isLocationPresent() &&
result.getLocationSettingsStates().isLocationUsable()) {
Log.i(TAG, "In displayLocationSettingsRequest if setupGPS called");
setupGPS();
}
} catch (ApiException ex) {
Log.i(TAG, "In displayLocationSettingsRequest catch");
switch (ex.getStatusCode()) {
case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
try {
ResolvableApiException resolvableApiException =
(ResolvableApiException) ex;
resolvableApiException
.startResolutionForResult(getActivity(), 87);
Log.i(TAG, "In displayLocationSettingsRequest catch case1 try setupGPS called");
setupGPS();
} catch (IntentSender.SendIntentException e) {
}
break;
case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
Toast.makeText(getContext(), getString(R.string.GPS_not_enables), Toast.LENGTH_LONG).show();
break;
}
}
}
});
}
private void setupGPS() {
Log.i(TAG, "In setup");
if (getView() == null || getActivity() == null) return;
// Permissions stuff
if (ContextCompat.checkSelfPermission(getActivity(),
Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(getActivity(),
new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
MY_PERMISSIONS_REQUEST_LOCATION);
} else {
try {
mFusedLocationClient.getLastLocation().addOnSuccessListener(new OnSuccessListener<Location>() {
@Override
public void onSuccess(Location location) {
// Got last known location. In some rare situations this can be null.
if (location != null) {
// Logic to handle location object
Log.i(TAG, "lat = " + location.getLatitude() + " lon = " + location.getLongitude());
Location = new LatLng(location.getLatitude(), location.getLongitude());
updateMap(Location, "Current Location", location.getLatitude() + ", " + location.getLongitude(), cursor);
} else {
Toast.makeText(getContext(), getString(R.string.getting_current_location), Toast.LENGTH_SHORT).show();
}
}
});
mFusedLocationClient.getLastLocation().addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(Exception e) {
e.printStackTrace();
}
});
GPSIsSetup = true;
} catch (SecurityException ignored) {
Toast.makeText(getContext(), getString(R.string.no_permission), Toast.LENGTH_LONG).show();
}
}
}
private void populateTags(String cs) {
tagList2.add(new TagClass(cs));
ArrayList<Tag> tags = new ArrayList<>();
Tag tag;
for (int i = 0; i < tagList2.size(); i++) {
tag = new Tag(tagList2.get(i).getName());
tag.radius = 10f;
tag.layoutColor = Color.parseColor(tagList2.get(i).getColor());
tag.isDeletable = true;
tags.add(tag);
}
tagView.addTags(tags);
}
private void setTags(CharSequence cs) {
if (!cs.toString().equals("")) {
String text = cs.toString();
ArrayList<Tag> tags = new ArrayList<>();
Tag tag;
for (int i = 0; i < tagList.size(); i++) {
if (tagList.get(i).getName().toLowerCase().contains(text.toLowerCase())) {
tagsLayout.setVisibility(View.VISIBLE);
tag = new Tag(tagList.get(i).getName());
tag.radius = 10f;
tag.layoutColor = Color.parseColor(tagList.get(i).getColor());
tag.isDeletable = false;
tags.add(tag);
}
}
tagViewPopulate.addTags(tags);
} else {
tagViewPopulate.addTags(new ArrayList<Tag>());
return;
}
tagsLayout.post(new Runnable() {
@Override
public void run() {
nestedScrollView.fullScroll(ScrollView.FOCUS_DOWN);
}
});
}
private void prepareTags() {
tagList = new ArrayList<>();
try {
for (int i = 0; i < TagCategories.CATEGORIES.length; i++) {
tagList.add(new TagClass(TagCategories.CATEGORIES[i]));
}
} catch (Exception e) {
e.printStackTrace();
}
}
private void addComplaint() {
String complaint = "Complaint: " + autoCompleteTextView.getText().toString();
String suggestion = null;
Log.i(TAG, "Suggestion: " + editTextSuggestions.getText().toString());
if (!(editTextSuggestions.getText().toString().isEmpty())) {
suggestion = "\nSuggestion: " + editTextSuggestions.getText().toString();
} else {
suggestion = "";
}
if (Location == null) {
Toast.makeText(getContext(), "Please specify the location", Toast.LENGTH_LONG).show();
} else {
ComplaintCreateRequest complaintCreateRequest = new ComplaintCreateRequest(complaint + suggestion, Address, (float) Location.latitude, (float) Location.longitude, Tags, uploadedImagesUrl);
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
retrofitInterface.postComplaint("sessionid=" + getArguments().getString(Constants.SESSION_ID), complaintCreateRequest).enqueue(new Callback<ComplaintCreateResponse>() {
@Override
public void onResponse(Call<ComplaintCreateResponse> call, Response<ComplaintCreateResponse> response) {
Toast.makeText(getContext(), "Complaint successfully posted", Toast.LENGTH_LONG).show();
Bundle bundle = getArguments();
bundle.putString(Constants.USER_ID, userId);
ComplaintFragment complaintFragment = new ComplaintFragment();
complaintFragment.setArguments(bundle);
FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.framelayout_for_fragment, complaintFragment, complaintFragment.getTag());
transaction.commit();
}
@Override
public void onFailure(Call<ComplaintCreateResponse> call, Throwable t) {
Log.i(TAG, "failure in addComplaint: " + t.toString());
Toast.makeText(getContext(), "Complaint Creation Failed", Toast.LENGTH_SHORT).show();
}
});
}
}
private void updateMap(LatLng Location, String Name, String Address, int cursor) {
Log.i(TAG, "In updateMap");
LocationAPIUtils locationAPIUtils = new LocationAPIUtils(googleMap, mMapView);
locationAPIUtils.callGoogleToShowLocationOnMap(Location, Name, Address, cursor);
showAnalysis();
}
private void showAnalysis() {
/* Machine Learning Part */
}
private void giveOptionsToAddImage() {
final CharSequence[] items = {getString(R.string.take_photo_using_camera), getString(R.string.choose_from_library)};
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.add_photo);
builder.setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int item) {
if (items[item].equals(getString(R.string.take_photo_using_camera))) {
if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
return;
}
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
startActivityForResult(intent, Constants.REQUEST_CAMERA_INT_ID);
}
} else if (items[item].equals(getString(R.string.choose_from_library))) {
if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(getActivity(), new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
return;
}
Intent intent = new Intent(
Intent.ACTION_PICK,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setType("image/*");
startActivityForResult(intent, RESULT_LOAD_IMAGE);
} else {
dialog.dismiss();
}
}
});
builder.show();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK && requestCode == Constants.REQUEST_CAMERA_INT_ID && data != null) {
progressDialog.setIndeterminate(true);
progressDialog.setCancelable(false);
progressDialog.show();
Bundle bundle = data.getExtras();
Bitmap bitmap = (Bitmap) bundle.get("data");
base64Image = convertImageToString(bitmap);
sendImage();
} else if (resultCode == Activity.RESULT_OK && requestCode == Constants.RESULT_LOAD_IMAGE && data != null) {
progressDialog.setIndeterminate(true);
progressDialog.setCancelable(false);
progressDialog.show();
Uri selectedImage = data.getData();
String[] filePathColumn = {MediaStore.Images.Media.DATA};
Cursor cursor = getActivity().getContentResolver().query(selectedImage, filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
base64Image = convertImageToString(getScaledBitmap(picturePath, 800, 800));
sendImage();
}
}
private void sendImage() {
progressDialog.setMessage("Uploading Image");
ImageUploadRequest imageUploadRequest = new ImageUploadRequest(base64Image);
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
retrofitInterface.uploadImage("sessionid=" + getArguments().getString(Constants.SESSION_ID), imageUploadRequest).enqueue(new Callback<ImageUploadResponse>() {
@Override
public void onResponse(Call<ImageUploadResponse> call, Response<ImageUploadResponse> response) {
if (response.isSuccessful()) {
ImageUploadResponse imageUploadResponse = response.body();
uploadedImagesUrl.add(imageUploadResponse.getPictureURL());
showImage(uploadedImagesUrl);
Log.i(TAG, "ImageURL: " + uploadedImagesUrl.toString());
} else {
progressDialog.dismiss();
Toast.makeText(getContext(), getString(R.string.error_message), Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure(Call<ImageUploadResponse> call, Throwable t) {
Log.i(TAG, "failure in sendImage: " + t.toString());
progressDialog.dismiss();
Toast.makeText(getContext(), getString(R.string.error_message), Toast.LENGTH_LONG).show();
}
});
}
private void showImage(List<String> uploadedImagesUrl) {
if (viewPager != null) {
try {
imageViewPagerAdapter = new ImageViewPagerAdapter(getFragmentManager(), uploadedImagesUrl);
linearLayoutAddImage.setVisibility(View.GONE);
viewPager.setAdapter(imageViewPagerAdapter);
indicator.setViewPager(viewPager);
imageViewPagerAdapter.registerDataSetObserver(indicator.getDataSetObserver());
viewPager.getAdapter().notifyDataSetChanged();
synchronized (viewPager) {
viewPager.notifyAll();
}
imageViewPagerAdapter.notifyDataSetChanged();
Toast.makeText(getContext(), "Picture Taken", Toast.LENGTH_SHORT).show();
progressDialog.dismiss();
} catch (Exception e) {
e.printStackTrace();
}
}
}
private Bitmap getScaledBitmap(String picturePath, int width, int height) {
BitmapFactory.Options sizeOptions = new BitmapFactory.Options();
sizeOptions.inJustDecodeBounds = true;
BitmapFactory.decodeFile(picturePath, sizeOptions);
int inSampleSize = calculaInSampleSize(sizeOptions, width, height);
sizeOptions.inJustDecodeBounds = false;
sizeOptions.inSampleSize = inSampleSize;
return BitmapFactory.decodeFile(picturePath, sizeOptions);
}
private int calculaInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
// Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
// Calculate ratios of height and width to requested height and
// width
final int heightRatio = Math.round((float) height / (float) reqHeight);
final int widthRatio = Math.round((float) width / (float) reqWidth);
// Choose the smallest ratio as inSampleSize value, this will
// guarantee
// a final image with both dimensions larger than or equal to the
// requested height and width.
inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
}
return inSampleSize;
}
private String convertImageToString(Bitmap bitmap) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
if (bitmap != null) {
bitmap.compress(Bitmap.CompressFormat.JPEG, 60, stream);
byte[] byteArray = stream.toByteArray();
return Base64.encodeToString(byteArray, Base64.DEFAULT);
} else {
return null;
}
}
}
\ No newline at end of file
package app.insti.fragment;
import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
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 java.util.List;
import app.insti.R;
import app.insti.Utils;
import app.insti.activity.MainActivity;
import app.insti.adapter.ComplaintsRecyclerViewAdapter;
import app.insti.api.RetrofitInterface;
import app.insti.api.model.Venter;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class HomeFragment extends Fragment {
Activity activity;
ComplaintsRecyclerViewAdapter homeListAdapter;
RecyclerView recyclerViewHome;
private SwipeRefreshLayout swipeContainer;
private static String TAG = HomeFragment.class.getSimpleName();
private boolean isCalled = false;
private TextView error_message_home;
static String sID, uID;
public static HomeFragment getInstance(String sessionID, String userID) {
sID = sessionID;
uID = userID;
return new HomeFragment();
}
@Override
public void onStart() {
super.onStart();
swipeContainer.post(new Runnable() {
@Override
public void run() {
swipeContainer.setRefreshing(true);
callServerToGetNearbyComplaints();
}
});
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home, container, false);
recyclerViewHome = (RecyclerView) view.findViewById(R.id.recyclerViewHome);
homeListAdapter = new ComplaintsRecyclerViewAdapter(getActivity(), sID, uID);
swipeContainer = (SwipeRefreshLayout) view.findViewById(R.id.swipeContainer);
error_message_home = view.findViewById(R.id.error_message_home);
LinearLayoutManager llm = new LinearLayoutManager(activity);
recyclerViewHome.setLayoutManager(llm);
recyclerViewHome.setHasFixedSize(true);
recyclerViewHome.setAdapter(homeListAdapter);
swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
callServerToGetNearbyComplaints();
}
});
swipeContainer.setColorSchemeResources(R.color.colorPrimary);
if (!isCalled) {
swipeContainer.post(new Runnable() {
@Override
public void run() {
swipeContainer.setRefreshing(true);
callServerToGetNearbyComplaints();
}
});
isCalled = true;
}
return view;
}
private void callServerToGetNearbyComplaints() {
try {
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
retrofitInterface.getAllComplaints("sessionid=" + sID).enqueue(new Callback<List<Venter.Complaint>>() {
@Override
public void onResponse(@NonNull Call<List<Venter.Complaint>> call, @NonNull Response<List<Venter.Complaint>> response) {
if (response.body() != null && !(response.body().isEmpty())) {
Log.i(TAG, "response.body != null");
Log.i(TAG, "response: " + response.body());
initialiseRecyclerView(response.body());
swipeContainer.setRefreshing(false);
} else {
Log.i(TAG, "response.body is empty");
error_message_home.setVisibility(View.VISIBLE);
error_message_home.setText(getString(R.string.no_complaints));
swipeContainer.setRefreshing(false);
}
}
@Override
public void onFailure(@NonNull Call<List<Venter.Complaint>> call, @NonNull Throwable t) {
Log.i(TAG, "failure" + t.toString());
swipeContainer.setRefreshing(false);
error_message_home.setVisibility(View.VISIBLE);
}
});
} catch (Exception e) {
e.printStackTrace();
swipeContainer.setRefreshing(false);
}
}
private void initialiseRecyclerView(List<Venter.Complaint> list) {
homeListAdapter.setcomplaintList(list);
homeListAdapter.notifyDataSetChanged();
}
}
package app.insti.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.squareup.picasso.Picasso;
import app.insti.R;
public class ImageFragment extends BaseFragment {
private static final String TAG = ImageFragment.class.getSimpleName();
private String image;
int indexChosen;
public static ImageFragment newInstance(String image, int index) {
ImageFragment fragment = new ImageFragment();
Bundle args = new Bundle();
args.putString("image", image);
args.putInt("index", index);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(TAG, "getArguments in ImageFragment" + getArguments());
if (getArguments() != null) {
image = getArguments().getString("image");
indexChosen = getArguments().getInt("index", 0);
}
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_image, container, false);
ImageView imageView = view.findViewById(R.id.imageView);
Picasso.get().load(image).into(imageView);
return view;
}
}
\ No newline at end of file
package app.insti.fragment;
import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
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 java.util.List;
import app.insti.R;
import app.insti.Utils;
import app.insti.activity.MainActivity;
import app.insti.adapter.ComplaintsRecyclerViewAdapter;
import app.insti.api.RetrofitInterface;
import app.insti.api.model.Venter;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MeFragment extends Fragment {
static String uID, sID;
Activity activity;
RecyclerView recyclerViewMe;
ComplaintsRecyclerViewAdapter meListAdapter;
TextView error_message_me;
SwipeRefreshLayout swipeContainer;
private static String TAG = MeFragment.class.getSimpleName();
private boolean isCalled = false;
public static MeFragment getInstance(String sessionID, String userID) {
sID = sessionID;
uID = userID;
return new MeFragment();
}
@Override
public void onStart() {
super.onStart();
swipeContainer.post(new Runnable() {
@Override
public void run() {
swipeContainer.setRefreshing(true);
getMeItems();
}
});
}
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_me, container, false);
recyclerViewMe = view.findViewById(R.id.recyclerViewMe);
meListAdapter = new ComplaintsRecyclerViewAdapter(getActivity(), sID, uID);
swipeContainer = view.findViewById(R.id.swipeContainer);
error_message_me = view.findViewById(R.id.error_message_me);
LinearLayoutManager llm = new LinearLayoutManager(activity);
recyclerViewMe.setLayoutManager(llm);
recyclerViewMe.setHasFixedSize(true);
recyclerViewMe.setAdapter(meListAdapter);
swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
getMeItems();
}
});
swipeContainer.setColorSchemeColors(getResources().getColor(R.color.colorPrimary));
if (!isCalled) {
swipeContainer.post(new Runnable() {
@Override
public void run() {
swipeContainer.setRefreshing(true);
getMeItems();
}
});
isCalled = true;
}
return view;
}
private void getMeItems() {
callServerToGetMyComplaints();
}
private void callServerToGetMyComplaints() {
try {
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
retrofitInterface.getUserComplaints("sessionid=" + sID).enqueue(new Callback<List<Venter.Complaint>>() {
@Override
public void onResponse(@NonNull Call<List<Venter.Complaint>> call, @NonNull Response<List<Venter.Complaint>> response) {
if (response.body() != null && !(response.body().isEmpty())) {
Log.i(TAG, "response.body != null");
Log.i(TAG, "response: " + response.body());
initialiseRecyclerView(response.body());
swipeContainer.setRefreshing(false);
} else {
error_message_me.setVisibility(View.VISIBLE);
error_message_me.setText(getString(R.string.no_complaints));
swipeContainer.setRefreshing(false);
}
}
@Override
public void onFailure(@NonNull Call<List<Venter.Complaint>> call, @NonNull Throwable t) {
Log.i(TAG, "failure" + t.toString());
swipeContainer.setRefreshing(false);
error_message_me.setVisibility(View.VISIBLE);
}
});
} catch (Exception e) {
e.printStackTrace();
swipeContainer.setRefreshing(false);
}
}
private void initialiseRecyclerView(List<Venter.Complaint> list) {
meListAdapter.setcomplaintList(list);
meListAdapter.notifyDataSetChanged();
}
}
\ No newline at end of file
package app.insti.utils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;
public class DateTimeUtil {
private static String time_ago = "";
public static String getDate(String dtStart) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'+05:30'");
try {
Date date = format.parse(dtStart);
Date now = new Date();
long diff = System.currentTimeMillis() - date.getTime();
long seconds = TimeUnit.MILLISECONDS.toSeconds(now.getTime() - date.getTime());
long minutes = TimeUnit.MILLISECONDS.toMinutes(now.getTime() - date.getTime());
long hours = TimeUnit.MILLISECONDS.toHours(now.getTime() - date.getTime());
if (seconds <= 0) {
return time_ago = "now";
} else if (seconds < 60 && seconds > 0) {
return time_ago = seconds + " seconds ago";
} else if (minutes < 60 && minutes > 0) {
return time_ago = minutes + " minutes ago";
} else if (hours < 24 && hours > 0) {
return hours + " hours ago";
} else {
long days = Math.round(diff / (24.0 * 60 * 60 * 1000));
if (days == 0)
return "today";
else if (days == 1)
return "yesterday";
else if (days < 14)
return days + " days ago";
else if (days < 30)
return ((int) (days / 7)) + " weeks ago";
else if (days < 365)
return ((int) (days / 30)) + " months ago";
else
return ((int) (days / 365)) + " years ago";
}
} catch (ParseException e) {
e.printStackTrace();
}
return "";
}
}
\ No newline at end of file
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
package app.insti.utils;
/**
* Created by Shivam Sharma on 13-08-2018.
*/
public class TagCategories {
public static final String[] CATEGORIES = new String[]{
"Used Flexes",
"Plastic Bottles (in Hostel messes)",
"Placards on Trees",
"Request for donation of clothes",
"Other donations",
"Cattle Issues",
"Autorickshaws",
"Potholes in Roads",
"Broken stormwater drains",
"Desilting - lakes",
"Flooding of roads and footpaths",
"Damaged footbaths",
"Garbage issues",
"Illegal posters and boardings",
"Manholes",
"Streetlights issues",
"Sewage drains issues",
"Toilets infrastructural issues",
"Fencing issues",
"Security issues",
"Infrastructural defaults in the academic area",
"Cycle pooling issues"};
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="0dp"
android:shape="ring"
android:thicknessRatio="2"
android:useLevel="false" >
<solid
android:color="@android:color/black"/>
<stroke
android:width="1dp"
android:color="@android:color/white" />
</shape>
\ No newline at end of file
<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="M21,3H3C2,3 1,4 1,5v14c0,1.1 0.9,2 2,2h18c1,0 2,-1 2,-2V5c0,-1 -1,-2 -2,-2zM5,17l3.5,-4.5 2.5,3.01L14.5,11l4.5,6H5z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<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/cardViewComment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:layout_margin="5dp"
android:padding="10dp"
app:cardUseCompatPadding="true"
app:cardBackgroundColor="@color/colorWhite"
app:cardCornerRadius="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:orientation="horizontal">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/circleImageViewUserImage"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_weight="3"
android:orientation="vertical">
<TextView
android:id="@+id/textViewUserComment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="User Name"
android:textColor="@android:color/black"
android:textSize="18sp" />
<TextView
android:id="@+id/textViewTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time of Comment" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/textViewComment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:scrollHorizontally="true"
android:text="Comment"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:layout_margin="5dp"
card_view:cardBackgroundColor="@color/colorWhite"
card_view:cardCornerRadius="0dp"
card_view:cardElevation="5dp"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="4">
<TextView
android:id="@+id/textViewUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="4"
android:text="User"
android:textColor="@android:color/black"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/textViewStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="10dp"
android:text="status"
android:textColor="@android:color/black"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/textViewReportDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorGray"
android:textSize="14sp" />
<TextView
android:id="@+id/textViewLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorGray"
android:textSize="14sp" />
<View
android:layout_width="match_parent"
android:layout_height="10dp" />
<TextView
android:id="@+id/textViewDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="2">
<Button
android:id="@+id/buttonComments"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_weight="1"
android:background="#12C1D6"
android:textColor="@color/colorWhite" />
<Button
android:id="@+id/buttonVotes"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_weight="1"
android:background="@android:color/black"
android:textColor="@color/colorWhite" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/baseline_photo_size_select_actual_black_48"
android:id="@+id/image_view_image"/>
</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.ComplaintFragment">
<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/nobody_taking_care_of_your_civic_complaints_be_it_garbage_water_potholes_etc"
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
<?xml version="1.0" encoding="utf-8"?>
<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_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Base.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="@android:color/white"
android:background="@color/colorWhite"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout
android:id="@+id/image_holder_view"
android:layout_width="match_parent"
android:layout_height="2dp"
android:orientation="vertical"
app:layout_collapseMode="parallax">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/complaint_image_view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<me.relex.circleindicator.CircleIndicator
android:id="@+id/indicator"
android:layout_width="match_parent"
android:layout_height="48dp"
app:ci_animator="@animator/scale_with_alpha"
app:ci_drawable="@drawable/selected_dot" />
</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/colorPrimary"
android:background="@color/colorWhite"
app:tabTextColor="@color/colorGray"
app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"
app:tabSelectedTextColor="#4a4a4a"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/tab_viewpager_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<Button
android:id="@+id/buttonVoteUp"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:textColor="@color/secondaryTextColor"
android:background="@color/colorSecondary"
android:text="Upvote"
android:layout_weight="2"/>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView 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_height="match_parent"
android:background="@android:color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/textViewUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Username"
android:textColor="@android:color/black"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textViewStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="10dp"
android:text="STATUS"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/textViewReportDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Report Date"
android:textColor="@android:color/darker_gray"
android:textSize="14sp" />
<TextView
android:id="@+id/textViewLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Location"
android:textColor="@android:color/darker_gray"
android:textSize="14sp" />
<View
android:layout_width="match_parent"
android:layout_height="10dp" />
<TextView
android:id="@+id/textViewDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Description"
android:textColor="@android:color/black"
android:textSize="14sp" />
</LinearLayout>
<com.google.android.gms.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/google_map"
android:layout_width="match_parent"
android:layout_height="200dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TAGS"
android:textColor="@android:color/black"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="7dp" />
<ScrollView
android:id="@+id/tags_laoyut"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/editText"
android:layout_marginLeft="6dp"
android:background="@android:color/white"
android:visibility="visible">
<com.cunoraz.tagview.TagView
android:id="@+id/tag_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp" />
</ScrollView>
<View
android:layout_width="match_parent"
android:layout_height="7dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
android:padding="10dp">
<TextView
android:id="@+id/comment_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="COMMENTS"
android:textColor="@android:color/black"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<android.support.design.widget.CoordinatorLayout
android:id="@+id/layoutComments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerViewComments"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.CoordinatorLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/comment_user_image"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:scaleType="centerCrop" />
<EditText
android:id="@+id/edit_comment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="9"
android:hint="@string/enter_comment" />
<ImageButton
android:id="@+id/send_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@android:drawable/ic_menu_send" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
android:padding="10dp">
<TextView
android:id="@+id/up_vote_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="VoteUp"
android:textColor="@android:color/black"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/layoutVotes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="20dp" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linear_layout_file_complaint"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:scrollbars="vertical"
tools:context="app.insti.fragment.FileComplaintFragment">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Widget.AppCompat.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorWhite"
app:contentScrim="@android:color/white"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout
android:id="@+id/image_holder_view"
android:layout_width="match_parent"
android:layout_height="2dp"
android:orientation="vertical"
app:layout_collapseMode="parallax">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|end"
android:layout_marginEnd="20dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:src="@drawable/ic_add_a_photo_black_24dp"
app:backgroundTint="@color/colorSecondary"
app:borderWidth="0dp"
app:fabSize="normal"
app:layout_anchorGravity="bottom|end" />
<LinearLayout
android:id="@+id/linearLayoutAddImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/imageViewAddImage"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/baseline_photo_size_select_actual_black_48"/>
</LinearLayout>
<android.support.v4.view.ViewPager
android:id="@+id/complaint_image_view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<me.relex.circleindicator.CircleIndicator
android:id="@+id/indicator"
android:layout_width="match_parent"
android:layout_height="48dp"
app:ci_animator="@animator/scale_with_alpha"
app:ci_drawable="@drawable/selected_dot"
app:ci_drawable_unselected="@drawable/white_radius" />
</RelativeLayout>
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/editTextIncCreditScoreLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hintTextAppearance="@style/edit_text_hint_apperarance">
<app.insti.CustomAutoCompleteTextView
android:id="@+id/dynamicAutoCompleteTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:hint="Enter Description"
android:imeOptions="flagNoExtractUi|actionSearch"
android:inputType="textMultiLine"
android:minLines="3"
android:textColor="@android:color/black"
android:textColorHint="#4a4a4a"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
<ProgressBar
android:id="@+id/pb_loading_indicator"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:visibility="gone" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hintTextAppearance="@style/edit_text_hint_apperarance">
<EditText
android:id="@+id/editTextSuggestions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:hint="@string/enter_suggestions_if_any"
android:imeOptions="flagNoExtractUi|actionSearch"
android:inputType="textMultiLine"
android:minLines="3"
android:textColor="@android:color/black"
android:textColorHint="#4a4a4a"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
</FrameLayout>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5sp">
<fragment
android:id="@+id/place_autocomplete_fragment"
android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.v7.widget.CardView>
</LinearLayout>
<LinearLayout
android:id="@+id/layoutAnalyse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.gms.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/google_map"
android:layout_width="match_parent"
android:layout_height="200dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ccc"
android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TAGS"
android:textColor="#4A4A4A"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="7dp" />
<com.cunoraz.tagview.TagView
android:id="@+id/tag_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp" />
<View
android:layout_width="match_parent"
android:layout_height="7dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100">
<android.support.design.widget.TextInputLayout
android:id="@+id/textLayoutTags"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="90"
app:hintTextAppearance="@style/edit_text_hint_apperarance">
<EditText
android:id="@+id/editTextTags"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Add more Tags"
android:inputType="text"
android:textColor="@android:color/black"
android:textColorHint="#66000000"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
<ImageButton
android:id="@+id/imageButtonAddTags"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="10"
app:srcCompat="@android:drawable/ic_input_add" />
</LinearLayout>
<ScrollView
android:id="@+id/tags_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:background="@android:color/white"
android:visibility="invisible">
<com.cunoraz.tagview.TagView
android:id="@+id/tag_populate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp" />
</ScrollView>
<View
android:layout_width="match_parent"
android:layout_height="17dp" />
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
<LinearLayout
android:id="@+id/layout_buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<Button
android:id="@+id/button_analysis"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="ANALYSIS"
android:textColor="@color/colorWhite" />
<Button
android:id="@+id/buttonSubmit"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_weight="1"
android:background="@color/colorSecondary"
android:text="SUBMIT"
android:textColor="@color/secondaryTextColor" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<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_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ededed">
<TextView
android:id="@+id/error_message_home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:text="@string/error_message"
android:textColor="@color/secondaryTextColor"
android:visibility="invisible" />
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipeContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerViewHome"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.design.widget.CoordinatorLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<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="0dp"
android:layout_weight="1"
android:background="#ededed">
<TextView
android:id="@+id/error_message_me"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:text="@string/error_message"
android:textColor="@color/secondaryTextColor"
android:visibility="gone" />
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipeContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerViewMe"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.design.widget.CoordinatorLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="4dp"
android:paddingLeft="18dp"
android:paddingRight="10dp"
android:paddingTop="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:orientation="horizontal">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/circleImageViewUserUpVoteImage"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_weight="3"
android:orientation="vertical">
<TextView
android:id="@+id/textViewUserUpVoteName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="User Name"
android:textColor="@android:color/black"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
...@@ -43,6 +43,11 @@ ...@@ -43,6 +43,11 @@
android:icon="@drawable/ic_map_black_48dp" android:icon="@drawable/ic_map_black_48dp"
android:title="Map" /> android:title="Map" />
<item
android:id="@+id/nav_complaint"
android:icon="@drawable/baseline_description_black_48"
android:title="Complaints/Suggestions" />
<item <item
android:id="@+id/nav_qlinks" android:id="@+id/nav_qlinks"
android:icon="@drawable/ic_link_black_24dp" android:icon="@drawable/ic_link_black_24dp"
......
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/copy_comment_option"
android:title="Copy"/>
<item
android:id="@+id/delete_comment_option"
android:title="Delete"/>
</menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/copy_comment_option"
android:title="Copy" />
</menu>
\ No newline at end of file
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<color name="primaryTextColor">#fafafa</color> <color name="primaryTextColor">#fafafa</color>
<color name="secondaryTextColor">#000000</color> <color name="secondaryTextColor">#000000</color>
<color name="colorCalendarWeek">#000000</color> <color name="colorCalendarWeek">#000000</color>
<color name="colorGray">#757575</color>
<color name="colorWhite">#FFFFFF</color> <color name="colorWhite">#FFFFFF</color>
<!-- Map --> <!-- Map -->
......
...@@ -32,4 +32,29 @@ ...@@ -32,4 +32,29 @@
</string-array> </string-array>
<string name="default_notification_channel_id">INSTIAPP_NOTIFS</string> <string name="default_notification_channel_id">INSTIAPP_NOTIFS</string>
<!--NSS side-->
<string name="google_maps_api_key">AIzaSyC0T4chZbdcKjLkgEts9YVonPFyP7ckMIE</string>
<string name="enter_title">Enter title</string>
<string name="enter_description">Enter Complaint Description</string>
<string name="take_photo_using_camera">Take photo using Camera</string>
<string name="choose_from_library">Choose from gallery</string>
<string name="add_photo">Add Image</string>
<string name="select_file">Select File</string>
<string name="please_try_again">Please try again</string>
<string name="relevant_complaints">Relevant Complaints</string>
<string name="complaint_details">Complaint Details</string>
<string name="more">MORE</string>
<string name="vent_your_issues_now">Vent your issues now!</string>
<string name="nobody_taking_care_of_your_civic_complaints_be_it_garbage_water_potholes_etc">Nobody taking care of your civic complaints? Be it garbage, water, potholes etc.</string>
<string name="my_complaints">My complaints</string>
<string name="voted_complaints">Voted Complaints</string>
<string name="error_message">Please check your Network Connectivity</string>
<string name="enter_comment">Enter Comment</string>
<string name="enter_suggestions_if_any">Enter Suggestions (if any)</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="getting_current_location">Getting current location. Please try after some time</string>
<string name="GPS_not_enables">GPS is not enabled!</string>
<string name="no_permission">No permission!</string>
</resources> </resources>
...@@ -39,4 +39,18 @@ ...@@ -39,4 +39,18 @@
<item name="android:textSize">18sp</item> <item name="android:textSize">18sp</item>
</style> </style>
<style name="CustomTabLayout" parent="Widget.Design.TabLayout">
<item name="tabTextAppearance">@style/CustomTextAppearance</item>
</style>
<style name="CustomTextAppearance" parent="TextAppearance.Design.Tab">
<item name="android:textSize">15sp</item>
<item name="textAllCaps">false</item>
<item name="android:singleLine">true</item>
</style>
<style name="edit_text_hint_apperarance" parent="@android:style/TextAppearance">
<item name="android:textColor">#999</item>
<item name="android:textSize">12sp</item>
</style>
</resources> </resources>
...@@ -10,7 +10,7 @@ buildscript { ...@@ -10,7 +10,7 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.2.0' classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:3.2.0' classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
...@@ -22,6 +22,9 @@ allprojects { ...@@ -22,6 +22,9 @@ allprojects {
jcenter() jcenter()
maven { url 'https://maven.google.com' } maven { url 'https://maven.google.com' }
google() google()
maven {
url "https://jitpack.io"
}
} }
} }
......
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