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
ec8fa297
Commit
ec8fa297
authored
Feb 02, 2019
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show fab after load on calendar
parent
33caa649
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
20 deletions
+26
-20
app/src/main/java/app/insti/fragment/CalendarFragment.java
app/src/main/java/app/insti/fragment/CalendarFragment.java
+25
-19
app/src/main/res/layout/fragment_calendar.xml
app/src/main/res/layout/fragment_calendar.xml
+1
-1
No files found.
app/src/main/java/app/insti/fragment/CalendarFragment.java
View file @
ec8fa297
...
...
@@ -105,16 +105,18 @@ public class CalendarFragment extends BaseFragment {
}
});
// Handle fab click
fab
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
AddEventFragment
addEventFragment
=
new
AddEventFragment
();
((
MainActivity
)
getActivity
()).
updateFragment
(
addEventFragment
);
}
});
return
view
;
}
// Show the fab if we can make events
@Override
public
void
onStart
()
{
super
.
onStart
();
updateEvents
(
CalendarDay
.
today
(),
true
);
}
/** Show the fab if we can make events */
private
void
showFab
()
{
if
(((
MainActivity
)
getActivity
()).
createEventAccess
())
{
fab
.
show
();
NestedScrollView
nsv
=
view
.
findViewById
(
R
.
id
.
calendar_nsv
);
...
...
@@ -125,27 +127,28 @@ public class CalendarFragment extends BaseFragment {
else
fab
.
show
();
}
});
}
return
view
;
// Handle fab click
fab
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
AddEventFragment
addEventFragment
=
new
AddEventFragment
();
((
MainActivity
)
getActivity
()).
updateFragment
(
addEventFragment
);
}
});
}
}
@Override
public
void
onStart
()
{
super
.
onStart
();
updateEvents
(
CalendarDay
.
today
(),
true
);
}
/** Convert CalendarDay to Date */
p
ublic
Date
toDate
(
CalendarDay
date
)
throws
ParseException
{
p
rivate
Date
toDate
(
CalendarDay
date
)
throws
ParseException
{
String
sdate
=
date
.
getDay
()
+
"/"
+
date
.
getMonth
()
+
"/"
+
date
.
getYear
();
Date
showDate
=
new
SimpleDateFormat
(
"dd/M/yyyy"
).
parse
(
sdate
);
return
showDate
;
}
/** Decorator for Calendar */
p
ublic
class
EventDecorator
implements
DayViewDecorator
{
p
rivate
class
EventDecorator
implements
DayViewDecorator
{
private
final
int
color
=
getResources
().
getColor
(
R
.
color
.
colorAccent
);
private
final
int
white
=
getResources
().
getColor
(
R
.
color
.
primaryTextColor
);
private
final
HashSet
<
CalendarDay
>
dates
;
...
...
@@ -234,6 +237,9 @@ public class CalendarFragment extends BaseFragment {
// Select today's date
final
MaterialCalendarView
matCalendarView
=
view
.
findViewById
(
R
.
id
.
simpleCalendarView
);
matCalendarView
.
setSelectedDate
(
CalendarDay
.
today
());
// Show the fab
showFab
();
}
// Generate the decorators
...
...
app/src/main/res/layout/fragment_calendar.xml
View file @
ec8fa297
...
...
@@ -77,7 +77,7 @@
android:layout_margin=
"16dp"
android:src=
"@drawable/ic_add_black_24dp"
android:tint=
"@android:color/black"
android:visibility=
"
gon
e"
/>
android:visibility=
"
invisibl
e"
/>
<include
layout=
"@layout/loading_panel"
/>
...
...
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