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
72bb881e
Commit
72bb881e
authored
Jul 13, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show following count of body in badge
parent
3ea4a573
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
app/src/main/java/app/insti/fragment/BodyFragment.java
app/src/main/java/app/insti/fragment/BodyFragment.java
+1
-0
app/src/main/java/app/insti/fragment/EventFragment.java
app/src/main/java/app/insti/fragment/EventFragment.java
+8
-2
app/src/main/res/layout/fragment_body.xml
app/src/main/res/layout/fragment_body.xml
+1
-1
No files found.
app/src/main/java/app/insti/fragment/BodyFragment.java
View file @
72bb881e
...
@@ -173,6 +173,7 @@ public class BodyFragment extends Fragment {
...
@@ -173,6 +173,7 @@ public class BodyFragment extends Fragment {
/* Check if user is already following
/* Check if user is already following
* 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
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
followButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
...
...
app/src/main/java/app/insti/fragment/EventFragment.java
View file @
72bb881e
...
@@ -207,12 +207,18 @@ public class EventFragment extends BaseFragment {
...
@@ -207,12 +207,18 @@ public class EventFragment extends BaseFragment {
* @param count integer count to show in the badge
* @param count integer count to show in the badge
* @return spannable to be used as view.setText(spannable)
* @return spannable to be used as view.setText(spannable)
*/
*/
static
Spannable
getCountBadgeSpannable
(
String
text
,
int
count
)
{
static
Spannable
getCountBadgeSpannable
(
String
text
,
Integer
count
)
{
// Check for nulls
if
(
count
==
null
)
return
new
SpannableString
(
text
);
// Make a spannable
String
countString
=
Integer
.
toString
(
count
);
String
countString
=
Integer
.
toString
(
count
);
Spannable
spannable
=
new
SpannableString
(
text
+
" "
+
countString
);
Spannable
spannable
=
new
SpannableString
(
text
+
" "
+
countString
);
spannable
.
setSpan
(
new
StyleSpan
(
Typeface
.
NORMAL
),
0
,
text
.
length
(),
Spannable
.
SPAN_INCLUSIVE_INCLUSIVE
);
// Set font face and color of badge
spannable
.
setSpan
(
new
RelativeSizeSpan
(
0.75f
),
text
.
length
(),
text
.
length
()
+
1
+
countString
.
length
(),
Spannable
.
SPAN_INCLUSIVE_INCLUSIVE
);
spannable
.
setSpan
(
new
RelativeSizeSpan
(
0.75f
),
text
.
length
(),
text
.
length
()
+
1
+
countString
.
length
(),
Spannable
.
SPAN_INCLUSIVE_INCLUSIVE
);
spannable
.
setSpan
(
new
ForegroundColorSpan
(
Color
.
DKGRAY
),
text
.
length
(),
text
.
length
()
+
1
+
countString
.
length
(),
Spannable
.
SPAN_INCLUSIVE_INCLUSIVE
);
spannable
.
setSpan
(
new
ForegroundColorSpan
(
Color
.
DKGRAY
),
text
.
length
(),
text
.
length
()
+
1
+
countString
.
length
(),
Spannable
.
SPAN_INCLUSIVE_INCLUSIVE
);
return
spannable
;
return
spannable
;
}
}
...
...
app/src/main/res/layout/fragment_body.xml
View file @
72bb881e
...
@@ -103,7 +103,7 @@
...
@@ -103,7 +103,7 @@
android:layout_margin=
"0dp"
android:layout_margin=
"0dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:text=
"Follow"
android:text=
"Follow"
android:textColor=
"@color/
colorGray
"
/>
android:textColor=
"@color/
secondaryTextColor
"
/>
</LinearLayout>
</LinearLayout>
<View
<View
...
...
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