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
784b04f1
Commit
784b04f1
authored
Sep 30, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor static constant strings into Constants
parent
3ed11a83
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
12 deletions
+21
-12
app/src/main/java/app/insti/Constants.java
app/src/main/java/app/insti/Constants.java
+6
-0
app/src/main/java/app/insti/activity/MainActivity.java
app/src/main/java/app/insti/activity/MainActivity.java
+15
-12
No files found.
app/src/main/java/app/insti/Constants.java
View file @
784b04f1
...
@@ -32,6 +32,12 @@ public class Constants {
...
@@ -32,6 +32,12 @@ public class Constants {
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
DATA_TYPE_EVENT
=
"event"
;
public
static
final
String
DATA_TYPE_BODY
=
"body"
;
public
static
final
String
DATA_TYPE_USER
=
"userprofile"
;
public
static
final
String
DATA_TYPE_NEWS
=
"newsentry"
;
public
static
final
String
DATA_TYPE_PT
=
"blogentry"
;
/* Map */
/* Map */
public
static
final
double
MAP_Xn
=
19.134417
,
MAP_Yn
=
72.901229
,
MAP_Zn
=
1757
,
MAP_Zyn
=
501
;
public
static
final
double
MAP_Xn
=
19.134417
,
MAP_Yn
=
72.901229
,
MAP_Zn
=
1757
,
MAP_Zyn
=
501
;
public
static
final
double
[]
MAP_WEIGHTS_X
=
{-
11.392001766454612
,
-
36.31634553309953
,
73.91269388324432
,
-
24.14021153064087
,
3.4508817531539115
,
-
0.1462262375477863
,
5.532505074667804
,
-
1.542391995870977
,
36.14211738142935
};
public
static
final
double
[]
MAP_WEIGHTS_X
=
{-
11.392001766454612
,
-
36.31634553309953
,
73.91269388324432
,
-
24.14021153064087
,
3.4508817531539115
,
-
0.1462262375477863
,
5.532505074667804
,
-
1.542391995870977
,
36.14211738142935
};
...
...
app/src/main/java/app/insti/activity/MainActivity.java
View file @
784b04f1
...
@@ -73,6 +73,9 @@ import retrofit2.Call;
...
@@ -73,6 +73,9 @@ import retrofit2.Call;
import
retrofit2.Callback
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
import
retrofit2.Response
;
import
static
app
.
insti
.
Constants
.
DATA_TYPE_BODY
;
import
static
app
.
insti
.
Constants
.
DATA_TYPE_EVENT
;
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
;
import
static
app
.
insti
.
Constants
.
RESULT_LOAD_IMAGE
;
import
static
app
.
insti
.
Constants
.
RESULT_LOAD_IMAGE
;
...
@@ -272,13 +275,13 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -272,13 +275,13 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private
void
chooseIntent
(
String
type
,
String
id
)
{
private
void
chooseIntent
(
String
type
,
String
id
)
{
if
(
type
==
null
||
id
==
null
)
{
return
;
}
if
(
type
==
null
||
id
==
null
)
{
return
;
}
switch
(
type
)
{
switch
(
type
)
{
case
"body"
:
case
DATA_TYPE_BODY
:
openBodyFragment
(
id
);
openBodyFragment
(
id
);
break
;
break
;
case
"user"
:
case
DATA_TYPE_USER
:
openUserFragment
(
id
);
openUserFragment
(
id
);
break
;
break
;
case
"event"
:
case
DATA_TYPE_EVENT
:
openEventFragment
(
id
);
openEventFragment
(
id
);
break
;
break
;
}
}
...
@@ -319,23 +322,23 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -319,23 +322,23 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
if
(
appLinkData
.
charAt
(
appLinkData
.
length
()
-
1
)
==
'/'
)
if
(
appLinkData
.
charAt
(
appLinkData
.
length
()
-
1
)
==
'/'
)
appLinkData
=
appLinkData
.
substring
(
0
,
appLinkData
.
length
()
-
1
);
appLinkData
=
appLinkData
.
substring
(
0
,
appLinkData
.
length
()
-
1
);
switch
(
getType
(
appLinkData
))
{
switch
(
getType
(
appLinkData
))
{
case
"body"
:
case
DATA_TYPE_BODY
:
return
appLinkData
.
substring
(
appLinkData
.
indexOf
(
"org"
)
+
4
);
return
appLinkData
.
substring
(
appLinkData
.
indexOf
(
"org"
)
+
4
);
case
"user"
:
case
DATA_TYPE_USER
:
return
appLinkData
.
substring
(
appLinkData
.
indexOf
(
"user"
)
+
5
);
return
appLinkData
.
substring
(
appLinkData
.
indexOf
(
"user"
)
+
5
);
case
"event"
:
case
DATA_TYPE_EVENT
:
return
appLinkData
.
substring
(
appLinkData
.
indexOf
(
"event"
)
+
6
);
return
appLinkData
.
substring
(
appLinkData
.
indexOf
(
"event"
)
+
6
);
}
}
return
null
;
return
null
;
}
}
private
String
getType
(
String
appLinkData
)
{
private
String
getType
(
String
appLinkData
)
{
if
(
appLinkData
.
startsWith
(
"http://insti.app/org/"
)
||
appLinkData
.
startsWith
(
"https
://insti.app/org/"
))
{
if
(
appLinkData
.
contains
(
"
://insti.app/org/"
))
{
return
"body"
;
return
DATA_TYPE_BODY
;
}
else
if
(
appLinkData
.
startsWith
(
"http://insti.app/user/"
)
||
appLinkData
.
startsWith
(
"https
://insti.app/user/"
))
{
}
else
if
(
appLinkData
.
contains
(
"
://insti.app/user/"
))
{
return
"user"
;
return
DATA_TYPE_USER
;
}
else
if
(
appLinkData
.
startsWith
(
"http://insti.app/event/"
)
||
appLinkData
.
startsWith
(
"https
://insti.app/event/"
))
{
}
else
if
(
appLinkData
.
contains
(
"
://insti.app/event/"
))
{
return
"event"
;
return
DATA_TYPE_EVENT
;
}
}
return
null
;
return
null
;
}
}
...
...
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