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
9a3193a2
Commit
9a3193a2
authored
Sep 30, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Follow training and placement blog notifications
parent
784b04f1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
16 deletions
+49
-16
app/src/main/java/app/insti/Constants.java
app/src/main/java/app/insti/Constants.java
+1
-0
app/src/main/java/app/insti/activity/MainActivity.java
app/src/main/java/app/insti/activity/MainActivity.java
+48
-16
No files found.
app/src/main/java/app/insti/Constants.java
View file @
9a3193a2
...
@@ -31,6 +31,7 @@ public class Constants {
...
@@ -31,6 +31,7 @@ public class Constants {
public
static
final
String
MAIN_INTENT_EXTRAS
=
"MAIN_EXTRA"
;
public
static
final
String
MAIN_INTENT_EXTRAS
=
"MAIN_EXTRA"
;
public
static
final
String
FCM_BUNDLE_TYPE
=
"type"
;
public
static
final
String
FCM_BUNDLE_TYPE
=
"type"
;
public
static
final
String
FCM_BUNDLE_ID
=
"id"
;
public
static
final
String
FCM_BUNDLE_ID
=
"id"
;
public
static
final
String
FCM_BUNDLE_EXTRA
=
"extra"
;
public
static
final
String
DATA_TYPE_EVENT
=
"event"
;
public
static
final
String
DATA_TYPE_EVENT
=
"event"
;
public
static
final
String
DATA_TYPE_BODY
=
"body"
;
public
static
final
String
DATA_TYPE_BODY
=
"body"
;
...
...
app/src/main/java/app/insti/activity/MainActivity.java
View file @
9a3193a2
...
@@ -75,6 +75,8 @@ import retrofit2.Response;
...
@@ -75,6 +75,8 @@ import retrofit2.Response;
import
static
app
.
insti
.
Constants
.
DATA_TYPE_BODY
;
import
static
app
.
insti
.
Constants
.
DATA_TYPE_BODY
;
import
static
app
.
insti
.
Constants
.
DATA_TYPE_EVENT
;
import
static
app
.
insti
.
Constants
.
DATA_TYPE_EVENT
;
import
static
app
.
insti
.
Constants
.
DATA_TYPE_NEWS
;
import
static
app
.
insti
.
Constants
.
DATA_TYPE_PT
;
import
static
app
.
insti
.
Constants
.
DATA_TYPE_USER
;
import
static
app
.
insti
.
Constants
.
DATA_TYPE_USER
;
import
static
app
.
insti
.
Constants
.
MY_PERMISSIONS_REQUEST_ACCESS_LOCATION
;
import
static
app
.
insti
.
Constants
.
MY_PERMISSIONS_REQUEST_ACCESS_LOCATION
;
import
static
app
.
insti
.
Constants
.
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE
;
import
static
app
.
insti
.
Constants
.
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE
;
...
@@ -258,7 +260,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -258,7 +260,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private
void
handleFCMIntent
(
Bundle
bundle
)
{
private
void
handleFCMIntent
(
Bundle
bundle
)
{
chooseIntent
(
chooseIntent
(
bundle
.
getString
(
Constants
.
FCM_BUNDLE_TYPE
),
bundle
.
getString
(
Constants
.
FCM_BUNDLE_TYPE
),
bundle
.
getString
(
Constants
.
FCM_BUNDLE_ID
)
bundle
.
getString
(
Constants
.
FCM_BUNDLE_ID
),
bundle
.
getString
(
Constants
.
FCM_BUNDLE_EXTRA
)
);
);
}
}
...
@@ -284,6 +287,26 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -284,6 +287,26 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
case
DATA_TYPE_EVENT:
case
DATA_TYPE_EVENT:
openEventFragment
(
id
);
openEventFragment
(
id
);
break
;
break
;
case
DATA_TYPE_NEWS:
updateFragment
(
new
NewsFragment
());
break
;
}
}
/** Open the proper fragment from given type, id and extra */
private
void
chooseIntent
(
String
type
,
String
id
,
String
extra
)
{
if
(
extra
==
null
)
{
chooseIntent
(
type
,
id
);
}
else
{
switch
(
type
)
{
case
DATA_TYPE_PT:
if
(
extra
.
contains
(
"/trainingblog"
))
{
openTrainingBlog
();
}
else
{
openPlacementBlog
();
}
break
;
}
}
}
}
}
...
@@ -461,7 +484,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -461,7 +484,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
return
super
.
onOptionsItemSelected
(
item
);
return
super
.
onOptionsItemSelected
(
item
);
}
}
@SuppressWarnings
(
"StatementWithEmptyBody"
)
@Override
@Override
public
boolean
onNavigationItemSelected
(
MenuItem
item
)
{
public
boolean
onNavigationItemSelected
(
MenuItem
item
)
{
// Handle navigation view item clicks here.
// Handle navigation view item clicks here.
...
@@ -486,26 +508,16 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -486,26 +508,16 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
break
;
break
;
case
R
.
id
.
nav_news
:
case
R
.
id
.
nav_news
:
NewsFragment
newsFragment
=
new
NewsFragment
();
updateFragment
(
new
NewsFragment
());
updateFragment
(
newsFragment
);
break
;
break
;
case
R
.
id
.
nav_placement_blog
:
case
R
.
id
.
nav_placement_blog
:
if
(
session
.
isLoggedIn
())
{
openPlacementBlog
();
PlacementBlogFragment
placementBlogFragment
=
new
PlacementBlogFragment
();
updateFragment
(
placementBlogFragment
);
}
else
{
Toast
.
makeText
(
this
,
Constants
.
LOGIN_MESSAGE
,
Toast
.
LENGTH_LONG
).
show
();
}
break
;
break
;
case
R
.
id
.
nav_training_blog
:
case
R
.
id
.
nav_training_blog
:
if
(
session
.
isLoggedIn
())
{
openTrainingBlog
();
TrainingBlogFragment
trainingBlogFragment
=
new
TrainingBlogFragment
();
updateFragment
(
trainingBlogFragment
);
}
else
{
Toast
.
makeText
(
this
,
Constants
.
LOGIN_MESSAGE
,
Toast
.
LENGTH_LONG
).
show
();
}
break
;
break
;
case
R
.
id
.
nav_mess_menu
:
case
R
.
id
.
nav_mess_menu
:
MessMenuFragment
messMenuFragment
=
new
MessMenuFragment
();
MessMenuFragment
messMenuFragment
=
new
MessMenuFragment
();
updateFragment
(
messMenuFragment
);
updateFragment
(
messMenuFragment
);
...
@@ -534,6 +546,26 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -534,6 +546,26 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
return
true
;
return
true
;
}
}
/** Open placement blog fragment */
private
void
openPlacementBlog
()
{
if
(
session
.
isLoggedIn
())
{
PlacementBlogFragment
placementBlogFragment
=
new
PlacementBlogFragment
();
updateFragment
(
placementBlogFragment
);
}
else
{
Toast
.
makeText
(
this
,
Constants
.
LOGIN_MESSAGE
,
Toast
.
LENGTH_LONG
).
show
();
}
}
private
void
openTrainingBlog
()
{
if
(
session
.
isLoggedIn
())
{
TrainingBlogFragment
trainingBlogFragment
=
new
TrainingBlogFragment
();
updateFragment
(
trainingBlogFragment
);
}
else
{
Toast
.
makeText
(
this
,
Constants
.
LOGIN_MESSAGE
,
Toast
.
LENGTH_LONG
).
show
();
}
}
/** Change the active fragment to the supplied one */
public
void
updateFragment
(
Fragment
fragment
)
{
public
void
updateFragment
(
Fragment
fragment
)
{
Log
.
d
(
TAG
,
"updateFragment: "
+
fragment
.
toString
());
Log
.
d
(
TAG
,
"updateFragment: "
+
fragment
.
toString
());
Bundle
bundle
=
fragment
.
getArguments
();
Bundle
bundle
=
fragment
.
getArguments
();
...
...
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