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
b3ea021f
Commit
b3ea021f
authored
Jul 25, 2018
by
Sajal Narang
Committed by
GitHub
Jul 25, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #156 from pulsejet/patch-2
Multiple fixes
parents
9246b5f9
5389583d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
76 additions
and
11 deletions
+76
-11
app/src/main/java/app/insti/fragment/BodyFragment.java
app/src/main/java/app/insti/fragment/BodyFragment.java
+1
-1
app/src/main/java/app/insti/fragment/EventFragment.java
app/src/main/java/app/insti/fragment/EventFragment.java
+14
-2
app/src/main/java/app/insti/fragment/MapFragment.java
app/src/main/java/app/insti/fragment/MapFragment.java
+48
-5
app/src/main/java/app/insti/fragment/QuickLinksFragment.java
app/src/main/java/app/insti/fragment/QuickLinksFragment.java
+2
-0
app/src/main/res/layout/fragment_body.xml
app/src/main/res/layout/fragment_body.xml
+2
-1
app/src/main/res/layout/fragment_event.xml
app/src/main/res/layout/fragment_event.xml
+4
-2
app/src/main/res/layout/fragment_quick_links.xml
app/src/main/res/layout/fragment_quick_links.xml
+5
-0
No files found.
app/src/main/java/app/insti/fragment/BodyFragment.java
View file @
b3ea021f
...
@@ -217,7 +217,7 @@ public class BodyFragment extends BackHandledFragment {
...
@@ -217,7 +217,7 @@ public class BodyFragment extends BackHandledFragment {
/* 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
(
"F
ollow
"
,
body
.
getBodyFollowersCount
()));
followButton
.
setText
(
EventFragment
.
getCountBadgeSpannable
(
"F
OLLOW
"
,
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 @
b3ea021f
...
@@ -235,8 +235,8 @@ public class EventFragment extends BackHandledFragment {
...
@@ -235,8 +235,8 @@ public class EventFragment extends BackHandledFragment {
goingButton
.
setBackgroundColor
(
getResources
().
getColor
(
status
==
Constants
.
STATUS_GOING
?
R
.
color
.
colorAccent
:
R
.
color
.
colorWhite
));
goingButton
.
setBackgroundColor
(
getResources
().
getColor
(
status
==
Constants
.
STATUS_GOING
?
R
.
color
.
colorAccent
:
R
.
color
.
colorWhite
));
// Show badges
// Show badges
interestedButton
.
setText
(
getCountBadgeSpannable
(
"I
nterested
"
,
event
.
getEventInterestedCount
()));
interestedButton
.
setText
(
getCountBadgeSpannable
(
"I
NTERESTED
"
,
event
.
getEventInterestedCount
()));
goingButton
.
setText
(
getCountBadgeSpannable
(
"G
oing
"
,
event
.
getEventGoingCount
()));
goingButton
.
setText
(
getCountBadgeSpannable
(
"G
OING
"
,
event
.
getEventGoingCount
()));
}
}
/**
/**
...
@@ -271,6 +271,18 @@ public class EventFragment extends BackHandledFragment {
...
@@ -271,6 +271,18 @@ public class EventFragment 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
())
{
/* TODO: Find a better way to change counts */
if
(
endStatus
==
0
)
{
if
(
event
.
getEventUserUes
()
==
1
)
{
event
.
setEventInterestedCount
(
event
.
getEventInterestedCount
()
-
1
);
}
if
(
event
.
getEventUserUes
()
==
2
)
{
event
.
setEventGoingCount
(
event
.
getEventGoingCount
()
-
1
);
}
}
else
if
(
endStatus
==
1
)
{
if
(
event
.
getEventUserUes
()
!=
1
)
{
event
.
setEventInterestedCount
(
event
.
getEventInterestedCount
()
+
1
);
}
if
(
event
.
getEventUserUes
()
==
2
)
{
event
.
setEventGoingCount
(
event
.
getEventGoingCount
()
-
1
);
}
}
else
if
(
endStatus
==
2
)
{
if
(
event
.
getEventUserUes
()
!=
2
)
{
event
.
setEventGoingCount
(
event
.
getEventGoingCount
()
+
1
);
}
if
(
event
.
getEventUserUes
()
==
1
)
{
event
.
setEventInterestedCount
(
event
.
getEventInterestedCount
()
-
1
);
}
}
event
.
setEventUserUes
(
endStatus
);
event
.
setEventUserUes
(
endStatus
);
new
updateDbEvent
().
execute
(
event
);
new
updateDbEvent
().
execute
(
event
);
setFollowButtonColors
(
endStatus
);
setFollowButtonColors
(
endStatus
);
...
...
app/src/main/java/app/insti/fragment/MapFragment.java
View file @
b3ea021f
...
@@ -15,6 +15,7 @@ import android.location.LocationListener;
...
@@ -15,6 +15,7 @@ import android.location.LocationListener;
import
android.location.LocationManager
;
import
android.location.LocationManager
;
import
android.media.AudioManager
;
import
android.media.AudioManager
;
import
android.media.SoundPool
;
import
android.media.SoundPool
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.os.Message
;
...
@@ -91,6 +92,7 @@ import app.insti.MainActivity;
...
@@ -91,6 +92,7 @@ import app.insti.MainActivity;
import
app.insti.R
;
import
app.insti.R
;
import
app.insti.api.RetrofitInterface
;
import
app.insti.api.RetrofitInterface
;
import
app.insti.api.ServiceGenerator
;
import
app.insti.api.ServiceGenerator
;
import
app.insti.data.AppDatabase
;
import
app.insti.data.Venue
;
import
app.insti.data.Venue
;
import
retrofit2.Call
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Callback
;
...
@@ -102,6 +104,7 @@ public class MapFragment extends Fragment implements TextWatcher,
...
@@ -102,6 +104,7 @@ public class MapFragment extends Fragment implements TextWatcher,
TextView
.
OnEditorActionListener
,
AdapterView
.
OnItemClickListener
,
View
.
OnFocusChangeListener
,
TextView
.
OnEditorActionListener
,
AdapterView
.
OnItemClickListener
,
View
.
OnFocusChangeListener
,
View
.
OnTouchListener
,
ExpandableListView
.
OnChildClickListener
{
View
.
OnTouchListener
,
ExpandableListView
.
OnChildClickListener
{
private
static
MapFragment
mainactivity
;
private
static
MapFragment
mainactivity
;
private
AppDatabase
appDatabase
;
private
SettingsManager
settingsManager
;
private
SettingsManager
settingsManager
;
private
FuzzySearchAdapter
adapter
;
private
FuzzySearchAdapter
adapter
;
private
ExpandableListAdapter
expAdapter
;
private
ExpandableListAdapter
expAdapter
;
...
@@ -148,6 +151,7 @@ public class MapFragment extends Fragment implements TextWatcher,
...
@@ -148,6 +151,7 @@ public class MapFragment extends Fragment implements TextWatcher,
public
SoundPool
soundPool
;
public
SoundPool
soundPool
;
public
int
[]
soundPoolIds
;
public
int
[]
soundPoolIds
;
private
boolean
locationsShown
=
false
;
private
boolean
GPSIsSetup
=
false
;
private
boolean
GPSIsSetup
=
false
;
private
boolean
followingUser
=
false
;
private
boolean
followingUser
=
false
;
private
Marker
user
=
new
Marker
(
"You"
,
""
,
0
,
0
,
-
10
,
""
);
private
Marker
user
=
new
Marker
(
"You"
,
""
,
0
,
0
,
-
10
,
""
);
...
@@ -194,22 +198,57 @@ public class MapFragment extends Fragment implements TextWatcher,
...
@@ -194,22 +198,57 @@ public class MapFragment extends Fragment implements TextWatcher,
Toolbar
toolbar
=
getActivity
().
findViewById
(
R
.
id
.
toolbar
);
Toolbar
toolbar
=
getActivity
().
findViewById
(
R
.
id
.
toolbar
);
toolbar
.
setTitle
(
"InstiMap"
);
toolbar
.
setTitle
(
"InstiMap"
);
/* Initialize */
appDatabase
=
AppDatabase
.
getAppDatabase
(
getContext
());
getAPILocations
();
new
showLocationsFromDB
().
execute
();
}
private
void
getAPILocations
()
{
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
retrofitInterface
.
getAllVenues
().
enqueue
(
new
Callback
<
List
<
Venue
>>()
{
retrofitInterface
.
getAllVenues
().
enqueue
(
new
Callback
<
List
<
Venue
>>()
{
@Override
@Override
public
void
onResponse
(
Call
<
List
<
Venue
>>
call
,
Response
<
List
<
Venue
>>
response
)
{
public
void
onResponse
(
Call
<
List
<
Venue
>>
call
,
Response
<
List
<
Venue
>>
response
)
{
if
(
response
.
isSuccessful
())
{
if
(
response
.
isSuccessful
())
{
setupWithData
(
response
.
body
());
new
updateDatabase
().
execute
(
response
.
body
());
if
(!
locationsShown
)
{
setupWithData
(
response
.
body
());
locationsShown
=
true
;
}
}
}
}
}
@Override
@Override
public
void
onFailure
(
Call
<
List
<
Venue
>>
call
,
Throwable
t
)
{
public
void
onFailure
(
Call
<
List
<
Venue
>>
call
,
Throwable
t
)
{
setupWithData
(
new
ArrayList
<
Venue
>());
// Do nothing
}
}
});
});
}
}
private
class
updateDatabase
extends
AsyncTask
<
List
<
Venue
>,
Void
,
Integer
>
{
@Override
protected
Integer
doInBackground
(
List
<
Venue
>...
venues
)
{
appDatabase
.
dbDao
().
deleteVenues
();
appDatabase
.
dbDao
().
insertVenues
(
venues
[
0
]);
return
1
;
}
}
private
class
showLocationsFromDB
extends
AsyncTask
<
String
,
Void
,
List
<
Venue
>>
{
@Override
protected
List
<
Venue
>
doInBackground
(
String
...
events
)
{
return
appDatabase
.
dbDao
().
getAllVenues
();
}
protected
void
onPostExecute
(
List
<
Venue
>
result
)
{
if
(!
locationsShown
&&
result
.
size
()
>
0
)
{
setupWithData
(
result
);
locationsShown
=
true
;
}
}
}
void
setupWithData
(
List
<
Venue
>
venues
)
{
void
setupWithData
(
List
<
Venue
>
venues
)
{
if
(
getView
()
==
null
||
getActivity
()
==
null
)
return
;
if
(
getView
()
==
null
||
getActivity
()
==
null
)
return
;
Locations
mLocations
=
new
Locations
(
venues
);
Locations
mLocations
=
new
Locations
(
venues
);
...
@@ -236,8 +275,12 @@ public class MapFragment extends Fragment implements TextWatcher,
...
@@ -236,8 +275,12 @@ public class MapFragment extends Fragment implements TextWatcher,
if
(!
campusMapView
.
isAddedMarker
(
user
))
{
if
(!
campusMapView
.
isAddedMarker
(
user
))
{
campusMapView
.
addMarker
(
user
);
campusMapView
.
addMarker
(
user
);
}
}
SubsamplingScaleImageView
.
AnimationBuilder
anim
=
campusMapView
.
animateCenter
(
user
.
getPoint
());
if
(
user
.
getPoint
().
x
==
0
)
{
if
(
anim
!=
null
)
anim
.
start
();
Toast
.
makeText
(
getContext
(),
"Searching for GPS!"
,
Toast
.
LENGTH_LONG
).
show
();
}
else
{
SubsamplingScaleImageView
.
AnimationBuilder
anim
=
campusMapView
.
animateCenter
(
user
.
getPoint
());
if
(
anim
!=
null
)
anim
.
start
();
}
}
}
}
}
...
@@ -1175,7 +1218,7 @@ public class MapFragment extends Fragment implements TextWatcher,
...
@@ -1175,7 +1218,7 @@ public class MapFragment extends Fragment implements TextWatcher,
}
catch
(
IntentSender
.
SendIntentException
e
)
{
}
}
catch
(
IntentSender
.
SendIntentException
e
)
{
}
break
;
break
;
case
LocationSettingsStatusCodes
.
SETTINGS_CHANGE_UNAVAILABLE
:
case
LocationSettingsStatusCodes
.
SETTINGS_CHANGE_UNAVAILABLE
:
Toast
.
makeText
(
getContext
(),
"GPS is not enabled!"
,
Toast
.
LENGTH_LONG
);
Toast
.
makeText
(
getContext
(),
"GPS is not enabled!"
,
Toast
.
LENGTH_LONG
)
.
show
()
;
break
;
break
;
}
}
}
}
...
...
app/src/main/java/app/insti/fragment/QuickLinksFragment.java
View file @
b3ea021f
...
@@ -37,6 +37,7 @@ public class QuickLinksFragment extends BaseFragment {
...
@@ -37,6 +37,7 @@ public class QuickLinksFragment extends BaseFragment {
TextView
Holidays
=
getActivity
().
findViewById
(
R
.
id
.
button_Holidays
);
TextView
Holidays
=
getActivity
().
findViewById
(
R
.
id
.
button_Holidays
);
TextView
Circulars
=
getActivity
().
findViewById
(
R
.
id
.
button_Circulars
);
TextView
Circulars
=
getActivity
().
findViewById
(
R
.
id
.
button_Circulars
);
TextView
Courses
=
getActivity
().
findViewById
(
R
.
id
.
button_Courselist
);
TextView
Courses
=
getActivity
().
findViewById
(
R
.
id
.
button_Courselist
);
TextView
WebMail
=
getActivity
().
findViewById
(
R
.
id
.
button_WebMail
);
TextView
GPO
=
getActivity
().
findViewById
(
R
.
id
.
button_GPO
);
TextView
GPO
=
getActivity
().
findViewById
(
R
.
id
.
button_GPO
);
TextView
CAMP
=
getActivity
().
findViewById
(
R
.
id
.
button_CAMP
);
TextView
CAMP
=
getActivity
().
findViewById
(
R
.
id
.
button_CAMP
);
TextView
MSStore
=
getActivity
().
findViewById
(
R
.
id
.
button_MSStore
);
TextView
MSStore
=
getActivity
().
findViewById
(
R
.
id
.
button_MSStore
);
...
@@ -60,6 +61,7 @@ public class QuickLinksFragment extends BaseFragment {
...
@@ -60,6 +61,7 @@ public class QuickLinksFragment extends BaseFragment {
Holidays
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
goToUrl
(
"http://www.iitb.ac.in/en/about-iit-bombay/iit-bombay-holidays-list"
);
}
});
Holidays
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
goToUrl
(
"http://www.iitb.ac.in/en/about-iit-bombay/iit-bombay-holidays-list"
);
}
});
Circulars
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
goToUrl
(
"http://www.iitb.ac.in/newacadhome/circular.jsp"
);
}
});
Circulars
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
goToUrl
(
"http://www.iitb.ac.in/newacadhome/circular.jsp"
);
}
});
Courses
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
goToUrl
(
"https://portal.iitb.ac.in/asc/Courses"
);
}
});
Courses
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
goToUrl
(
"https://portal.iitb.ac.in/asc/Courses"
);
}
});
WebMail
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
goToUrl
(
"https://webmail.iitb.ac.in"
);
}
});
GPO
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
goToUrl
(
"https://gpo.iitb.ac.in"
);
}
});
GPO
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
goToUrl
(
"https://gpo.iitb.ac.in"
);
}
});
CAMP
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
goToUrl
(
"https://camp.iitb.ac.in/"
);
}
});
CAMP
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
goToUrl
(
"https://camp.iitb.ac.in/"
);
}
});
MSStore
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
goToUrl
(
"http://msstore.iitb.ac.in/"
);
}
});
MSStore
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
public
void
onClick
(
View
v
)
{
goToUrl
(
"http://msstore.iitb.ac.in/"
);
}
});
...
...
app/src/main/res/layout/fragment_body.xml
View file @
b3ea021f
...
@@ -99,11 +99,12 @@
...
@@ -99,11 +99,12 @@
<Button
<Button
android:id=
"@+id/follow_button"
android:id=
"@+id/follow_button"
style=
"?android:attr/buttonBarButtonStyle"
style=
"?android:attr/buttonBarButtonStyle"
android:textAllCaps=
"false"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"0dp"
android:layout_margin=
"0dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:text=
"F
ollow
"
android:text=
"F
OLLOW
"
android:textColor=
"@color/secondaryTextColor"
/>
android:textColor=
"@color/secondaryTextColor"
/>
</LinearLayout>
</LinearLayout>
...
...
app/src/main/res/layout/fragment_event.xml
View file @
b3ea021f
...
@@ -152,11 +152,12 @@
...
@@ -152,11 +152,12 @@
<Button
<Button
android:id=
"@+id/going_button"
android:id=
"@+id/going_button"
style=
"?android:attr/buttonBarButtonStyle"
style=
"?android:attr/buttonBarButtonStyle"
android:textAllCaps=
"false"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"0dp"
android:layout_margin=
"0dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:text=
"G
oing
"
android:text=
"G
OING
"
android:textColor=
"@color/secondaryTextColor"
/>
android:textColor=
"@color/secondaryTextColor"
/>
<View
<View
...
@@ -171,11 +172,12 @@
...
@@ -171,11 +172,12 @@
<Button
<Button
android:id=
"@+id/interested_button"
android:id=
"@+id/interested_button"
style=
"?android:attr/buttonBarButtonStyle"
style=
"?android:attr/buttonBarButtonStyle"
android:textAllCaps=
"false"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"0dp"
android:layout_margin=
"0dp"
android:layout_weight=
"1"
android:layout_weight=
"1"
android:text=
"I
nterested
"
android:text=
"I
NTERESTED
"
android:textColor=
"@color/secondaryTextColor"
/>
android:textColor=
"@color/secondaryTextColor"
/>
</LinearLayout>
</LinearLayout>
...
...
app/src/main/res/layout/fragment_quick_links.xml
View file @
b3ea021f
...
@@ -97,6 +97,11 @@
...
@@ -97,6 +97,11 @@
style=
"@style/QuickLinksHeading"
style=
"@style/QuickLinksHeading"
android:text=
"Services"
/>
android:text=
"Services"
/>
<TextView
android:id=
"@+id/button_WebMail"
style=
"@style/QuickLink"
android:text=
"WebMail"
/>
<TextView
<TextView
android:id=
"@+id/button_GPO"
android:id=
"@+id/button_GPO"
style=
"@style/QuickLink"
style=
"@style/QuickLink"
...
...
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