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
07985ffc
Commit
07985ffc
authored
Feb 18, 2019
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(venter): Get rid of Upvotes Adapter
parent
05fa6282
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
174 deletions
+5
-174
app/src/main/java/app/insti/adapter/UpVotesAdapter.java
app/src/main/java/app/insti/adapter/UpVotesAdapter.java
+0
-91
app/src/main/java/app/insti/fragment/ComplaintDetailsFragment.java
...ain/java/app/insti/fragment/ComplaintDetailsFragment.java
+5
-23
app/src/main/res/layout/vote_up_card.xml
app/src/main/res/layout/vote_up_card.xml
+0
-60
No files found.
app/src/main/java/app/insti/adapter/UpVotesAdapter.java
deleted
100644 → 0
View file @
05fa6282
package
app.insti.adapter
;
import
android.content.Context
;
import
android.support.annotation.NonNull
;
import
android.support.v4.app.Fragment
;
import
android.support.v7.widget.CardView
;
import
android.support.v7.widget.RecyclerView
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
import
com.squareup.picasso.Picasso
;
import
java.util.ArrayList
;
import
java.util.List
;
import
app.insti.R
;
import
app.insti.Utils
;
import
app.insti.api.model.User
;
import
de.hdodenhof.circleimageview.CircleImageView
;
public
class
UpVotesAdapter
extends
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>
{
private
static
final
String
TAG
=
CommentsAdapter
.
class
.
getSimpleName
();
private
LayoutInflater
inflater
;
private
Fragment
fragment
;
private
List
<
User
>
userList
=
new
ArrayList
<>();
public
UpVotesAdapter
(
Fragment
fragment
,
Context
context
)
{
inflater
=
LayoutInflater
.
from
(
context
);
this
.
fragment
=
fragment
;
}
public
class
UpVotesViewHolder
extends
RecyclerView
.
ViewHolder
{
private
CardView
cardView
;
private
CircleImageView
circleImageView
;
private
TextView
textViewName
;
UpVotesViewHolder
(
View
itemView
)
{
super
(
itemView
);
cardView
=
itemView
.
findViewById
(
R
.
id
.
cardViewUpVote
);
textViewName
=
itemView
.
findViewById
(
R
.
id
.
textViewUserUpVoteName
);
circleImageView
=
itemView
.
findViewById
(
R
.
id
.
circleImageViewUserUpVoteImage
);
cardView
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
Utils
.
openUserFragment
(
userList
.
get
(
getAdapterPosition
()),
fragment
.
getActivity
());
}
});
}
private
void
bindHolder
(
final
int
position
)
{
final
User
user
=
userList
.
get
(
position
);
try
{
String
profileUrl
=
user
.
getUserProfilePictureUrl
();
Log
.
i
(
TAG
,
"PROFILE URL: "
+
profileUrl
);
Picasso
.
get
().
load
(
profileUrl
).
placeholder
(
R
.
drawable
.
user_placeholder
).
into
(
circleImageView
);
textViewName
.
setText
(
user
.
getUserName
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
@NonNull
@Override
public
RecyclerView
.
ViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
viewGroup
,
int
i
)
{
View
view
=
inflater
.
inflate
(
R
.
layout
.
vote_up_card
,
viewGroup
,
false
);
return
new
UpVotesViewHolder
(
view
);
}
@Override
public
void
onBindViewHolder
(
@NonNull
RecyclerView
.
ViewHolder
viewHolder
,
int
i
)
{
if
(
viewHolder
instanceof
UpVotesViewHolder
)
{
((
UpVotesViewHolder
)
viewHolder
).
bindHolder
(
i
);
}
}
@Override
public
int
getItemCount
()
{
return
userList
.
size
();
}
public
void
setUpVoteList
(
List
<
User
>
userList
)
{
this
.
userList
=
userList
;
}
}
\ No newline at end of file
app/src/main/java/app/insti/fragment/ComplaintDetailsFragment.java
View file @
07985ffc
...
...
@@ -5,7 +5,6 @@ import android.content.res.ColorStateList;
import
android.os.Bundle
;
import
android.support.v4.app.Fragment
;
import
android.support.v4.view.ViewPager
;
import
android.support.v4.widget.NestedScrollView
;
import
android.support.v7.app.AlertDialog
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
...
...
@@ -17,7 +16,6 @@ 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
;
...
...
@@ -40,7 +38,7 @@ import app.insti.Utils;
import
app.insti.activity.MainActivity
;
import
app.insti.adapter.CommentsAdapter
;
import
app.insti.adapter.ImageViewPagerAdapter
;
import
app.insti.adapter.U
pVotes
Adapter
;
import
app.insti.adapter.U
ser
Adapter
;
import
app.insti.api.RetrofitInterface
;
import
app.insti.api.model.User
;
import
app.insti.api.model.Venter
;
...
...
@@ -82,12 +80,10 @@ public class ComplaintDetailsFragment extends Fragment {
private
static
String
cId
,
uId
,
uProfileUrl
;
private
CommentsAdapter
commentListAdapter
;
private
U
pVotes
Adapter
upVotesAdapter
;
private
U
ser
Adapter
upVotesAdapter
;
private
List
<
Venter
.
Comment
>
commentList
;
private
List
<
User
>
upVotesList
;
private
List
<
User
>
upVotesList
=
new
ArrayList
<>()
;
private
LinearLayout
linearLayoutTags
;
private
ScrollView
layoutUpVotes
;
private
NestedScrollView
nestedScrollView
;
private
CircleIndicator
circleIndicator
;
public
static
ComplaintDetailsFragment
getInstance
(
String
complaintid
,
String
userid
,
String
userProfileUrl
)
{
...
...
@@ -105,18 +101,15 @@ public class ComplaintDetailsFragment extends Fragment {
commentList
=
new
ArrayList
<>();
initialiseViews
(
view
);
upVotesList
=
new
ArrayList
<>();
commentListAdapter
=
new
CommentsAdapter
(
getActivity
(),
uId
,
this
);
LinearLayoutManager
linearLayoutManager
=
new
LinearLayoutManager
(
getContext
());
upVotesAdapter
=
new
U
pVotesAdapter
(
this
,
getContext
()
);
upVotesAdapter
=
new
U
serAdapter
(
upVotesList
,
this
);
recyclerViewComments
.
setLayoutManager
(
linearLayoutManager
);
recyclerViewUpVotes
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
()));
recyclerViewComments
.
setHasFixedSize
(
true
);
recyclerViewUpVotes
.
setHasFixedSize
(
true
);
recyclerViewComments
.
setAdapter
(
commentListAdapter
);
recyclerViewUpVotes
.
setAdapter
(
upVotesAdapter
);
upVotesAdapter
.
setUpVoteList
(
upVotesList
);
upVotesAdapter
.
notifyDataSetChanged
();
mMapView
=
view
.
findViewById
(
R
.
id
.
google_map
);
mMapView
.
onCreate
(
savedInstanceState
);
...
...
@@ -166,7 +159,6 @@ public class ComplaintDetailsFragment extends Fragment {
}
private
void
initialiseViews
(
View
view
)
{
nestedScrollView
=
view
.
findViewById
(
R
.
id
.
nestedScrollViewComplaintDetail
);
circleImageViewCreatorImage
=
view
.
findViewById
(
R
.
id
.
circleImageViewCreatorImage
);
linearLayoutSuggestions
=
view
.
findViewById
(
R
.
id
.
linearLayoutSuggestions
);
linearLayoutLocationDetails
=
view
.
findViewById
(
R
.
id
.
linearLayoutLocationDetails
);
...
...
@@ -319,7 +311,6 @@ public class ComplaintDetailsFragment extends Fragment {
Venter
.
Complaint
complaint
=
response
.
body
();
detailedComplaint
.
setVoteCount
(
1
);
addVotesToView
(
complaint
);
onUpvote
();
}
}
...
...
@@ -412,20 +403,11 @@ public class ComplaintDetailsFragment extends Fragment {
for
(
User
users
:
detailedComplaint
.
getUsersUpVoted
())
{
upVotesList
.
add
(
users
);
}
upVotesAdapter
.
set
UpVote
List
(
upVotesList
);
upVotesAdapter
.
setList
(
upVotesList
);
upVotesAdapter
.
notifyDataSetChanged
();
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
())
{
...
...
app/src/main/res/layout/vote_up_card.xml
deleted
100644 → 0
View file @
05fa6282
<?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/cardViewUpVote"
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:orientation=
"vertical"
android:paddingBottom=
"4dp"
android:paddingLeft=
"18dp"
android:paddingRight=
"10dp"
android:paddingTop=
"4dp"
>
<LinearLayout
android:id=
"@+id/layoutUpVote"
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>
</android.support.v7.widget.CardView>
\ 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