Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InstiApp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RAHUL SHARMA
InstiApp
Commits
f05521e9
Commit
f05521e9
authored
Oct 11, 2018
by
Preetam Ozarde
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make minor codacy changes, delete relevant_complaint module.
parent
51ab033d
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
226 additions
and
356 deletions
+226
-356
app/src/main/java/app/insti/adapter/CommentsAdapter.java
app/src/main/java/app/insti/adapter/CommentsAdapter.java
+4
-1
app/src/main/java/app/insti/adapter/ComplaintDetailsPagerAdapter.java
.../java/app/insti/adapter/ComplaintDetailsPagerAdapter.java
+6
-3
app/src/main/java/app/insti/adapter/UpVotesAdapter.java
app/src/main/java/app/insti/adapter/UpVotesAdapter.java
+0
-2
app/src/main/java/app/insti/fragment/ComplaintDetailsFragment.java
...ain/java/app/insti/fragment/ComplaintDetailsFragment.java
+23
-3
app/src/main/java/app/insti/fragment/ComplaintFragment.java
app/src/main/java/app/insti/fragment/ComplaintFragment.java
+0
-2
app/src/main/java/app/insti/fragment/ComplaintsFragment.java
app/src/main/java/app/insti/fragment/ComplaintsFragment.java
+2
-2
app/src/main/java/app/insti/fragment/ComplaintsHomeFragment.java
.../main/java/app/insti/fragment/ComplaintsHomeFragment.java
+2
-2
app/src/main/java/app/insti/fragment/FileComplaintFragment.java
...c/main/java/app/insti/fragment/FileComplaintFragment.java
+173
-170
app/src/main/java/app/insti/fragment/RelevantComplaintsFragment.java
...n/java/app/insti/fragment/RelevantComplaintsFragment.java
+0
-85
app/src/main/res/layout/fragment_complaint_details.xml
app/src/main/res/layout/fragment_complaint_details.xml
+16
-46
app/src/main/res/layout/fragment_relevant_complaints.xml
app/src/main/res/layout/fragment_relevant_complaints.xml
+0
-40
No files found.
app/src/main/java/app/insti/adapter/CommentsAdapter.java
View file @
f05521e9
...
...
@@ -43,6 +43,7 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
private
LayoutInflater
inflater
;
private
String
sessionId
,
userId
;
private
Fragment
fragment
;
private
TextView
textViewCommentLabel
;
private
List
<
Venter
.
Comment
>
commentList
=
new
ArrayList
<>();
...
...
@@ -122,6 +123,7 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
notifyDataSetChanged
();
notifyItemRemoved
(
position
);
notifyItemRangeChanged
(
position
,
commentList
.
size
()
-
position
);
textViewCommentLabel
.
setText
(
"Comments ("
+
commentList
.
size
()
+
")"
);
}
else
{
Toast
.
makeText
(
context
,
"You can't delete this comment"
,
Toast
.
LENGTH_SHORT
).
show
();
}
...
...
@@ -181,7 +183,8 @@ public class CommentsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
return
commentList
.
size
();
}
public
void
setCommentList
(
List
<
Venter
.
Comment
>
commentList
)
{
public
void
setCommentList
(
List
<
Venter
.
Comment
>
commentList
,
TextView
textViewCommentLabel
)
{
this
.
commentList
=
commentList
;
this
.
textViewCommentLabel
=
textViewCommentLabel
;
}
}
\ No newline at end of file
app/src/main/java/app/insti/adapter/ComplaintDetailsPagerAdapter.java
View file @
f05521e9
...
...
@@ -27,8 +27,11 @@ public class ComplaintDetailsPagerAdapter extends FragmentPagerAdapter {
switch
(
position
)
{
case
0
:
return
ComplaintDetailsFragment
.
getInstance
(
sessionid
,
complaintid
,
userid
,
userProfileUrl
);
/* case 1:
return RelevantComplaintsFragment.getInstance(sessionid, userid);*/
/*
For version 2:
case 1:
return RelevantComplaintsFragment.getInstance(sessionid, userid);
*/
default
:
return
ComplaintDetailsFragment
.
getInstance
(
sessionid
,
complaintid
,
userid
,
userProfileUrl
);
}
...
...
@@ -46,6 +49,6 @@ public class ComplaintDetailsPagerAdapter extends FragmentPagerAdapter {
@Override
public
int
getCount
()
{
return
2
;
return
1
;
}
}
app/src/main/java/app/insti/adapter/UpVotesAdapter.java
View file @
f05521e9
...
...
@@ -23,10 +23,8 @@ public class UpVotesAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
private
static
final
String
TAG
=
CommentsAdapter
.
class
.
getSimpleName
();
private
LayoutInflater
inflater
;
private
Fragment
fragment
;
private
List
<
User
>
userList
=
new
ArrayList
<>();
public
UpVotesAdapter
(
Fragment
fragment
,
Context
context
)
{
inflater
=
LayoutInflater
.
from
(
context
);
this
.
fragment
=
fragment
;
...
...
app/src/main/java/app/insti/fragment/ComplaintDetailsFragment.java
View file @
f05521e9
...
...
@@ -3,6 +3,7 @@ package app.insti.fragment;
import
android.content.res.ColorStateList
;
import
android.os.Bundle
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.widget.NestedScrollView
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
import
android.util.Log
;
...
...
@@ -13,8 +14,10 @@ import android.widget.Button;
import
android.widget.EditText
;
import
android.widget.ImageButton
;
import
android.widget.LinearLayout
;
import
android.widget.ScrollView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.google.android.gms.maps.CameraUpdateFactory
;
import
com.google.android.gms.maps.GoogleMap
;
import
com.google.android.gms.maps.MapView
;
...
...
@@ -24,8 +27,10 @@ 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
;
...
...
@@ -37,6 +42,7 @@ 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
;
...
...
@@ -67,6 +73,8 @@ public class ComplaintDetailsFragment extends Fragment {
private
List
<
Venter
.
Comment
>
commentList
;
private
List
<
User
>
upVotesList
;
private
LinearLayout
linearLayoutTags
;
private
ScrollView
layoutUpVotes
;
private
NestedScrollView
nestedScrollView
;
public
static
ComplaintDetailsFragment
getInstance
(
String
sessionid
,
String
complaintid
,
String
userid
,
String
userProfileUrl
)
{
sId
=
sessionid
;
...
...
@@ -124,10 +132,12 @@ public class ComplaintDetailsFragment extends Fragment {
upVote
(
detailedComplaint
);
}
});
return
view
;
}
private
void
initialiseViews
(
View
view
)
{
nestedScrollView
=
view
.
findViewById
(
R
.
id
.
nestedScrollViewComplaintDetail
);
textViewUserName
=
view
.
findViewById
(
R
.
id
.
textViewUserName
);
textViewReportDate
=
view
.
findViewById
(
R
.
id
.
textViewReportDate
);
textViewLocation
=
view
.
findViewById
(
R
.
id
.
textViewLocation
);
...
...
@@ -137,6 +147,7 @@ public class ComplaintDetailsFragment extends Fragment {
textViewVoteUpLabel
=
view
.
findViewById
(
R
.
id
.
up_vote_label
);
tagsLayout
=
view
.
findViewById
(
R
.
id
.
tags_layout
);
linearLayoutTags
=
view
.
findViewById
(
R
.
id
.
linearLayoutTags
);
layoutUpVotes
=
view
.
findViewById
(
R
.
id
.
layoutUpVotes
);
recyclerViewComments
=
view
.
findViewById
(
R
.
id
.
recyclerViewComments
);
recyclerViewUpVotes
=
view
.
findViewById
(
R
.
id
.
recyclerViewUpVotes
);
editTextComment
=
view
.
findViewById
(
R
.
id
.
edit_comment
);
...
...
@@ -220,7 +231,7 @@ public class ComplaintDetailsFragment extends Fragment {
private
void
addNewComment
(
Venter
.
Comment
newComment
)
{
commentList
.
add
(
newComment
);
commentListAdapter
.
setCommentList
(
commentList
);
commentListAdapter
.
setCommentList
(
commentList
,
textViewCommentLabel
);
commentListAdapter
.
notifyItemInserted
(
commentList
.
indexOf
(
newComment
));
commentListAdapter
.
notifyItemRangeChanged
(
0
,
commentListAdapter
.
getItemCount
());
textViewCommentLabel
.
setText
(
"Comments ("
+
commentList
.
size
()
+
")"
);
...
...
@@ -235,7 +246,7 @@ public class ComplaintDetailsFragment extends Fragment {
private
void
addCommentsToView
(
Venter
.
Complaint
detailedComplaint
)
{
for
(
Venter
.
Comment
comment
:
detailedComplaint
.
getComment
())
commentList
.
add
(
comment
);
commentListAdapter
.
setCommentList
(
commentList
);
commentListAdapter
.
setCommentList
(
commentList
,
textViewCommentLabel
);
commentListAdapter
.
notifyDataSetChanged
();
}
...
...
@@ -249,6 +260,7 @@ public class ComplaintDetailsFragment extends Fragment {
Venter
.
Complaint
complaint
=
response
.
body
();
detailedComplaint
.
setVoteCount
(
1
);
addVotesToView
(
complaint
);
onUpvote
();
}
}
...
...
@@ -286,6 +298,15 @@ public class ComplaintDetailsFragment extends Fragment {
textViewVoteUpLabel
.
setText
(
"Up Votes ("
+
detailedComplaint
.
getUsersUpVoted
().
size
()
+
")"
);
}
private
void
onUpvote
(){
layoutUpVotes
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
nestedScrollView
.
fullScroll
(
ScrollView
.
FOCUS_DOWN
);
}
});
}
private
void
addTagsToView
(
Venter
.
Complaint
detailedComplaint
)
{
for
(
Venter
.
TagUri
tagUri
:
detailedComplaint
.
getTags
())
{
...
...
@@ -305,7 +326,6 @@ public class ComplaintDetailsFragment extends Fragment {
textViewTags
.
setBackgroundTintList
(
ColorStateList
.
valueOf
(
getContext
().
getResources
().
getColor
(
R
.
color
.
colorTagGreen
)));
textViewTags
.
setTextColor
(
getContext
().
getResources
().
getColor
(
R
.
color
.
primaryTextColor
));
tagsLayout
.
setLayoutParams
(
layoutParams
);
tagsLayout
.
addView
(
textViewTags
);
}
}
...
...
app/src/main/java/app/insti/fragment/ComplaintFragment.java
View file @
f05521e9
...
...
@@ -107,7 +107,6 @@ public class ComplaintFragment extends Fragment {
if
(
viewPager
!=
null
)
{
try
{
ImageViewPagerAdapter
imageFragmentPagerAdapter
=
new
ImageViewPagerAdapter
(
getChildFragmentManager
(),
detailedComplaint
);
viewPager
.
setAdapter
(
imageFragmentPagerAdapter
);
circleIndicator
.
setViewPager
(
viewPager
);
imageFragmentPagerAdapter
.
registerDataSetObserver
(
circleIndicator
.
getDataSetObserver
());
...
...
@@ -122,7 +121,6 @@ public class ComplaintFragment extends Fragment {
}
private
void
initTabViews
(
final
Venter
.
Complaint
detailedComplaint
)
{
try
{
if
(
detailedComplaint
!=
null
)
{
viewPager
=
mview
.
findViewById
(
R
.
id
.
tab_viewpager_details
);
...
...
app/src/main/java/app/insti/fragment/ComplaintsFragment.java
View file @
f05521e9
...
...
@@ -36,9 +36,9 @@ public class ComplaintsFragment extends BaseFragment {
userProfileUrl
=
bundle
.
getString
(
Constants
.
CURRENT_USER_PROFILE_PICTURE
);
CollapsingToolbarLayout
collapsingToolbarLayout
=
view
.
findViewById
(
R
.
id
.
collapsing_toolbar
);
collapsingToolbarLayout
.
setTitleEnabled
(
false
);
ViewPager
viewPager
=
(
ViewPager
)
view
.
findViewById
(
R
.
id
.
tab_viewpager
);
ViewPager
viewPager
=
view
.
findViewById
(
R
.
id
.
tab_viewpager
);
slidingTabLayout
=
(
TabLayout
)
view
.
findViewById
(
R
.
id
.
sliding_tab_layout
);
slidingTabLayout
=
view
.
findViewById
(
R
.
id
.
sliding_tab_layout
);
Button
buttonVentIssues
=
view
.
findViewById
(
R
.
id
.
buttonVentIssues
);
...
...
app/src/main/java/app/insti/fragment/ComplaintsHomeFragment.java
View file @
f05521e9
...
...
@@ -54,9 +54,9 @@ public class ComplaintsHomeFragment extends Fragment {
public
View
onCreateView
(
@NonNull
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_complaints_home
,
container
,
false
);
RecyclerView
recyclerViewHome
=
(
RecyclerView
)
view
.
findViewById
(
R
.
id
.
recyclerViewHome
);
RecyclerView
recyclerViewHome
=
view
.
findViewById
(
R
.
id
.
recyclerViewHome
);
homeListAdapter
=
new
ComplaintsAdapter
(
getActivity
(),
sID
,
uID
,
uProfileUrl
);
swipeContainer
=
(
SwipeRefreshLayout
)
view
.
findViewById
(
R
.
id
.
swipeContainer
);
swipeContainer
=
view
.
findViewById
(
R
.
id
.
swipeContainer
);
error_message_home
=
view
.
findViewById
(
R
.
id
.
error_message_home
);
LinearLayoutManager
llm
=
new
LinearLayoutManager
(
getActivity
());
...
...
app/src/main/java/app/insti/fragment/FileComplaintFragment.java
View file @
f05521e9
This diff is collapsed.
Click to expand it.
app/src/main/java/app/insti/fragment/RelevantComplaintsFragment.java
deleted
100644 → 0
View file @
51ab033d
package
app.insti.fragment
;
import
android.os.Bundle
;
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.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
app.insti.R
;
import
app.insti.adapter.ComplaintsAdapter
;
public
class
RelevantComplaintsFragment
extends
Fragment
{
private
SwipeRefreshLayout
swipeContainer
;
private
boolean
isCalled
=
false
;
private
static
String
sID
,
uID
;
public
static
RelevantComplaintsFragment
getInstance
(
String
sessionID
,
String
userID
)
{
sID
=
sessionID
;
uID
=
userID
;
return
new
RelevantComplaintsFragment
();
}
@Override
public
void
onStart
()
{
super
.
onStart
();
swipeContainer
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
swipeContainer
.
setRefreshing
(
true
);
callServerToGetRelevantComplaints
();
}
});
}
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
}
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
fragment_relevant_complaints
,
container
,
false
);
RecyclerView
recyclerViewRelevantComplaints
=
(
RecyclerView
)
view
.
findViewById
(
R
.
id
.
recyclerViewRelevantComplaints
);
ComplaintsAdapter
relevantComplaintsAdapter
=
new
ComplaintsAdapter
(
getActivity
(),
sID
,
uID
,
""
);
//Change userProfileUrl to the current user Profile Pic
swipeContainer
=
(
SwipeRefreshLayout
)
view
.
findViewById
(
R
.
id
.
swipeContainer
);
LinearLayoutManager
llm
=
new
LinearLayoutManager
(
getActivity
());
recyclerViewRelevantComplaints
.
setLayoutManager
(
llm
);
recyclerViewRelevantComplaints
.
setHasFixedSize
(
true
);
recyclerViewRelevantComplaints
.
setAdapter
(
relevantComplaintsAdapter
);
swipeContainer
.
setOnRefreshListener
(
new
SwipeRefreshLayout
.
OnRefreshListener
()
{
@Override
public
void
onRefresh
()
{
callServerToGetRelevantComplaints
();
}
});
swipeContainer
.
setColorSchemeResources
(
R
.
color
.
colorPrimary
);
if
(!
isCalled
)
{
swipeContainer
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
swipeContainer
.
setRefreshing
(
true
);
callServerToGetRelevantComplaints
();
}
});
isCalled
=
true
;
}
return
view
;
}
private
void
callServerToGetRelevantComplaints
(){
//Get Relevant Complaints from Server
}
}
app/src/main/res/layout/fragment_complaint_details.xml
View file @
f05521e9
...
...
@@ -5,7 +5,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/white"
app:layout_behavior=
"@string/appbar_scrolling_view_behavior"
>
app:layout_behavior=
"@string/appbar_scrolling_view_behavior"
android:id=
"@+id/nestedScrollViewComplaintDetail"
>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
...
...
@@ -107,19 +108,11 @@
</LinearLayout>
<!--<com.cunoraz.tagview.TagView-->
<!--android:id="@+id/tag_group"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_margin="10dp"-->
<!--android:clickable="false"-->
<!--android:longClickable="false"/>-->
<LinearLayout
android:id=
"@+id/tags_layout"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
></LinearLayout
>
android:orientation=
"vertical"
/
>
</LinearLayout>
...
...
@@ -222,51 +215,29 @@
</LinearLayout>
<
android.support.design.widget.CoordinatorLayout
<
ScrollView
android:id=
"@+id/layoutUpVotes"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:
orientation=
"vertical
"
android:
padding=
"10dp
"
>
android:
layout_marginLeft=
"6dp
"
android:
background=
"@android:color/white
"
>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/recyclerViewUpVotes"
<android.support.design.widget.CoordinatorLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
</android.support.design.widget.CoordinatorLayout>
</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:padding="10dp">
<TextView
android:id="@+id/up_vote_label"
android:layout_width="wrap_content"
android:layout_height=
"wrap_content"
android:
textColor="@android:color/black
"
android:
textSize="16sp" /
>
android:
orientation=
"vertical
"
android:
padding=
"10dp"
>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/recyclerViewUpVotes"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<LinearLayout
android:id="@+id/layoutVotes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</android.support.design.widget.CoordinatorLayout>
</
LinearLayout
>
</
ScrollView
>
</LinearLayout>
-->
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
...
...
@@ -287,7 +258,6 @@
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
\ No newline at end of file
app/src/main/res/layout/fragment_relevant_complaints.xml
deleted
100644 → 0
View file @
51ab033d
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
tools:context=
".fragment.RelevantComplaintsFragment"
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_relevant_complaints"
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/recyclerViewRelevantComplaints"
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment