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
553d3f1e
Commit
553d3f1e
authored
Sep 23, 2018
by
atharvkotwal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Number of followers increase/decrease on clicking follow in body
parent
ec32a6de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
app/src/main/java/app/insti/fragment/BodyFragment.java
app/src/main/java/app/insti/fragment/BodyFragment.java
+7
-4
app/src/main/java/app/insti/fragment/NewsFragment.java
app/src/main/java/app/insti/fragment/NewsFragment.java
+3
-0
No files found.
app/src/main/java/app/insti/fragment/BodyFragment.java
View file @
553d3f1e
...
@@ -232,7 +232,7 @@ public class BodyFragment extends BackHandledFragment {
...
@@ -232,7 +232,7 @@ public class BodyFragment extends BackHandledFragment {
* Initialize follow button */
* Initialize follow button */
followButton
.
setBackgroundColor
(
getResources
().
getColor
(
body
.
getBodyUserFollows
()
?
R
.
color
.
colorAccent
:
R
.
color
.
colorWhite
));
followButton
.
setBackgroundColor
(
getResources
().
getColor
(
body
.
getBodyUserFollows
()
?
R
.
color
.
colorAccent
:
R
.
color
.
colorWhite
));
followButton
.
setText
(
EventFragment
.
getCountBadgeSpannable
(
"FOLLOW"
,
body
.
getBodyFollowersCount
()));
followButton
.
setText
(
EventFragment
.
getCountBadgeSpannable
(
"FOLLOW"
,
body
.
getBodyFollowersCount
()));
final
boolean
initial
=
body
.
getBodyUserFollows
();
followButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
followButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
...
@@ -241,11 +241,14 @@ public class BodyFragment extends BackHandledFragment {
...
@@ -241,11 +241,14 @@ public class BodyFragment extends BackHandledFragment {
@Override
@Override
public
void
onResponse
(
Call
<
Void
>
call
,
Response
<
Void
>
response
)
{
public
void
onResponse
(
Call
<
Void
>
call
,
Response
<
Void
>
response
)
{
if
(
response
.
isSuccessful
())
{
if
(
response
.
isSuccessful
())
{
body
.
setBodyUserFollows
(!
body
.
getBodyUserFollows
());
body
.
setBodyUserFollows
(!
body
.
getBodyUserFollows
());
new
updateDbBody
().
execute
(
body
);
followButton
.
setBackgroundColor
(
getResources
().
getColor
(
body
.
getBodyUserFollows
()
?
R
.
color
.
colorAccent
:
R
.
color
.
colorWhite
));
followButton
.
setBackgroundColor
(
getResources
().
getColor
(
body
.
getBodyUserFollows
()
?
R
.
color
.
colorAccent
:
R
.
color
.
colorWhite
));
if
(
body
.
getBodyUserFollows
())
followButton
.
setText
(
body
.
getBodyFollowersCount
()
+
1
);
followButton
.
setText
(
EventFragment
.
getCountBadgeSpannable
(
"FOLLOW"
,
body
.
getBodyFollowersCount
())
);
else
{
followButton
.
setText
(
body
.
getBodyFollowersCount
()
+
1
);}
if
(!
initial
)
{
if
(
body
.
getBodyUserFollows
())
{
followButton
.
setText
(
EventFragment
.
getCountBadgeSpannable
(
"FOLLOW"
,
body
.
getBodyFollowersCount
()+
1
));
}}
else
{
if
(!
body
.
getBodyUserFollows
())
{
followButton
.
setText
(
EventFragment
.
getCountBadgeSpannable
(
"FOLLOW"
,
body
.
getBodyFollowersCount
()-
1
));
}}
}
}
}
}
...
...
app/src/main/java/app/insti/fragment/NewsFragment.java
View file @
553d3f1e
...
@@ -48,6 +48,8 @@ public class NewsFragment extends BaseFragment {
...
@@ -48,6 +48,8 @@ public class NewsFragment extends BaseFragment {
private
AppDatabase
appDatabase
;
private
AppDatabase
appDatabase
;
private
boolean
freshNewsDisplayed
=
false
;
private
boolean
freshNewsDisplayed
=
false
;
private
String
searchQuery
;
private
String
searchQuery
;
LinearLayoutManager
mLayoutManager
;
public
static
int
index
=
-
1
,
top
=
-
1
;
public
NewsFragment
()
{
public
NewsFragment
()
{
// Required empty public constructor
// Required empty public constructor
...
@@ -125,6 +127,7 @@ public class NewsFragment extends BaseFragment {
...
@@ -125,6 +127,7 @@ public class NewsFragment extends BaseFragment {
public
void
run
(
Activity
pActivity
)
{
public
void
run
(
Activity
pActivity
)
{
try
{
try
{
newsRecyclerView
=
getActivity
().
findViewById
(
R
.
id
.
news_recycler_view
);
newsRecyclerView
=
getActivity
().
findViewById
(
R
.
id
.
news_recycler_view
);
newsRecyclerView
.
setAdapter
(
newsAdapter
);
newsRecyclerView
.
setAdapter
(
newsAdapter
);
newsRecyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
()));
newsRecyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
()));
newsRecyclerView
.
addOnScrollListener
(
new
RecyclerView
.
OnScrollListener
()
{
newsRecyclerView
.
addOnScrollListener
(
new
RecyclerView
.
OnScrollListener
()
{
...
...
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